@replyke/core 7.0.0-beta.98 → 7.0.0-beta.99
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/helpers/addNotificationsMessages.js +17 -3
- package/dist/cjs/helpers/addNotificationsMessages.js.map +1 -1
- package/dist/cjs/interfaces/models/AppNotification.d.ts +68 -2
- package/dist/cjs/store/slices/appNotificationsSlice.d.ts +1226 -38
- package/dist/esm/helpers/addNotificationsMessages.js +17 -3
- package/dist/esm/helpers/addNotificationsMessages.js.map +1 -1
- package/dist/esm/interfaces/models/AppNotification.d.ts +68 -2
- package/dist/esm/store/slices/appNotificationsSlice.d.ts +1226 -38
- package/package.json +1 -1
|
@@ -21,6 +21,7 @@ var replaceTemplateVariables = function (template, variables) {
|
|
|
21
21
|
};
|
|
22
22
|
// Centralized logic to build variable replacements
|
|
23
23
|
var getReplacementVariables = function (notification) {
|
|
24
|
+
var _a;
|
|
24
25
|
return {
|
|
25
26
|
initiatorName: (0, getUserName_1.getUserName)({
|
|
26
27
|
id: notification.metadata.initiatorId,
|
|
@@ -37,6 +38,7 @@ var getReplacementVariables = function (notification) {
|
|
|
37
38
|
commentContent: notification.metadata.commentContent || "",
|
|
38
39
|
replyContent: notification.metadata.replyContent || "",
|
|
39
40
|
reactionType: notification.metadata.reactionType || "",
|
|
41
|
+
milestoneCount: ((_a = notification.metadata.milestoneCount) === null || _a === void 0 ? void 0 : _a.toString()) || "",
|
|
40
42
|
};
|
|
41
43
|
};
|
|
42
44
|
// Generalized message configuration function
|
|
@@ -52,7 +54,7 @@ var configureMessage = function (notification, defaultTitleTemplate, defaultCont
|
|
|
52
54
|
// Main notification mapping logic
|
|
53
55
|
exports.default = (function (notifications, notificationTemplates) {
|
|
54
56
|
return notifications.map(function (notification) {
|
|
55
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
57
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
56
58
|
if (notification.title)
|
|
57
59
|
return notification;
|
|
58
60
|
var title = "";
|
|
@@ -90,11 +92,23 @@ exports.default = (function (notifications, notificationTemplates) {
|
|
|
90
92
|
case "comment-reaction":
|
|
91
93
|
(_j = configureMessage(notification, "$initiatorUsername reacted $reactionType to your comment", "$commentContent", notificationTemplates === null || notificationTemplates === void 0 ? void 0 : notificationTemplates.commentReaction), title = _j.title, content = _j.content);
|
|
92
94
|
break;
|
|
95
|
+
case "entity-reaction-milestone-specific":
|
|
96
|
+
(_k = configureMessage(notification, "Your post reached $milestoneCount $reactionType reactions", "", notificationTemplates === null || notificationTemplates === void 0 ? void 0 : notificationTemplates.entityReactionMilestoneSpecific), title = _k.title, content = _k.content);
|
|
97
|
+
break;
|
|
98
|
+
case "entity-reaction-milestone-total":
|
|
99
|
+
(_l = configureMessage(notification, "Your post reached $milestoneCount reactions", "", notificationTemplates === null || notificationTemplates === void 0 ? void 0 : notificationTemplates.entityReactionMilestoneTotal), title = _l.title, content = _l.content);
|
|
100
|
+
break;
|
|
101
|
+
case "comment-reaction-milestone-specific":
|
|
102
|
+
(_m = configureMessage(notification, "Your comment reached $milestoneCount $reactionType reactions", "$commentContent", notificationTemplates === null || notificationTemplates === void 0 ? void 0 : notificationTemplates.commentReactionMilestoneSpecific), title = _m.title, content = _m.content);
|
|
103
|
+
break;
|
|
104
|
+
case "comment-reaction-milestone-total":
|
|
105
|
+
(_o = configureMessage(notification, "Your comment reached $milestoneCount reactions", "$commentContent", notificationTemplates === null || notificationTemplates === void 0 ? void 0 : notificationTemplates.commentReactionMilestoneTotal), title = _o.title, content = _o.content);
|
|
106
|
+
break;
|
|
93
107
|
case "connection-request":
|
|
94
|
-
(
|
|
108
|
+
(_p = configureMessage(notification, "$initiatorUsername sent you a connection request", "", notificationTemplates === null || notificationTemplates === void 0 ? void 0 : notificationTemplates.connectionRequest), title = _p.title, content = _p.content);
|
|
95
109
|
break;
|
|
96
110
|
case "connection-accepted":
|
|
97
|
-
(
|
|
111
|
+
(_q = configureMessage(notification, "$initiatorUsername accepted your connection request", "", notificationTemplates === null || notificationTemplates === void 0 ? void 0 : notificationTemplates.connectionAccepted), title = _q.title, content = _q.content);
|
|
98
112
|
break;
|
|
99
113
|
default:
|
|
100
114
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addNotificationsMessages.js","sourceRoot":"","sources":["../../../src/helpers/addNotificationsMessages.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAKA,6CAA4C;AAI5C,sDAAsD;AACtD,IAAM,wBAAwB,GAAG,UAC/B,QAAgB,EAChB,SAAiC;IAEjC,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CACrC,UAAC,MAAM,EAAE,EAAY;YAAX,GAAG,QAAA,EAAE,KAAK,QAAA;QAClB,OAAA,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,aAAM,GAAG,CAAE,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC;IAAnD,CAAmD,EACrD,QAAQ,CACT,CAAC;AACJ,CAAC,CAAC;AAEF,mDAAmD;AACnD,IAAM,uBAAuB,GAAG,UAAC,YAAiB
|
|
1
|
+
{"version":3,"file":"addNotificationsMessages.js","sourceRoot":"","sources":["../../../src/helpers/addNotificationsMessages.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAKA,6CAA4C;AAI5C,sDAAsD;AACtD,IAAM,wBAAwB,GAAG,UAC/B,QAAgB,EAChB,SAAiC;IAEjC,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CACrC,UAAC,MAAM,EAAE,EAAY;YAAX,GAAG,QAAA,EAAE,KAAK,QAAA;QAClB,OAAA,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,aAAM,GAAG,CAAE,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC;IAAnD,CAAmD,EACrD,QAAQ,CACT,CAAC;AACJ,CAAC,CAAC;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AAK,qBAAqB;gBACxB,CAAC,KAAqB,gBAAgB,CACpC,YAAY,EACZ,qDAAqD,EACrD,EAAE,EACF,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,kBAAkB,CAC1C,EALE,KAAK,WAAA,EAAE,OAAO,aAAA,CAKf,CAAC;gBACH,MAAM;YACR;gBACE,MAAM;QACV,CAAC;QAED,OAAO,sBACF,YAAY,KACf,KAAK,OAAA,EACL,OAAO,SAAA,GACsC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC,EAAC"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
interface MilestoneUser {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string | null | undefined;
|
|
4
|
+
username: string | null | undefined;
|
|
5
|
+
avatar: string | null | undefined;
|
|
6
|
+
}
|
|
7
|
+
type AppNotificationType = "system" | "entity-comment" | "comment-reply" | "entity-mention" | "comment-mention" | "entity-upvote" | "comment-upvote" | "entity-reaction" | "comment-reaction" | "entity-reaction-milestone-specific" | "entity-reaction-milestone-total" | "comment-reaction-milestone-specific" | "comment-reaction-milestone-total" | "new-follow" | "connection-request" | "connection-accepted";
|
|
2
8
|
interface BaseAppNotification {
|
|
3
9
|
id: string;
|
|
4
10
|
userId: string;
|
|
@@ -145,6 +151,62 @@ export interface CommentReactionNotification extends BaseAppNotification {
|
|
|
145
151
|
initiatorAvatar: string | null | undefined;
|
|
146
152
|
};
|
|
147
153
|
}
|
|
154
|
+
export interface EntityReactionMilestoneSpecificNotification extends BaseAppNotification {
|
|
155
|
+
type: "entity-reaction-milestone-specific";
|
|
156
|
+
action: "open-entity";
|
|
157
|
+
metadata: {
|
|
158
|
+
entityId: string;
|
|
159
|
+
entityShortId: string;
|
|
160
|
+
entityTitle: string | null | undefined;
|
|
161
|
+
entityContent: string | null | undefined;
|
|
162
|
+
reactionType: string;
|
|
163
|
+
milestoneCount: number;
|
|
164
|
+
lastThreeUsers: MilestoneUser[];
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
export interface EntityReactionMilestoneTotalNotification extends BaseAppNotification {
|
|
168
|
+
type: "entity-reaction-milestone-total";
|
|
169
|
+
action: "open-entity";
|
|
170
|
+
metadata: {
|
|
171
|
+
entityId: string;
|
|
172
|
+
entityShortId: string;
|
|
173
|
+
entityTitle: string | null | undefined;
|
|
174
|
+
entityContent: string | null | undefined;
|
|
175
|
+
milestoneCount: number;
|
|
176
|
+
reactionCounts: Record<string, number>;
|
|
177
|
+
lastThreeUsers: MilestoneUser[];
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
export interface CommentReactionMilestoneSpecificNotification extends BaseAppNotification {
|
|
181
|
+
type: "comment-reaction-milestone-specific";
|
|
182
|
+
action: "open-comment";
|
|
183
|
+
metadata: {
|
|
184
|
+
entityId: string;
|
|
185
|
+
entityShortId: string;
|
|
186
|
+
entityTitle: string | null | undefined;
|
|
187
|
+
entityContent: string | null | undefined;
|
|
188
|
+
commentId: string;
|
|
189
|
+
commentContent: string | null | undefined;
|
|
190
|
+
reactionType: string;
|
|
191
|
+
milestoneCount: number;
|
|
192
|
+
lastThreeUsers: MilestoneUser[];
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
export interface CommentReactionMilestoneTotalNotification extends BaseAppNotification {
|
|
196
|
+
type: "comment-reaction-milestone-total";
|
|
197
|
+
action: "open-comment";
|
|
198
|
+
metadata: {
|
|
199
|
+
entityId: string;
|
|
200
|
+
entityShortId: string;
|
|
201
|
+
entityTitle: string | null | undefined;
|
|
202
|
+
entityContent: string | null | undefined;
|
|
203
|
+
commentId: string;
|
|
204
|
+
commentContent: string | null | undefined;
|
|
205
|
+
milestoneCount: number;
|
|
206
|
+
reactionCounts: Record<string, number>;
|
|
207
|
+
lastThreeUsers: MilestoneUser[];
|
|
208
|
+
};
|
|
209
|
+
}
|
|
148
210
|
export interface NewFollowNotification extends BaseAppNotification {
|
|
149
211
|
type: "new-follow";
|
|
150
212
|
action: "open-profile";
|
|
@@ -177,7 +239,7 @@ export interface ConnectionAcceptedNotification extends BaseAppNotification {
|
|
|
177
239
|
initiatorAvatar: string | null | undefined;
|
|
178
240
|
};
|
|
179
241
|
}
|
|
180
|
-
export type UnifiedAppNotification = SystemNotification | EntityCommentNotification | CommentReplyNotification | EntityMentionNotification | CommentMentionNotification | EntityUpvoteNotification | CommentUpvoteNotification | EntityReactionNotification | CommentReactionNotification | NewFollowNotification | ConnectionRequestNotification | ConnectionAcceptedNotification;
|
|
242
|
+
export type UnifiedAppNotification = SystemNotification | EntityCommentNotification | CommentReplyNotification | EntityMentionNotification | CommentMentionNotification | EntityUpvoteNotification | CommentUpvoteNotification | EntityReactionNotification | CommentReactionNotification | EntityReactionMilestoneSpecificNotification | EntityReactionMilestoneTotalNotification | CommentReactionMilestoneSpecificNotification | CommentReactionMilestoneTotalNotification | NewFollowNotification | ConnectionRequestNotification | ConnectionAcceptedNotification;
|
|
181
243
|
export type NotificationTemplate = {
|
|
182
244
|
title?: string;
|
|
183
245
|
content?: string;
|
|
@@ -191,6 +253,10 @@ export type NotificationTemplates = {
|
|
|
191
253
|
commentUpvote: NotificationTemplate;
|
|
192
254
|
entityReaction: NotificationTemplate;
|
|
193
255
|
commentReaction: NotificationTemplate;
|
|
256
|
+
entityReactionMilestoneSpecific: NotificationTemplate;
|
|
257
|
+
entityReactionMilestoneTotal: NotificationTemplate;
|
|
258
|
+
commentReactionMilestoneSpecific: NotificationTemplate;
|
|
259
|
+
commentReactionMilestoneTotal: NotificationTemplate;
|
|
194
260
|
newFollow: NotificationTemplate;
|
|
195
261
|
connectionRequest: NotificationTemplate;
|
|
196
262
|
connectionAccepted: NotificationTemplate;
|