@novu/react 3.11.0 → 3.12.0-rc.1

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 (101) hide show
  1. package/README.md +10 -18
  2. package/dist/cjs/components/Inbox.cjs +5 -1
  3. package/dist/cjs/components/Inbox.cjs.map +1 -1
  4. package/dist/cjs/components/NovuUI.cjs +3 -1
  5. package/dist/cjs/components/NovuUI.cjs.map +1 -1
  6. package/dist/cjs/components/NovuUI.d.cts +9 -9
  7. package/dist/cjs/components/index.cjs +7 -1
  8. package/dist/cjs/components/index.cjs.map +1 -1
  9. package/dist/cjs/components/index.d.cts +5 -0
  10. package/dist/cjs/components/subscription/DefaultSubscription.cjs +59 -0
  11. package/dist/cjs/components/subscription/DefaultSubscription.cjs.map +1 -0
  12. package/dist/cjs/components/subscription/DefaultSubscription.d.cts +11 -0
  13. package/dist/cjs/components/subscription/Subscription.cjs +80 -0
  14. package/dist/cjs/components/subscription/Subscription.cjs.map +1 -0
  15. package/dist/cjs/components/subscription/Subscription.d.cts +22 -0
  16. package/dist/cjs/components/subscription/SubscriptionButton.cjs +91 -0
  17. package/dist/cjs/components/subscription/SubscriptionButton.cjs.map +1 -0
  18. package/dist/cjs/components/subscription/SubscriptionButton.d.cts +8 -0
  19. package/dist/cjs/components/subscription/SubscriptionPreferences.cjs +91 -0
  20. package/dist/cjs/components/subscription/SubscriptionPreferences.cjs.map +1 -0
  21. package/dist/cjs/components/subscription/SubscriptionPreferences.d.cts +8 -0
  22. package/dist/cjs/hooks/NovuProvider.cjs +21 -18
  23. package/dist/cjs/hooks/NovuProvider.cjs.map +1 -1
  24. package/dist/cjs/hooks/index.cjs +11 -1
  25. package/dist/cjs/hooks/index.cjs.map +1 -1
  26. package/dist/cjs/hooks/index.d.cts +7 -1
  27. package/dist/cjs/hooks/useCreateSubscription.cjs +61 -0
  28. package/dist/cjs/hooks/useCreateSubscription.cjs.map +1 -0
  29. package/dist/cjs/hooks/useCreateSubscription.d.cts +17 -0
  30. package/dist/cjs/hooks/useDeleteSubscription.cjs +61 -0
  31. package/dist/cjs/hooks/useDeleteSubscription.cjs.map +1 -0
  32. package/dist/cjs/hooks/useDeleteSubscription.d.cts +17 -0
  33. package/dist/cjs/hooks/useSubscription.cjs +156 -0
  34. package/dist/cjs/hooks/useSubscription.cjs.map +1 -0
  35. package/dist/cjs/hooks/useSubscription.d.cts +21 -0
  36. package/dist/cjs/hooks/useSubscriptions.cjs +121 -0
  37. package/dist/cjs/hooks/useSubscriptions.cjs.map +1 -0
  38. package/dist/cjs/hooks/useSubscriptions.d.cts +36 -0
  39. package/dist/cjs/hooks/useUpdateSubscription.cjs +61 -0
  40. package/dist/cjs/hooks/useUpdateSubscription.cjs.map +1 -0
  41. package/dist/cjs/hooks/useUpdateSubscription.d.cts +18 -0
  42. package/dist/cjs/index.cjs +18 -2
  43. package/dist/cjs/index.cjs.map +1 -1
  44. package/dist/cjs/index.d.cts +14 -3
  45. package/dist/cjs/server/index.cjs +61 -2
  46. package/dist/cjs/server/index.cjs.map +1 -1
  47. package/dist/cjs/server/index.d.cts +18 -4
  48. package/dist/cjs/utils/appearance.cjs.map +1 -1
  49. package/dist/cjs/utils/appearance.d.cts +3 -3
  50. package/dist/cjs/utils/types.cjs.map +1 -1
  51. package/dist/cjs/utils/types.d.cts +32 -11
  52. package/dist/esm/components/Inbox.js +5 -1
  53. package/dist/esm/components/Inbox.js.map +1 -1
  54. package/dist/esm/components/NovuUI.d.ts +9 -9
  55. package/dist/esm/components/NovuUI.js +3 -1
  56. package/dist/esm/components/NovuUI.js.map +1 -1
  57. package/dist/esm/components/index.d.ts +5 -0
  58. package/dist/esm/components/index.js +3 -0
  59. package/dist/esm/components/index.js.map +1 -1
  60. package/dist/esm/components/subscription/DefaultSubscription.d.ts +11 -0
  61. package/dist/esm/components/subscription/DefaultSubscription.js +34 -0
  62. package/dist/esm/components/subscription/DefaultSubscription.js.map +1 -0
  63. package/dist/esm/components/subscription/Subscription.d.ts +22 -0
  64. package/dist/esm/components/subscription/Subscription.js +45 -0
  65. package/dist/esm/components/subscription/Subscription.js.map +1 -0
  66. package/dist/esm/components/subscription/SubscriptionButton.d.ts +8 -0
  67. package/dist/esm/components/subscription/SubscriptionButton.js +56 -0
  68. package/dist/esm/components/subscription/SubscriptionButton.js.map +1 -0
  69. package/dist/esm/components/subscription/SubscriptionPreferences.d.ts +8 -0
  70. package/dist/esm/components/subscription/SubscriptionPreferences.js +56 -0
  71. package/dist/esm/components/subscription/SubscriptionPreferences.js.map +1 -0
  72. package/dist/esm/hooks/NovuProvider.js +22 -19
  73. package/dist/esm/hooks/NovuProvider.js.map +1 -1
  74. package/dist/esm/hooks/index.d.ts +7 -1
  75. package/dist/esm/hooks/index.js +5 -0
  76. package/dist/esm/hooks/index.js.map +1 -1
  77. package/dist/esm/hooks/useCreateSubscription.d.ts +17 -0
  78. package/dist/esm/hooks/useCreateSubscription.js +36 -0
  79. package/dist/esm/hooks/useCreateSubscription.js.map +1 -0
  80. package/dist/esm/hooks/useDeleteSubscription.d.ts +17 -0
  81. package/dist/esm/hooks/useDeleteSubscription.js +36 -0
  82. package/dist/esm/hooks/useDeleteSubscription.js.map +1 -0
  83. package/dist/esm/hooks/useSubscription.d.ts +21 -0
  84. package/dist/esm/hooks/useSubscription.js +129 -0
  85. package/dist/esm/hooks/useSubscription.js.map +1 -0
  86. package/dist/esm/hooks/useSubscriptions.d.ts +36 -0
  87. package/dist/esm/hooks/useSubscriptions.js +96 -0
  88. package/dist/esm/hooks/useSubscriptions.js.map +1 -0
  89. package/dist/esm/hooks/useUpdateSubscription.d.ts +18 -0
  90. package/dist/esm/hooks/useUpdateSubscription.js +36 -0
  91. package/dist/esm/hooks/useUpdateSubscription.js.map +1 -0
  92. package/dist/esm/index.d.ts +14 -3
  93. package/dist/esm/index.js +32 -3
  94. package/dist/esm/index.js.map +1 -1
  95. package/dist/esm/server/index.d.ts +18 -4
  96. package/dist/esm/server/index.js +53 -2
  97. package/dist/esm/server/index.js.map +1 -1
  98. package/dist/esm/utils/appearance.d.ts +3 -3
  99. package/dist/esm/utils/appearance.js.map +1 -1
  100. package/dist/esm/utils/types.d.ts +32 -11
  101. package/package.json +11 -11
