@novu/js 3.0.3 → 3.2.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/README.md +1 -1
- package/dist/cjs/{chunk-47NZ3DJQ.js → chunk-4KMXR5HJ.js} +36 -59
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +8 -32
- package/dist/{esm/novu-BXVPjTIj.d.mts → cjs/novu-jtIKy6p0.d.ts} +36 -62
- package/dist/cjs/themes/index.d.ts +2 -2
- package/dist/cjs/{types-BOvaROWQ.d.ts → types-qgZnJ8j8.d.ts} +2 -2
- package/dist/cjs/ui/index.d.ts +5 -5
- package/dist/cjs/ui/index.js +84 -84
- package/dist/esm/{chunk-GCPLP2EW.mjs → chunk-3SPOLIN3.mjs} +37 -54
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +1 -1
- package/dist/{cjs/novu-BXVPjTIj.d.ts → esm/novu-jtIKy6p0.d.mts} +36 -62
- package/dist/esm/themes/index.d.mts +2 -2
- package/dist/esm/{types-Du_GH8TU.d.mts → types-Bi1DqOQ-.d.mts} +2 -2
- package/dist/esm/ui/index.d.mts +5 -5
- package/dist/esm/ui/index.mjs +81 -81
- package/dist/novu.min.js +10 -10
- package/dist/novu.min.js.gz +0 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ import { Novu } from '@novu/js';
|
|
|
20
20
|
|
|
21
21
|
const novu = new Novu({
|
|
22
22
|
applicationIdentifier: 'YOUR_NOVU_APPLICATION_IDENTIFIER',
|
|
23
|
-
|
|
23
|
+
subscriber: 'YOUR_INTERNAL_SUBSCRIBER_ID',
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
const { data: notifications, error } = await novu.notifications.list();
|
|
@@ -17,20 +17,6 @@ var NotificationStatus = /* @__PURE__ */ ((NotificationStatus2) => {
|
|
|
17
17
|
NotificationStatus2["UNSEEN"] = "unseen";
|
|
18
18
|
return NotificationStatus2;
|
|
19
19
|
})(NotificationStatus || {});
|
|
20
|
-
var NotificationButton = /* @__PURE__ */ ((NotificationButton2) => {
|
|
21
|
-
NotificationButton2["PRIMARY"] = "primary";
|
|
22
|
-
NotificationButton2["SECONDARY"] = "secondary";
|
|
23
|
-
return NotificationButton2;
|
|
24
|
-
})(NotificationButton || {});
|
|
25
|
-
var NotificationActionStatus = /* @__PURE__ */ ((NotificationActionStatus2) => {
|
|
26
|
-
NotificationActionStatus2["PENDING"] = "pending";
|
|
27
|
-
NotificationActionStatus2["DONE"] = "done";
|
|
28
|
-
return NotificationActionStatus2;
|
|
29
|
-
})(NotificationActionStatus || {});
|
|
30
|
-
var CtaType = /* @__PURE__ */ ((CtaType2) => {
|
|
31
|
-
CtaType2["REDIRECT"] = "redirect";
|
|
32
|
-
return CtaType2;
|
|
33
|
-
})(CtaType || {});
|
|
34
20
|
var PreferenceLevel = /* @__PURE__ */ ((PreferenceLevel2) => {
|
|
35
21
|
PreferenceLevel2["GLOBAL"] = "global";
|
|
36
22
|
PreferenceLevel2["TEMPLATE"] = "template";
|
|
@@ -44,29 +30,12 @@ var ChannelType = /* @__PURE__ */ ((ChannelType2) => {
|
|
|
44
30
|
ChannelType2["PUSH"] = "push";
|
|
45
31
|
return ChannelType2;
|
|
46
32
|
})(ChannelType || {});
|
|
47
|
-
var PreferenceOverrideSource = /* @__PURE__ */ ((PreferenceOverrideSource2) => {
|
|
48
|
-
PreferenceOverrideSource2["SUBSCRIBER"] = "subscriber";
|
|
49
|
-
PreferenceOverrideSource2["TEMPLATE"] = "template";
|
|
50
|
-
PreferenceOverrideSource2["WORKFLOW_OVERRIDE"] = "workflowOverride";
|
|
51
|
-
return PreferenceOverrideSource2;
|
|
52
|
-
})(PreferenceOverrideSource || {});
|
|
53
33
|
var WebSocketEvent = /* @__PURE__ */ ((WebSocketEvent2) => {
|
|
54
34
|
WebSocketEvent2["RECEIVED"] = "notification_received";
|
|
55
35
|
WebSocketEvent2["UNREAD"] = "unread_count_changed";
|
|
56
36
|
WebSocketEvent2["UNSEEN"] = "unseen_count_changed";
|
|
57
37
|
return WebSocketEvent2;
|
|
58
38
|
})(WebSocketEvent || {});
|
|
59
|
-
var ActionTypeEnum = /* @__PURE__ */ ((ActionTypeEnum2) => {
|
|
60
|
-
ActionTypeEnum2["PRIMARY"] = "primary";
|
|
61
|
-
ActionTypeEnum2["SECONDARY"] = "secondary";
|
|
62
|
-
return ActionTypeEnum2;
|
|
63
|
-
})(ActionTypeEnum || {});
|
|
64
|
-
var PreferenceOverrideSourceEnum = /* @__PURE__ */ ((PreferenceOverrideSourceEnum2) => {
|
|
65
|
-
PreferenceOverrideSourceEnum2["SUBSCRIBER"] = "subscriber";
|
|
66
|
-
PreferenceOverrideSourceEnum2["TEMPLATE"] = "template";
|
|
67
|
-
PreferenceOverrideSourceEnum2["WORKFLOW_OVERRIDE"] = "workflowOverride";
|
|
68
|
-
return PreferenceOverrideSourceEnum2;
|
|
69
|
-
})(PreferenceOverrideSourceEnum || {});
|
|
70
39
|
|
|
71
40
|
// src/utils/arrays.ts
|
|
72
41
|
var arrayValuesEqual = (arr1, arr2) => {
|
|
@@ -91,7 +60,7 @@ var isSameFilter = (filter1, filter2) => {
|
|
|
91
60
|
// src/api/http-client.ts
|
|
92
61
|
var DEFAULT_API_VERSION = "v1";
|
|
93
62
|
var DEFAULT_BACKEND_URL = "https://api.novu.co";
|
|
94
|
-
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.0
|
|
63
|
+
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.2.0"}`;
|
|
95
64
|
var HttpClient = class {
|
|
96
65
|
constructor(options = {}) {
|
|
97
66
|
const {
|
|
@@ -206,13 +175,13 @@ var InboxService = class {
|
|
|
206
175
|
initializeSession(_0) {
|
|
207
176
|
return chunk7B52C2XE_js.__async(this, arguments, function* ({
|
|
208
177
|
applicationIdentifier,
|
|
209
|
-
|
|
210
|
-
|
|
178
|
+
subscriberHash,
|
|
179
|
+
subscriber
|
|
211
180
|
}) {
|
|
212
181
|
const response = yield chunk7B52C2XE_js.__privateGet(this, _httpClient).post(`${INBOX_ROUTE}/session`, {
|
|
213
182
|
applicationIdentifier,
|
|
214
|
-
|
|
215
|
-
|
|
183
|
+
subscriberHash,
|
|
184
|
+
subscriber
|
|
216
185
|
});
|
|
217
186
|
chunk7B52C2XE_js.__privateGet(this, _httpClient).setAuthorizationToken(response.token);
|
|
218
187
|
this.isSessionInitialized = true;
|
|
@@ -414,7 +383,7 @@ var Notification = class {
|
|
|
414
383
|
this.tags = notification.tags;
|
|
415
384
|
this.redirect = notification.redirect;
|
|
416
385
|
this.data = notification.data;
|
|
417
|
-
this.
|
|
386
|
+
this.workflow = notification.workflow;
|
|
418
387
|
}
|
|
419
388
|
read() {
|
|
420
389
|
return read({
|
|
@@ -1527,17 +1496,17 @@ var Session = class {
|
|
|
1527
1496
|
return chunk7B52C2XE_js.__privateGet(this, _options).applicationIdentifier;
|
|
1528
1497
|
}
|
|
1529
1498
|
get subscriberId() {
|
|
1530
|
-
return chunk7B52C2XE_js.__privateGet(this, _options).subscriberId;
|
|
1499
|
+
return chunk7B52C2XE_js.__privateGet(this, _options).subscriber.subscriberId;
|
|
1531
1500
|
}
|
|
1532
1501
|
initialize() {
|
|
1533
1502
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1534
1503
|
try {
|
|
1535
|
-
const { applicationIdentifier,
|
|
1504
|
+
const { applicationIdentifier, subscriberHash, subscriber } = chunk7B52C2XE_js.__privateGet(this, _options);
|
|
1536
1505
|
chunk7B52C2XE_js.__privateGet(this, _emitter5).emit("session.initialize.pending", { args: chunk7B52C2XE_js.__privateGet(this, _options) });
|
|
1537
1506
|
const response = yield chunk7B52C2XE_js.__privateGet(this, _inboxService2).initializeSession({
|
|
1538
1507
|
applicationIdentifier,
|
|
1539
|
-
|
|
1540
|
-
|
|
1508
|
+
subscriberHash,
|
|
1509
|
+
subscriber
|
|
1541
1510
|
});
|
|
1542
1511
|
chunk7B52C2XE_js.__privateGet(this, _emitter5).emit("session.initialize.resolved", { args: chunk7B52C2XE_js.__privateGet(this, _options), data: response });
|
|
1543
1512
|
} catch (error) {
|
|
@@ -1568,20 +1537,25 @@ var mapToNotification = ({
|
|
|
1568
1537
|
cta,
|
|
1569
1538
|
tags,
|
|
1570
1539
|
data,
|
|
1571
|
-
|
|
1540
|
+
workflow
|
|
1572
1541
|
}) => {
|
|
1573
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
1542
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1574
1543
|
const to = {
|
|
1575
|
-
id:
|
|
1544
|
+
id: subscriber == null ? void 0 : subscriber._id,
|
|
1545
|
+
subscriberId: subscriber == null ? void 0 : subscriber.subscriberId,
|
|
1576
1546
|
firstName: subscriber == null ? void 0 : subscriber.firstName,
|
|
1577
1547
|
lastName: subscriber == null ? void 0 : subscriber.lastName,
|
|
1578
1548
|
avatar: subscriber == null ? void 0 : subscriber.avatar,
|
|
1579
|
-
|
|
1549
|
+
locale: subscriber == null ? void 0 : subscriber.locale,
|
|
1550
|
+
data: subscriber == null ? void 0 : subscriber.data,
|
|
1551
|
+
timezone: subscriber == null ? void 0 : subscriber.timezone,
|
|
1552
|
+
email: subscriber == null ? void 0 : subscriber.email,
|
|
1553
|
+
phone: subscriber == null ? void 0 : subscriber.phone
|
|
1580
1554
|
};
|
|
1581
|
-
const primaryCta = (
|
|
1582
|
-
const secondaryCta = (
|
|
1583
|
-
const actionType = (
|
|
1584
|
-
const actionStatus = (
|
|
1555
|
+
const primaryCta = (_b = (_a = cta.action) == null ? void 0 : _a.buttons) == null ? void 0 : _b.find((button) => button.type === "primary" /* PRIMARY */);
|
|
1556
|
+
const secondaryCta = (_d = (_c = cta.action) == null ? void 0 : _c.buttons) == null ? void 0 : _d.find((button) => button.type === "secondary" /* SECONDARY */);
|
|
1557
|
+
const actionType = (_f = (_e = cta.action) == null ? void 0 : _e.result) == null ? void 0 : _f.type;
|
|
1558
|
+
const actionStatus = (_g = cta.action) == null ? void 0 : _g.status;
|
|
1585
1559
|
return {
|
|
1586
1560
|
id: _id,
|
|
1587
1561
|
subject,
|
|
@@ -1611,12 +1585,12 @@ var mapToNotification = ({
|
|
|
1611
1585
|
},
|
|
1612
1586
|
channelType: channel,
|
|
1613
1587
|
tags,
|
|
1614
|
-
redirect: ((
|
|
1588
|
+
redirect: ((_h = cta.data) == null ? void 0 : _h.url) ? {
|
|
1615
1589
|
url: cta.data.url,
|
|
1616
1590
|
target: cta.data.target
|
|
1617
1591
|
} : void 0,
|
|
1618
1592
|
data,
|
|
1619
|
-
|
|
1593
|
+
workflow
|
|
1620
1594
|
};
|
|
1621
1595
|
};
|
|
1622
1596
|
var _token, _emitter6, _socketIo, _socketUrl, _notificationReceived, _unseenCountChanged, _unreadCountChanged, _Socket_instances, initializeSocket_fn, handleConnectSocket_fn, handleDisconnectSocket_fn;
|
|
@@ -1749,8 +1723,8 @@ var Novu = class {
|
|
|
1749
1723
|
chunk7B52C2XE_js.__privateSet(this, _session, new Session(
|
|
1750
1724
|
{
|
|
1751
1725
|
applicationIdentifier: options.applicationIdentifier,
|
|
1752
|
-
|
|
1753
|
-
|
|
1726
|
+
subscriberHash: options.subscriberHash,
|
|
1727
|
+
subscriber: buildSubscriber(options)
|
|
1754
1728
|
},
|
|
1755
1729
|
chunk7B52C2XE_js.__privateGet(this, _inboxService3),
|
|
1756
1730
|
chunk7B52C2XE_js.__privateGet(this, _emitter7)
|
|
@@ -1794,17 +1768,20 @@ var Novu = class {
|
|
|
1794
1768
|
_emitter7 = new WeakMap();
|
|
1795
1769
|
_session = new WeakMap();
|
|
1796
1770
|
_inboxService3 = new WeakMap();
|
|
1771
|
+
function buildSubscriber(options) {
|
|
1772
|
+
let subscriberObj;
|
|
1773
|
+
if (options.subscriber) {
|
|
1774
|
+
subscriberObj = typeof options.subscriber === "string" ? { subscriberId: options.subscriber } : options.subscriber;
|
|
1775
|
+
} else {
|
|
1776
|
+
subscriberObj = { subscriberId: options.subscriberId };
|
|
1777
|
+
}
|
|
1778
|
+
return subscriberObj;
|
|
1779
|
+
}
|
|
1797
1780
|
|
|
1798
|
-
exports.ActionTypeEnum = ActionTypeEnum;
|
|
1799
1781
|
exports.ChannelType = ChannelType;
|
|
1800
|
-
exports.CtaType = CtaType;
|
|
1801
|
-
exports.NotificationActionStatus = NotificationActionStatus;
|
|
1802
|
-
exports.NotificationButton = NotificationButton;
|
|
1803
1782
|
exports.NotificationStatus = NotificationStatus;
|
|
1804
1783
|
exports.Novu = Novu;
|
|
1805
1784
|
exports.PreferenceLevel = PreferenceLevel;
|
|
1806
|
-
exports.PreferenceOverrideSource = PreferenceOverrideSource;
|
|
1807
|
-
exports.PreferenceOverrideSourceEnum = PreferenceOverrideSourceEnum;
|
|
1808
1785
|
exports.WebSocketEvent = WebSocketEvent;
|
|
1809
1786
|
exports.areTagsEqual = areTagsEqual;
|
|
1810
1787
|
exports.isSameFilter = isSameFilter;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NotificationFilter } from './novu-
|
|
2
|
-
export {
|
|
1
|
+
import { N as NotificationFilter } from './novu-jtIKy6p0.js';
|
|
2
|
+
export { C as ChannelPreference, c as ChannelType, E as EventHandler, a as Events, F as FiltersCountResponse, I as InboxNotification, L as ListNotificationsResponse, d as Notification, e as NotificationStatus, b as Novu, f as NovuError, g as NovuOptions, P as Preference, h as PreferenceLevel, i as PreferencesResponse, S as SocketEventNames, j as Subscriber, W as WebSocketEvent } from './novu-jtIKy6p0.js';
|
|
3
3
|
|
|
4
4
|
declare const areTagsEqual: (tags1?: string[], tags2?: string[]) => boolean;
|
|
5
5
|
declare const isSameFilter: (filter1: NotificationFilter, filter2: NotificationFilter) => boolean;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,59 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk4KMXR5HJ_js = require('./chunk-4KMXR5HJ.js');
|
|
4
4
|
require('./chunk-7B52C2XE.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
Object.defineProperty(exports, "ActionTypeEnum", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () { return chunk47NZ3DJQ_js.ActionTypeEnum; }
|
|
11
|
-
});
|
|
12
8
|
Object.defineProperty(exports, "ChannelType", {
|
|
13
9
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(exports, "CtaType", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () { return chunk47NZ3DJQ_js.CtaType; }
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(exports, "NotificationActionStatus", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () { return chunk47NZ3DJQ_js.NotificationActionStatus; }
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "NotificationButton", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () { return chunk47NZ3DJQ_js.NotificationButton; }
|
|
10
|
+
get: function () { return chunk4KMXR5HJ_js.ChannelType; }
|
|
27
11
|
});
|
|
28
12
|
Object.defineProperty(exports, "NotificationStatus", {
|
|
29
13
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunk4KMXR5HJ_js.NotificationStatus; }
|
|
31
15
|
});
|
|
32
16
|
Object.defineProperty(exports, "Novu", {
|
|
33
17
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunk4KMXR5HJ_js.Novu; }
|
|
35
19
|
});
|
|
36
20
|
Object.defineProperty(exports, "PreferenceLevel", {
|
|
37
21
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
39
|
-
});
|
|
40
|
-
Object.defineProperty(exports, "PreferenceOverrideSource", {
|
|
41
|
-
enumerable: true,
|
|
42
|
-
get: function () { return chunk47NZ3DJQ_js.PreferenceOverrideSource; }
|
|
43
|
-
});
|
|
44
|
-
Object.defineProperty(exports, "PreferenceOverrideSourceEnum", {
|
|
45
|
-
enumerable: true,
|
|
46
|
-
get: function () { return chunk47NZ3DJQ_js.PreferenceOverrideSourceEnum; }
|
|
22
|
+
get: function () { return chunk4KMXR5HJ_js.PreferenceLevel; }
|
|
47
23
|
});
|
|
48
24
|
Object.defineProperty(exports, "WebSocketEvent", {
|
|
49
25
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunk4KMXR5HJ_js.WebSocketEvent; }
|
|
51
27
|
});
|
|
52
28
|
Object.defineProperty(exports, "areTagsEqual", {
|
|
53
29
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunk4KMXR5HJ_js.areTagsEqual; }
|
|
55
31
|
});
|
|
56
32
|
Object.defineProperty(exports, "isSameFilter", {
|
|
57
33
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunk4KMXR5HJ_js.isSameFilter; }
|
|
59
35
|
});
|
|
@@ -66,17 +66,6 @@ declare enum NotificationStatus {
|
|
|
66
66
|
UNREAD = "unread",
|
|
67
67
|
UNSEEN = "unseen"
|
|
68
68
|
}
|
|
69
|
-
declare enum NotificationButton {
|
|
70
|
-
PRIMARY = "primary",
|
|
71
|
-
SECONDARY = "secondary"
|
|
72
|
-
}
|
|
73
|
-
declare enum NotificationActionStatus {
|
|
74
|
-
PENDING = "pending",
|
|
75
|
-
DONE = "done"
|
|
76
|
-
}
|
|
77
|
-
declare enum CtaType {
|
|
78
|
-
REDIRECT = "redirect"
|
|
79
|
-
}
|
|
80
69
|
declare enum PreferenceLevel {
|
|
81
70
|
GLOBAL = "global",
|
|
82
71
|
TEMPLATE = "template"
|
|
@@ -88,55 +77,49 @@ declare enum ChannelType {
|
|
|
88
77
|
CHAT = "chat",
|
|
89
78
|
PUSH = "push"
|
|
90
79
|
}
|
|
91
|
-
declare enum PreferenceOverrideSource {
|
|
92
|
-
SUBSCRIBER = "subscriber",
|
|
93
|
-
TEMPLATE = "template",
|
|
94
|
-
WORKFLOW_OVERRIDE = "workflowOverride"
|
|
95
|
-
}
|
|
96
80
|
declare enum WebSocketEvent {
|
|
97
81
|
RECEIVED = "notification_received",
|
|
98
82
|
UNREAD = "unread_count_changed",
|
|
99
83
|
UNSEEN = "unseen_count_changed"
|
|
100
84
|
}
|
|
101
|
-
declare enum ActionTypeEnum {
|
|
102
|
-
PRIMARY = "primary",
|
|
103
|
-
SECONDARY = "secondary"
|
|
104
|
-
}
|
|
105
85
|
type Session = {
|
|
106
86
|
token: string;
|
|
107
87
|
totalUnreadCount: number;
|
|
108
88
|
removeNovuBranding: boolean;
|
|
109
89
|
isDevelopmentMode: boolean;
|
|
110
90
|
};
|
|
111
|
-
type MessageButton = {
|
|
112
|
-
type: NotificationButton;
|
|
113
|
-
content: string;
|
|
114
|
-
resultContent?: string;
|
|
115
|
-
};
|
|
116
|
-
type MessageAction = {
|
|
117
|
-
status?: NotificationActionStatus;
|
|
118
|
-
buttons?: MessageButton[];
|
|
119
|
-
result: {
|
|
120
|
-
payload?: Record<string, unknown>;
|
|
121
|
-
type?: NotificationButton;
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
91
|
type Subscriber = {
|
|
125
|
-
id
|
|
92
|
+
id?: string;
|
|
93
|
+
subscriberId: string;
|
|
126
94
|
firstName?: string;
|
|
127
95
|
lastName?: string;
|
|
96
|
+
email?: string;
|
|
97
|
+
phone?: string;
|
|
128
98
|
avatar?: string;
|
|
129
|
-
|
|
99
|
+
locale?: string;
|
|
100
|
+
data?: Record<string, unknown>;
|
|
101
|
+
timezone?: string;
|
|
130
102
|
};
|
|
131
103
|
type Redirect = {
|
|
132
104
|
url: string;
|
|
133
105
|
target?: '_self' | '_blank' | '_parent' | '_top' | '_unfencedTop';
|
|
134
106
|
};
|
|
107
|
+
declare enum ActionTypeEnum {
|
|
108
|
+
PRIMARY = "primary",
|
|
109
|
+
SECONDARY = "secondary"
|
|
110
|
+
}
|
|
135
111
|
type Action = {
|
|
136
112
|
label: string;
|
|
137
113
|
isCompleted: boolean;
|
|
138
114
|
redirect?: Redirect;
|
|
139
115
|
};
|
|
116
|
+
type Workflow = {
|
|
117
|
+
id: string;
|
|
118
|
+
identifier: string;
|
|
119
|
+
name: string;
|
|
120
|
+
critical: boolean;
|
|
121
|
+
tags?: string[];
|
|
122
|
+
};
|
|
140
123
|
type InboxNotification = {
|
|
141
124
|
id: string;
|
|
142
125
|
subject?: string;
|
|
@@ -154,20 +137,13 @@ type InboxNotification = {
|
|
|
154
137
|
tags?: string[];
|
|
155
138
|
data?: NotificationData;
|
|
156
139
|
redirect?: Redirect;
|
|
157
|
-
|
|
140
|
+
workflow?: Workflow;
|
|
158
141
|
};
|
|
159
142
|
type NotificationFilter = {
|
|
160
143
|
tags?: string[];
|
|
161
144
|
read?: boolean;
|
|
162
145
|
archived?: boolean;
|
|
163
146
|
};
|
|
164
|
-
type Workflow = {
|
|
165
|
-
id: string;
|
|
166
|
-
identifier: string;
|
|
167
|
-
name: string;
|
|
168
|
-
critical: boolean;
|
|
169
|
-
tags?: string[];
|
|
170
|
-
};
|
|
171
147
|
type ChannelPreference = {
|
|
172
148
|
email?: boolean;
|
|
173
149
|
sms?: boolean;
|
|
@@ -175,13 +151,6 @@ type ChannelPreference = {
|
|
|
175
151
|
chat?: boolean;
|
|
176
152
|
push?: boolean;
|
|
177
153
|
};
|
|
178
|
-
type PaginatedResponse<T = unknown> = {
|
|
179
|
-
data: T[];
|
|
180
|
-
hasMore: boolean;
|
|
181
|
-
totalCount: number;
|
|
182
|
-
pageSize: number;
|
|
183
|
-
page: number;
|
|
184
|
-
};
|
|
185
154
|
type PreferencesResponse = {
|
|
186
155
|
level: PreferenceLevel;
|
|
187
156
|
enabled: boolean;
|
|
@@ -198,23 +167,28 @@ type IPreferenceOverride = {
|
|
|
198
167
|
channel: ChannelType;
|
|
199
168
|
source: PreferenceOverrideSourceEnum;
|
|
200
169
|
};
|
|
201
|
-
type TODO = any;
|
|
202
170
|
type Result<D = undefined, E = NovuError> = Promise<{
|
|
203
171
|
data?: D;
|
|
204
172
|
error?: E;
|
|
205
173
|
}>;
|
|
206
174
|
type NovuOptions = {
|
|
207
|
-
applicationIdentifier: string;
|
|
208
|
-
subscriberId: string;
|
|
209
|
-
subscriberHash?: string;
|
|
210
175
|
/** @deprecated Use apiUrl instead */
|
|
211
176
|
backendUrl?: string;
|
|
177
|
+
/** @internal Should be used internally for testing purposes */
|
|
178
|
+
__userAgent?: string;
|
|
179
|
+
applicationIdentifier: string;
|
|
180
|
+
subscriberHash?: string;
|
|
212
181
|
apiUrl?: string;
|
|
213
182
|
socketUrl?: string;
|
|
214
183
|
useCache?: boolean;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
184
|
+
} & ({
|
|
185
|
+
/** @deprecated Use subscriber prop instead */
|
|
186
|
+
subscriberId: string;
|
|
187
|
+
subscriber?: never;
|
|
188
|
+
} | {
|
|
189
|
+
subscriber: Subscriber | string;
|
|
190
|
+
subscriberId?: never;
|
|
191
|
+
});
|
|
218
192
|
type Prettify<T> = {
|
|
219
193
|
[K in keyof T]: T[K];
|
|
220
194
|
} & {};
|
|
@@ -230,10 +204,10 @@ declare class InboxService {
|
|
|
230
204
|
#private;
|
|
231
205
|
isSessionInitialized: boolean;
|
|
232
206
|
constructor(options?: InboxServiceOptions);
|
|
233
|
-
initializeSession({ applicationIdentifier,
|
|
207
|
+
initializeSession({ applicationIdentifier, subscriberHash, subscriber, }: {
|
|
234
208
|
applicationIdentifier: string;
|
|
235
|
-
subscriberId: string;
|
|
236
209
|
subscriberHash?: string;
|
|
210
|
+
subscriber: Subscriber;
|
|
237
211
|
}): Promise<Session>;
|
|
238
212
|
fetchNotifications({ after, archived, limit, offset, read, tags, }: {
|
|
239
213
|
tags?: string[];
|
|
@@ -319,7 +293,7 @@ declare class Notification implements Pick<NovuEventEmitter, 'on'>, InboxNotific
|
|
|
319
293
|
readonly tags: InboxNotification['tags'];
|
|
320
294
|
readonly redirect: InboxNotification['redirect'];
|
|
321
295
|
readonly data?: InboxNotification['data'];
|
|
322
|
-
readonly
|
|
296
|
+
readonly workflow?: InboxNotification['workflow'];
|
|
323
297
|
constructor(notification: InboxNotification, emitter: NovuEventEmitter, inboxService: InboxService);
|
|
324
298
|
read(): Result<Notification>;
|
|
325
299
|
unread(): Result<Notification>;
|
|
@@ -453,7 +427,7 @@ declare class Notifications extends BaseModule {
|
|
|
453
427
|
|
|
454
428
|
type InitializeSessionArgs = {
|
|
455
429
|
applicationIdentifier: string;
|
|
456
|
-
|
|
430
|
+
subscriber: Subscriber;
|
|
457
431
|
subscriberHash?: string;
|
|
458
432
|
};
|
|
459
433
|
|
|
@@ -582,4 +556,4 @@ declare class Novu implements Pick<NovuEventEmitter, 'on'> {
|
|
|
582
556
|
constructor(options: NovuOptions);
|
|
583
557
|
}
|
|
584
558
|
|
|
585
|
-
export {
|
|
559
|
+
export { type ChannelPreference as C, type EventHandler as E, type FiltersCountResponse as F, type InboxNotification as I, type ListNotificationsResponse as L, type NotificationFilter as N, Preference as P, type SocketEventNames as S, WebSocketEvent as W, type Events as a, Novu as b, ChannelType as c, Notification as d, NotificationStatus as e, NovuError as f, type NovuOptions as g, PreferenceLevel as h, type PreferencesResponse as i, type Subscriber as j };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as Notification, N as NotificationFilter, g as NovuOptions, b as Novu } from './novu-jtIKy6p0.js';
|
|
2
2
|
|
|
3
3
|
declare const appearanceKeys: readonly ["button", "icon", "popoverContent", "popoverTrigger", "dropdownContent", "dropdownTrigger", "dropdownItem", "dropdownItemLabel", "dropdownItemLabelContainer", "dropdownItemLeft__icon", "dropdownItemRight__icon", "dropdownItem__icon", "collapsible", "tooltipContent", "tooltipTrigger", "back__button", "skeletonText", "skeletonAvatar", "skeletonSwitch", "skeletonSwitchThumb", "tabsRoot", "tabsList", "tabsContent", "tabsTrigger", "dots", "root", "bellIcon", "bellContainer", "bellDot", "preferences__button", "preferencesContainer", "inboxHeader", "loading", "inboxContent", "inbox__popoverTrigger", "inbox__popoverContent", "notificationListContainer", "notificationList", "notificationListEmptyNoticeContainer", "notificationListEmptyNoticeOverlay", "notificationListEmptyNoticeIcon", "notificationListEmptyNotice", "notificationList__skeleton", "notificationList__skeletonContent", "notificationList__skeletonItem", "notificationList__skeletonAvatar", "notificationList__skeletonText", "notificationListNewNotificationsNotice__button", "notification", "notificationContent", "notificationTextContainer", "notificationDot", "notificationSubject", "notificationSubject__strong", "notificationBody", "notificationBody__strong", "notificationBodyContainer", "notificationImage", "notificationImageLoadingFallback", "notificationDate", "notificationDateActionsContainer", "notificationDefaultActions", "notificationCustomActions", "notificationPrimaryAction__button", "notificationSecondaryAction__button", "notificationRead__button", "notificationUnread__button", "notificationArchive__button", "notificationUnarchive__button", "notificationRead__icon", "notificationUnread__icon", "notificationArchive__icon", "notificationUnarchive__icon", "notificationsTabs__tabsRoot", "notificationsTabs__tabsList", "notificationsTabs__tabsContent", "notificationsTabs__tabsTrigger", "notificationsTabsTriggerLabel", "notificationsTabsTriggerCount", "inboxStatus__title", "inboxStatus__dropdownTrigger", "inboxStatus__dropdownContent", "inboxStatus__dropdownItem", "inboxStatus__dropdownItemLabel", "inboxStatus__dropdownItemLabelContainer", "inboxStatus__dropdownItemLeft__icon", "inboxStatus__dropdownItemRight__icon", "inboxStatus__dropdownItem__icon", "inboxStatus__dropdownItemCheck__icon", "moreActionsContainer", "moreActions__dropdownTrigger", "moreActions__dropdownContent", "moreActions__dropdownItem", "moreActions__dropdownItemLabel", "moreActions__dropdownItemLeft__icon", "moreActions__dots", "moreTabs__button", "moreTabs__icon", "moreTabs__dropdownTrigger", "moreTabs__dropdownContent", "moreTabs__dropdownItem", "moreTabs__dropdownItemLabel", "moreTabs__dropdownItemRight__icon", "workflowContainer", "workflowLabel", "workflowLabelHeader", "workflowLabelContainer", "workflowContainerDisabledNotice", "workflowLabelDisabled__icon", "workflowContainerRight__icon", "workflowArrow__icon", "workflowDescription", "channelContainer", "channelIconContainer", "channel__icon", "channelsContainerCollapsible", "channelsContainer", "channelLabel", "channelLabelContainer", "channelName", "channelSwitchContainer", "channelSwitch", "channelSwitchThumb", "preferencesHeader", "preferencesHeader__back__button", "preferencesHeader__back__button__icon", "preferencesHeader__title", "preferencesHeader__icon", "preferencesListEmptyNoticeContainer", "preferencesListEmptyNotice", "preferencesList__skeleton", "preferencesList__skeletonContent", "preferencesList__skeletonItem", "preferencesList__skeletonIcon", "preferencesList__skeletonSwitch", "preferencesList__skeletonSwitchThumb", "preferencesList__skeletonText", "strong"];
|
|
4
4
|
|
|
@@ -100,4 +100,4 @@ declare enum NotificationStatus {
|
|
|
100
100
|
}
|
|
101
101
|
type PreferencesFilter = Pick<NotificationFilter, 'tags'>;
|
|
102
102
|
|
|
103
|
-
export { type Appearance as A, type BellRenderer as B, type
|
|
103
|
+
export { type Appearance as A, type BellRenderer as B, type Elements as E, type Localization as L, type NotificationClickHandler as N, type PreferencesFilter as P, type RouterPush as R, type SubjectRenderer as S, type Tab as T, type Variables as V, type NotificationActionClickHandler as a, type NotificationRenderer as b, type BodyRenderer as c, type NovuProviderProps as d, type BaseNovuProviderProps as e, type AppearanceKey as f, type ElementStyles as g, type LocalizationKey as h, NotificationStatus as i, type Theme as j };
|
package/dist/cjs/ui/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import { B as BellRenderer, N as NotificationClickHandler, a as NotificationActionClickHandler, b as NotificationRenderer, S as SubjectRenderer, c as BodyRenderer, d as NovuProviderProps, e as BaseNovuProviderProps, A as Appearance, L as Localization, T as Tab, P as PreferencesFilter, R as RouterPush } from '../types-
|
|
4
|
-
export { f as AppearanceKey,
|
|
1
|
+
import { g as NovuOptions } from '../novu-jtIKy6p0.js';
|
|
2
|
+
export { d as Notification } from '../novu-jtIKy6p0.js';
|
|
3
|
+
import { B as BellRenderer, N as NotificationClickHandler, a as NotificationActionClickHandler, b as NotificationRenderer, S as SubjectRenderer, c as BodyRenderer, d as NovuProviderProps, e as BaseNovuProviderProps, A as Appearance, L as Localization, T as Tab, P as PreferencesFilter, R as RouterPush } from '../types-qgZnJ8j8.js';
|
|
4
|
+
export { f as AppearanceKey, g as ElementStyles, E as Elements, h as LocalizationKey, i as NotificationStatus, V as Variables } from '../types-qgZnJ8j8.js';
|
|
5
5
|
import { Placement, OffsetOptions } from '@floating-ui/dom';
|
|
6
6
|
import * as solid_js from 'solid-js';
|
|
7
7
|
import { ComponentProps } from 'solid-js';
|
|
@@ -75,4 +75,4 @@ declare class NovuUI {
|
|
|
75
75
|
unmount(): void;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
export { Appearance,
|
|
78
|
+
export { Appearance, type BaseNovuUIOptions, BellRenderer, BodyRenderer, InboxPage, type InboxProps, Localization, NotificationActionClickHandler, NotificationClickHandler, NotificationRenderer, NovuProviderProps, NovuUI, type NovuUIOptions, PreferencesFilter, RouterPush, SubjectRenderer, Tab };
|