@novu/react 3.15.0 → 3.17.0-rc.d0046861c6

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 (151) hide show
  1. package/dist/cjs/components/NovuUI.cjs.map +1 -1
  2. package/dist/cjs/components/NovuUI.d.cts +2 -2
  3. package/dist/cjs/components/connect-chat/ConnectChat.cjs +63 -0
  4. package/dist/cjs/components/connect-chat/ConnectChat.cjs.map +1 -0
  5. package/dist/cjs/components/connect-chat/ConnectChat.d.cts +12 -0
  6. package/dist/cjs/components/connect-chat/DefaultConnectChat.cjs +83 -0
  7. package/dist/cjs/components/connect-chat/DefaultConnectChat.cjs.map +1 -0
  8. package/dist/cjs/components/connect-chat/DefaultConnectChat.d.cts +7 -0
  9. package/dist/cjs/components/index.cjs +8 -0
  10. package/dist/cjs/components/index.cjs.map +1 -1
  11. package/dist/cjs/components/index.d.cts +9 -1
  12. package/dist/cjs/components/msteams-connect-button/DefaultMsTeamsConnectButton.cjs +92 -0
  13. package/dist/cjs/components/msteams-connect-button/DefaultMsTeamsConnectButton.cjs.map +1 -0
  14. package/dist/cjs/components/msteams-connect-button/DefaultMsTeamsConnectButton.d.cts +7 -0
  15. package/dist/cjs/components/msteams-connect-button/MsTeamsConnectButton.cjs +63 -0
  16. package/dist/cjs/components/msteams-connect-button/MsTeamsConnectButton.cjs.map +1 -0
  17. package/dist/cjs/components/msteams-connect-button/MsTeamsConnectButton.d.cts +12 -0
  18. package/dist/cjs/components/msteams-link-user/DefaultMsTeamsLinkUser.cjs +80 -0
  19. package/dist/cjs/components/msteams-link-user/DefaultMsTeamsLinkUser.cjs.map +1 -0
  20. package/dist/cjs/components/msteams-link-user/DefaultMsTeamsLinkUser.d.cts +7 -0
  21. package/dist/cjs/components/msteams-link-user/MsTeamsLinkUser.cjs +63 -0
  22. package/dist/cjs/components/msteams-link-user/MsTeamsLinkUser.cjs.map +1 -0
  23. package/dist/cjs/components/msteams-link-user/MsTeamsLinkUser.d.cts +12 -0
  24. package/dist/cjs/components/slack-connect-button/DefaultSlackConnectButton.cjs +92 -0
  25. package/dist/cjs/components/slack-connect-button/DefaultSlackConnectButton.cjs.map +1 -0
  26. package/dist/cjs/components/slack-connect-button/DefaultSlackConnectButton.d.cts +7 -0
  27. package/dist/cjs/components/slack-connect-button/SlackConnectButton.cjs +63 -0
  28. package/dist/cjs/components/slack-connect-button/SlackConnectButton.cjs.map +1 -0
  29. package/dist/cjs/components/slack-connect-button/SlackConnectButton.d.cts +12 -0
  30. package/dist/cjs/components/slack-link-user/DefaultSlackLinkUser.cjs +80 -0
  31. package/dist/cjs/components/slack-link-user/DefaultSlackLinkUser.cjs.map +1 -0
  32. package/dist/cjs/components/slack-link-user/DefaultSlackLinkUser.d.cts +7 -0
  33. package/dist/cjs/components/slack-link-user/SlackLinkUser.cjs +63 -0
  34. package/dist/cjs/components/slack-link-user/SlackLinkUser.cjs.map +1 -0
  35. package/dist/cjs/components/slack-link-user/SlackLinkUser.d.cts +12 -0
  36. package/dist/cjs/hooks/NovuProvider.cjs +34 -22
  37. package/dist/cjs/hooks/NovuProvider.cjs.map +1 -1
  38. package/dist/cjs/hooks/NovuProvider.d.cts +13 -2
  39. package/dist/cjs/hooks/index.cjs +10 -0
  40. package/dist/cjs/hooks/index.cjs.map +1 -1
  41. package/dist/cjs/hooks/index.d.cts +5 -0
  42. package/dist/cjs/hooks/internal/useBrowserTabsChannel.cjs +5 -2
  43. package/dist/cjs/hooks/internal/useBrowserTabsChannel.cjs.map +1 -1
  44. package/dist/cjs/hooks/internal/useBrowserTabsChannel.d.cts +2 -1
  45. package/dist/cjs/hooks/internal/useWebsocketEvent.cjs +6 -3
  46. package/dist/cjs/hooks/internal/useWebsocketEvent.cjs.map +1 -1
  47. package/dist/cjs/hooks/internal/useWebsocketEvent.d.cts +2 -1
  48. package/dist/cjs/hooks/useChannelConnection.cjs +107 -0
  49. package/dist/cjs/hooks/useChannelConnection.cjs.map +1 -0
  50. package/dist/cjs/hooks/useChannelConnection.d.cts +20 -0
  51. package/dist/cjs/hooks/useChannelConnections.cjs +85 -0
  52. package/dist/cjs/hooks/useChannelConnections.cjs.map +1 -0
  53. package/dist/cjs/hooks/useChannelConnections.d.cts +24 -0
  54. package/dist/cjs/hooks/useChannelEndpoint.cjs +110 -0
  55. package/dist/cjs/hooks/useChannelEndpoint.cjs.map +1 -0
  56. package/dist/cjs/hooks/useChannelEndpoint.d.cts +20 -0
  57. package/dist/cjs/hooks/useCounts.cjs +5 -1
  58. package/dist/cjs/hooks/useCounts.cjs.map +1 -1
  59. package/dist/cjs/hooks/useCounts.d.cts +18 -0
  60. package/dist/cjs/hooks/useCreateChannelEndpoint.cjs +61 -0
  61. package/dist/cjs/hooks/useCreateChannelEndpoint.cjs.map +1 -0
  62. package/dist/cjs/hooks/useCreateChannelEndpoint.d.cts +17 -0
  63. package/dist/cjs/hooks/useDeleteChannelEndpoint.cjs +69 -0
  64. package/dist/cjs/hooks/useDeleteChannelEndpoint.cjs.map +1 -0
  65. package/dist/cjs/hooks/useDeleteChannelEndpoint.d.cts +17 -0
  66. package/dist/cjs/hooks/useNotifications.cjs +4 -0
  67. package/dist/cjs/hooks/useNotifications.cjs.map +1 -1
  68. package/dist/cjs/hooks/useNotifications.d.cts +18 -0
  69. package/dist/cjs/index.cjs +18 -0
  70. package/dist/cjs/index.cjs.map +1 -1
  71. package/dist/cjs/index.d.cts +15 -2
  72. package/dist/cjs/internal/index.d.cts +1 -0
  73. package/dist/cjs/server/index.d.cts +1 -1
  74. package/dist/cjs/themes/index.d.cts +0 -1
  75. package/dist/cjs/utils/appearance.cjs.map +1 -1
  76. package/dist/cjs/utils/appearance.d.cts +2 -2
  77. package/dist/esm/components/NovuUI.d.ts +2 -2
  78. package/dist/esm/components/NovuUI.js.map +1 -1
  79. package/dist/esm/components/connect-chat/ConnectChat.d.ts +12 -0
  80. package/dist/esm/components/connect-chat/ConnectChat.js +28 -0
  81. package/dist/esm/components/connect-chat/ConnectChat.js.map +1 -0
  82. package/dist/esm/components/connect-chat/DefaultConnectChat.d.ts +7 -0
  83. package/dist/esm/components/connect-chat/DefaultConnectChat.js +58 -0
  84. package/dist/esm/components/connect-chat/DefaultConnectChat.js.map +1 -0
  85. package/dist/esm/components/index.d.ts +9 -1
  86. package/dist/esm/components/index.js +4 -0
  87. package/dist/esm/components/index.js.map +1 -1
  88. package/dist/esm/components/msteams-connect-button/DefaultMsTeamsConnectButton.d.ts +7 -0
  89. package/dist/esm/components/msteams-connect-button/DefaultMsTeamsConnectButton.js +67 -0
  90. package/dist/esm/components/msteams-connect-button/DefaultMsTeamsConnectButton.js.map +1 -0
  91. package/dist/esm/components/msteams-connect-button/MsTeamsConnectButton.d.ts +12 -0
  92. package/dist/esm/components/msteams-connect-button/MsTeamsConnectButton.js +28 -0
  93. package/dist/esm/components/msteams-connect-button/MsTeamsConnectButton.js.map +1 -0
  94. package/dist/esm/components/msteams-link-user/DefaultMsTeamsLinkUser.d.ts +7 -0
  95. package/dist/esm/components/msteams-link-user/DefaultMsTeamsLinkUser.js +55 -0
  96. package/dist/esm/components/msteams-link-user/DefaultMsTeamsLinkUser.js.map +1 -0
  97. package/dist/esm/components/msteams-link-user/MsTeamsLinkUser.d.ts +12 -0
  98. package/dist/esm/components/msteams-link-user/MsTeamsLinkUser.js +28 -0
  99. package/dist/esm/components/msteams-link-user/MsTeamsLinkUser.js.map +1 -0
  100. package/dist/esm/components/slack-connect-button/DefaultSlackConnectButton.d.ts +7 -0
  101. package/dist/esm/components/slack-connect-button/DefaultSlackConnectButton.js +67 -0
  102. package/dist/esm/components/slack-connect-button/DefaultSlackConnectButton.js.map +1 -0
  103. package/dist/esm/components/slack-connect-button/SlackConnectButton.d.ts +12 -0
  104. package/dist/esm/components/slack-connect-button/SlackConnectButton.js +28 -0
  105. package/dist/esm/components/slack-connect-button/SlackConnectButton.js.map +1 -0
  106. package/dist/esm/components/slack-link-user/DefaultSlackLinkUser.d.ts +7 -0
  107. package/dist/esm/components/slack-link-user/DefaultSlackLinkUser.js +55 -0
  108. package/dist/esm/components/slack-link-user/DefaultSlackLinkUser.js.map +1 -0
  109. package/dist/esm/components/slack-link-user/SlackLinkUser.d.ts +12 -0
  110. package/dist/esm/components/slack-link-user/SlackLinkUser.js +28 -0
  111. package/dist/esm/components/slack-link-user/SlackLinkUser.js.map +1 -0
  112. package/dist/esm/hooks/NovuProvider.d.ts +13 -2
  113. package/dist/esm/hooks/NovuProvider.js +33 -22
  114. package/dist/esm/hooks/NovuProvider.js.map +1 -1
  115. package/dist/esm/hooks/index.d.ts +5 -0
  116. package/dist/esm/hooks/index.js +5 -0
  117. package/dist/esm/hooks/index.js.map +1 -1
  118. package/dist/esm/hooks/internal/useBrowserTabsChannel.d.ts +2 -1
  119. package/dist/esm/hooks/internal/useBrowserTabsChannel.js +5 -2
  120. package/dist/esm/hooks/internal/useBrowserTabsChannel.js.map +1 -1
  121. package/dist/esm/hooks/internal/useWebsocketEvent.d.ts +2 -1
  122. package/dist/esm/hooks/internal/useWebsocketEvent.js +6 -3
  123. package/dist/esm/hooks/internal/useWebsocketEvent.js.map +1 -1
  124. package/dist/esm/hooks/useChannelConnection.d.ts +20 -0
  125. package/dist/esm/hooks/useChannelConnection.js +81 -0
  126. package/dist/esm/hooks/useChannelConnection.js.map +1 -0
  127. package/dist/esm/hooks/useChannelConnections.d.ts +24 -0
  128. package/dist/esm/hooks/useChannelConnections.js +60 -0
  129. package/dist/esm/hooks/useChannelConnections.js.map +1 -0
  130. package/dist/esm/hooks/useChannelEndpoint.d.ts +20 -0
  131. package/dist/esm/hooks/useChannelEndpoint.js +83 -0
  132. package/dist/esm/hooks/useChannelEndpoint.js.map +1 -0
  133. package/dist/esm/hooks/useCounts.d.ts +18 -0
  134. package/dist/esm/hooks/useCounts.js +6 -2
  135. package/dist/esm/hooks/useCounts.js.map +1 -1
  136. package/dist/esm/hooks/useCreateChannelEndpoint.d.ts +17 -0
  137. package/dist/esm/hooks/useCreateChannelEndpoint.js +36 -0
  138. package/dist/esm/hooks/useCreateChannelEndpoint.js.map +1 -0
  139. package/dist/esm/hooks/useDeleteChannelEndpoint.d.ts +17 -0
  140. package/dist/esm/hooks/useDeleteChannelEndpoint.js +43 -0
  141. package/dist/esm/hooks/useDeleteChannelEndpoint.js.map +1 -0
  142. package/dist/esm/hooks/useNotifications.d.ts +18 -0
  143. package/dist/esm/hooks/useNotifications.js +5 -1
  144. package/dist/esm/hooks/useNotifications.js.map +1 -1
  145. package/dist/esm/index.d.ts +15 -2
  146. package/dist/esm/index.js +18 -0
  147. package/dist/esm/index.js.map +1 -1
  148. package/dist/esm/server/index.d.ts +1 -1
  149. package/dist/esm/utils/appearance.d.ts +2 -2
  150. package/dist/esm/utils/appearance.js.map +1 -1
  151. package/package.json +2 -2