@@ -0,0 +1,121 @@
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/useSubscriptions.ts
21
+ var useSubscriptions_exports = {};
22
+ __export(useSubscriptions_exports, {
23
+ useSubscriptions: () => useSubscriptions
24
+ });
25
+ module.exports = __toCommonJS(useSubscriptions_exports);
26
+ var import_react = require("react");
27
+ var import_NovuProvider = require("./NovuProvider.cjs");
28
+ var useSubscriptions = ({ topicKey, onSuccess, onError }) => {
29
+ const novu = (0, import_NovuProvider.useNovu)();
30
+ const [data, setData] = (0, import_react.useState)();
31
+ const [error, setError] = (0, import_react.useState)();
32
+ const [isLoading, setIsLoading] = (0, import_react.useState)(true);
33
+ const [isFetching, setIsFetching] = (0, import_react.useState)(false);
34
+ const fetchSubscriptions = (0, import_react.useCallback)(
35
+ async (options) => {
36
+ if (options == null ? void 0 : options.refetch) {
37
+ setError(void 0);
38
+ setIsLoading(true);
39
+ novu.subscriptions.cache.invalidate({ topicKey });
40
+ }
41
+ setIsFetching(true);
42
+ const response = await novu.subscriptions.list({ topicKey }, { refetch: options == null ? void 0 : options.refetch });
43
+ if (response.error) {
44
+ setError(response.error);
45
+ onError == null ? void 0 : onError(response.error);
46
+ } else if (response.data) {
47
+ onSuccess == null ? void 0 : onSuccess(response.data);
48
+ setData(response.data);
49
+ }
50
+ setIsLoading(false);
51
+ setIsFetching(false);
52
+ },
53
+ [novu, topicKey, onError, onSuccess]
54
+ );
55
+ (0, import_react.useEffect)(() => {
56
+ const cleanupListPending = novu.on("subscriptions.list.pending", ({ args }) => {
57
+ if (args.topicKey !== topicKey) {
58
+ return;
59
+ }
60
+ setIsFetching(true);
61
+ });
62
+ const cleanupListResolved = novu.on("subscriptions.list.resolved", ({ args, data: data2, error: error2 }) => {
63
+ if (args.topicKey !== topicKey) {
64
+ return;
65
+ }
66
+ if (error2) {
67
+ setError(error2);
68
+ onError == null ? void 0 : onError(error2);
69
+ } else if (data2) {
70
+ onSuccess == null ? void 0 : onSuccess(data2);
71
+ setData(data2);
72
+ }
73
+ setIsLoading(false);
74
+ setIsFetching(false);
75
+ });
76
+ const cleanupListUpdated = novu.on("subscriptions.list.updated", ({ data: data2 }) => {
77
+ if (data2.topicKey !== topicKey) {
78
+ return;
79
+ }
80
+ setData(data2.subscriptions);
81
+ });
82
+ const cleanupCreateResolved = novu.on("subscription.create.resolved", ({ args, data: data2 }) => {
83
+ if (args.topicKey !== topicKey) {
84
+ return;
85
+ }
86
+ if (data2) {
87
+ void fetchSubscriptions({ refetch: true });
88
+ }
89
+ });
90
+ const cleanupDeleteResolved = novu.on("subscription.delete.resolved", ({ args }) => {
91
+ const deleteTopicKey = "subscription" in args ? args.subscription.topicKey : topicKey;
92
+ if (deleteTopicKey !== topicKey) {
93
+ return;
94
+ }
95
+ void fetchSubscriptions({ refetch: true });
96
+ });
97
+ void fetchSubscriptions({ refetch: true });
98
+ return () => {
99
+ cleanupListPending();
100
+ cleanupListResolved();
101
+ cleanupListUpdated();
102
+ cleanupCreateResolved();
103
+ cleanupDeleteResolved();
104
+ };
105
+ }, [topicKey, novu, fetchSubscriptions, onError, onSuccess]);
106
+ const refetch = (0, import_react.useCallback)(() => {
107
+ return fetchSubscriptions({ refetch: true });
108
+ }, [fetchSubscriptions]);
109
+ return {
110
+ subscriptions: data,
111
+ error,
112
+ isLoading,
113
+ isFetching,
114
+ refetch
115
+ };
116
+ };
117
+ // Annotate the CommonJS export names for ESM import in node:
118
+ 0 && (module.exports = {
119
+ useSubscriptions
120
+ });
121
+ //# sourceMappingURL=useSubscriptions.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/hooks/useSubscriptions.ts"],"sourcesContent":["import { NovuError, TopicSubscription } from '@novu/js';\nimport { useCallback, useEffect, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\n/**\n * Get all subscriptions for a topic.\n * Props for the useSubscriptions hook.\n *\n * @example\n * ```tsx\n * // Get all subscriptions for a topic\n * const { subscriptions } = useSubscriptions({\n * topicKey: 'my-topic'\n * });\n *\n * // Get subscriptions with callbacks\n * const { subscriptions, refetch } = useSubscriptions({\n * topicKey: 'my-topic',\n * onSuccess: (data) => console.log('Loaded:', data),\n * onError: (error) => console.error('Error:', error)\n * });\n * ```\n */\nexport type UseSubscriptionsProps = {\n topicKey: string;\n onSuccess?: (data: TopicSubscription[]) => void;\n onError?: (error: NovuError) => void;\n};\n\nexport type UseSubscriptionsResult = {\n subscriptions?: TopicSubscription[];\n error?: NovuError;\n isLoading: boolean;\n isFetching: boolean;\n refetch: () => Promise<void>;\n};\n\nexport const useSubscriptions = ({ topicKey, onSuccess, onError }: UseSubscriptionsProps): UseSubscriptionsResult => {\n const novu = useNovu();\n const [data, setData] = useState<TopicSubscription[]>();\n const [error, setError] = useState<NovuError>();\n const [isLoading, setIsLoading] = useState(true);\n const [isFetching, setIsFetching] = useState(false);\n\n const fetchSubscriptions = useCallback(\n async (options?: { refetch: boolean }) => {\n if (options?.refetch) {\n setError(undefined);\n setIsLoading(true);\n novu.subscriptions.cache.invalidate({ topicKey });\n }\n setIsFetching(true);\n\n const response = await novu.subscriptions.list({ topicKey }, { refetch: options?.refetch });\n\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else if (response.data) {\n onSuccess?.(response.data);\n setData(response.data);\n }\n setIsLoading(false);\n setIsFetching(false);\n },\n [novu, topicKey, onError, onSuccess]\n );\n\n useEffect(() => {\n const cleanupListPending = novu.on('subscriptions.list.pending', ({ args }) => {\n if (args.topicKey !== topicKey) {\n return;\n }\n setIsFetching(true);\n });\n\n const cleanupListResolved = novu.on('subscriptions.list.resolved', ({ args, data, error }) => {\n if (args.topicKey !== topicKey) {\n return;\n }\n if (error) {\n setError(error as NovuError);\n onError?.(error as NovuError);\n } else if (data) {\n onSuccess?.(data);\n setData(data);\n }\n setIsLoading(false);\n setIsFetching(false);\n });\n\n const cleanupListUpdated = novu.on('subscriptions.list.updated', ({ data }) => {\n if (data.topicKey !== topicKey) {\n return;\n }\n setData(data.subscriptions);\n });\n\n const cleanupCreateResolved = novu.on('subscription.create.resolved', ({ args, data }) => {\n if (args.topicKey !== topicKey) {\n return;\n }\n if (data) {\n void fetchSubscriptions({ refetch: true });\n }\n });\n\n const cleanupDeleteResolved = novu.on('subscription.delete.resolved', ({ args }) => {\n const deleteTopicKey = 'subscription' in args ? args.subscription.topicKey : topicKey;\n if (deleteTopicKey !== topicKey) {\n return;\n }\n void fetchSubscriptions({ refetch: true });\n });\n\n void fetchSubscriptions({ refetch: true });\n\n return () => {\n cleanupListPending();\n cleanupListResolved();\n cleanupListUpdated();\n cleanupCreateResolved();\n cleanupDeleteResolved();\n };\n }, [topicKey, novu, fetchSubscriptions, onError, onSuccess]);\n\n const refetch = useCallback(() => {\n return fetchSubscriptions({ refetch: true });\n }, [fetchSubscriptions]);\n\n return {\n subscriptions: data,\n error,\n isLoading,\n isFetching,\n refetch,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAiD;AACjD,0BAAwB;AAmCjB,IAAM,mBAAmB,CAAC,EAAE,UAAU,WAAW,QAAQ,MAAqD;AACnH,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;AAElD,QAAM,yBAAqB;AAAA,IACzB,OAAO,YAAmC;AACxC,UAAI,mCAAS,SAAS;AACpB,iBAAS,MAAS;AAClB,qBAAa,IAAI;AACjB,aAAK,cAAc,MAAM,WAAW,EAAE,SAAS,CAAC;AAAA,MAClD;AACA,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc,KAAK,EAAE,SAAS,GAAG,EAAE,SAAS,mCAAS,QAAQ,CAAC;AAE1F,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,2CAAU,SAAS;AAAA,MACrB,WAAW,SAAS,MAAM;AACxB,+CAAY,SAAS;AACrB,gBAAQ,SAAS,IAAI;AAAA,MACvB;AACA,mBAAa,KAAK;AAClB,oBAAc,KAAK;AAAA,IACrB;AAAA,IACA,CAAC,MAAM,UAAU,SAAS,SAAS;AAAA,EACrC;AAEA,8BAAU,MAAM;AACd,UAAM,qBAAqB,KAAK,GAAG,8BAA8B,CAAC,EAAE,KAAK,MAAM;AAC7E,UAAI,KAAK,aAAa,UAAU;AAC9B;AAAA,MACF;AACA,oBAAc,IAAI;AAAA,IACpB,CAAC;AAED,UAAM,sBAAsB,KAAK,GAAG,+BAA+B,CAAC,EAAE,MAAM,MAAAA,OAAM,OAAAC,OAAM,MAAM;AAC5F,UAAI,KAAK,aAAa,UAAU;AAC9B;AAAA,MACF;AACA,UAAIA,QAAO;AACT,iBAASA,MAAkB;AAC3B,2CAAUA;AAAA,MACZ,WAAWD,OAAM;AACf,+CAAYA;AACZ,gBAAQA,KAAI;AAAA,MACd;AACA,mBAAa,KAAK;AAClB,oBAAc,KAAK;AAAA,IACrB,CAAC;AAED,UAAM,qBAAqB,KAAK,GAAG,8BAA8B,CAAC,EAAE,MAAAA,MAAK,MAAM;AAC7E,UAAIA,MAAK,aAAa,UAAU;AAC9B;AAAA,MACF;AACA,cAAQA,MAAK,aAAa;AAAA,IAC5B,CAAC;AAED,UAAM,wBAAwB,KAAK,GAAG,gCAAgC,CAAC,EAAE,MAAM,MAAAA,MAAK,MAAM;AACxF,UAAI,KAAK,aAAa,UAAU;AAC9B;AAAA,MACF;AACA,UAAIA,OAAM;AACR,aAAK,mBAAmB,EAAE,SAAS,KAAK,CAAC;AAAA,MAC3C;AAAA,IACF,CAAC;AAED,UAAM,wBAAwB,KAAK,GAAG,gCAAgC,CAAC,EAAE,KAAK,MAAM;AAClF,YAAM,iBAAiB,kBAAkB,OAAO,KAAK,aAAa,WAAW;AAC7E,UAAI,mBAAmB,UAAU;AAC/B;AAAA,MACF;AACA,WAAK,mBAAmB,EAAE,SAAS,KAAK,CAAC;AAAA,IAC3C,CAAC;AAED,SAAK,mBAAmB,EAAE,SAAS,KAAK,CAAC;AAEzC,WAAO,MAAM;AACX,yBAAmB;AACnB,0BAAoB;AACpB,yBAAmB;AACnB,4BAAsB;AACtB,4BAAsB;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,UAAU,MAAM,oBAAoB,SAAS,SAAS,CAAC;AAE3D,QAAM,cAAU,0BAAY,MAAM;AAChC,WAAO,mBAAmB,EAAE,SAAS,KAAK,CAAC;AAAA,EAC7C,GAAG,CAAC,kBAAkB,CAAC;AAEvB,SAAO;AAAA,IACL,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["data","error"]}
@@ -0,0 +1,36 @@
1
+ import { TopicSubscription, NovuError } from '@novu/js';
2
+
3
+ /**
4
+ * Get all subscriptions for a topic.
5
+ * Props for the useSubscriptions hook.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * // Get all subscriptions for a topic
10
+ * const { subscriptions } = useSubscriptions({
11
+ * topicKey: 'my-topic'
12
+ * });
13
+ *
14
+ * // Get subscriptions with callbacks
15
+ * const { subscriptions, refetch } = useSubscriptions({
16
+ * topicKey: 'my-topic',
17
+ * onSuccess: (data) => console.log('Loaded:', data),
18
+ * onError: (error) => console.error('Error:', error)
19
+ * });
20
+ * ```
21
+ */
22
+ type UseSubscriptionsProps = {
23
+ topicKey: string;
24
+ onSuccess?: (data: TopicSubscription[]) => void;
25
+ onError?: (error: NovuError) => void;
26
+ };
27
+ type UseSubscriptionsResult = {
28
+ subscriptions?: TopicSubscription[];
29
+ error?: NovuError;
30
+ isLoading: boolean;
31
+ isFetching: boolean;
32
+ refetch: () => Promise<void>;
33
+ };
34
+ declare const useSubscriptions: ({ topicKey, onSuccess, onError }: UseSubscriptionsProps) => UseSubscriptionsResult;
35
+
36
+ export { type UseSubscriptionsProps, type UseSubscriptionsResult, useSubscriptions };
@@ -0,0 +1,61 @@
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/useUpdateSubscription.ts
21
+ var useUpdateSubscription_exports = {};
22
+ __export(useUpdateSubscription_exports, {
23
+ useUpdateSubscription: () => useUpdateSubscription
24
+ });
25
+ module.exports = __toCommonJS(useUpdateSubscription_exports);
26
+ var import_react = require("react");
27
+ var import_NovuProvider = require("./NovuProvider.cjs");
28
+ var useUpdateSubscription = (props = {}) => {
29
+ const propsRef = (0, import_react.useRef)(props);
30
+ propsRef.current = props;
31
+ const novu = (0, import_NovuProvider.useNovu)();
32
+ const [isUpdating, setIsUpdating] = (0, import_react.useState)(false);
33
+ const [error, setError] = (0, import_react.useState)();
34
+ const update = (0, import_react.useCallback)(
35
+ async (args) => {
36
+ const { onSuccess, onError } = propsRef.current;
37
+ setError(void 0);
38
+ setIsUpdating(true);
39
+ const response = await novu.subscriptions.update(args);
40
+ setIsUpdating(false);
41
+ if (response.error) {
42
+ setError(response.error);
43
+ onError == null ? void 0 : onError(response.error);
44
+ } else if (response.data) {
45
+ onSuccess == null ? void 0 : onSuccess(response.data);
46
+ }
47
+ return response;
48
+ },
49
+ [novu]
50
+ );
51
+ return {
52
+ update,
53
+ isUpdating,
54
+ error
55
+ };
56
+ };
57
+ // Annotate the CommonJS export names for ESM import in node:
58
+ 0 && (module.exports = {
59
+ useUpdateSubscription
60
+ });
61
+ //# sourceMappingURL=useUpdateSubscription.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/hooks/useUpdateSubscription.ts"],"sourcesContent":["import { BaseUpdateSubscriptionArgs, NovuError, TopicSubscription, UpdateSubscriptionArgs } from '@novu/js';\nimport { useCallback, useRef, useState } from 'react';\nimport { useNovu } from './NovuProvider';\n\nexport type UseUpdateSubscriptionProps = {\n onSuccess?: (data: TopicSubscription) => void;\n onError?: (error: NovuError) => void;\n};\n\ntype UpdateResult = Promise<{\n data?: TopicSubscription | undefined;\n error?: NovuError;\n}>;\n\nexport type UseUpdateSubscriptionResult = {\n isUpdating: boolean;\n error?: NovuError;\n update: (args: UpdateSubscriptionArgs) => UpdateResult;\n};\n\nexport const useUpdateSubscription = (props: UseUpdateSubscriptionProps = {}): UseUpdateSubscriptionResult => {\n const propsRef = useRef<UseUpdateSubscriptionProps>(props);\n propsRef.current = props;\n const novu = useNovu();\n const [isUpdating, setIsUpdating] = useState(false);\n const [error, setError] = useState<NovuError>();\n\n const update = useCallback(\n async (args: UpdateSubscriptionArgs): UpdateResult => {\n const { onSuccess, onError } = propsRef.current;\n setError(undefined);\n setIsUpdating(true);\n\n const response = await novu.subscriptions.update(args as BaseUpdateSubscriptionArgs);\n\n setIsUpdating(false);\n\n if (response.error) {\n setError(response.error);\n onError?.(response.error);\n } else if (response.data) {\n onSuccess?.(response.data);\n }\n\n return response;\n },\n [novu]\n );\n\n return {\n update,\n isUpdating,\n error,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA8C;AAC9C,0BAAwB;AAkBjB,IAAM,wBAAwB,CAAC,QAAoC,CAAC,MAAmC;AAC5G,QAAM,eAAW,qBAAmC,KAAK;AACzD,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,SAA+C;AACpD,YAAM,EAAE,WAAW,QAAQ,IAAI,SAAS;AACxC,eAAS,MAAS;AAClB,oBAAc,IAAI;AAElB,YAAM,WAAW,MAAM,KAAK,cAAc,OAAO,IAAkC;AAEnF,oBAAc,KAAK;AAEnB,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,2CAAU,SAAS;AAAA,MACrB,WAAW,SAAS,MAAM;AACxB,+CAAY,SAAS;AAAA,MACvB;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,18 @@
1
+ import { TopicSubscription, NovuError, UpdateSubscriptionArgs } from '@novu/js';
2
+
3
+ type UseUpdateSubscriptionProps = {
4
+ onSuccess?: (data: TopicSubscription) => void;
5
+ onError?: (error: NovuError) => void;
6
+ };
7
+ type UpdateResult = Promise<{
8
+ data?: TopicSubscription | undefined;
9
+ error?: NovuError;
10
+ }>;
11
+ type UseUpdateSubscriptionResult = {
12
+ isUpdating: boolean;
13
+ error?: NovuError;
14
+ update: (args: UpdateSubscriptionArgs) => UpdateResult;
15
+ };
16
+ declare const useUpdateSubscription: (props?: UseUpdateSubscriptionProps) => UseUpdateSubscriptionResult;
17
+
18
+ export { type UseUpdateSubscriptionProps, type UseUpdateSubscriptionResult, useUpdateSubscription };
@@ -28,12 +28,20 @@ __export(src_exports, {
28
28
  PreferenceLevel: () => import_js.PreferenceLevel,
29
29
  Preferences: () => import_components.Preferences,
30
30
  SeverityLevelEnum: () => import_js.SeverityLevelEnum,
31
+ Subscription: () => import_components.Subscription,
32
+ SubscriptionButton: () => import_components.SubscriptionButton,
33
+ SubscriptionPreferences: () => import_components.SubscriptionPreferences,
31
34
  WorkflowCriticalityEnum: () => import_js.WorkflowCriticalityEnum,
32
35
  useCounts: () => import_hooks.useCounts,
36
+ useCreateSubscription: () => import_hooks.useCreateSubscription,
37
+ useDeleteSubscription: () => import_hooks.useDeleteSubscription,
33
38
  useNotifications: () => import_hooks.useNotifications,
34
39
  useNovu: () => import_hooks.useNovu,
35
40
  usePreferences: () => import_hooks.usePreferences,
36
- useSchedule: () => import_hooks.useSchedule
41
+ useSchedule: () => import_hooks.useSchedule,
42
+ useSubscription: () => import_hooks.useSubscription,
43
+ useSubscriptions: () => import_hooks.useSubscriptions,
44
+ useUpdateSubscription: () => import_hooks.useUpdateSubscription
37
45
  });
