@novu/react 2.6.5 → 3.0.0-canary.0
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.
- package/dist/cjs/components/Bell.cjs +63 -0
- package/dist/cjs/components/Bell.cjs.map +1 -0
- package/dist/cjs/components/Bell.d.cts +12 -0
- package/dist/cjs/components/Inbox.cjs +198 -0
- package/dist/cjs/components/Inbox.cjs.map +1 -0
- package/dist/cjs/components/Inbox.d.cts +9 -0
- package/dist/cjs/components/InboxContent.cjs +94 -0
- package/dist/cjs/components/InboxContent.cjs.map +1 -0
- package/dist/cjs/components/InboxContent.d.cts +16 -0
- package/dist/cjs/components/Mounter.cjs +51 -0
- package/dist/cjs/components/Mounter.cjs.map +1 -0
- package/dist/cjs/components/Mounter.d.cts +11 -0
- package/dist/cjs/components/Notifications.cjs +88 -0
- package/dist/cjs/components/Notifications.cjs.map +1 -0
- package/dist/cjs/components/Notifications.d.cts +14 -0
- package/dist/cjs/components/NovuUI.cjs +60 -0
- package/dist/cjs/components/NovuUI.cjs.map +1 -0
- package/dist/cjs/components/NovuUI.d.cts +12 -0
- package/dist/cjs/components/Preferences.cjs +54 -0
- package/dist/cjs/components/Preferences.cjs.map +1 -0
- package/dist/cjs/components/Preferences.d.cts +5 -0
- package/dist/cjs/components/Renderer.cjs +70 -0
- package/dist/cjs/components/Renderer.cjs.map +1 -0
- package/dist/cjs/components/Renderer.d.cts +8 -0
- package/dist/cjs/components/index.cjs +35 -0
- package/dist/cjs/components/index.cjs.map +1 -0
- package/dist/cjs/components/index.d.cts +11 -0
- package/dist/cjs/context/NovuUIContext.cjs +40 -0
- package/dist/cjs/context/NovuUIContext.cjs.map +1 -0
- package/dist/cjs/context/NovuUIContext.d.cts +14 -0
- package/dist/cjs/context/RendererContext.cjs +40 -0
- package/dist/cjs/context/RendererContext.cjs.map +1 -0
- package/dist/cjs/context/RendererContext.d.cts +15 -0
- package/dist/cjs/hooks/NovuProvider.cjs +101 -0
- package/dist/cjs/hooks/NovuProvider.cjs.map +1 -0
- package/dist/cjs/hooks/NovuProvider.d.cts +20 -0
- package/dist/cjs/hooks/index.cjs +40 -0
- package/dist/cjs/hooks/index.cjs.map +1 -0
- package/dist/cjs/hooks/index.d.cts +7 -0
- package/dist/cjs/hooks/internal/useBrowserTabsChannel.cjs +52 -0
- package/dist/cjs/hooks/internal/useBrowserTabsChannel.cjs.map +1 -0
- package/dist/cjs/hooks/internal/useBrowserTabsChannel.d.cts +8 -0
- package/dist/cjs/hooks/internal/useDataRef.cjs +36 -0
- package/dist/cjs/hooks/internal/useDataRef.cjs.map +1 -0
- package/dist/cjs/hooks/internal/useDataRef.d.cts +5 -0
- package/dist/cjs/hooks/internal/useWebsocketEvent.cjs +57 -0
- package/dist/cjs/hooks/internal/useWebsocketEvent.cjs.map +1 -0
- package/dist/cjs/hooks/internal/useWebsocketEvent.d.cts +8 -0
- package/dist/cjs/hooks/useCounts.cjs +104 -0
- package/dist/cjs/hooks/useCounts.cjs.map +1 -0
- package/dist/cjs/hooks/useCounts.d.cts +21 -0
- package/dist/cjs/hooks/useNotifications.cjs +121 -0
- package/dist/cjs/hooks/useNotifications.cjs.map +1 -0
- package/dist/cjs/hooks/useNotifications.d.cts +34 -0
- package/dist/cjs/hooks/usePreferences.cjs +80 -0
- package/dist/cjs/hooks/usePreferences.cjs.map +1 -0
- package/dist/cjs/hooks/usePreferences.d.cts +19 -0
- package/dist/cjs/index.cjs +27 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.cts +14 -0
- package/dist/cjs/server/index.cjs +92 -0
- package/dist/cjs/server/index.cjs.map +1 -0
- package/dist/cjs/server/index.d.cts +29 -0
- package/dist/cjs/themes/index.cjs +25 -0
- package/dist/cjs/themes/index.cjs.map +1 -0
- package/dist/cjs/utils/createContextAndHook.cjs +63 -0
- package/dist/cjs/utils/createContextAndHook.cjs.map +1 -0
- package/dist/cjs/utils/createContextAndHook.d.cts +19 -0
- package/dist/cjs/utils/requestLock.cjs +52 -0
- package/dist/cjs/utils/requestLock.cjs.map +1 -0
- package/dist/cjs/utils/requestLock.d.cts +3 -0
- package/dist/cjs/utils/types.cjs +19 -0
- package/dist/cjs/utils/types.cjs.map +1 -0
- package/dist/cjs/utils/types.d.cts +54 -0
- package/dist/client/{index.d.mts → components/index.d.mts} +23 -6
- package/dist/client/{index.d.ts → components/index.d.ts} +23 -6
- package/dist/client/{index.js → components/index.js} +93 -9
- package/dist/client/components/index.js.map +1 -0
- package/dist/client/{index.mjs → components/index.mjs} +78 -9
- package/dist/client/components/index.mjs.map +1 -0
- package/dist/{hooks → client/hooks}/index.js +9 -1
- package/dist/client/hooks/index.js.map +1 -0
- package/dist/{hooks → client/hooks}/index.mjs +1 -1
- package/dist/client/hooks/index.mjs.map +1 -0
- package/dist/client/themes/index.d.ts +1 -0
- package/dist/{themes → client/themes}/index.js +4 -0
- package/dist/client/themes/index.js.map +1 -0
- package/dist/client/themes/index.mjs.map +1 -0
- package/dist/esm/components/Bell.d.ts +12 -0
- package/dist/esm/components/Bell.js +28 -0
- package/dist/esm/components/Bell.js.map +1 -0
- package/dist/esm/components/Inbox.d.ts +9 -0
- package/dist/esm/components/Inbox.js +163 -0
- package/dist/esm/components/Inbox.js.map +1 -0
- package/dist/esm/components/InboxContent.d.ts +16 -0
- package/dist/esm/components/InboxContent.js +59 -0
- package/dist/esm/components/InboxContent.js.map +1 -0
- package/dist/esm/components/Mounter.d.ts +11 -0
- package/dist/esm/components/Mounter.js +26 -0
- package/dist/esm/components/Mounter.js.map +1 -0
- package/dist/esm/components/Notifications.d.ts +14 -0
- package/dist/esm/components/Notifications.js +53 -0
- package/dist/esm/components/Notifications.js.map +1 -0
- package/dist/esm/components/NovuUI.d.ts +12 -0
- package/dist/esm/components/NovuUI.js +35 -0
- package/dist/esm/components/NovuUI.js.map +1 -0
- package/dist/esm/components/Preferences.d.ts +5 -0
- package/dist/esm/components/Preferences.js +19 -0
- package/dist/esm/components/Preferences.js.map +1 -0
- package/dist/esm/components/Renderer.d.ts +8 -0
- package/dist/esm/components/Renderer.js +44 -0
- package/dist/esm/components/Renderer.js.map +1 -0
- package/dist/esm/components/index.d.ts +11 -0
- package/dist/esm/components/index.js +8 -0
- package/dist/esm/components/index.js.map +1 -0
- package/dist/esm/context/NovuUIContext.d.ts +14 -0
- package/dist/esm/context/NovuUIContext.js +13 -0
- package/dist/esm/context/NovuUIContext.js.map +1 -0
- package/dist/esm/context/RendererContext.d.ts +15 -0
- package/dist/esm/context/RendererContext.js +13 -0
- package/dist/esm/context/RendererContext.js.map +1 -0
- package/dist/esm/hooks/NovuProvider.d.ts +20 -0
- package/dist/esm/hooks/NovuProvider.js +73 -0
- package/dist/esm/hooks/NovuProvider.js.map +1 -0
- package/dist/esm/hooks/index.d.ts +7 -0
- package/dist/esm/hooks/index.js +10 -0
- package/dist/esm/hooks/index.js.map +1 -0
- package/dist/esm/hooks/internal/useBrowserTabsChannel.d.ts +8 -0
- package/dist/esm/hooks/internal/useBrowserTabsChannel.js +27 -0
- package/dist/esm/hooks/internal/useBrowserTabsChannel.js.map +1 -0
- package/dist/esm/hooks/internal/useDataRef.d.ts +5 -0
- package/dist/esm/hooks/internal/useDataRef.js +11 -0
- package/dist/esm/hooks/internal/useDataRef.js.map +1 -0
- package/dist/esm/hooks/internal/useWebsocketEvent.d.ts +8 -0
- package/dist/esm/hooks/internal/useWebsocketEvent.js +32 -0
- package/dist/esm/hooks/internal/useWebsocketEvent.js.map +1 -0
- package/dist/esm/hooks/useCounts.d.ts +21 -0
- package/dist/esm/hooks/useCounts.js +76 -0
- package/dist/esm/hooks/useCounts.js.map +1 -0
- package/dist/esm/hooks/useNotifications.d.ts +34 -0
- package/dist/esm/hooks/useNotifications.js +96 -0
- package/dist/esm/hooks/useNotifications.js.map +1 -0
- package/dist/esm/hooks/usePreferences.d.ts +19 -0
- package/dist/esm/hooks/usePreferences.js +55 -0
- package/dist/esm/hooks/usePreferences.js.map +1 -0
- package/dist/esm/index.d.ts +14 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/server/index.d.ts +29 -0
- package/dist/esm/server/index.js +56 -0
- package/dist/esm/server/index.js.map +1 -0
- package/dist/esm/themes/index.d.ts +1 -0
- package/dist/esm/themes/index.js +3 -0
- package/dist/esm/themes/index.js.map +1 -0
- package/dist/esm/utils/createContextAndHook.d.ts +19 -0
- package/dist/esm/utils/createContextAndHook.js +27 -0
- package/dist/esm/utils/createContextAndHook.js.map +1 -0
- package/dist/esm/utils/requestLock.d.ts +3 -0
- package/dist/esm/utils/requestLock.js +27 -0
- package/dist/esm/utils/requestLock.js.map +1 -0
- package/dist/esm/utils/types.d.ts +54 -0
- package/dist/esm/utils/types.js +1 -0
- package/dist/esm/utils/types.js.map +1 -0
- package/dist/server/{server.d.mts → index.d.mts} +26 -5
- package/dist/server/{server.d.ts → index.d.ts} +26 -5
- package/dist/server/{server.js → index.js} +18 -21
- package/dist/server/index.js.map +1 -0
- package/dist/server/{server.mjs → index.mjs} +17 -20
- package/dist/server/index.mjs.map +1 -0
- package/hooks/package.json +3 -3
- package/package.json +61 -39
- package/server/package.json +5 -0
- package/themes/package.json +3 -3
- package/dist/client/index.js.map +0 -1
- package/dist/client/index.mjs.map +0 -1
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/index.mjs.map +0 -1
- package/dist/server/server.js.map +0 -1
- package/dist/server/server.mjs.map +0 -1
- package/dist/themes/index.js.map +0 -1
- package/dist/themes/index.mjs.map +0 -1
- /package/dist/{themes/index.d.mts → cjs/themes/index.d.cts} +0 -0
- /package/dist/{hooks → client/hooks}/index.d.mts +0 -0
- /package/dist/{hooks → client/hooks}/index.d.ts +0 -0
- /package/dist/{themes/index.d.ts → client/themes/index.d.mts} +0 -0
- /package/dist/{themes → client/themes}/index.mjs +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/components/Bell.tsx
|
|
31
|
+
var Bell_exports = {};
|
|
32
|
+
__export(Bell_exports, {
|
|
33
|
+
Bell: () => Bell
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(Bell_exports);
|
|
36
|
+
var import_react = __toESM(require("react"), 1);
|
|
37
|
+
var import_Mounter = require("./Mounter.cjs");
|
|
38
|
+
var import_Renderer = require("./Renderer.cjs");
|
|
39
|
+
var import_NovuUIContext = require("../context/NovuUIContext.cjs");
|
|
40
|
+
var import_RendererContext = require("../context/RendererContext.cjs");
|
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var _Bell = import_react.default.memo((props) => {
|
|
43
|
+
const { renderBell } = props;
|
|
44
|
+
const { novuUI } = (0, import_NovuUIContext.useNovuUI)();
|
|
45
|
+
const { mountElement } = (0, import_RendererContext.useRenderer)();
|
|
46
|
+
const mount = import_react.default.useCallback(
|
|
47
|
+
(element) => {
|
|
48
|
+
return novuUI.mountComponent({
|
|
49
|
+
name: "Bell",
|
|
50
|
+
element,
|
|
51
|
+
props: renderBell ? { renderBell: (el, unreadCount) => mountElement(el, renderBell(unreadCount)) } : void 0
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
[renderBell]
|
|
55
|
+
);
|
|
56
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Mounter.Mounter, { mount });
|
|
57
|
+
});
|
|
58
|
+
var Bell = (0, import_Renderer.withRenderer)(_Bell);
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
Bell
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=Bell.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Bell.tsx"],"sourcesContent":["import React from 'react';\nimport { Mounter } from './Mounter';\nimport { BellRenderer } from '../utils/types';\nimport { withRenderer } from './Renderer';\nimport { useNovuUI } from '../context/NovuUIContext';\nimport { useRenderer } from '../context/RendererContext';\n\nexport type BellProps = {\n renderBell?: BellRenderer;\n};\n\nconst _Bell = React.memo((props: BellProps) => {\n const { renderBell } = props;\n const { novuUI } = useNovuUI();\n const { mountElement } = useRenderer();\n\n const mount = React.useCallback(\n (element: HTMLElement) => {\n return novuUI.mountComponent({\n name: 'Bell',\n element,\n props: renderBell ? { renderBell: (el, unreadCount) => mountElement(el, renderBell(unreadCount)) } : undefined,\n });\n },\n [renderBell]\n );\n\n return <Mounter mount={mount} />;\n});\n\nexport const Bell = withRenderer(_Bell);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,qBAAwB;AAExB,sBAA6B;AAC7B,2BAA0B;AAC1B,6BAA4B;AAsBnB;AAhBT,IAAM,QAAQ,aAAAA,QAAM,KAAK,CAAC,UAAqB;AAC7C,QAAM,EAAE,WAAW,IAAI;AACvB,QAAM,EAAE,OAAO,QAAI,gCAAU;AAC7B,QAAM,EAAE,aAAa,QAAI,oCAAY;AAErC,QAAM,QAAQ,aAAAA,QAAM;AAAA,IAClB,CAAC,YAAyB;AACxB,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN;AAAA,QACA,OAAO,aAAa,EAAE,YAAY,CAAC,IAAI,gBAAgB,aAAa,IAAI,WAAW,WAAW,CAAC,EAAE,IAAI;AAAA,MACvG,CAAC;AAAA,IACH;AAAA,IACA,CAAC,UAAU;AAAA,EACb;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC,CAAC;AAEM,IAAM,WAAO,8BAAa,KAAK;","names":["React"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { BellRenderer } from '../utils/types.cjs';
|
|
3
|
+
import '@novu/js/ui';
|
|
4
|
+
|
|
5
|
+
type BellProps = {
|
|
6
|
+
renderBell?: BellRenderer;
|
|
7
|
+
};
|
|
8
|
+
declare const Bell: React__default.ComponentType<BellProps & {
|
|
9
|
+
children?: React__default.ReactNode | undefined;
|
|
10
|
+
}>;
|
|
11
|
+
|
|
12
|
+
export { Bell, type BellProps };
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/components/Inbox.tsx
|
|
31
|
+
var Inbox_exports = {};
|
|
32
|
+
__export(Inbox_exports, {
|
|
33
|
+
Inbox: () => Inbox
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(Inbox_exports);
|
|
36
|
+
var import_react = __toESM(require("react"), 1);
|
|
37
|
+
var import_Mounter = require("./Mounter.cjs");
|
|
38
|
+
var import_NovuUIContext = require("../context/NovuUIContext.cjs");
|
|
39
|
+
var import_RendererContext = require("../context/RendererContext.cjs");
|
|
40
|
+
var import_NovuProvider = require("../hooks/NovuProvider.cjs");
|
|
41
|
+
var import_NovuUI = require("./NovuUI.cjs");
|
|
42
|
+
var import_Renderer = require("./Renderer.cjs");
|
|
43
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
+
var _DefaultInbox = (props) => {
|
|
45
|
+
const {
|
|
46
|
+
open,
|
|
47
|
+
renderNotification,
|
|
48
|
+
renderSubject,
|
|
49
|
+
renderBody,
|
|
50
|
+
renderBell,
|
|
51
|
+
onNotificationClick,
|
|
52
|
+
onPrimaryActionClick,
|
|
53
|
+
onSecondaryActionClick,
|
|
54
|
+
placement,
|
|
55
|
+
placementOffset
|
|
56
|
+
} = props;
|
|
57
|
+
const { novuUI } = (0, import_NovuUIContext.useNovuUI)();
|
|
58
|
+
const { mountElement } = (0, import_RendererContext.useRenderer)();
|
|
59
|
+
const mount = import_react.default.useCallback(
|
|
60
|
+
(element) => {
|
|
61
|
+
if (renderNotification) {
|
|
62
|
+
return novuUI.mountComponent({
|
|
63
|
+
name: "Inbox",
|
|
64
|
+
props: {
|
|
65
|
+
open,
|
|
66
|
+
renderNotification: renderNotification ? (el, notification) => mountElement(el, renderNotification(notification)) : void 0,
|
|
67
|
+
renderBell: renderBell ? (el, unreadCount) => mountElement(el, renderBell(unreadCount)) : void 0,
|
|
68
|
+
onNotificationClick,
|
|
69
|
+
onPrimaryActionClick,
|
|
70
|
+
onSecondaryActionClick,
|
|
71
|
+
placementOffset,
|
|
72
|
+
placement
|
|
73
|
+
},
|
|
74
|
+
element
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return novuUI.mountComponent({
|
|
78
|
+
name: "Inbox",
|
|
79
|
+
props: {
|
|
80
|
+
open,
|
|
81
|
+
renderSubject: renderSubject ? (el, notification) => mountElement(el, renderSubject(notification)) : void 0,
|
|
82
|
+
renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : void 0,
|
|
83
|
+
renderBell: renderBell ? (el, unreadCount) => mountElement(el, renderBell(unreadCount)) : void 0,
|
|
84
|
+
onNotificationClick,
|
|
85
|
+
onPrimaryActionClick,
|
|
86
|
+
onSecondaryActionClick,
|
|
87
|
+
placementOffset,
|
|
88
|
+
placement
|
|
89
|
+
},
|
|
90
|
+
element
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
[
|
|
94
|
+
open,
|
|
95
|
+
renderNotification,
|
|
96
|
+
renderSubject,
|
|
97
|
+
renderBody,
|
|
98
|
+
renderBell,
|
|
99
|
+
onNotificationClick,
|
|
100
|
+
onPrimaryActionClick,
|
|
101
|
+
onSecondaryActionClick
|
|
102
|
+
]
|
|
103
|
+
);
|
|
104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Mounter.Mounter, { mount });
|
|
105
|
+
};
|
|
106
|
+
var DefaultInbox = (0, import_Renderer.withRenderer)(_DefaultInbox);
|
|
107
|
+
var Inbox = import_react.default.memo((props) => {
|
|
108
|
+
const { applicationIdentifier, subscriberId, subscriberHash, backendUrl, socketUrl } = props;
|
|
109
|
+
const novu = (0, import_NovuProvider.useUnsafeNovu)();
|
|
110
|
+
if (novu) {
|
|
111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InboxChild, { ...props });
|
|
112
|
+
}
|
|
113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
114
|
+
import_NovuProvider.InternalNovuProvider,
|
|
115
|
+
{
|
|
116
|
+
applicationIdentifier,
|
|
117
|
+
subscriberId,
|
|
118
|
+
subscriberHash,
|
|
119
|
+
backendUrl,
|
|
120
|
+
socketUrl,
|
|
121
|
+
userAgentType: "components",
|
|
122
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InboxChild, { ...props })
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
});
|
|
126
|
+
var InboxChild = import_react.default.memo((props) => {
|
|
127
|
+
const {
|
|
128
|
+
localization,
|
|
129
|
+
appearance,
|
|
130
|
+
tabs,
|
|
131
|
+
preferencesFilter,
|
|
132
|
+
routerPush,
|
|
133
|
+
applicationIdentifier,
|
|
134
|
+
subscriberId,
|
|
135
|
+
subscriberHash,
|
|
136
|
+
backendUrl,
|
|
137
|
+
socketUrl
|
|
138
|
+
} = props;
|
|
139
|
+
const novu = (0, import_NovuProvider.useNovu)();
|
|
140
|
+
const options = (0, import_react.useMemo)(() => {
|
|
141
|
+
return {
|
|
142
|
+
localization,
|
|
143
|
+
appearance,
|
|
144
|
+
tabs,
|
|
145
|
+
preferencesFilter,
|
|
146
|
+
routerPush,
|
|
147
|
+
options: { applicationIdentifier, subscriberId, subscriberHash, backendUrl, socketUrl }
|
|
148
|
+
};
|
|
149
|
+
}, [
|
|
150
|
+
localization,
|
|
151
|
+
appearance,
|
|
152
|
+
tabs,
|
|
153
|
+
preferencesFilter,
|
|
154
|
+
applicationIdentifier,
|
|
155
|
+
subscriberId,
|
|
156
|
+
subscriberHash,
|
|
157
|
+
backendUrl,
|
|
158
|
+
socketUrl
|
|
159
|
+
]);
|
|
160
|
+
if (isWithChildrenProps(props)) {
|
|
161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NovuUI.NovuUI, { options, novu, children: props.children });
|
|
162
|
+
}
|
|
163
|
+
const {
|
|
164
|
+
open,
|
|
165
|
+
renderNotification,
|
|
166
|
+
renderSubject,
|
|
167
|
+
renderBody,
|
|
168
|
+
renderBell,
|
|
169
|
+
onNotificationClick,
|
|
170
|
+
onPrimaryActionClick,
|
|
171
|
+
onSecondaryActionClick,
|
|
172
|
+
placementOffset,
|
|
173
|
+
placement
|
|
174
|
+
} = props;
|
|
175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NovuUI.NovuUI, { options, novu, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
176
|
+
DefaultInbox,
|
|
177
|
+
{
|
|
178
|
+
open,
|
|
179
|
+
renderNotification,
|
|
180
|
+
renderSubject,
|
|
181
|
+
renderBody,
|
|
182
|
+
renderBell,
|
|
183
|
+
onNotificationClick,
|
|
184
|
+
onPrimaryActionClick,
|
|
185
|
+
onSecondaryActionClick,
|
|
186
|
+
placement,
|
|
187
|
+
placementOffset
|
|
188
|
+
}
|
|
189
|
+
) });
|
|
190
|
+
});
|
|
191
|
+
function isWithChildrenProps(props) {
|
|
192
|
+
return "children" in props;
|
|
193
|
+
}
|
|
194
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
195
|
+
0 && (module.exports = {
|
|
196
|
+
Inbox
|
|
197
|
+
});
|
|
198
|
+
//# sourceMappingURL=Inbox.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Inbox.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { DefaultProps, DefaultInboxProps, WithChildrenProps } from '../utils/types';\nimport { Mounter } from './Mounter';\nimport { useNovuUI } from '../context/NovuUIContext';\nimport { useRenderer } from '../context/RendererContext';\nimport { InternalNovuProvider, useNovu, useUnsafeNovu } from '../hooks/NovuProvider';\nimport { NovuUI } from './NovuUI';\nimport { withRenderer } from './Renderer';\n\nexport type InboxProps = DefaultProps | WithChildrenProps;\n\nconst _DefaultInbox = (props: DefaultInboxProps) => {\n const {\n open,\n renderNotification,\n renderSubject,\n renderBody,\n renderBell,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n placement,\n placementOffset,\n } = props;\n const { novuUI } = useNovuUI();\n const { mountElement } = useRenderer();\n\n const mount = React.useCallback(\n (element: HTMLElement) => {\n if (renderNotification) {\n return novuUI.mountComponent({\n name: 'Inbox',\n props: {\n open,\n renderNotification: renderNotification\n ? (el, notification) => mountElement(el, renderNotification(notification))\n : undefined,\n renderBell: renderBell ? (el, unreadCount) => mountElement(el, renderBell(unreadCount)) : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n placementOffset,\n placement,\n },\n element,\n });\n }\n\n return novuUI.mountComponent({\n name: 'Inbox',\n props: {\n open,\n renderSubject: renderSubject\n ? (el, notification) => mountElement(el, renderSubject(notification))\n : undefined,\n renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : undefined,\n renderBell: renderBell ? (el, unreadCount) => mountElement(el, renderBell(unreadCount)) : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n placementOffset,\n placement,\n },\n element,\n });\n },\n [\n open,\n renderNotification,\n renderSubject,\n renderBody,\n renderBell,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n ]\n );\n\n return <Mounter mount={mount} />;\n};\n\nconst DefaultInbox = withRenderer(_DefaultInbox);\n\nexport const Inbox = React.memo((props: InboxProps) => {\n const { applicationIdentifier, subscriberId, subscriberHash, backendUrl, socketUrl } = props;\n const novu = useUnsafeNovu();\n\n if (novu) {\n return <InboxChild {...props} />;\n }\n\n return (\n <InternalNovuProvider\n applicationIdentifier={applicationIdentifier}\n subscriberId={subscriberId}\n subscriberHash={subscriberHash}\n backendUrl={backendUrl}\n socketUrl={socketUrl}\n userAgentType=\"components\"\n >\n <InboxChild {...props} />\n </InternalNovuProvider>\n );\n});\n\nconst InboxChild = React.memo((props: InboxProps) => {\n const {\n localization,\n appearance,\n tabs,\n preferencesFilter,\n routerPush,\n applicationIdentifier,\n subscriberId,\n subscriberHash,\n backendUrl,\n socketUrl,\n } = props;\n const novu = useNovu();\n\n const options = useMemo(() => {\n return {\n localization,\n appearance,\n tabs,\n preferencesFilter,\n routerPush,\n options: { applicationIdentifier, subscriberId, subscriberHash, backendUrl, socketUrl },\n };\n }, [\n localization,\n appearance,\n tabs,\n preferencesFilter,\n applicationIdentifier,\n subscriberId,\n subscriberHash,\n backendUrl,\n socketUrl,\n ]);\n\n if (isWithChildrenProps(props)) {\n return (\n <NovuUI options={options} novu={novu}>\n {props.children}\n </NovuUI>\n );\n }\n\n const {\n open,\n renderNotification,\n renderSubject,\n renderBody,\n renderBell,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n placementOffset,\n placement,\n } = props;\n\n return (\n <NovuUI options={options} novu={novu}>\n <DefaultInbox\n open={open}\n renderNotification={renderNotification}\n renderSubject={renderSubject}\n renderBody={renderBody}\n renderBell={renderBell}\n onNotificationClick={onNotificationClick}\n onPrimaryActionClick={onPrimaryActionClick}\n onSecondaryActionClick={onSecondaryActionClick}\n placement={placement}\n placementOffset={placementOffset}\n />\n </NovuUI>\n );\n});\n\nfunction isWithChildrenProps(props: InboxProps): props is WithChildrenProps {\n return 'children' in props;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAE/B,qBAAwB;AACxB,2BAA0B;AAC1B,6BAA4B;AAC5B,0BAA6D;AAC7D,oBAAuB;AACvB,sBAA6B;AAuEpB;AAnET,IAAM,gBAAgB,CAAC,UAA6B;AAClD,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,QAAI,gCAAU;AAC7B,QAAM,EAAE,aAAa,QAAI,oCAAY;AAErC,QAAM,QAAQ,aAAAA,QAAM;AAAA,IAClB,CAAC,YAAyB;AACxB,UAAI,oBAAoB;AACtB,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN,OAAO;AAAA,YACL;AAAA,YACA,oBAAoB,qBAChB,CAAC,IAAI,iBAAiB,aAAa,IAAI,mBAAmB,YAAY,CAAC,IACvE;AAAA,YACJ,YAAY,aAAa,CAAC,IAAI,gBAAgB,aAAa,IAAI,WAAW,WAAW,CAAC,IAAI;AAAA,YAC1F;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAEA,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN,OAAO;AAAA,UACL;AAAA,UACA,eAAe,gBACX,CAAC,IAAI,iBAAiB,aAAa,IAAI,cAAc,YAAY,CAAC,IAClE;AAAA,UACJ,YAAY,aAAa,CAAC,IAAI,iBAAiB,aAAa,IAAI,WAAW,YAAY,CAAC,IAAI;AAAA,UAC5F,YAAY,aAAa,CAAC,IAAI,gBAAgB,aAAa,IAAI,WAAW,WAAW,CAAC,IAAI;AAAA,UAC1F;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,IACF;AAAA,EACF;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC;AAEA,IAAM,mBAAe,8BAAa,aAAa;AAExC,IAAM,QAAQ,aAAAA,QAAM,KAAK,CAAC,UAAsB;AACrD,QAAM,EAAE,uBAAuB,cAAc,gBAAgB,YAAY,UAAU,IAAI;AACvF,QAAM,WAAO,mCAAc;AAE3B,MAAI,MAAM;AACR,WAAO,4CAAC,cAAY,GAAG,OAAO;AAAA,EAChC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,eAAc;AAAA,MAEd,sDAAC,cAAY,GAAG,OAAO;AAAA;AAAA,EACzB;AAEJ,CAAC;AAED,IAAM,aAAa,aAAAA,QAAM,KAAK,CAAC,UAAsB;AACnD,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,WAAO,6BAAQ;AAErB,QAAM,cAAU,sBAAQ,MAAM;AAC5B,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,EAAE,uBAAuB,cAAc,gBAAgB,YAAY,UAAU;AAAA,IACxF;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,MAAI,oBAAoB,KAAK,GAAG;AAC9B,WACE,4CAAC,wBAAO,SAAkB,MACvB,gBAAM,UACT;AAAA,EAEJ;AAEA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,SACE,4CAAC,wBAAO,SAAkB,MACxB;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF,GACF;AAEJ,CAAC;AAED,SAAS,oBAAoB,OAA+C;AAC1E,SAAO,cAAc;AACvB;","names":["React"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { DefaultProps, WithChildrenProps } from '../utils/types.cjs';
|
|
4
|
+
import '@novu/js/ui';
|
|
5
|
+
|
|
6
|
+
type InboxProps = DefaultProps | WithChildrenProps;
|
|
7
|
+
declare const Inbox: React__default.MemoExoticComponent<(props: InboxProps) => react_jsx_runtime.JSX.Element>;
|
|
8
|
+
|
|
9
|
+
export { Inbox, type InboxProps };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/components/InboxContent.tsx
|
|
31
|
+
var InboxContent_exports = {};
|
|
32
|
+
__export(InboxContent_exports, {
|
|
33
|
+
InboxContent: () => InboxContent
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(InboxContent_exports);
|
|
36
|
+
var import_react = __toESM(require("react"), 1);
|
|
37
|
+
var import_Mounter = require("./Mounter.cjs");
|
|
38
|
+
var import_RendererContext = require("../context/RendererContext.cjs");
|
|
39
|
+
var import_NovuUIContext = require("../context/NovuUIContext.cjs");
|
|
40
|
+
var import_Renderer = require("./Renderer.cjs");
|
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var _InboxContent = import_react.default.memo((props) => {
|
|
43
|
+
const {
|
|
44
|
+
onNotificationClick,
|
|
45
|
+
onPrimaryActionClick,
|
|
46
|
+
renderNotification,
|
|
47
|
+
renderSubject,
|
|
48
|
+
renderBody,
|
|
49
|
+
onSecondaryActionClick,
|
|
50
|
+
initialPage,
|
|
51
|
+
hideNav
|
|
52
|
+
} = props;
|
|
53
|
+
const { novuUI } = (0, import_NovuUIContext.useNovuUI)();
|
|
54
|
+
const { mountElement } = (0, import_RendererContext.useRenderer)();
|
|
55
|
+
const mount = import_react.default.useCallback(
|
|
56
|
+
(element) => {
|
|
57
|
+
if (renderNotification) {
|
|
58
|
+
return novuUI.mountComponent({
|
|
59
|
+
name: "InboxContent",
|
|
60
|
+
element,
|
|
61
|
+
props: {
|
|
62
|
+
renderNotification: renderNotification ? (el, notification) => mountElement(el, renderNotification(notification)) : void 0,
|
|
63
|
+
onNotificationClick,
|
|
64
|
+
onPrimaryActionClick,
|
|
65
|
+
onSecondaryActionClick,
|
|
66
|
+
initialPage,
|
|
67
|
+
hideNav
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return novuUI.mountComponent({
|
|
72
|
+
name: "InboxContent",
|
|
73
|
+
element,
|
|
74
|
+
props: {
|
|
75
|
+
renderSubject: renderSubject ? (el, notification) => mountElement(el, renderSubject(notification)) : void 0,
|
|
76
|
+
renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : void 0,
|
|
77
|
+
onNotificationClick,
|
|
78
|
+
onPrimaryActionClick,
|
|
79
|
+
onSecondaryActionClick,
|
|
80
|
+
initialPage,
|
|
81
|
+
hideNav
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
[renderNotification, renderSubject, renderBody, onNotificationClick, onPrimaryActionClick, onSecondaryActionClick]
|
|
86
|
+
);
|
|
87
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Mounter.Mounter, { mount });
|
|
88
|
+
});
|
|
89
|
+
var InboxContent = (0, import_Renderer.withRenderer)(_InboxContent);
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
InboxContent
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=InboxContent.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/InboxContent.tsx"],"sourcesContent":["import React from 'react';\nimport type { NotificationClickHandler, NotificationActionClickHandler, InboxPage } from '@novu/js/ui';\nimport { Mounter } from './Mounter';\nimport { NoRendererProps, SubjectBodyRendererProps, NotificationRendererProps } from '../utils/types';\nimport { useRenderer } from '../context/RendererContext';\nimport { useNovuUI } from '../context/NovuUIContext';\nimport { withRenderer } from './Renderer';\n\nexport type InboxContentProps = {\n onNotificationClick?: NotificationClickHandler;\n onPrimaryActionClick?: NotificationActionClickHandler;\n onSecondaryActionClick?: NotificationActionClickHandler;\n initialPage?: InboxPage;\n hideNav?: boolean;\n} & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);\n\nconst _InboxContent = React.memo((props: InboxContentProps) => {\n const {\n onNotificationClick,\n onPrimaryActionClick,\n renderNotification,\n renderSubject,\n renderBody,\n onSecondaryActionClick,\n initialPage,\n hideNav,\n } = props;\n const { novuUI } = useNovuUI();\n const { mountElement } = useRenderer();\n\n const mount = React.useCallback(\n (element: HTMLElement) => {\n if (renderNotification) {\n return novuUI.mountComponent({\n name: 'InboxContent',\n element,\n props: {\n renderNotification: renderNotification\n ? (el, notification) => mountElement(el, renderNotification(notification))\n : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n initialPage,\n hideNav,\n },\n });\n }\n\n return novuUI.mountComponent({\n name: 'InboxContent',\n element,\n props: {\n renderSubject: renderSubject\n ? (el, notification) => mountElement(el, renderSubject(notification))\n : undefined,\n renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n initialPage,\n hideNav,\n },\n });\n },\n [renderNotification, renderSubject, renderBody, onNotificationClick, onPrimaryActionClick, onSecondaryActionClick]\n );\n\n return <Mounter mount={mount} />;\n});\n\nexport const InboxContent = withRenderer(_InboxContent);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,qBAAwB;AAExB,6BAA4B;AAC5B,2BAA0B;AAC1B,sBAA6B;AA8DpB;AApDT,IAAM,gBAAgB,aAAAA,QAAM,KAAK,CAAC,UAA6B;AAC7D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,OAAO,QAAI,gCAAU;AAC7B,QAAM,EAAE,aAAa,QAAI,oCAAY;AAErC,QAAM,QAAQ,aAAAA,QAAM;AAAA,IAClB,CAAC,YAAyB;AACxB,UAAI,oBAAoB;AACtB,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN;AAAA,UACA,OAAO;AAAA,YACL,oBAAoB,qBAChB,CAAC,IAAI,iBAAiB,aAAa,IAAI,mBAAmB,YAAY,CAAC,IACvE;AAAA,YACJ;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAEA,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN;AAAA,QACA,OAAO;AAAA,UACL,eAAe,gBACX,CAAC,IAAI,iBAAiB,aAAa,IAAI,cAAc,YAAY,CAAC,IAClE;AAAA,UACJ,YAAY,aAAa,CAAC,IAAI,iBAAiB,aAAa,IAAI,WAAW,YAAY,CAAC,IAAI;AAAA,UAC5F;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,CAAC,oBAAoB,eAAe,YAAY,qBAAqB,sBAAsB,sBAAsB;AAAA,EACnH;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC,CAAC;AAEM,IAAM,mBAAe,8BAAa,aAAa;","names":["React"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { NotificationClickHandler, NotificationActionClickHandler, InboxPage } from '@novu/js/ui';
|
|
3
|
+
import { NotificationRendererProps, SubjectBodyRendererProps, NoRendererProps } from '../utils/types.cjs';
|
|
4
|
+
|
|
5
|
+
type InboxContentProps = {
|
|
6
|
+
onNotificationClick?: NotificationClickHandler;
|
|
7
|
+
onPrimaryActionClick?: NotificationActionClickHandler;
|
|
8
|
+
onSecondaryActionClick?: NotificationActionClickHandler;
|
|
9
|
+
initialPage?: InboxPage;
|
|
10
|
+
hideNav?: boolean;
|
|
11
|
+
} & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);
|
|
12
|
+
declare const InboxContent: React__default.ComponentType<InboxContentProps & {
|
|
13
|
+
children?: React__default.ReactNode | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
|
|
16
|
+
export { InboxContent, type InboxContentProps };
|
|
@@ -0,0 +1,51 @@
|
|
|
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/components/Mounter.tsx
|
|
21
|
+
var Mounter_exports = {};
|
|
22
|
+
__export(Mounter_exports, {
|
|
23
|
+
Mounter: () => Mounter
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Mounter_exports);
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
function Mounter({ mount }) {
|
|
29
|
+
const ref = (0, import_react.useRef)(null);
|
|
30
|
+
(0, import_react.useEffect)(() => {
|
|
31
|
+
let unmount;
|
|
32
|
+
const element = ref.current;
|
|
33
|
+
if (element && mount) {
|
|
34
|
+
const possibleUnmount = mount(element);
|
|
35
|
+
if (possibleUnmount) {
|
|
36
|
+
unmount = possibleUnmount;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return () => {
|
|
40
|
+
if (element && unmount) {
|
|
41
|
+
unmount(element);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}, [ref, mount]);
|
|
45
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref });
|
|
46
|
+
}
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
Mounter
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=Mounter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Mounter.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\ntype MounterProps = {\n mount: (node: HTMLElement) => ((node: HTMLElement) => void) | void;\n};\n\n/**\n * Mounter allows you to mount a component to a DOM node.\n */\nexport function Mounter({ mount }: MounterProps) {\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n let unmount: (node: HTMLDivElement) => void | undefined;\n const element = ref.current;\n if (element && mount) {\n const possibleUnmount = mount(element);\n if (possibleUnmount) {\n unmount = possibleUnmount;\n }\n }\n\n return () => {\n if (element && unmount) {\n unmount(element);\n }\n };\n }, [ref, mount]);\n\n return <div ref={ref} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkC;AA6BzB;AApBF,SAAS,QAAQ,EAAE,MAAM,GAAiB;AAC/C,QAAM,UAAM,qBAAuB,IAAI;AAEvC,8BAAU,MAAM;AACd,QAAI;AACJ,UAAM,UAAU,IAAI;AACpB,QAAI,WAAW,OAAO;AACpB,YAAM,kBAAkB,MAAM,OAAO;AACrC,UAAI,iBAAiB;AACnB,kBAAU;AAAA,MACZ;AAAA,IACF;AAEA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,gBAAQ,OAAO;AAAA,MACjB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,KAAK,KAAK,CAAC;AAEf,SAAO,4CAAC,SAAI,KAAU;AACxB;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type MounterProps = {
|
|
4
|
+
mount: (node: HTMLElement) => ((node: HTMLElement) => void) | void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Mounter allows you to mount a component to a DOM node.
|
|
8
|
+
*/
|
|
9
|
+
declare function Mounter({ mount }: MounterProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { Mounter };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/components/Notifications.tsx
|
|
31
|
+
var Notifications_exports = {};
|
|
32
|
+
__export(Notifications_exports, {
|
|
33
|
+
Notifications: () => Notifications
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(Notifications_exports);
|
|
36
|
+
var import_react = __toESM(require("react"), 1);
|
|
37
|
+
var import_Mounter = require("./Mounter.cjs");
|
|
38
|
+
var import_RendererContext = require("../context/RendererContext.cjs");
|
|
39
|
+
var import_NovuUIContext = require("../context/NovuUIContext.cjs");
|
|
40
|
+
var import_Renderer = require("./Renderer.cjs");
|
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var _Notifications = import_react.default.memo((props) => {
|
|
43
|
+
const {
|
|
44
|
+
renderNotification,
|
|
45
|
+
renderSubject,
|
|
46
|
+
renderBody,
|
|
47
|
+
onNotificationClick,
|
|
48
|
+
onPrimaryActionClick,
|
|
49
|
+
onSecondaryActionClick
|
|
50
|
+
} = props;
|
|
51
|
+
const { novuUI } = (0, import_NovuUIContext.useNovuUI)();
|
|
52
|
+
const { mountElement } = (0, import_RendererContext.useRenderer)();
|
|
53
|
+
const mount = import_react.default.useCallback(
|
|
54
|
+
(element) => {
|
|
55
|
+
if (renderNotification) {
|
|
56
|
+
return novuUI.mountComponent({
|
|
57
|
+
name: "Notifications",
|
|
58
|
+
element,
|
|
59
|
+
props: {
|
|
60
|
+
renderNotification: renderNotification ? (el, notification) => mountElement(el, renderNotification(notification)) : void 0,
|
|
61
|
+
onNotificationClick,
|
|
62
|
+
onPrimaryActionClick,
|
|
63
|
+
onSecondaryActionClick
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return novuUI.mountComponent({
|
|
68
|
+
name: "Notifications",
|
|
69
|
+
element,
|
|
70
|
+
props: {
|
|
71
|
+
renderSubject: renderSubject ? (el, notification) => mountElement(el, renderSubject(notification)) : void 0,
|
|
72
|
+
renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : void 0,
|
|
73
|
+
onNotificationClick,
|
|
74
|
+
onPrimaryActionClick,
|
|
75
|
+
onSecondaryActionClick
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
[renderNotification, renderSubject, renderBody, onNotificationClick, onPrimaryActionClick, onSecondaryActionClick]
|
|
80
|
+
);
|
|
81
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Mounter.Mounter, { mount });
|
|
82
|
+
});
|
|
83
|
+
var Notifications = (0, import_Renderer.withRenderer)(_Notifications);
|
|
84
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
+
0 && (module.exports = {
|
|
86
|
+
Notifications
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=Notifications.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Notifications.tsx"],"sourcesContent":["import React from 'react';\nimport type { NotificationClickHandler, NotificationActionClickHandler } from '@novu/js/ui';\nimport { Mounter } from './Mounter';\nimport { NoRendererProps, NotificationRendererProps, SubjectBodyRendererProps } from '../utils/types';\nimport { useRenderer } from '../context/RendererContext';\nimport { useNovuUI } from '../context/NovuUIContext';\nimport { withRenderer } from './Renderer';\n\nexport type NotificationProps = {\n onNotificationClick?: NotificationClickHandler;\n onPrimaryActionClick?: NotificationActionClickHandler;\n onSecondaryActionClick?: NotificationActionClickHandler;\n} & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);\n\nconst _Notifications = React.memo((props: NotificationProps) => {\n const {\n renderNotification,\n renderSubject,\n renderBody,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n } = props;\n const { novuUI } = useNovuUI();\n const { mountElement } = useRenderer();\n\n const mount = React.useCallback(\n (element: HTMLElement) => {\n if (renderNotification) {\n return novuUI.mountComponent({\n name: 'Notifications',\n element,\n props: {\n renderNotification: renderNotification\n ? (el, notification) => mountElement(el, renderNotification(notification))\n : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n },\n });\n }\n\n return novuUI.mountComponent({\n name: 'Notifications',\n element,\n props: {\n renderSubject: renderSubject\n ? (el, notification) => mountElement(el, renderSubject(notification))\n : undefined,\n renderBody: renderBody ? (el, notification) => mountElement(el, renderBody(notification)) : undefined,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n },\n });\n },\n [renderNotification, renderSubject, renderBody, onNotificationClick, onPrimaryActionClick, onSecondaryActionClick]\n );\n\n return <Mounter mount={mount} />;\n});\n\nexport const Notifications = withRenderer(_Notifications);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,qBAAwB;AAExB,6BAA4B;AAC5B,2BAA0B;AAC1B,sBAA6B;AAsDpB;AA9CT,IAAM,iBAAiB,aAAAA,QAAM,KAAK,CAAC,UAA6B;AAC9D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,OAAO,QAAI,gCAAU;AAC7B,QAAM,EAAE,aAAa,QAAI,oCAAY;AAErC,QAAM,QAAQ,aAAAA,QAAM;AAAA,IAClB,CAAC,YAAyB;AACxB,UAAI,oBAAoB;AACtB,eAAO,OAAO,eAAe;AAAA,UAC3B,MAAM;AAAA,UACN;AAAA,UACA,OAAO;AAAA,YACL,oBAAoB,qBAChB,CAAC,IAAI,iBAAiB,aAAa,IAAI,mBAAmB,YAAY,CAAC,IACvE;AAAA,YACJ;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAEA,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN;AAAA,QACA,OAAO;AAAA,UACL,eAAe,gBACX,CAAC,IAAI,iBAAiB,aAAa,IAAI,cAAc,YAAY,CAAC,IAClE;AAAA,UACJ,YAAY,aAAa,CAAC,IAAI,iBAAiB,aAAa,IAAI,WAAW,YAAY,CAAC,IAAI;AAAA,UAC5F;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,CAAC,oBAAoB,eAAe,YAAY,qBAAqB,sBAAsB,sBAAsB;AAAA,EACnH;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC,CAAC;AAEM,IAAM,oBAAgB,8BAAa,cAAc;","names":["React"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { NotificationClickHandler, NotificationActionClickHandler } from '@novu/js/ui';
|
|
3
|
+
import { NotificationRendererProps, SubjectBodyRendererProps, NoRendererProps } from '../utils/types.cjs';
|
|
4
|
+
|
|
5
|
+
type NotificationProps = {
|
|
6
|
+
onNotificationClick?: NotificationClickHandler;
|
|
7
|
+
onPrimaryActionClick?: NotificationActionClickHandler;
|
|
8
|
+
onSecondaryActionClick?: NotificationActionClickHandler;
|
|
9
|
+
} & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);
|
|
10
|
+
declare const Notifications: React__default.ComponentType<NotificationProps & {
|
|
11
|
+
children?: React__default.ReactNode | undefined;
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
export { type NotificationProps, Notifications };
|