@cocreate/notification 1.1.4 → 1.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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [1.2.0](https://github.com/CoCreate-app/CoCreate-notification/compare/v1.1.5...v1.2.0) (2023-10-17)
2
+
3
+
4
+ ### Features
5
+
6
+ * addUser() to define the user_id in clients ([94b420e](https://github.com/CoCreate-app/CoCreate-notification/commit/94b420edb17df9d51f6399e474b096b34b185efb))
7
+
8
+ ## [1.1.5](https://github.com/CoCreate-app/CoCreate-notification/compare/v1.1.4...v1.1.5) (2023-10-14)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * bump dependencies ([730f1f1](https://github.com/CoCreate-app/CoCreate-notification/commit/730f1f177e4ecde09e6350e4913885a90f029855))
14
+
1
15
  ## [1.1.4](https://github.com/CoCreate-app/CoCreate-notification/compare/v1.1.3...v1.1.4) (2023-10-09)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/notification",
3
- "version": "1.1.4",
3
+ "version": "1.2.0",
4
4
  "description": "Simple HTML5 & JavaScript component add, update & remove values in element's notification from input, select or js api. Easily configured using HTML5 notification and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "cocreate",
@@ -57,8 +57,8 @@
57
57
  "webpack-log": "^3.0.1"
58
58
  },
59
59
  "dependencies": {
60
- "@cocreate/actions": "^1.11.5",
61
- "@cocreate/socket-client": "^1.29.2",
60
+ "@cocreate/actions": "^1.11.6",
61
+ "@cocreate/socket-client": "^1.29.3",
62
62
  "web-push": "^3.6.6"
63
63
  }
64
64
  }
package/src/server.js CHANGED
@@ -16,10 +16,23 @@ class CoCreateNotification {
16
16
  this.socket.on('notification.publicKey', (data) => this.publicKey(data));
17
17
  this.socket.on('notification.subscription', (data) => this.subscription(data));
18
18
  this.socket.on('notification.send', (data) => this.send(data));
19
+ this.socket.on('notification.user', (data) => this.addUser(data));
19
20
  }
20
21
  }
21
22
 
22
23
  // Function to generate VAPID keys (public and private)
24
+ addUser(data) {
25
+ this.crud.send({
26
+ method: 'update.object',
27
+ array: 'clients',
28
+ object: {
29
+ _id: data.clientId,
30
+ user_id: data.user_id
31
+ },
32
+ organization_id: data.organization_id
33
+ })
34
+ }
35
+
23
36
  publicKey(data) {
24
37
  let subscription = this.subscriptions.has(data.clientId)
25
38
  if (!subscription) {