38
46
  module.exports = __toCommonJS(src_exports);
39
47
  var import_js = require("@novu/js");
@@ -49,11 +57,19 @@ var import_hooks = require("./hooks/index.cjs");
49
57
  PreferenceLevel,
50
58
  Preferences,
51
59
  SeverityLevelEnum,
60
+ Subscription,
61
+ SubscriptionButton,
62
+ SubscriptionPreferences,
52
63
  WorkflowCriticalityEnum,
53
64
  useCounts,
65
+ useCreateSubscription,
66
+ useDeleteSubscription,
54
67
  useNotifications,
55
68
  useNovu,
56
69
  usePreferences,
57
- useSchedule
70
+ useSchedule,
71
+ useSubscription,
72
+ useSubscriptions,
73
+ useUpdateSubscription
58
74
  });
59
75
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type {\n ChannelPreference,\n ChannelType,\n EventHandler,\n Events,\n FiltersCountResponse,\n InboxNotification,\n ListNotificationsResponse,\n Notification,\n NotificationFilter,\n NotificationStatus,\n NovuError,\n NovuOptions,\n Preference,\n PreferencesResponse,\n SocketEventNames,\n UnreadCount,\n WebSocketEvent,\n} from '@novu/js';\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';\n\nexport type {\n Appearance,\n AppearanceCallback,\n AppearanceCallbackFunction,\n AppearanceCallbackKeys,\n AppearanceKey,\n ElementStyles,\n Elements,\n Localization,\n LocalizationKey,\n NotificationActionClickHandler,\n NotificationClickHandler,\n NotificationRenderer,\n PreferenceGroups,\n PreferencesFilter,\n RouterPush,\n Tab,\n Variables,\n} from '@novu/js/ui';\nexport type { BellProps, InboxContentProps, InboxProps, NotificationProps, NovuProviderProps } from './components';\nexport { Bell, Inbox, InboxContent, Notifications, NovuProvider, Preferences } from './components';\nexport type {\n UseCountsProps,\n UseCountsResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesResult,\n UseScheduleProps as UsePreferencesProps,\n} from './hooks';\nexport { useCounts, useNotifications, useNovu, usePreferences, useSchedule } from './hooks';\n\nexport type {\n BaseProps,\n BellRenderer,\n BodyRenderer,\n DefaultInboxProps,\n DefaultProps,\n NoRendererProps,\n NotificationRendererProps,\n NotificationsRenderer,\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;AAmBA,gBAA4E;AAsB5E,wBAAoF;AASpF,mBAAkF;","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 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 useDeleteSubscription,\n useNotifications,\n useNovu,\n usePreferences,\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,15 +1,26 @@
1
- export { ChannelPreference, ChannelType, EventHandler, Events, FiltersCountResponse, InboxNotification, ListNotificationsResponse, Notification, NotificationFilter, NotificationStatus, NovuError, NovuOptions, Preference, PreferenceLevel, PreferencesResponse, SeverityLevelEnum, SocketEventNames, UnreadCount, WebSocketEvent, WorkflowCriticalityEnum } from '@novu/js';
2
- export { Appearance, AppearanceCallback, AppearanceCallbackFunction, AppearanceCallbackKeys, AppearanceKey, ElementStyles, Elements, Localization, LocalizationKey, NotificationActionClickHandler, NotificationClickHandler, NotificationRenderer, PreferenceGroups, PreferencesFilter, RouterPush, Tab, Variables } from '@novu/js/ui';
1
+ export * from '@novu/js';
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
4
  export { NovuProvider, NovuProviderProps, useNovu } from './hooks/NovuProvider.cjs';