@@ -0,0 +1,17 @@
1
+ import { ChannelEndpointResponse, NovuError, CreateChannelEndpointArgs } from '@novu/js';
2
+
3
+ type UseCreateChannelEndpointProps = {
4
+ onSuccess?: (data: ChannelEndpointResponse) => void;
5
+ onError?: (error: NovuError) => void;
6
+ };
7
+ type UseCreateChannelEndpointResult = {
8
+ isCreating: boolean;
9
+ error?: NovuError;
10
+ create: (args: CreateChannelEndpointArgs) => Promise<{
11
+ data?: ChannelEndpointResponse | undefined;
12
+ error?: NovuError | undefined;
13
+ }>;
14
+ };
15
+ declare const useCreateChannelEndpoint: (props?: UseCreateChannelEndpointProps) => UseCreateChannelEndpointResult;
16
+
17
+ export { type UseCreateChannelEndpointProps, type UseCreateChannelEndpointResult, useCreateChannelEndpoint };
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/hooks/useDeleteChannelEndpoint.ts
21
+ var useDeleteChannelEndpoint_exports = {};
22
+ __export(useDeleteChannelEndpoint_exports, {
23
+ useDeleteChannelEndpoint: () => useDeleteChannelEndpoint
24
+ });
25
+ module.exports = __toCommonJS(useDeleteChannelEndpoint_exports);
26
+ var import_react = require("react");
27
+ var import_NovuProvider = require("./NovuProvider.cjs");
28
+ var useDeleteChannelEndpoint = (props = {}) => {
29
+ const propsRef = (0, import_react.useRef)(props);
30
+ propsRef.current = props;
31
+ const novu = (0, import_NovuProvider.useNovu)();
32
+ const [isDeleting, setIsDeleting] = (0, import_react.useState)(false);
33
+ const [error, setError] = (0, import_react.useState)();
34
+ const remove = (0, import_react.useCallback)(
35
+ async (identifier) => {
36
+ var _a, _b, _c, _d, _e, _f;
37
+ setError(void 0);
38
+ setIsDeleting(true);
39
+ try {
40
+ const response = await novu.channelEndpoints.delete({ identifier });
41
+ if (response.error) {
42
+ setError(response.error);
43
+ (_b = (_a = propsRef.current).onError) == null ? void 0 : _b.call(_a, response.error);
44
+ } else {
45
+ (_d = (_c = propsRef.current).onSuccess) == null ? void 0 : _d.call(_c);
46
+ }
47
+ return response;
48
+ } catch (err) {
49
+ const novuError = err;
50
+ setError(novuError);
51
+ (_f = (_e = propsRef.current).onError) == null ? void 0 : _f.call(_e, novuError);
52
+ return { error: novuError };
53
+ } finally {
54
+ setIsDeleting(false);
55
+ }
56
+ },
57
+ [novu]
58
+ );
59
+ return {
60
+ remove,
61
+ isDeleting,
62
+ error
63
+ };
64
+ };
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {
67
+ useDeleteChannelEndpoint
68
+ });
69
+ //# sourceMappingURL=useDeleteChannelEndpoint.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/hooks/useDeleteChannelEndpoint.ts"],"sourcesContent":["import type { NovuError } from '@novu/js';\nimport { useCallback, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseDeleteChannelEndpointProps = {\n onSuccess?: () => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseDeleteChannelEndpointResult = {\n isDeleting: boolean;\n error?: NovuError;\n remove: (identifier: string) => Promise<{\n data?: undefined;\n error?: NovuError | undefined;\n }>;\n};\n\nexport const useDeleteChannelEndpoint = (props: UseDeleteChannelEndpointProps = {}): UseDeleteChannelEndpointResult => {\n const propsRef = useRef<UseDeleteChannelEndpointProps>(props);\n propsRef.current = props;\n const novu = useNovu();\n const [isDeleting, setIsDeleting] = useState(false);\n const [error, setError] = useState<NovuError>();\n\n const remove = useCallback(\n async (identifier: string) => {\n setError(undefined);\n setIsDeleting(true);\n\n try {\n const response = await novu.channelEndpoints.delete({ identifier });\n\n if (response.error) {\n setError(response.error as NovuError);\n propsRef.current.onError?.(response.error as NovuError);\n } else {\n propsRef.current.onSuccess?.();\n }\n\n return response as { data?: undefined; error?: NovuError };\n } catch (err) {\n const novuError = err as NovuError;\n setError(novuError);\n propsRef.current.onError?.(novuError);\n\n return { error: novuError };\n } finally {\n setIsDeleting(false);\n }\n },\n [novu]\n );\n\n return {\n remove,\n isDeleting,\n error,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA8C;AAC9C,0BAAwB;AAgBjB,IAAM,2BAA2B,CAAC,QAAuC,CAAC,MAAsC;AACrH,QAAM,eAAW,qBAAsC,KAAK;AAC5D,WAAS,UAAU;AACnB,QAAM,WAAO,6BAAQ;AACrB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAE9C,QAAM,aAAS;AAAA,IACb,OAAO,eAAuB;AA1BlC;AA2BM,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,UAAI;AACF,cAAM,WAAW,MAAM,KAAK,iBAAiB,OAAO,EAAE,WAAW,CAAC;AAElE,YAAI,SAAS,OAAO;AAClB,mBAAS,SAAS,KAAkB;AACpC,+BAAS,SAAQ,YAAjB,4BAA2B,SAAS;AAAA,QACtC,OAAO;AACL,+BAAS,SAAQ,cAAjB;AAAA,QACF;AAEA,eAAO;AAAA,MACT,SAAS,KAAK;AACZ,cAAM,YAAY;AAClB,iBAAS,SAAS;AAClB,6BAAS,SAAQ,YAAjB,4BAA2B;AAE3B,eAAO,EAAE,OAAO,UAAU;AAAA,MAC5B,UAAE;AACA,sBAAc,KAAK;AAAA,MACrB;AAAA,IACF;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,17 @@
1
+ import { NovuError } from '@novu/js';
2
+
3
+ type UseDeleteChannelEndpointProps = {
4
+ onSuccess?: () => void;
5
+ onError?: (error: NovuError) => void;
6
+ };
7
+ type UseDeleteChannelEndpointResult = {
8
+ isDeleting: boolean;
9
+ error?: NovuError;
10
+ remove: (identifier: string) => Promise<{
11
+ data?: undefined;
12
+ error?: NovuError | undefined;
13
+ }>;
14
+ };
15
+ declare const useDeleteChannelEndpoint: (props?: UseDeleteChannelEndpointProps) => UseDeleteChannelEndpointResult;
16
+
17
+ export { type UseDeleteChannelEndpointProps, type UseDeleteChannelEndpointResult, useDeleteChannelEndpoint };
@@ -40,6 +40,7 @@ var useNotifications = (props) => {
40
40
  createdGte,
41
41
  createdLte,
42
42
  limit = 10,
43
+ realtime: propsRealtime,
43
44
  onSuccess,
44
45
  onError
45
46
  } = props || {};
@@ -56,6 +57,8 @@ var useNotifications = (props) => {
56
57
  createdLte
57
58
  });
58
59
  const novu = (0, import_NovuProvider.useNovu)();
60
+ const providerRealtime = (0, import_NovuProvider.useRealtime)();
61
+ const realtime = propsRealtime ?? providerRealtime;
59
62
  const [data, setData] = (0, import_react.useState)();
60
63
  const [error, setError] = (0, import_react.useState)();
61
64
  const [isLoading, setIsLoading] = (0, import_react.useState)(true);
