@glissandoo/lib 1.1.1 → 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";
@@ -42,7 +42,9 @@ export default class Communication extends Model<CommunicationData> {
42
42
  alt: string;
43
43
  };
44
44
  get editedAt(): FirebaseFirestore.Timestamp | null;
45
+ /** @deprecated use reactions */
45
46
  get totalClaps(): number;
47
+ get reactions(): Record<string, number>;
46
48
  get totalViews(): number;
47
49
  get isServer(): boolean;
48
50
  getRecipient: (userId: string) => import("./types").CommunicationRecipientData | null;
@@ -127,11 +127,15 @@ class Communication extends Model_1.default {
127
127
  get editedAt() {
128
128
  return this.data.editedAt || null;
129
129
  }
130
+ /** @deprecated use reactions */
130
131
  get totalClaps() {
131
132
  return this.listRecipients
132
133
  .map((recipient) => recipient.claps || 0)
133
134
  .reduce((acc, current) => acc + current, 0);
134
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
+ }
135
139
  get totalViews() {
136
140
  return this.listRecipients
137
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",