4
5
  export { Bell, BellProps } from './components/Bell.cjs';
5
6
  export { Inbox, InboxProps } from './components/Inbox.cjs';
6
7
  export { InboxContent, InboxContentProps } from './components/InboxContent.cjs';
7
8
  export { NotificationProps, Notifications } from './components/Notifications.cjs';
8
9
  export { Preferences } from './components/Preferences.cjs';
10
+ export { Subscription, SubscriptionProps } from './components/subscription/Subscription.cjs';
11
+ export { SubscriptionButton, SubscriptionButtonProps } from './components/subscription/SubscriptionButton.cjs';
12
+ export { SubscriptionPreferences, SubscriptionPreferencesProps } from './components/subscription/SubscriptionPreferences.cjs';
9
13
  export { UseCountsProps, UseCountsResult, useCounts } from './hooks/useCounts.cjs';
14
+ export { useCreateSubscription } from './hooks/useCreateSubscription.cjs';
15
+ export { useDeleteSubscription } from './hooks/useDeleteSubscription.cjs';
10
16
  export { UseNotificationsProps, UseNotificationsResult, useNotifications } from './hooks/useNotifications.cjs';
11
17
  export { UsePreferencesResult, usePreferences } from './hooks/usePreferences.cjs';
12
18
  export { UseScheduleProps as UsePreferencesProps, useSchedule } from './hooks/useSchedule.cjs';