@@ -81,6 +84,7 @@ var useNotifications = (props) => {
81
84
  }, [filterRef, novu]);
82
85
  (0, import_useWebsocketEvent.useWebSocketEvent)({
83
86
  event: "notifications.notification_received",
87
+ enabled: realtime,
84
88
  eventHandler: ({ result: notification }) => {
85
89
  const currentFilter = filterRef.current;
86
90
  const matches = (0, import_js.checkNotificationMatchesFilter)(notification, currentFilter);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hooks/useNotifications.ts"],"sourcesContent":["import { checkNotificationMatchesFilter, isSameFilter, Notification, NotificationFilter, NovuError } from '@novu/js';\nimport { useCallback, useEffect, useState } from 'react';\nimport { useDataRef } from './internal/useDataRef';\nimport { useWebSocketEvent } from './internal/useWebsocketEvent';\nimport { useNovu } from './NovuProvider';\n\n/**\n * Props for the useNotifications hook.\n *\n * @example\n * ```tsx\n * // Get unread notifications\n * const { notifications } = useNotifications({\n * read: false\n * });\n *\n * // Get unseen notifications with specific tags\n * const { notifications } = useNotifications({\n * seen: false,\n * tags: ['important']\n * });\n *\n * // Get notifications (auto-updates in real time when new notifications arrive)\n * const { notifications } = useNotifications({\n * read: false\n * });\n *\n * // Get notifications from a specific time period\n * const { notifications } = useNotifications({\n * createdGte: 1704067200000,\n * createdLte: 1735689599999\n * });\n * ```\n */\nexport type UseNotificationsProps = {\n tags?: NotificationFilter['tags'];\n data?: NotificationFilter['data'];\n read?: NotificationFilter['read'];\n archived?: NotificationFilter['archived'];\n snoozed?: NotificationFilter['snoozed'];\n seen?: NotificationFilter['seen'];\n severity?: NotificationFilter['severity'];\n createdGte?: NotificationFilter['createdGte'];\n createdLte?: NotificationFilter['createdLte'];\n limit?: number;\n onSuccess?: (data: Notification[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseNotificationsResult = {\n notifications?: Notification[];\n error?: NovuError;\n isLoading: boolean;\n isFetching: boolean;\n hasMore: boolean;\n readAll: () => Promise<{\n data?: void | undefined;\n error?: NovuError | undefined;\n }>;\n seenAll: () => Promise<{\n data?: void | undefined;\n error?: NovuError | undefined;\n }>;\n archiveAll: () => Promise<{\n data?: void | undefined;\n error?: NovuError | undefined;\n }>;\n archiveAllRead: () => Promise<{\n data?: void | undefined;\n error?: NovuError | undefined;\n }>;\n refetch: () => Promise<void>;\n fetchMore: () => Promise<void>;\n};\n\nexport const useNotifications = (props?: UseNotificationsProps): UseNotificationsResult => {\n const {\n tags,\n data: dataFilter,\n read,\n archived = false,\n snoozed = false,\n seen,\n severity,\n createdGte,\n createdLte,\n limit = 10,\n onSuccess,\n onError,\n } = props || {};\n const limitRef = useDataRef<number | undefined>(limit);\n const filterRef = useDataRef<NotificationFilter>({\n tags,\n data: dataFilter,\n read,\n archived,\n snoozed,\n seen,\n severity,\n createdGte,\n createdLte,\n });\n const novu = useNovu();\n const [data, setData] = useState<Array<Notification>>();\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n const [hasMore, setHasMore] = useState(false);\n const length = data?.length;\n const after = length ? data[length - 1].id : undefined;\n const afterRef = useDataRef<string | undefined>(after);\n\n useEffect(() => {\n const listener = ({\n data,\n }: {\n data: { notifications: Notification[]; hasMore: boolean; filter: NotificationFilter };\n }) => {\n if (!data || !isSameFilter(filterRef.current, data.filter)) {\n return;\n }\n\n // the event is called with the list of all notifications cached matching the current filter\n setData(data.notifications);\n setHasMore(data.hasMore);\n };\n\n const cleanup = novu.on('notifications.list.updated', listener);\n\n return () => {\n cleanup();\n };\n }, [filterRef, novu]);\n\n useWebSocketEvent({\n event: 'notifications.notification_received',\n eventHandler: ({ result: notification }) => {\n const currentFilter = filterRef.current;\n const matches = checkNotificationMatchesFilter(notification, currentFilter);\n if (matches) {\n // the limit and after props are used to create a cache key\n // the first batch of notifications in the cache doesn't include the after prop and we want to push to the first batch\n const cacheKey = { ...currentFilter, limit: limitRef.current };\n novu.notifications.cache.unshift(cacheKey, notification);\n }\n },\n });\n\n const fetchNotifications = useCallback(\n async (options?: { refetch: boolean }) => {\n if (options?.refetch) {\n setError(undefined);\n setIsLoading(true);\n setIsFetching(false);\n }\n setIsFetching(true);\n\n const response = await novu.notifications.list({\n ...filterRef.current,\n limit,\n after: options?.refetch ? undefined : afterRef.current,\n });\n\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n setIsLoading(false);\n setIsFetching(false);\n } else if (response.data) {\n const responseData = response.data;\n onSuccess?.(responseData.notifications);\n setData(responseData.notifications);\n setHasMore(responseData.hasMore);\n setIsLoading(false);\n setIsFetching(false);\n }\n },\n [novu, filterRef, afterRef, limit, onError, onSuccess]\n );\n\n useEffect(() => {\n novu.notifications.clearCache({ filter: filterRef.current });\n fetchNotifications({ refetch: true });\n }, [filterRef, novu, JSON.stringify(filterRef.current), fetchNotifications]);\n\n const refetch = useCallback(() => {\n novu.notifications.clearCache({ filter: filterRef.current });\n return fetchNotifications({ refetch: true });\n }, [filterRef, novu, fetchNotifications]);\n\n const fetchMore = useCallback(async () => {\n if (!hasMore || isFetching) return;\n\n return fetchNotifications();\n }, [hasMore, isFetching, fetchNotifications]);\n\n const readAll = useCallback(async () => {\n return await novu.notifications.readAll({ tags: filterRef.current.tags, data: filterRef.current.data });\n }, [filterRef, novu]);\n\n const seenAll = useCallback(async () => {\n return await novu.notifications.seenAll({ tags: filterRef.current.tags, data: filterRef.current.data });\n }, [filterRef, novu]);\n\n const archiveAll = useCallback(async () => {\n return await novu.notifications.archiveAll({ tags: filterRef.current.tags, data: filterRef.current.data });\n }, [filterRef, novu]);\n\n const archiveAllRead = useCallback(async () => {\n return await novu.notifications.archiveAllRead({ tags: filterRef.current.tags, data: filterRef.current.data });\n }, [filterRef, novu]);\n\n return {\n readAll,\n seenAll,\n archiveAll,\n archiveAllRead,\n notifications: data,\n error,\n isLoading,\n isFetching,\n refetch,\n fetchMore,\n hasMore,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA0G;AAC1G,mBAAiD;AACjD,wBAA2B;AAC3B,+BAAkC;AAClC,0BAAwB;AAuEjB,IAAM,mBAAmB,CAAC,UAA0D;AACzF,QAAM;AAAA,IACJ;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA,WAAW;AAAA,IACX,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,EACF,IAAI,SAAS,CAAC;AACd,QAAM,eAAW,8BAA+B,KAAK;AACrD,QAAM,gBAAY,8BAA+B;AAAA,IAC/C;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,WAAO,6BAAQ;AACrB,QAAM,CAAC,MAAM,OAAO,QAAI,uBAA8B;AACtD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,KAAK;AAC5C,QAAM,SAAS,6BAAM;AACrB,QAAM,QAAQ,SAAS,KAAK,SAAS,CAAC,EAAE,KAAK;AAC7C,QAAM,eAAW,8BAA+B,KAAK;AAErD,8BAAU,MAAM;AACd,UAAM,WAAW,CAAC;AAAA,MAChB,MAAAA;AAAA,IACF,MAEM;AACJ,UAAI,CAACA,SAAQ,KAAC,wBAAa,UAAU,SAASA,MAAK,MAAM,GAAG;AAC1D;AAAA,MACF;AAGA,cA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AAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["data"]}
1
+ {"version":3,"sources":["../../../src/hooks/useNotifications.ts"],"sourcesContent":["import { checkNotificationMatchesFilter, isSameFilter, Notification, NotificationFilter, NovuError } from '@novu/js';\nimport { useCallback, useEffect, useState } from 'react';\nimport { useDataRef } from './internal/useDataRef';\nimport { useWebSocketEvent } from './internal/useWebsocketEvent';\nimport { useNovu, useRealtime } from './NovuProvider';\n\n/**\n * Props for the useNotifications hook.\n *\n * @example\n * ```tsx\n * // Get unread notifications\n * const { notifications } = useNotifications({\n * read: false\n * });\n *\n * // Get unseen notifications with specific tags\n * const { notifications } = useNotifications({\n * seen: false,\n * tags: ['important']\n * });\n *\n * // Get notifications (auto-updates in real time when new notifications arrive)\n * const { notifications } = useNotifications({\n * read: false\n * });\n *\n * // Get notifications from a specific time period\n * const { notifications } = useNotifications({\n * createdGte: 1704067200000,\n * createdLte: 1735689599999\n * });\n *\n * // Opt out of the built-in realtime updates and drive them yourself\n * const { notifications, refetch } = useNotifications({\n * read: false,\n * realtime: false,\n * });\n * ```\n */\nexport type UseNotificationsProps = {\n tags?: NotificationFilter['tags'];\n data?: NotificationFilter['data'];\n read?: NotificationFilter['read'];\n archived?: NotificationFilter['archived'];\n snoozed?: NotificationFilter['snoozed'];\n seen?: NotificationFilter['seen'];\n severity?: NotificationFilter['severity'];\n createdGte?: NotificationFilter['createdGte'];\n createdLte?: NotificationFilter['createdLte'];\n limit?: number;\n /**\n * When `false`, disables the WebSocket subscription that auto-injects\n * newly received notifications into the list. Built-in mutations like\n * `readAll`, `seenAll`, `archiveAll`, and `archiveAllRead` continue to\n * update local state. Use this when you want to drive new-notification updates yourself (e.g.\n * via your own `novu.on('notifications.notification_received', ...)`\n * handler combined with `refetch()`).\n *\n * When set, this prop takes precedence over the `realtime` config on\n * `<NovuProvider />`. When omitted, the provider value (default `true`) is used.\n */\n realtime?: boolean;\n onSuccess?: (data: Notification[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseNotificationsResult = {\n notifications?: Notification[];\n error?: NovuError;\n isLoading: boolean;\n isFetching: boolean;\n hasMore: boolean;\n readAll: () => Promise<{\n data?: void | undefined;\n error?: NovuError | undefined;\n }>;\n seenAll: () => Promise<{\n data?: void | undefined;\n error?: NovuError | undefined;\n }>;\n archiveAll: () => Promise<{\n data?: void | undefined;\n error?: NovuError | undefined;\n }>;\n archiveAllRead: () => Promise<{\n data?: void | undefined;\n error?: NovuError | undefined;\n }>;\n refetch: () => Promise<void>;\n fetchMore: () => Promise<void>;\n};\n\nexport const useNotifications = (props?: UseNotificationsProps): UseNotificationsResult => {\n const {\n tags,\n data: dataFilter,\n read,\n archived = false,\n snoozed = false,\n seen,\n severity,\n createdGte,\n createdLte,\n limit = 10,\n realtime: propsRealtime,\n onSuccess,\n onError,\n } = props || {};\n const limitRef = useDataRef<number | undefined>(limit);\n const filterRef = useDataRef<NotificationFilter>({\n tags,\n data: dataFilter,\n read,\n archived,\n snoozed,\n seen,\n severity,\n createdGte,\n createdLte,\n });\n const novu = useNovu();\n const providerRealtime = useRealtime();\n const realtime = propsRealtime ?? providerRealtime;\n const [data, setData] = useState<Array<Notification>>();\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n const [hasMore, setHasMore] = useState(false);\n const length = data?.length;\n const after = length ? data[length - 1].id : undefined;\n const afterRef = useDataRef<string | undefined>(after);\n\n useEffect(() => {\n const listener = ({\n data,\n }: {\n data: { notifications: Notification[]; hasMore: boolean; filter: NotificationFilter };\n }) => {\n if (!data || !isSameFilter(filterRef.current, data.filter)) {\n return;\n }\n\n // the event is called with the list of all notifications cached matching the current filter\n setData(data.notifications);\n setHasMore(data.hasMore);\n };\n\n const cleanup = novu.on('notifications.list.updated', listener);\n\n return () => {\n cleanup();\n };\n }, [filterRef, novu]);\n\n useWebSocketEvent({\n event: 'notifications.notification_received',\n enabled: realtime,\n eventHandler: ({ result: notification }) => {\n const currentFilter = filterRef.current;\n const matches = checkNotificationMatchesFilter(notification, currentFilter);\n if (matches) {\n // the limit and after props are used to create a cache key\n // the first batch of notifications in the cache doesn't include the after prop and we want to push to the first batch\n const cacheKey = { ...currentFilter, limit: limitRef.current };\n novu.notifications.cache.unshift(cacheKey, notification);\n }\n },\n });\n\n const fetchNotifications = useCallback(\n async (options?: { refetch: boolean }) => {\n if (options?.refetch) {\n setError(undefined);\n setIsLoading(true);\n setIsFetching(false);\n }\n setIsFetching(true);\n\n const response = await novu.notifications.list({\n ...filterRef.current,\n limit,\n after: options?.refetch ? undefined : afterRef.current,\n });\n\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n setIsLoading(false);\n setIsFetching(false);\n } else if (response.data) {\n const responseData = response.data;\n onSuccess?.(responseData.notifications);\n setData(responseData.notifications);\n setHasMore(responseData.hasMore);\n setIsLoading(false);\n setIsFetching(false);\n }\n },\n [novu, filterRef, afterRef, limit, onError, onSuccess]\n );\n\n useEffect(() => {\n novu.notifications.clearCache({ filter: filterRef.current });\n fetchNotifications({ refetch: true });\n }, [filterRef, novu, JSON.stringify(filterRef.current), fetchNotifications]);\n\n const refetch = useCallback(() => {\n novu.notifications.clearCache({ filter: filterRef.current });\n return fetchNotifications({ refetch: true });\n }, [filterRef, novu, fetchNotifications]);\n\n const fetchMore = useCallback(async () => {\n if (!hasMore || isFetching) return;\n\n return fetchNotifications();\n }, [hasMore, isFetching, fetchNotifications]);\n\n const readAll = useCallback(async () => {\n return await novu.notifications.readAll({ tags: filterRef.current.tags, data: filterRef.current.data });\n }, [filterRef, novu]);\n\n const seenAll = useCallback(async () => {\n return await novu.notifications.seenAll({ tags: filterRef.current.tags, data: filterRef.current.data });\n }, [filterRef, novu]);\n\n const archiveAll = useCallback(async () => {\n return await novu.notifications.archiveAll({ tags: filterRef.current.tags, data: filterRef.current.data });\n }, [filterRef, novu]);\n\n const archiveAllRead = useCallback(async () => {\n return await novu.notifications.archiveAllRead({ tags: filterRef.current.tags, data: filterRef.current.data });\n }, [filterRef, novu]);\n\n return {\n readAll,\n seenAll,\n archiveAll,\n archiveAllRead,\n notifications: data,\n error,\n isLoading,\n isFetching,\n refetch,\n fetchMore,\n hasMore,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA0G;AAC1G,mBAAiD;AACjD,wBAA2B;AAC3B,+BAAkC;AAClC,0BAAqC;AAyF9B,IAAM,mBAAmB,CAAC,UAA0D;AACzF,QAAM;AAAA,IACJ;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA,WAAW;AAAA,IACX,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,UAAU;AAAA,IACV;AAAA,IACA;AAAA,EACF,IAAI,SAAS,CAAC;AACd,QAAM,eAAW,8BAA+B,KAAK;AACrD,QAAM,gBAAY,8BAA+B;AAAA,IAC/C;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,WAAO,6BAAQ;AACrB,QAAM,uBAAmB,iCAAY;AACrC,QAAM,WAAW,iBAAiB;AAClC,QAAM,CAAC,MAAM,OAAO,QAAI,uBAA8B;AACtD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAoB;AAC9C,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,KAAK;AAC5C,QAAM,SAAS,6BAAM;AACrB,QAAM,QAAQ,SAAS,KAAK,SAAS,CAAC,EAAE,KAAK;AAC7C,QAAM,eAAW,8BAA+B,KAAK;AAErD,8BAAU,MAAM;AACd,UAAM,WAAW,CAAC;AAAA,MAChB,MAAAA;AAA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AAG,CAAC,WAAW,IAAI,CAAC;AAEpB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["data"]}
@@ -26,6 +26,12 @@ import { NotificationFilter, Notification, NovuError } from '@novu/js';
26
26
  * createdGte: 1704067200000,
27
27
  * createdLte: 1735689599999
28
28
  * });
29
+ *
30
+ * // Opt out of the built-in realtime updates and drive them yourself
31
+ * const { notifications, refetch } = useNotifications({
32
+ * read: false,
33
+ * realtime: false,
34
+ * });
29
35
  * ```
30
36
  */
31
37
  type UseNotificationsProps = {
@@ -39,6 +45,18 @@ type UseNotificationsProps = {
39
45
  createdGte?: NotificationFilter['createdGte'];
40
46
  createdLte?: NotificationFilter['createdLte'];
41
47
  limit?: number;
48
+ /**
49
+ * When `false`, disables the WebSocket subscription that auto-injects
50
+ * newly received notifications into the list. Built-in mutations like
51
+ * `readAll`, `seenAll`, `archiveAll`, and `archiveAllRead` continue to
52
+ * update local state. Use this when you want to drive new-notification updates yourself (e.g.
53
+ * via your own `novu.on('notifications.notification_received', ...)`
54
+ * handler combined with `refetch()`).
55
+ *
56
+ * When set, this prop takes precedence over the `realtime` config on
57
+ * `<NovuProvider />`. When omitted, the provider value (default `true`) is used.
58
+ */
59
+ realtime?: boolean;
42
60
  onSuccess?: (data: Notification[]) => void;
43
61
  onError?: (error: NovuError) => void;
44
62
  };
@@ -23,17 +23,26 @@ __export(index_exports, {
23
23
  Bell: () => import_components.Bell,
24
24
  Inbox: () => import_components.Inbox,
25
25
  InboxContent: () => import_components.InboxContent,
26
+ MsTeamsConnectButton: () => import_components.MsTeamsConnectButton,
27
+ MsTeamsLinkUser: () => import_components.MsTeamsLinkUser,
26
28
  Notifications: () => import_components.Notifications,
27
29
  NovuProvider: () => import_components.NovuProvider,
28
30
  PreferenceLevel: () => import_js.PreferenceLevel,
29
31
  Preferences: () => import_components.Preferences,
30
32
  SeverityLevelEnum: () => import_js.SeverityLevelEnum,
33
+ SlackConnectButton: () => import_components.SlackConnectButton,
34
+ SlackLinkUser: () => import_components.SlackLinkUser,
31
35
  Subscription: () => import_components.Subscription,
32
36
  SubscriptionButton: () => import_components.SubscriptionButton,
33
37
  SubscriptionPreferences: () => import_components.SubscriptionPreferences,
34
38
  WorkflowCriticalityEnum: () => import_js.WorkflowCriticalityEnum,
39
+ useChannelConnection: () => import_hooks.useChannelConnection,
40
+ useChannelConnections: () => import_hooks.useChannelConnections,
41
+ useChannelEndpoint: () => import_hooks.useChannelEndpoint,
35
42
  useCounts: () => import_hooks.useCounts,
43
+ useCreateChannelEndpoint: () => import_hooks.useCreateChannelEndpoint,
36
44
  useCreateSubscription: () => import_hooks.useCreateSubscription,
45
+ useDeleteChannelEndpoint: () => import_hooks.useDeleteChannelEndpoint,
37
46
  useNotifications: () => import_hooks.useNotifications,
38
47
  useNovu: () => import_hooks.useNovu,
39
48
  usePreferences: () => import_hooks.usePreferences,
@@ -52,17 +61,26 @@ var import_hooks = require("./hooks/index.cjs");
52
61
  Bell,
53
62
  Inbox,
54
63
  InboxContent,
64
+ MsTeamsConnectButton,
65
+ MsTeamsLinkUser,
55
66
  Notifications,
56
67
  NovuProvider,
57
68
  PreferenceLevel,
58
69
  Preferences,
59
70
  SeverityLevelEnum,
71
+ SlackConnectButton,
72
+ SlackLinkUser,
60
73
  Subscription,
61
74
  SubscriptionButton,
62
75
  SubscriptionPreferences,
63
76
  WorkflowCriticalityEnum,
77
+ useChannelConnection,
78
+ useChannelConnections,
79
+ useChannelEndpoint,
64
80
  useCounts,
81
+ useCreateChannelEndpoint,
65
82
  useCreateSubscription,
83
+ useDeleteChannelEndpoint,
66
84
  useNotifications,
67
85
  useNovu,
68
86
  usePreferences,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type * from '@novu/js';\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';\n\nexport type {\n AllLocalization,\n AllLocalizationKey,\n ElementStyles,\n InboxAppearance,\n InboxAppearanceCallback,\n InboxAppearanceCallbackFunction,\n InboxAppearanceCallbackKeys,\n InboxAppearanceKey,\n InboxElements,\n InboxLocalization,\n InboxLocalizationKey,\n InboxTheme,\n NotificationActionClickHandler,\n NotificationClickHandler,\n NotificationRenderer,\n PreferenceGroups,\n PreferencesFilter,\n RouterPush,\n SubscriptionAppearance,\n SubscriptionAppearanceCallback,\n SubscriptionAppearanceCallbackFunction,\n SubscriptionAppearanceCallbackKeys,\n SubscriptionAppearanceKey,\n SubscriptionElements,\n SubscriptionLocalization,\n SubscriptionLocalizationKey,\n SubscriptionTheme,\n Tab,\n Variables,\n} from '@novu/js/ui';\nexport type {\n BellProps,\n InboxContentProps,\n InboxProps,\n NotificationProps,\n NovuProviderProps,\n SubscriptionButtonProps,\n SubscriptionPreferencesProps,\n SubscriptionProps,\n} from './components';\nexport {\n Bell,\n Inbox,\n InboxContent,\n Notifications,\n NovuProvider,\n Preferences,\n Subscription,\n SubscriptionButton,\n SubscriptionPreferences,\n} from './components';\nexport type {\n UseCountsProps,\n UseCountsResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesResult,\n UseScheduleProps as UsePreferencesProps,\n} from './hooks';\nexport {\n useCounts,\n useCreateSubscription,\n useNotifications,\n useNovu,\n usePreferences,\n useRemoveSubscription,\n useSchedule,\n useSubscription,\n useSubscriptions,\n useUpdateSubscription,\n} from './hooks';\n\nexport type {\n BaseProps,\n BellRenderer,\n BodyRenderer,\n DefaultInboxProps,\n DefaultProps,\n NoRendererProps,\n NotificationRendererProps,\n NotificationsRenderer,\n ReactInboxAppearance,\n ReactInboxTheme,\n ReactSubscriptionAppearance,\n ReactSubscriptionTheme,\n SubjectBodyRendererProps,\n SubjectRenderer,\n WithChildrenProps,\n} from './utils/types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAA4E;AA2C5E,wBAUO;AASP,mBAWO;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type * from '@novu/js';\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';\n\nexport type {\n AllLocalization,\n AllLocalizationKey,\n ChannelConnectButtonIconKey,\n ElementStyles,\n InboxAppearance,\n InboxAppearanceCallback,\n InboxAppearanceCallbackFunction,\n InboxAppearanceCallbackKeys,\n InboxAppearanceKey,\n InboxElements,\n InboxLocalization,\n InboxLocalizationKey,\n InboxTheme,\n NotificationActionClickHandler,\n NotificationClickHandler,\n NotificationRenderer,\n PreferenceGroups,\n PreferencesFilter,\n RouterPush,\n SubscriptionAppearance,\n SubscriptionAppearanceCallback,\n SubscriptionAppearanceCallbackFunction,\n SubscriptionAppearanceCallbackKeys,\n SubscriptionAppearanceKey,\n SubscriptionElements,\n SubscriptionLocalization,\n SubscriptionLocalizationKey,\n SubscriptionTheme,\n Tab,\n Variables,\n} from '@novu/js/ui';\nexport type {\n BellProps,\n InboxContentProps,\n InboxProps,\n MsTeamsConnectButtonProps,\n MsTeamsLinkUserProps,\n NotificationProps,\n NovuProviderProps,\n SlackConnectButtonProps,\n SlackLinkUserProps,\n SubscriptionButtonProps,\n SubscriptionPreferencesProps,\n SubscriptionProps,\n} from './components';\nexport {\n Bell,\n Inbox,\n InboxContent,\n MsTeamsConnectButton,\n MsTeamsLinkUser,\n Notifications,\n NovuProvider,\n Preferences,\n SlackConnectButton,\n SlackLinkUser,\n Subscription,\n SubscriptionButton,\n SubscriptionPreferences,\n} from './components';\nexport type {\n UseChannelConnectionProps,\n UseChannelConnectionResult,\n UseChannelConnectionsProps,\n UseChannelConnectionsResult,\n UseChannelEndpointProps,\n UseChannelEndpointResult,\n UseCountsProps,\n UseCountsResult,\n UseCreateChannelEndpointProps,\n UseCreateChannelEndpointResult,\n UseDeleteChannelEndpointProps,\n UseDeleteChannelEndpointResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesResult,\n UseScheduleProps as UsePreferencesProps,\n} from './hooks';\nexport {\n useChannelConnection,\n useChannelConnections,\n useChannelEndpoint,\n useCounts,\n useCreateChannelEndpoint,\n useCreateSubscription,\n useDeleteChannelEndpoint,\n useNotifications,\n useNovu,\n usePreferences,\n useRemoveSubscription,\n useSchedule,\n useSubscription,\n useSubscriptions,\n useUpdateSubscription,\n} from './hooks';\n\nexport type {\n BaseProps,\n BellRenderer,\n BodyRenderer,\n DefaultInboxProps,\n DefaultProps,\n NoRendererProps,\n NotificationRendererProps,\n NotificationsRenderer,\n ReactAllAppearance,\n ReactInboxAppearance,\n ReactInboxTheme,\n ReactSubscriptionAppearance,\n ReactSubscriptionTheme,\n SubjectBodyRendererProps,\n SubjectRenderer,\n WithChildrenProps,\n} from './utils/types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAA4E;AAgD5E,wBAcO;AAmBP,mBAgBO;","names":[]}
@@ -1,17 +1,26 @@
1
1
  export * from '@novu/js';
2
2
  export { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';
3
- export { AllLocalization, AllLocalizationKey, ElementStyles, InboxAppearance, InboxAppearanceCallback, InboxAppearanceCallbackFunction, InboxAppearanceCallbackKeys, InboxAppearanceKey, InboxElements, InboxLocalization, InboxLocalizationKey, InboxTheme, NotificationActionClickHandler, NotificationClickHandler, NotificationRenderer, PreferenceGroups, PreferencesFilter, RouterPush, SubscriptionAppearance, SubscriptionAppearanceCallback, SubscriptionAppearanceCallbackFunction, SubscriptionAppearanceCallbackKeys, SubscriptionAppearanceKey, SubscriptionElements, SubscriptionLocalization, SubscriptionLocalizationKey, SubscriptionTheme, Tab, Variables } from '@novu/js/ui';
3
+ export { AllLocalization, AllLocalizationKey, ChannelConnectButtonIconKey, ElementStyles, InboxAppearance, InboxAppearanceCallback, InboxAppearanceCallbackFunction, InboxAppearanceCallbackKeys, InboxAppearanceKey, InboxElements, InboxLocalization, InboxLocalizationKey, InboxTheme, NotificationActionClickHandler, NotificationClickHandler, NotificationRenderer, PreferenceGroups, PreferencesFilter, RouterPush, SubscriptionAppearance, SubscriptionAppearanceCallback, SubscriptionAppearanceCallbackFunction, SubscriptionAppearanceCallbackKeys, SubscriptionAppearanceKey, SubscriptionElements, SubscriptionLocalization, SubscriptionLocalizationKey, SubscriptionTheme, Tab, Variables } from '@novu/js/ui';
4
4
  export { NovuProvider, NovuProviderProps, useNovu } from './hooks/NovuProvider.cjs';
5
5
  export { Bell, BellProps } from './components/Bell.cjs';
6
6
  export { Inbox, InboxProps } from './components/Inbox.cjs';
7
7
  export { InboxContent, InboxContentProps } from './components/InboxContent.cjs';
8
+ export { MsTeamsConnectButton, MsTeamsConnectButtonProps } from './components/msteams-connect-button/MsTeamsConnectButton.cjs';
9
+ export { MsTeamsLinkUser, MsTeamsLinkUserProps } from './components/msteams-link-user/MsTeamsLinkUser.cjs';
8
10
  export { NotificationProps, Notifications } from './components/Notifications.cjs';
9
11
  export { Preferences } from './components/Preferences.cjs';
12
+ export { SlackConnectButton, SlackConnectButtonProps } from './components/slack-connect-button/SlackConnectButton.cjs';
13
+ export { SlackLinkUser, SlackLinkUserProps } from './components/slack-link-user/SlackLinkUser.cjs';
10
14
  export { Subscription, SubscriptionProps } from './components/subscription/Subscription.cjs';
11
15
  export { SubscriptionButton, SubscriptionButtonProps } from './components/subscription/SubscriptionButton.cjs';
12
16
  export { SubscriptionPreferences, SubscriptionPreferencesProps } from './components/subscription/SubscriptionPreferences.cjs';
17
+ export { UseChannelConnectionProps, UseChannelConnectionResult, useChannelConnection } from './hooks/useChannelConnection.cjs';
18
+ export { UseChannelConnectionsProps, UseChannelConnectionsResult, useChannelConnections } from './hooks/useChannelConnections.cjs';
19
+ export { UseChannelEndpointProps, UseChannelEndpointResult, useChannelEndpoint } from './hooks/useChannelEndpoint.cjs';
13
20
  export { UseCountsProps, UseCountsResult, useCounts } from './hooks/useCounts.cjs';
21
+ export { UseCreateChannelEndpointProps, UseCreateChannelEndpointResult, useCreateChannelEndpoint } from './hooks/useCreateChannelEndpoint.cjs';
14
22
  export { useCreateSubscription } from './hooks/useCreateSubscription.cjs';
23
+ export { UseDeleteChannelEndpointProps, UseDeleteChannelEndpointResult, useDeleteChannelEndpoint } from './hooks/useDeleteChannelEndpoint.cjs';
15
24
  export { UseNotificationsProps, UseNotificationsResult, useNotifications } from './hooks/useNotifications.cjs';
16
25
  export { UsePreferencesResult, usePreferences } from './hooks/usePreferences.cjs';
17
26
  export { useRemoveSubscription } from './hooks/useRemoveSubscription.cjs';
@@ -19,8 +28,12 @@ export { UseScheduleProps as UsePreferencesProps, useSchedule } from './hooks/us
19
28
  export { useSubscription } from './hooks/useSubscription.cjs';
20
29
  export { useSubscriptions } from './hooks/useSubscriptions.cjs';
21
30
  export { useUpdateSubscription } from './hooks/useUpdateSubscription.cjs';
22
- export { BaseProps, BellRenderer, BodyRenderer, DefaultInboxProps, DefaultProps, NoRendererProps, NotificationRendererProps, NotificationsRenderer, ReactInboxAppearance, ReactInboxTheme, ReactSubscriptionAppearance, ReactSubscriptionTheme, SubjectBodyRendererProps, SubjectRenderer, WithChildrenProps } from './utils/types.cjs';
31
+ export { BaseProps, BellRenderer, BodyRenderer, DefaultInboxProps, DefaultProps, NoRendererProps, NotificationRendererProps, NotificationsRenderer, ReactAllAppearance, ReactInboxAppearance, ReactInboxTheme, ReactSubscriptionAppearance, ReactSubscriptionTheme, SubjectBodyRendererProps, SubjectRenderer, WithChildrenProps } from './utils/types.cjs';
23
32
  import 'react/jsx-runtime';
24
33
  import 'react';
25
34
  import './components/NovuUI.cjs';
35
+ import './components/msteams-connect-button/DefaultMsTeamsConnectButton.cjs';
36
+ import './components/msteams-link-user/DefaultMsTeamsLinkUser.cjs';
37
+ import './components/slack-connect-button/DefaultSlackConnectButton.cjs';
38
+ import './components/slack-link-user/DefaultSlackLinkUser.cjs';
26
39
  import './components/subscription/DefaultSubscription.cjs';
@@ -1 +1,2 @@
1
1
  export { buildSubscriber } from '@novu/js/internal';
2
+ import '@novu/js/themes';
@@ -15,8 +15,8 @@ import { UseUpdateSubscriptionProps, UseUpdateSubscriptionResult } from '../hook
15
15
  export { AllLocalization, AllLocalizationKey, ElementStyles, InboxAppearance, InboxAppearanceCallback, InboxAppearanceCallbackFunction, InboxAppearanceCallbackKeys, InboxAppearanceKey, InboxElements, InboxLocalization, InboxLocalizationKey, InboxTheme, NotificationActionClickHandler, NotificationClickHandler, NotificationRenderer, PreferenceGroups, PreferencesFilter, RouterPush, SubscriptionAppearance, SubscriptionAppearanceCallback, SubscriptionAppearanceCallbackFunction, SubscriptionAppearanceCallbackKeys, SubscriptionAppearanceKey, SubscriptionElements, SubscriptionLocalization, SubscriptionLocalizationKey, SubscriptionTheme, Tab, Variables } from '@novu/js/ui';
16
16
  export { BellProps } from '../components/Bell.cjs';
17
17
  export { InboxContentProps } from '../components/InboxContent.cjs';
18
- export { NotificationProps } from '../components/Notifications.cjs';
19
18
  export { BaseProps, BellRenderer, BodyRenderer, DefaultInboxProps, DefaultProps, NoRendererProps, NotificationRendererProps, NotificationsRenderer, SubjectBodyRendererProps, SubjectRenderer, WithChildrenProps } from '../utils/types.cjs';
19
+ export { NotificationProps } from '../components/Notifications.cjs';
20
20
  import 'react';
21
21
 
22
22
  /**
@@ -1,2 +1 @@
1
1
  export * from '@novu/js/themes';
2
- import '@novu/js/internal';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/appearance.ts"],"sourcesContent":["import type { AllAppearance, AllIconKey, AllIconOverrides } from '@novu/js/ui';\nimport { MountedElement } from '../context/RendererContext';\nimport type { ReactIconRenderer, ReactInboxAppearance, ReactSubscriptionAppearance } from './types';\n\nexport function adaptAppearanceForJs(\n appearance: ReactInboxAppearance | ReactSubscriptionAppearance,\n mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void\n): AllAppearance | undefined {\n if (!appearance) {\n return undefined;\n }\n const { icons, ...restAppearance } = appearance;\n const jsAppearance = { ...restAppearance } as AllAppearance;\n\n if (icons) {\n const jsIcons: AllIconOverrides = {};\n const iconKeys = Object.keys(icons) as Array<AllIconKey>;\n\n for (const iconKey of iconKeys) {\n // @ts-expect-error: cant easily fix this type error\n const reactRenderer = icons[iconKey] as ReactIconRenderer;\n\n if (reactRenderer) {\n jsIcons[iconKey] = (el: HTMLDivElement, props: { class?: string }) => {\n return mountElement(el, reactRenderer(props));\n };\n }\n }\n\n // JsAppearance also has .icons directly (from JsTheme part of JsAppearance)\n jsAppearance.icons = jsIcons;\n } else {\n // If original didn't have icons, ensure the clone doesn't either\n delete jsAppearance.icons;\n }\n\n return jsAppearance;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,SAAS,qBACd,YACA,cAC2B;AAC3B,MAAI,CAAC,YAAY;AACf,WAAO;AAAA,EACT;AACA,QAAM,EAAE,OAAO,GAAG,eAAe,IAAI;AACrC,QAAM,eAAe,EAAE,GAAG,eAAe;AAEzC,MAAI,OAAO;AACT,UAAM,UAA4B,CAAC;AACnC,UAAM,WAAW,OAAO,KAAK,KAAK;AAElC,eAAW,WAAW,UAAU;AAE9B,YAAM,gBAAgB,MAAM,OAAO;AAEnC,UAAI,eAAe;AACjB,gBAAQ,OAAO,IAAI,CAAC,IAAoB,UAA8B;AACpE,iBAAO,aAAa,IAAI,cAAc,KAAK,CAAC;AAAA,QAC9C;AAAA,MACF;AAAA,IACF;AAGA,iBAAa,QAAQ;AAAA,EACvB,OAAO;AAEL,WAAO,aAAa;AAAA,EACtB;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../src/utils/appearance.ts"],"sourcesContent":["import type { AllAppearance, AllIconKey, AllIconOverrides } from '@novu/js/ui';\nimport { MountedElement } from '../context/RendererContext';\nimport type { ReactAllAppearance, ReactIconRenderer, ReactInboxAppearance, ReactSubscriptionAppearance } from './types';\n\nexport function adaptAppearanceForJs(\n appearance: ReactInboxAppearance | ReactSubscriptionAppearance | ReactAllAppearance,\n mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void\n): AllAppearance | undefined {\n if (!appearance) {\n return undefined;\n }\n const { icons, ...restAppearance } = appearance;\n const jsAppearance = { ...restAppearance } as AllAppearance;\n\n if (icons) {\n const jsIcons: AllIconOverrides = {};\n const iconKeys = Object.keys(icons) as Array<AllIconKey>;\n\n for (const iconKey of iconKeys) {\n // @ts-expect-error: cant easily fix this type error\n const reactRenderer = icons[iconKey] as ReactIconRenderer;\n\n if (reactRenderer) {\n jsIcons[iconKey] = (el: HTMLDivElement, props: { class?: string }) => {\n return mountElement(el, reactRenderer(props));\n };\n }\n }\n\n // JsAppearance also has .icons directly (from JsTheme part of JsAppearance)\n jsAppearance.icons = jsIcons;\n } else {\n // If original didn't have icons, ensure the clone doesn't either\n delete jsAppearance.icons;\n }\n\n return jsAppearance;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,SAAS,qBACd,YACA,cAC2B;AAC3B,MAAI,CAAC,YAAY;AACf,WAAO;AAAA,EACT;AACA,QAAM,EAAE,OAAO,GAAG,eAAe,IAAI;AACrC,QAAM,eAAe,EAAE,GAAG,eAAe;AAEzC,MAAI,OAAO;AACT,UAAM,UAA4B,CAAC;AACnC,UAAM,WAAW,OAAO,KAAK,KAAK;AAElC,eAAW,WAAW,UAAU;AAE9B,YAAM,gBAAgB,MAAM,OAAO;AAEnC,UAAI,eAAe;AACjB,gBAAQ,OAAO,IAAI,CAAC,IAAoB,UAA8B;AACpE,iBAAO,aAAa,IAAI,cAAc,KAAK,CAAC;AAAA,QAC9C;AAAA,MACF;AAAA,IACF;AAGA,iBAAa,QAAQ;AAAA,EACvB,OAAO;AAEL,WAAO,aAAa;AAAA,EACtB;AAEA,SAAO;AACT;","names":[]}
@@ -1,10 +1,10 @@
1
1
  import { AllAppearance } from '@novu/js/ui';
2
2
  import { MountedElement } from '../context/RendererContext.cjs';
3
- import { ReactInboxAppearance, ReactSubscriptionAppearance } from './types.cjs';
3
+ import { ReactInboxAppearance, ReactSubscriptionAppearance, ReactAllAppearance } from './types.cjs';
4
4
  import 'react/jsx-runtime';
5
5
  import 'react';
6
6
  import '@novu/js';
7
7
 
8
- declare function adaptAppearanceForJs(appearance: ReactInboxAppearance | ReactSubscriptionAppearance, mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void): AllAppearance | undefined;
8
+ declare function adaptAppearanceForJs(appearance: ReactInboxAppearance | ReactSubscriptionAppearance | ReactAllAppearance, mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void): AllAppearance | undefined;
9
9
 
10
10
  export { adaptAppearanceForJs };
@@ -2,10 +2,10 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Novu } from '@novu/js';
3
3
  import { NovuUIOptions as NovuUIOptions$1 } from '@novu/js/ui';
4
4
  import React__default from 'react';
5
- import { ReactInboxAppearance, ReactSubscriptionAppearance } from '../utils/types.js';
5
+ import { ReactInboxAppearance, ReactSubscriptionAppearance, ReactAllAppearance } from '../utils/types.js';
6
6
 
7
7
  type NovuUIOptions = Omit<NovuUIOptions$1, 'appearance'> & {
8
- appearance?: ReactInboxAppearance | ReactSubscriptionAppearance;
8
+ appearance?: ReactInboxAppearance | ReactSubscriptionAppearance | ReactAllAppearance;
9
9
  };
10
10
  type NovuUIProps = React__default.PropsWithChildren<{
11
11
  options: NovuUIOptions;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/NovuUI.tsx"],"sourcesContent":["import { Novu } from '@novu/js';\nimport type { NovuUIOptions as JsNovuUIOptions } from '@novu/js/ui';\nimport { NovuUI as NovuUIClass } from '@novu/js/ui';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { NovuUIProvider } from '../context/NovuUIContext';\nimport { useRenderer } from '../context/RendererContext';\nimport { useDataRef } from '../hooks/internal/useDataRef';\nimport { adaptAppearanceForJs } from '../utils/appearance';\nimport type { ReactInboxAppearance, ReactSubscriptionAppearance } from '../utils/types';\nimport { ShadowRootDetector } from './ShadowRootDetector';\n\nexport type NovuUIOptions = Omit<JsNovuUIOptions, 'appearance'> & {\n appearance?: ReactInboxAppearance | ReactSubscriptionAppearance;\n};\n\ntype NovuUIProps = React.PropsWithChildren<{\n options: NovuUIOptions;\n novu: Novu;\n}>;\n\nconst findParentShadowRoot = (child?: HTMLDivElement | null): Node | null => {\n if (!child) {\n return null;\n }\n\n let node: Node | null = child;\n\n while (node) {\n if (node instanceof Element && node.shadowRoot) {\n return node.shadowRoot;\n }\n\n if (node instanceof ShadowRoot) {\n return node;\n }\n\n node = node.parentNode;\n\n if (!node || node === document) {\n break;\n }\n }\n\n return null;\n};\n\nexport const NovuUI = ({ options, novu, children }: NovuUIProps) => {\n const shadowRootDetector = useRef<HTMLDivElement>(null);\n const { mountElement } = useRenderer();\n\n const adaptedAppearanceForUpdate = useMemo(\n () => adaptAppearanceForJs(options.appearance || {}, mountElement),\n [options.appearance, mountElement]\n );\n\n const adaptedOptions = useMemo(() => {\n return {\n ...options,\n appearance: adaptedAppearanceForUpdate,\n novu,\n };\n }, [options, novu, adaptedAppearanceForUpdate]);\n\n const optionsRef = useDataRef(adaptedOptions);\n const [novuUI, setNovuUI] = useState<NovuUIClass | undefined>();\n\n useEffect(() => {\n const parentShadowRoot = findParentShadowRoot(shadowRootDetector.current);\n const instance = new NovuUIClass({\n ...optionsRef.current,\n container: optionsRef.current.container ?? parentShadowRoot,\n });\n setNovuUI(instance);\n\n return () => {\n instance.unmount();\n };\n }, []);\n\n useEffect(() => {\n if (!novuUI) {\n return;\n }\n\n const parentShadowRoot = findParentShadowRoot(shadowRootDetector.current);\n novuUI.updateContainer(options.container ?? parentShadowRoot);\n novuUI.updateAppearance(adaptedAppearanceForUpdate);\n novuUI.updateLocalization(options.localization);\n novuUI.updateTabs(options.tabs);\n novuUI.updateOptions(options.options);\n novuUI.updateRouterPush(options.routerPush);\n novuUI.updateNovu(novu);\n }, [\n shadowRootDetector,\n novuUI,\n adaptedAppearanceForUpdate,\n options.localization,\n options.tabs,\n options.options,\n options.routerPush,\n novu,\n ]);\n\n return (\n <>\n <ShadowRootDetector ref={shadowRootDetector} />\n {novuUI && <NovuUIProvider value={{ novuUI }}>{children}</NovuUIProvider>}\n </>\n );\n};\n"],"mappings":";AAEA,SAAS,UAAU,mBAAmB;AACtC,SAAgB,WAAW,SAAS,QAAQ,gBAAgB;AAC5D,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,4BAA4B;AAErC,SAAS,0BAA0B;AA+F/B,mBACE,KADF;AApFJ,IAAM,uBAAuB,CAAC,UAA+C;AAC3E,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,EACT;AAEA,MAAI,OAAoB;AAExB,SAAO,MAAM;AACX,QAAI,gBAAgB,WAAW,KAAK,YAAY;AAC9C,aAAO,KAAK;AAAA,IACd;AAEA,QAAI,gBAAgB,YAAY;AAC9B,aAAO;AAAA,IACT;AAEA,WAAO,KAAK;AAEZ,QAAI,CAAC,QAAQ,SAAS,UAAU;AAC9B;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEO,IAAM,SAAS,CAAC,EAAE,SAAS,MAAM,SAAS,MAAmB;AAClE,QAAM,qBAAqB,OAAuB,IAAI;AACtD,QAAM,EAAE,aAAa,IAAI,YAAY;AAErC,QAAM,6BAA6B;AAAA,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3,"sources":["../../../src/components/NovuUI.tsx"],"sourcesContent":["import { Novu } from '@novu/js';\nimport type { NovuUIOptions as JsNovuUIOptions } from '@novu/js/ui';\nimport { NovuUI as NovuUIClass } from '@novu/js/ui';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { NovuUIProvider } from '../context/NovuUIContext';\nimport { useRenderer } from '../context/RendererContext';\nimport { useDataRef } from '../hooks/internal/useDataRef';\nimport { adaptAppearanceForJs } from '../utils/appearance';\nimport type { ReactAllAppearance, ReactInboxAppearance, ReactSubscriptionAppearance } from '../utils/types';\nimport { ShadowRootDetector } from './ShadowRootDetector';\n\nexport type NovuUIOptions = Omit<JsNovuUIOptions, 'appearance'> & {\n appearance?: ReactInboxAppearance | ReactSubscriptionAppearance | ReactAllAppearance;\n};\n\ntype NovuUIProps = React.PropsWithChildren<{\n options: NovuUIOptions;\n novu: Novu;\n}>;\n\nconst findParentShadowRoot = (child?: HTMLDivElement | null): Node | null => {\n if (!child) {\n return null;\n }\n\n let node: Node | null = child;\n\n while (node) {\n if (node instanceof Element && node.shadowRoot) {\n return node.shadowRoot;\n }\n\n if (node instanceof ShadowRoot) {\n return node;\n }\n\n node = node.parentNode;\n\n if (!node || node === document) {\n break;\n }\n }\n\n return null;\n};\n\nexport const NovuUI = ({ options, novu, children }: NovuUIProps) => {\n const shadowRootDetector = useRef<HTMLDivElement>(null);\n const { mountElement } = useRenderer();\n\n const adaptedAppearanceForUpdate = useMemo(\n () => adaptAppearanceForJs(options.appearance || {}, mountElement),\n [options.appearance, mountElement]\n );\n\n const adaptedOptions = useMemo(() => {\n return {\n ...options,\n appearance: adaptedAppearanceForUpdate,\n novu,\n };\n }, [options, novu, adaptedAppearanceForUpdate]);\n\n const optionsRef = useDataRef(adaptedOptions);\n const [novuUI, setNovuUI] = useState<NovuUIClass | undefined>();\n\n useEffect(() => {\n const parentShadowRoot = findParentShadowRoot(shadowRootDetector.current);\n const instance = new NovuUIClass({\n ...optionsRef.current,\n container: optionsRef.current.container ?? parentShadowRoot,\n });\n setNovuUI(instance);\n\n return () => {\n instance.unmount();\n };\n }, []);\n\n useEffect(() => {\n if (!novuUI) {\n return;\n }\n\n const parentShadowRoot = findParentShadowRoot(shadowRootDetector.current);\n novuUI.updateContainer(options.container ?? parentShadowRoot);\n novuUI.updateAppearance(adaptedAppearanceForUpdate);\n novuUI.updateLocalization(options.localization);\n novuUI.updateTabs(options.tabs);\n novuUI.updateOptions(options.options);\n novuUI.updateRouterPush(options.routerPush);\n novuUI.updateNovu(novu);\n }, [\n shadowRootDetector,\n novuUI,\n adaptedAppearanceForUpdate,\n options.localization,\n options.tabs,\n options.options,\n options.routerPush,\n novu,\n ]);\n\n return (\n <>\n <ShadowRootDetector ref={shadowRootDetector} />\n {novuUI && <NovuUIProvider value={{ novuUI }}>{children}</NovuUIProvider>}\n </>\n );\n};\n"],"mappings":";AAEA,SAAS,UAAU,mBAAmB;AACtC,SAAgB,WAAW,SAAS,QAAQ,gBAAgB;AAC5D,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,4BAA4B;AAErC,SAAS,0BAA0B;AA+F/B,mBACE,KADF;AApFJ,IAAM,uBAAuB,CAAC,UAA+C;AAC3E,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,EACT;AAEA,MAAI,OAAoB;AAExB,SAAO,MAAM;AACX,QAAI,gBAAgB,WAAW,KAAK,YAAY;AAC9C,aAAO,KAAK;AAAA,IACd;AAEA,QAAI,gBAAgB,YAAY;AAC9B,aAAO;AAAA,IACT;AAEA,WAAO,KAAK;AAEZ,QAAI,CAAC,QAAQ,SAAS,UAAU;AAC9B;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEO,IAAM,SAAS,CAAC,EAAE,SAAS,MAAM,SAAS,MAAmB;AAClE,QAAM,qBAAqB,OAAuB,IAAI;AACtD,QAAM,EAAE,aAAa,IAAI,YAAY;AAErC,QAAM,6BAA6B;AAAA,IACjC,M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@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+ import { NovuUIOptions } from '../NovuUI.js';
4
+ import { DefaultConnectChatProps } from './DefaultConnectChat.js';
5
+ import '@novu/js';
6
+ import '@novu/js/ui';
7
+ import '../../utils/types.js';
8
+
9
+ type ConnectChatProps = DefaultConnectChatProps & Pick<NovuUIOptions, 'container' | 'appearance'>;
10
+ declare const ConnectChat: React__default.MemoExoticComponent<(props: ConnectChatProps) => react_jsx_runtime.JSX.Element>;
11
+
12
+ export { ConnectChat, type ConnectChatProps };
@@ -0,0 +1,28 @@
1
+ // src/components/connect-chat/ConnectChat.tsx
2
+ import React, { useMemo } from "react";
3
+ import { useNovu } from "../../hooks/NovuProvider.js";
4
+ import { NovuUI } from "../NovuUI.js";
5
+ import { withRenderer } from "../Renderer.js";
6
+ import { DefaultConnectChat } from "./DefaultConnectChat.js";
7
+ import { jsx } from "react/jsx-runtime";
8
+ var ConnectChatInternal = withRenderer((props) => {
9
+ const { container, appearance, ...defaultProps } = props;
10
+ const novu = useNovu();
11
+ const options = useMemo(() => {
12
+ return {
13
+ container,
14
+ appearance,
15
+ options: novu.options
16
+ };
17
+ }, [container, appearance, novu.options]);
18
+ return /* @__PURE__ */ jsx(NovuUI, { options, novu, children: /* @__PURE__ */ jsx(DefaultConnectChat, { ...defaultProps }) });
19
+ });
20
+ ConnectChatInternal.displayName = "ConnectChatInternal";
21
+ var ConnectChat = React.memo((props) => {
22
+ return /* @__PURE__ */ jsx(ConnectChatInternal, { ...props });
23
+ });
24
+ ConnectChat.displayName = "ConnectChat";
25
+ export {
26
+ ConnectChat
27
+ };
28
+ //# sourceMappingURL=ConnectChat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/connect-chat/ConnectChat.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { withRenderer } from '../Renderer';\nimport { DefaultConnectChat, DefaultConnectChatProps } from './DefaultConnectChat';\n\nexport type ConnectChatProps = DefaultConnectChatProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\n\nconst ConnectChatInternal = withRenderer<ConnectChatProps>((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 <DefaultConnectChat {...defaultProps} />\n </NovuUI>\n );\n});\n\nConnectChatInternal.displayName = 'ConnectChatInternal';\n\nexport const ConnectChat = React.memo((props: ConnectChatProps) => {\n return <ConnectChatInternal {...props} />;\n});\n\nConnectChat.displayName = 'ConnectChat';\n"],"mappings":";AAAA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AACxB,SAAS,cAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,0BAAmD;AAkBtD;AAdN,IAAM,sBAAsB,aAA+B,CAAC,UAAU;AACpE,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,sBAAoB,GAAG,cAAc,GACxC;AAEJ,CAAC;AAED,oBAAoB,cAAc;AAE3B,IAAM,cAAc,MAAM,KAAK,CAAC,UAA4B;AACjE,SAAO,oBAAC,uBAAqB,GAAG,OAAO;AACzC,CAAC;AAED,YAAY,cAAc;","names":[]}
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ConnectChatProps } from '@novu/js/ui';
3
+
4
+ type DefaultConnectChatProps = Pick<ConnectChatProps, 'integrationIdentifier' | 'connectionIdentifier' | 'subscriberId' | 'context' | 'scope' | 'connectionMode' | 'onConnectSuccess' | 'onConnectError' | 'onDisconnectSuccess' | 'onDisconnectError'>;
5
+ declare const DefaultConnectChat: (props: DefaultConnectChatProps) => react_jsx_runtime.JSX.Element;
6
+
7
+ export { DefaultConnectChat, type DefaultConnectChatProps };
@@ -0,0 +1,58 @@
1
+ // src/components/connect-chat/DefaultConnectChat.tsx
2
+ import { useCallback } from "react";
3
+ import { useNovuUI } from "../../context/NovuUIContext.js";
4
+ import { Mounter } from "../Mounter.js";
5
+ import { jsx } from "react/jsx-runtime";
6
+ var DefaultConnectChat = (props) => {
7
+ const {
8
+ integrationIdentifier,
9
+ connectionIdentifier,
10
+ subscriberId,
11
+ context,
12
+ scope,
13
+ connectionMode,
14
+ onConnectSuccess,
15
+ onConnectError,
16
+ onDisconnectSuccess,
17
+ onDisconnectError
18
+ } = props;
19
+ const { novuUI } = useNovuUI();
20
+ const mount = useCallback(
21
+ (element) => {
22
+ return novuUI.mountComponent({
23
+ name: "ConnectChat",
24
+ props: {
25
+ integrationIdentifier,
26
+ connectionIdentifier,
27
+ subscriberId,
28
+ context,
29
+ scope,
30
+ connectionMode,
31
+ onConnectSuccess,
32
+ onConnectError,
33
+ onDisconnectSuccess,
34
+ onDisconnectError
35
+ },
36
+ element
37
+ });
38
+ },
39
+ [
40
+ novuUI,
41
+ integrationIdentifier,
42
+ connectionIdentifier,
43
+ subscriberId,
44
+ context,
45
+ scope,
46
+ connectionMode,
47
+ onConnectSuccess,
48
+ onConnectError,
49
+ onDisconnectSuccess,
50
+ onDisconnectError
51
+ ]
52
+ );
53
+ return /* @__PURE__ */ jsx(Mounter, { mount });
54
+ };
55
+ export {
56
+ DefaultConnectChat
57
+ };
58
+ //# sourceMappingURL=DefaultConnectChat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/connect-chat/DefaultConnectChat.tsx"],"sourcesContent":["import { ConnectChatProps } from '@novu/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultConnectChatProps = Pick<\n ConnectChatProps,\n | 'integrationIdentifier'\n | 'connectionIdentifier'\n | 'subscriberId'\n | 'context'\n | 'scope'\n | 'connectionMode'\n | 'onConnectSuccess'\n | 'onConnectError'\n | 'onDisconnectSuccess'\n | 'onDisconnectError'\n>;\n\nexport const DefaultConnectChat = (props: DefaultConnectChatProps) => {\n const {\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n scope,\n connectionMode,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n } = props;\n const { novuUI } = useNovuUI();\n\n const mount = useCallback(\n (element: HTMLElement) => {\n return novuUI.mountComponent({\n name: 'ConnectChat',\n props: {\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n scope,\n connectionMode,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n },\n element,\n });\n },\n [\n novuUI,\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n scope,\n connectionMode,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n ]\n );\n\n return <Mounter mount={mount} />;\n};\n"],"mappings":";AACA,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AAiEf;AAjDF,IAAM,qBAAqB,CAAC,UAAmC;AACpE,QAAM;AAAA,IACJ;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,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,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC;","names":[]}
@@ -1,9 +1,13 @@
1
- export { InternalNovuProvider, NovuProvider, NovuProviderProps, useNovu, useUnsafeNovu } from '../hooks/NovuProvider.js';
1
+ export { InternalNovuProvider, NovuProvider, NovuProviderProps, useNovu, useRealtime, useUnsafeNovu } from '../hooks/NovuProvider.js';
2
2
  export { Bell, BellProps } from './Bell.js';
3
3
  export { Inbox, InboxProps } from './Inbox.js';
4
4
  export { InboxContent, InboxContentProps } from './InboxContent.js';
5
+ export { MsTeamsConnectButton, MsTeamsConnectButtonProps } from './msteams-connect-button/MsTeamsConnectButton.js';
6
+ export { MsTeamsLinkUser, MsTeamsLinkUserProps } from './msteams-link-user/MsTeamsLinkUser.js';
5
7
  export { NotificationProps, Notifications } from './Notifications.js';
6
8
  export { Preferences } from './Preferences.js';
9
+ export { SlackConnectButton, SlackConnectButtonProps } from './slack-connect-button/SlackConnectButton.js';
10
+ export { SlackLinkUser, SlackLinkUserProps } from './slack-link-user/SlackLinkUser.js';
7
11
  export { Subscription, SubscriptionProps } from './subscription/Subscription.js';
8
12
  export { SubscriptionButton, SubscriptionButtonProps } from './subscription/SubscriptionButton.js';
9
13
  export { SubscriptionPreferences, SubscriptionPreferencesProps } from './subscription/SubscriptionPreferences.js';
@@ -13,4 +17,8 @@ import 'react';
13
17
  import '../utils/types.js';
14
18
  import '@novu/js/ui';
15
19
  import './NovuUI.js';
20
+ import './msteams-connect-button/DefaultMsTeamsConnectButton.js';
21
+ import './msteams-link-user/DefaultMsTeamsLinkUser.js';
22
+ import './slack-connect-button/DefaultSlackConnectButton.js';
23
+ import './slack-link-user/DefaultSlackLinkUser.js';
16
24
  import './subscription/DefaultSubscription.js';
@@ -3,8 +3,12 @@ export * from "../hooks/NovuProvider.js";
3
3
  export * from "./Bell.js";
4
4
  export * from "./Inbox.js";
5
5
  export * from "./InboxContent.js";
6
+ export * from "./msteams-connect-button/MsTeamsConnectButton.js";
7
+ export * from "./msteams-link-user/MsTeamsLinkUser.js";
6
8
  export * from "./Notifications.js";
7
9
  export * from "./Preferences.js";
10
+ export * from "./slack-connect-button/SlackConnectButton.js";
11
+ export * from "./slack-link-user/SlackLinkUser.js";
8
12
  export * from "./subscription/Subscription.js";
9
13
  export * from "./subscription/SubscriptionButton.js";
10
14
  export * from "./subscription/SubscriptionPreferences.js";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from '../hooks/NovuProvider';\nexport * from './Bell';\nexport * from './Inbox';\nexport * from './InboxContent';\nexport * from './Notifications';\nexport * from './Preferences';\nexport * from './subscription/Subscription';\nexport * from './subscription/SubscriptionButton';\nexport * from './subscription/SubscriptionPreferences';\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from '../hooks/NovuProvider';\nexport * from './Bell';\nexport * from './Inbox';\nexport * from './InboxContent';\nexport * from './msteams-connect-button/MsTeamsConnectButton';\nexport * from './msteams-link-user/MsTeamsLinkUser';\nexport * from './Notifications';\nexport * from './Preferences';\nexport * from './slack-connect-button/SlackConnectButton';\nexport * from './slack-link-user/SlackLinkUser';\nexport * from './subscription/Subscription';\nexport * from './subscription/SubscriptionButton';\nexport * from './subscription/SubscriptionPreferences';\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { MsTeamsConnectButtonProps } from '@novu/js/ui';
3
+
4
+ type DefaultMsTeamsConnectButtonProps = Pick<MsTeamsConnectButtonProps, 'integrationIdentifier' | 'connectionIdentifier' | 'subscriberId' | 'context' | 'scope' | 'connectionMode' | 'autoLinkUser' | 'onConnectSuccess' | 'onConnectError' | 'onDisconnectSuccess' | 'onDisconnectError' | 'connectLabel' | 'connectedLabel'>;
5
+ declare const DefaultMsTeamsConnectButton: (props: DefaultMsTeamsConnectButtonProps) => react_jsx_runtime.JSX.Element;
6
+
7
+ export { DefaultMsTeamsConnectButton, type DefaultMsTeamsConnectButtonProps };