@glissandoo/lib 1.1.0 → 1.1.2

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.
@@ -1,5 +1,6 @@
1
1
  export declare enum CollectionNames {
2
2
  Communication = "communication",
3
+ CommunicationComments = "comments",
3
4
  Notification = "notification",
4
5
  User = "user",
5
6
  UserGroups = "groups",
@@ -4,6 +4,7 @@ exports.CollectionNames = void 0;
4
4
  var CollectionNames;
5
5
  (function (CollectionNames) {
6
6
  CollectionNames["Communication"] = "communication";
7
+ CollectionNames["CommunicationComments"] = "comments";
7
8
  CollectionNames["Notification"] = "notification";
8
9
  CollectionNames["User"] = "user";
9
10
  CollectionNames["UserGroups"] = "groups";
@@ -18,6 +18,7 @@ export default class Communication extends Model<CommunicationData> {
18
18
  get listRecipients(): (import("./types").CommunicationRecipientData & {
19
19
  id: string;
20
20
  })[];
21
+ get commentsCount(): number;
21
22
  get type(): CommunicationType;
22
23
  get isPrivate(): boolean;
23
24
  get isPublic(): boolean;
@@ -41,7 +42,9 @@ export default class Communication extends Model<CommunicationData> {
41
42
  alt: string;
42
43
  };
43
44
  get editedAt(): FirebaseFirestore.Timestamp | null;
45
+ /** @deprecated use reactions */
44
46
  get totalClaps(): number;
47
+ get reactions(): Record<string, number>;
45
48
  get totalViews(): number;
46
49
  get isServer(): boolean;
47
50
  getRecipient: (userId: string) => import("./types").CommunicationRecipientData | null;
@@ -50,6 +50,9 @@ class Communication extends Model_1.default {
50
50
  get listRecipients() {
51
51
  return Object.keys(this.recipientsInfo).map((userId) => Object.assign(this.recipientsInfo[userId], { id: userId }));
52
52
  }
53
+ get commentsCount() {
54
+ return this.data.commentsCount || 0;
55
+ }
53
56
  get type() {
54
57
  return this.data.type;
55
58
  }
@@ -124,11 +127,15 @@ class Communication extends Model_1.default {
124
127
  get editedAt() {
125
128
  return this.data.editedAt || null;
126
129
  }
130
+ /** @deprecated use reactions */
127
131
  get totalClaps() {
128
132
  return this.listRecipients
129
133
  .map((recipient) => recipient.claps || 0)
130
134
  .reduce((acc, current) => acc + current, 0);
131
135
  }
136
+ get reactions() {
137
+ return this.listRecipients.reduce((acc, current) => (Object.assign(Object.assign({}, acc), (current.reaction && { [current.reaction]: (acc[current.reaction] || 0) + 1 }))), {});
138
+ }
132
139
  get totalViews() {
133
140
  return this.listRecipients
134
141
  .map((recipient) => recipient.countViews || 0)
@@ -23,10 +23,12 @@ export interface RichText {
23
23
  }
24
24
  export interface CommunicationRecipientData {
25
25
  sendedAt: Timestamp;
26
+ /** @deprecated use reaction */
26
27
  claps: number;
27
28
  viewedAt: Timestamp | null;
28
29
  lastViewedAt: Timestamp | null;
29
30
  countViews: number;
31
+ reaction: string | null;
30
32
  }
31
33
  export interface CommunicationData {
32
34
  title: string;
@@ -44,6 +46,7 @@ export interface CommunicationData {
44
46
  recipientsInfo: Record<string, CommunicationRecipientData>;
45
47
  thumbnailType: CommunicationThumbnailType | null;
46
48
  thumbnailURL: string | null;
49
+ commentsCount: number;
47
50
  avatar: (UserTinyData & {
48
51
  id: string;
49
52
  }) | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",