13
- export { BaseProps, BellRenderer, BodyRenderer, DefaultInboxProps, DefaultProps, NoRendererProps, NotificationRendererProps, NotificationsRenderer, SubjectBodyRendererProps, SubjectRenderer, WithChildrenProps } from './utils/types.cjs';
19
+ export { useSubscription } from './hooks/useSubscription.cjs';
20
+ export { useSubscriptions } from './hooks/useSubscriptions.cjs';
21
+ 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';
14
23
  import 'react/jsx-runtime';
15
24
  import 'react';
25
+ import './components/NovuUI.cjs';
26
+ import './components/subscription/DefaultSubscription.cjs';
@@ -28,12 +28,20 @@ __export(server_exports, {
28
28
  PreferenceLevel: () => import_js.PreferenceLevel,
29
29
  Preferences: () => Preferences,
30
30
  SeverityLevelEnum: () => import_js.SeverityLevelEnum,
31
+ Subscription: () => Subscription,
32
+ SubscriptionButton: () => SubscriptionButton,
33
+ SubscriptionPreferences: () => SubscriptionPreferences,
31
34
  WorkflowCriticalityEnum: () => import_js.WorkflowCriticalityEnum,
32
35
  useCounts: () => useCounts,
36
+ useCreateSubscription: () => useCreateSubscription,
37
+ useDeleteSubscription: () => useDeleteSubscription,
33
38
  useNotifications: () => useNotifications,
34
39
  useNovu: () => useNovu,
35
40
  usePreferences: () => usePreferences,
36
- useSchedule: () => useSchedule
41
+ useSchedule: () => useSchedule,
42
+ useSubscription: () => useSubscription,
43
+ useSubscriptions: () => useSubscriptions,
44
+ useUpdateSubscription: () => useUpdateSubscription
37
45
  });
38
46
  module.exports = __toCommonJS(server_exports);
39
47
  var import_ShadowRootDetector = require("../components/ShadowRootDetector.cjs");
@@ -51,6 +59,14 @@ function Preferences() {
51
59
  function Bell() {
52
60
  }
53
61
  function NovuProvider(props) {
62
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children });
63
+ }
64
+ function Subscription() {
65
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ShadowRootDetector.ShadowRootDetector, {});
66
+ }
67
+ function SubscriptionButton() {
68
+ }
69
+ function SubscriptionPreferences() {
54
70
  }
55
71
  function useNovu() {
56
72
  return null;
@@ -89,6 +105,41 @@ function useSchedule(_) {
89
105
  refetch: () => Promise.resolve()
90
106
  };
91
107
  }
108
+ function useSubscription(_) {
109
+ return {
110
+ isLoading: false,
111
+ isFetching: false,
112
+ refetch: () => Promise.resolve()
113
+ };
114
+ }
115
+ function useCreateSubscription(_ = {}) {
116
+ return {
117
+ isCreating: false,
118
+ error: void 0,
119
+ create: () => Promise.resolve({ data: void 0, error: void 0 })
120
+ };
121
+ }
122
+ function useUpdateSubscription(_ = {}) {
123
+ return {
124
+ isUpdating: false,
125
+ error: void 0,
126
+ update: () => Promise.resolve({ data: void 0, error: void 0 })
127
+ };
128
+ }
129
+ function useDeleteSubscription(_ = {}) {
130
+ return {
131
+ isDeleting: false,
132
+ error: void 0,
133
+ delete: () => Promise.resolve({ data: void 0, error: void 0 })
134
+ };
135
+ }
136
+ function useSubscriptions(_) {
137
+ return {
138
+ isLoading: false,
139
+ isFetching: false,
140
+ refetch: () => Promise.resolve()
141
+ };
142
+ }
92
143
  // Annotate the CommonJS export names for ESM import in node:
93
144
  0 && (module.exports = {
94
145
  Bell,
@@ -99,11 +150,19 @@ function useSchedule(_) {
99
150
  PreferenceLevel,
100
151
  Preferences,
101
152
  SeverityLevelEnum,
153
+ Subscription,
154
+ SubscriptionButton,
155
+ SubscriptionPreferences,
102
156
  WorkflowCriticalityEnum,
103
157
  useCounts,
158
+ useCreateSubscription,
159
+ useDeleteSubscription,
104
160
  useNotifications,
105
161
  useNovu,
106
162
  usePreferences,
107
- useSchedule
163
+ useSchedule,
164
+ useSubscription,
165
+ useSubscriptions,
166
+ useUpdateSubscription
108
167
  });
109
168
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/server/index.tsx"],"sourcesContent":["import type { InboxProps } from '../components/Inbox';\nimport { ShadowRootDetector } from '../components/ShadowRootDetector';\nimport type {\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesProps,\n UsePreferencesResult,\n UseScheduleProps,\n UseScheduleResult,\n} from '../hooks';\nimport type { NovuProviderProps } from '../hooks/NovuProvider';\nimport type { UseCountsProps, UseCountsResult } from '../hooks/useCounts';\n\n/**\n * Exporting all components from the components folder\n * as empty functions to fix build errors in SSR\n * This will be replaced with actual components\n * when we implement the SSR components in @novu/js/ui\n */\nexport function Inbox(props: InboxProps) {\n return <ShadowRootDetector />;\n}\n\nexport function InboxContent() {}\n\nexport function Notifications() {}\n\nexport function Preferences() {}\n\nexport function Bell() {}\n\nexport function NovuProvider(props: NovuProviderProps) {}\n\nexport function useNovu() {\n return null;\n}\n\nexport function useCounts(_: UseCountsProps): UseCountsResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useNotifications(_: UseNotificationsProps): UseNotificationsResult {\n return {\n isLoading: false,\n isFetching: false,\n hasMore: false,\n readAll: () => Promise.resolve({ data: undefined, error: undefined }),\n seenAll: () => Promise.resolve({ data: undefined, error: undefined }),\n archiveAll: () => Promise.resolve({ data: undefined, error: undefined }),\n archiveAllRead: () => Promise.resolve({ data: undefined, error: undefined }),\n refetch: () => Promise.resolve(),\n fetchMore: () => Promise.resolve(),\n };\n}\n\nexport function usePreferences(_: UsePreferencesProps): UsePreferencesResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useSchedule(_: UseScheduleProps): UseScheduleResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport type {\n ChannelPreference,\n ChannelType,\n FiltersCountResponse,\n InboxNotification,\n ListNotificationsResponse,\n Notification,\n NotificationFilter,\n NotificationStatus,\n NovuError,\n NovuOptions,\n Preference,\n} from '@novu/js';\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';\n\nexport type {\n Appearance,\n AppearanceKey,\n ElementStyles,\n Elements,\n Localization,\n LocalizationKey,\n NotificationActionClickHandler,\n NotificationClickHandler,\n NotificationRenderer,\n PreferenceGroups,\n PreferencesFilter,\n RouterPush,\n Tab,\n Variables,\n} from '@novu/js/ui';\n\nexport type { BellProps, InboxContentProps, InboxProps, NotificationProps, NovuProviderProps } from '../components';\n\nexport type {\n UseCountsProps,\n UseCountsResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesResult,\n UseScheduleProps as UsePreferencesProps,\n} from '../hooks';\n\nexport type {\n BaseProps,\n BellRenderer,\n BodyRenderer,\n DefaultInboxProps,\n DefaultProps,\n NoRendererProps,\n NotificationRendererProps,\n NotificationsRenderer,\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;AACA,gCAAmC;AAuFnC,gBAA4E;AApEnE;AADF,SAAS,MAAM,OAAmB;AACvC,SAAO,4CAAC,gDAAmB;AAC7B;AAEO,SAAS,eAAe;AAAC;AAEzB,SAAS,gBAAgB;AAAC;AAE1B,SAAS,cAAc;AAAC;AAExB,SAAS,OAAO;AAAC;AAEjB,SAAS,aAAa,OAA0B;AAAC;AAEjD,SAAS,UAAU;AACxB,SAAO;AACT;AAEO,SAAS,UAAU,GAAoC;AAC5D,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;AAEO,SAAS,iBAAiB,GAAkD;AACjF,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,SAAS,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,IACpE,SAAS,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,IACpE,YAAY,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,IACvE,gBAAgB,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,IAC3E,SAAS,MAAM,QAAQ,QAAQ;AAAA,IAC/B,WAAW,MAAM,QAAQ,QAAQ;AAAA,EACnC;AACF;AAEO,SAAS,eAAe,GAA8C;AAC3E,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;AAEO,SAAS,YAAY,GAAwC;AAClE,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/server/index.tsx"],"sourcesContent":["import type { InboxProps } from '../components/Inbox';\nimport { ShadowRootDetector } from '../components/ShadowRootDetector';\nimport type {\n UseCreateSubscriptionProps,\n UseCreateSubscriptionResult,\n UseDeleteSubscriptionProps,\n UseDeleteSubscriptionResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesProps,\n UsePreferencesResult,\n UseScheduleProps,\n UseScheduleResult,\n UseSubscriptionProps,\n UseSubscriptionResult,\n UseSubscriptionsProps,\n UseSubscriptionsResult,\n UseUpdateSubscriptionProps,\n UseUpdateSubscriptionResult,\n} from '../hooks';\nimport type { NovuProviderProps } from '../hooks/NovuProvider';\nimport type { UseCountsProps, UseCountsResult } from '../hooks/useCounts';\n\n/**\n * Exporting all components from the components folder\n * as empty functions to fix build errors in SSR\n * This will be replaced with actual components\n * when we implement the SSR components in @novu/js/ui\n */\nexport function Inbox(props: InboxProps) {\n return <ShadowRootDetector />;\n}\n\nexport function InboxContent() {}\n\nexport function Notifications() {}\n\nexport function Preferences() {}\n\nexport function Bell() {}\n\nexport function NovuProvider(props: NovuProviderProps) {\n return <>{props.children}</>;\n}\n\nexport function Subscription() {\n return <ShadowRootDetector />;\n}\n\nexport function SubscriptionButton() {}\n\nexport function SubscriptionPreferences() {}\n\nexport function useNovu() {\n return null;\n}\n\nexport function useCounts(_: UseCountsProps): UseCountsResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useNotifications(_: UseNotificationsProps): UseNotificationsResult {\n return {\n isLoading: false,\n isFetching: false,\n hasMore: false,\n readAll: () => Promise.resolve({ data: undefined, error: undefined }),\n seenAll: () => Promise.resolve({ data: undefined, error: undefined }),\n archiveAll: () => Promise.resolve({ data: undefined, error: undefined }),\n archiveAllRead: () => Promise.resolve({ data: undefined, error: undefined }),\n refetch: () => Promise.resolve(),\n fetchMore: () => Promise.resolve(),\n };\n}\n\nexport function usePreferences(_: UsePreferencesProps): UsePreferencesResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useSchedule(_: UseScheduleProps): UseScheduleResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useSubscription(_: UseSubscriptionProps): UseSubscriptionResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useCreateSubscription(_: UseCreateSubscriptionProps = {}): UseCreateSubscriptionResult {\n return {\n isCreating: false,\n error: undefined,\n create: () => Promise.resolve({ data: undefined, error: undefined }),\n };\n}\n\nexport function useUpdateSubscription(_: UseUpdateSubscriptionProps = {}): UseUpdateSubscriptionResult {\n return {\n isUpdating: false,\n error: undefined,\n update: () => Promise.resolve({ data: undefined, error: undefined }),\n };\n}\n\nexport function useDeleteSubscription(_: UseDeleteSubscriptionProps = {}): UseDeleteSubscriptionResult {\n return {\n isDeleting: false,\n error: undefined,\n delete: () => Promise.resolve({ data: undefined, error: undefined }),\n };\n}\n\nexport function useSubscriptions(_: UseSubscriptionsProps): UseSubscriptionsResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport 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';\n\nexport type { BellProps, InboxContentProps, InboxProps, NotificationProps, NovuProviderProps } from '../components';\n\nexport type {\n UseCountsProps,\n UseCountsResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesResult,\n UseScheduleProps as UsePreferencesProps,\n} from '../hooks';\n\nexport type {\n BaseProps,\n BellRenderer,\n BodyRenderer,\n DefaultInboxProps,\n DefaultProps,\n NoRendererProps,\n NotificationRendererProps,\n NotificationsRenderer,\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,gCAAmC;AAuInC,gBAA4E;AA1GnE;AADF,SAAS,MAAM,OAAmB;AACvC,SAAO,4CAAC,gDAAmB;AAC7B;AAEO,SAAS,eAAe;AAAC;AAEzB,SAAS,gBAAgB;AAAC;AAE1B,SAAS,cAAc;AAAC;AAExB,SAAS,OAAO;AAAC;AAEjB,SAAS,aAAa,OAA0B;AACrD,SAAO,2EAAG,gBAAM,UAAS;AAC3B;AAEO,SAAS,eAAe;AAC7B,SAAO,4CAAC,gDAAmB;AAC7B;AAEO,SAAS,qBAAqB;AAAC;AAE/B,SAAS,0BAA0B;AAAC;AAEpC,SAAS,UAAU;AACxB,SAAO;AACT;AAEO,SAAS,UAAU,GAAoC;AAC5D,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;AAEO,SAAS,iBAAiB,GAAkD;AACjF,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,SAAS,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,IACpE,SAAS,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,IACpE,YAAY,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,IACvE,gBAAgB,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,IAC3E,SAAS,MAAM,QAAQ,QAAQ;AAAA,IAC/B,WAAW,MAAM,QAAQ,QAAQ;AAAA,EACnC;AACF;AAEO,SAAS,eAAe,GAA8C;AAC3E,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;AAEO,SAAS,YAAY,GAAwC;AAClE,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;AAEO,SAAS,gBAAgB,GAAgD;AAC9E,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;AAEO,SAAS,sBAAsB,IAAgC,CAAC,GAAgC;AACrG,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,QAAQ,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,sBAAsB,IAAgC,CAAC,GAAgC;AACrG,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,QAAQ,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,sBAAsB,IAAgC,CAAC,GAAgC;AACrG,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,QAAQ,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,iBAAiB,GAAkD;AACjF,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;","names":[]}
@@ -1,12 +1,18 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { InboxProps } from '../components/Inbox.cjs';
3
- export { ChannelPreference, ChannelType, FiltersCountResponse, InboxNotification, ListNotificationsResponse, Notification, NotificationFilter, NotificationStatus, NovuError, NovuOptions, Preference, PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';
3
+ export * from '@novu/js';
4
+ export { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';
4
5
  import { NovuProviderProps } from '../hooks/NovuProvider.cjs';
5
6
  import { UseCountsProps, UseCountsResult } from '../hooks/useCounts.cjs';
7
+ import { UseCreateSubscriptionProps, UseCreateSubscriptionResult } from '../hooks/useCreateSubscription.cjs';
8
+ import { UseDeleteSubscriptionProps, UseDeleteSubscriptionResult } from '../hooks/useDeleteSubscription.cjs';
6
9
  import { UseNotificationsProps, UseNotificationsResult } from '../hooks/useNotifications.cjs';
7
10
  import { UsePreferencesProps, UsePreferencesResult } from '../hooks/usePreferences.cjs';
8
11
  import { UseScheduleProps, UseScheduleResult } from '../hooks/useSchedule.cjs';
9
- export { Appearance, AppearanceKey, ElementStyles, Elements, Localization, LocalizationKey, NotificationActionClickHandler, NotificationClickHandler, NotificationRenderer, PreferenceGroups, PreferencesFilter, RouterPush, Tab, Variables } from '@novu/js/ui';
12
+ import { UseSubscriptionProps, UseSubscriptionResult } from '../hooks/useSubscription.cjs';
13
+ import { UseSubscriptionsProps, UseSubscriptionsResult } from '../hooks/useSubscriptions.cjs';
14
+ import { UseUpdateSubscriptionProps, UseUpdateSubscriptionResult } from '../hooks/useUpdateSubscription.cjs';
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';
10
16
  export { BellProps } from '../components/Bell.cjs';
11
17
  export { InboxContentProps } from '../components/InboxContent.cjs';
12
18
  export { NotificationProps } from '../components/Notifications.cjs';
@@ -24,11 +30,19 @@ declare function InboxContent(): void;
24
30
  declare function Notifications(): void;
25
31
  declare function Preferences(): void;
26
32
  declare function Bell(): void;
27
- declare function NovuProvider(props: NovuProviderProps): void;
33
+ declare function NovuProvider(props: NovuProviderProps): react_jsx_runtime.JSX.Element;
34
+ declare function Subscription(): react_jsx_runtime.JSX.Element;
35
+ declare function SubscriptionButton(): void;
36
+ declare function SubscriptionPreferences(): void;
28
37
  declare function useNovu(): null;
29
38
  declare function useCounts(_: UseCountsProps): UseCountsResult;
30
39
  declare function useNotifications(_: UseNotificationsProps): UseNotificationsResult;
31
40
  declare function usePreferences(_: UsePreferencesProps): UsePreferencesResult;
32
41
  declare function useSchedule(_: UseScheduleProps): UseScheduleResult;
42
+ declare function useSubscription(_: UseSubscriptionProps): UseSubscriptionResult;
43
+ declare function useCreateSubscription(_?: UseCreateSubscriptionProps): UseCreateSubscriptionResult;
44
+ declare function useUpdateSubscription(_?: UseUpdateSubscriptionProps): UseUpdateSubscriptionResult;
45
+ declare function useDeleteSubscription(_?: UseDeleteSubscriptionProps): UseDeleteSubscriptionResult;
46
+ declare function useSubscriptions(_: UseSubscriptionsProps): UseSubscriptionsResult;
33
47
 
34
- export { Bell, Inbox, InboxContent, InboxProps, Notifications, NovuProvider, NovuProviderProps, Preferences, UseCountsProps, UseCountsResult, UseNotificationsProps, UseNotificationsResult, UseScheduleProps as UsePreferencesProps, UsePreferencesResult, useCounts, useNotifications, useNovu, usePreferences, useSchedule };
48
+ export { Bell, Inbox, InboxContent, InboxProps, Notifications, NovuProvider, NovuProviderProps, Preferences, Subscription, SubscriptionButton, SubscriptionPreferences, UseCountsProps, UseCountsResult, UseNotificationsProps, UseNotificationsResult, UseScheduleProps as UsePreferencesProps, UsePreferencesResult, useCounts, useCreateSubscription, useDeleteSubscription, useNotifications, useNovu, usePreferences, useSchedule, useSubscription, useSubscriptions, useUpdateSubscription };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/appearance.ts"],"sourcesContent":["import type { IconKey, Appearance as JsAppearance, IconOverrides as JsIconOverrides } from '@novu/js/ui';\nimport { MountedElement } from '../context/RendererContext';\nimport type { ReactAppearance } from './types';\n\nexport function adaptAppearanceForJs(\n appearance: ReactAppearance,\n mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void\n): JsAppearance | undefined {\n if (!appearance) {\n return undefined;\n }\n const { icons, ...restAppearance } = appearance;\n const jsAppearance: JsAppearance = { ...restAppearance };\n\n if (icons) {\n const jsIcons: JsIconOverrides = {};\n const iconKeys = Object.keys(icons) as IconKey[];\n\n for (const iconKey of iconKeys) {\n const reactRenderer = icons[iconKey];\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,cAC0B;AAC1B,MAAI,CAAC,YAAY;AACf,WAAO;AAAA,EACT;AACA,QAAM,EAAE,OAAO,GAAG,eAAe,IAAI;AACrC,QAAM,eAA6B,EAAE,GAAG,eAAe;AAEvD,MAAI,OAAO;AACT,UAAM,UAA2B,CAAC;AAClC,UAAM,WAAW,OAAO,KAAK,KAAK;AAElC,eAAW,WAAW,UAAU;AAC9B,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 { 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,10 +1,10 @@
1
- import { Appearance } from '@novu/js/ui';
1
+ import { AllAppearance } from '@novu/js/ui';
2
2
  import { MountedElement } from '../context/RendererContext.cjs';
3
- import { ReactAppearance } from './types.cjs';
3
+ import { ReactInboxAppearance, ReactSubscriptionAppearance } 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: ReactAppearance, mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void): Appearance | undefined;
8
+ declare function adaptAppearanceForJs(appearance: ReactInboxAppearance | ReactSubscriptionAppearance, mountElement: (el: HTMLElement, mountedElement: MountedElement) => () => void): AllAppearance | undefined;
9
9
 
10
10
  export { adaptAppearanceForJs };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/types.ts"],"sourcesContent":["import type { Context, DefaultSchedule, Subscriber, UnreadCount } from '@novu/js';\nimport type {\n IconKey,\n InboxProps,\n Theme as JsTheme,\n Localization,\n Notification,\n NotificationActionClickHandler,\n NotificationClickHandler,\n PreferenceGroups,\n PreferencesFilter,\n PreferencesSort,\n RouterPush,\n Tab,\n} from '@novu/js/ui';\nimport type { ReactNode } from 'react';\n\nexport type NotificationsRenderer = (notification: Notification) => React.ReactNode;\nexport type AvatarRenderer = (notification: Notification) => React.ReactNode;\nexport type SubjectRenderer = (notification: Notification) => React.ReactNode;\nexport type BodyRenderer = (notification: Notification) => React.ReactNode;\nexport type DefaultActionsRenderer = (notification: Notification) => React.ReactNode;\nexport type CustomActionsRenderer = (notification: Notification) => React.ReactNode;\nexport type BellRenderer = (unreadCount: UnreadCount) => React.ReactNode;\n\nexport type ReactIconRendererProps = { class?: string };\nexport type ReactIconRenderer = (props: ReactIconRendererProps) => ReactNode;\n\nexport type ReactIconOverrides = {\n [key in IconKey]?: ReactIconRenderer;\n};\n\nexport type ReactTheme = Omit<JsTheme, 'icons'> & {\n icons?: ReactIconOverrides;\n};\n\nexport type ReactAppearance = ReactTheme & {\n baseTheme?: JsTheme | JsTheme[];\n};\n\nexport type DefaultInboxProps = {\n open?: boolean;\n renderNotification?: NotificationsRenderer;\n renderAvatar?: AvatarRenderer;\n renderSubject?: SubjectRenderer;\n renderBody?: BodyRenderer;\n renderDefaultActions?: DefaultActionsRenderer;\n renderCustomActions?: CustomActionsRenderer;\n renderBell?: BellRenderer;\n onNotificationClick?: NotificationClickHandler;\n onPrimaryActionClick?: NotificationActionClickHandler;\n onSecondaryActionClick?: NotificationActionClickHandler;\n placement?: InboxProps['placement'];\n placementOffset?: InboxProps['placementOffset'];\n};\n\ntype StandardBaseProps = {\n subscriberHash?: string;\n contextHash?: string;\n backendUrl?: string;\n socketUrl?: string;\n appearance?: ReactAppearance;\n localization?: Localization;\n tabs?: Array<Tab>;\n preferencesFilter?: PreferencesFilter;\n preferenceGroups?: PreferenceGroups;\n preferencesSort?: PreferencesSort;\n defaultSchedule?: DefaultSchedule;\n routerPush?: RouterPush;\n context?: Context;\n} & (\n | {\n // TODO: Backward compatibility support - remove in future versions (see NV-5801)\n /** @deprecated Use subscriber prop instead */\n subscriberId: string;\n subscriber?: never;\n applicationIdentifier: string;\n }\n | {\n subscriber: Subscriber | string;\n subscriberId?: never;\n applicationIdentifier: string;\n }\n | {\n // Keyless mode - no subscriber or subscriberId or applicationIdentifier\n subscriber?: never;\n subscriberId?: never;\n applicationIdentifier?: never;\n }\n);\n\nexport type BaseProps = StandardBaseProps;\n\nexport type NotificationRendererProps = {\n renderNotification: NotificationsRenderer;\n renderAvatar?: never;\n renderSubject?: never;\n renderBody?: never;\n renderDefaultActions?: never;\n renderCustomActions?: never;\n};\n\nexport type SubjectBodyRendererProps = {\n renderNotification?: never;\n renderAvatar?: AvatarRenderer;\n renderSubject?: SubjectRenderer;\n renderBody?: BodyRenderer;\n renderDefaultActions?: DefaultActionsRenderer;\n renderCustomActions?: CustomActionsRenderer;\n};\n\nexport type NoRendererProps = {\n renderNotification?: undefined;\n renderAvatar?: undefined;\n renderSubject?: undefined;\n renderBody?: undefined;\n renderDefaultActions?: undefined;\n renderCustomActions?: undefined;\n};\n\nexport type DefaultProps = BaseProps &\n DefaultInboxProps & {\n children?: never;\n } & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);\n\nexport type WithChildrenProps = BaseProps & {\n children: React.ReactNode;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../../src/utils/types.ts"],"sourcesContent":["import type { Context, DefaultSchedule, Subscriber, UnreadCount } from '@novu/js';\nimport type {\n AllIconKey,\n AllTheme,\n InboxIconKey,\n InboxLocalization,\n InboxProps,\n InboxTheme,\n Notification,\n NotificationActionClickHandler,\n NotificationClickHandler,\n PreferenceGroups,\n PreferencesFilter,\n PreferencesSort,\n RouterPush,\n SubscriptionIconKey,\n SubscriptionTheme,\n Tab,\n} from '@novu/js/ui';\nimport type { ReactNode } from 'react';\n\nexport type NotificationsRenderer = (notification: Notification) => React.ReactNode;\nexport type AvatarRenderer = (notification: Notification) => React.ReactNode;\nexport type SubjectRenderer = (notification: Notification) => React.ReactNode;\nexport type BodyRenderer = (notification: Notification) => React.ReactNode;\nexport type DefaultActionsRenderer = (notification: Notification) => React.ReactNode;\nexport type CustomActionsRenderer = (notification: Notification) => React.ReactNode;\nexport type BellRenderer = (unreadCount: UnreadCount) => React.ReactNode;\n\nexport type ReactIconRendererProps = { class?: string };\nexport type ReactIconRenderer = (props: ReactIconRendererProps) => ReactNode;\n\nexport type ReactInboxIconOverrides = {\n [key in InboxIconKey]?: ReactIconRenderer;\n};\n\nexport type ReactInboxTheme = Omit<InboxTheme, 'icons'> & {\n icons?: ReactInboxIconOverrides;\n};\n\nexport type ReactSubscriptionIconOverrides = {\n [key in SubscriptionIconKey]?: ReactIconRenderer;\n};\n\nexport type ReactSubscriptionTheme = Omit<SubscriptionTheme, 'icons'> & {\n icons?: ReactSubscriptionIconOverrides;\n};\n\nexport type ReactAllIconOverrides = {\n [key in AllIconKey]?: ReactIconRenderer;\n};\n\nexport type ReactAllTheme = Omit<AllTheme, 'icons'> & {\n icons?: ReactAllIconOverrides;\n};\n\nexport type ReactInboxAppearance = ReactInboxTheme & {\n baseTheme?: InboxTheme | InboxTheme[];\n};\n\nexport type ReactSubscriptionAppearance = ReactSubscriptionTheme & {\n baseTheme?: SubscriptionTheme | SubscriptionTheme[];\n};\n\nexport type ReactAllAppearance = ReactAllTheme & {\n baseTheme?: ReactAllTheme | ReactAllTheme[];\n};\n\nexport type DefaultInboxProps = {\n open?: boolean;\n renderNotification?: NotificationsRenderer;\n renderAvatar?: AvatarRenderer;\n renderSubject?: SubjectRenderer;\n renderBody?: BodyRenderer;\n renderDefaultActions?: DefaultActionsRenderer;\n renderCustomActions?: CustomActionsRenderer;\n renderBell?: BellRenderer;\n onNotificationClick?: NotificationClickHandler;\n onPrimaryActionClick?: NotificationActionClickHandler;\n onSecondaryActionClick?: NotificationActionClickHandler;\n placement?: InboxProps['placement'];\n placementOffset?: InboxProps['placementOffset'];\n};\n\ntype StandardBaseProps = {\n subscriberHash?: string;\n contextHash?: string;\n backendUrl?: string;\n socketUrl?: string;\n appearance?: ReactInboxAppearance;\n localization?: InboxLocalization;\n tabs?: Array<Tab>;\n preferencesFilter?: PreferencesFilter;\n preferenceGroups?: PreferenceGroups;\n preferencesSort?: PreferencesSort;\n defaultSchedule?: DefaultSchedule;\n routerPush?: RouterPush;\n context?: Context;\n} & (\n | {\n // TODO: Backward compatibility support - remove in future versions (see NV-5801)\n /** @deprecated Use subscriber prop instead */\n subscriberId: string;\n subscriber?: never;\n applicationIdentifier: string;\n }\n | {\n subscriber: Subscriber | string;\n subscriberId?: never;\n applicationIdentifier: string;\n }\n | {\n // Keyless mode - no subscriber or subscriberId or applicationIdentifier\n subscriber?: never;\n subscriberId?: never;\n applicationIdentifier?: never;\n }\n);\n\ntype InboxBaseProps = Omit<StandardBaseProps, 'appearance'> & {\n appearance?: ReactInboxAppearance;\n};\n\nexport type BaseProps = InboxBaseProps;\n\nexport type NotificationRendererProps = {\n renderNotification: NotificationsRenderer;\n renderAvatar?: never;\n renderSubject?: never;\n renderBody?: never;\n renderDefaultActions?: never;\n renderCustomActions?: never;\n};\n\nexport type SubjectBodyRendererProps = {\n renderNotification?: never;\n renderAvatar?: AvatarRenderer;\n renderSubject?: SubjectRenderer;\n renderBody?: BodyRenderer;\n renderDefaultActions?: DefaultActionsRenderer;\n renderCustomActions?: CustomActionsRenderer;\n};\n\nexport type NoRendererProps = {\n renderNotification?: undefined;\n renderAvatar?: undefined;\n renderSubject?: undefined;\n renderBody?: undefined;\n renderDefaultActions?: undefined;\n renderCustomActions?: undefined;\n};\n\nexport type DefaultProps = BaseProps &\n DefaultInboxProps & {\n children?: never;\n } & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);\n\nexport type WithChildrenProps = BaseProps & {\n children: React.ReactNode;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}