@streamlayer/sdk-web-notifications 1.1.15 → 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.
Files changed (2) hide show
  1. package/lib/queue/index.js +17 -1
  2. package/package.json +5 -5
@@ -1,4 +1,4 @@
1
- import { createSingleStore } from '@streamlayer/sdk-web-interfaces';
1
+ import { createSingleStore, eventBus } from '@streamlayer/sdk-web-interfaces';
2
2
  import { createLogger } from '@streamlayer/sdk-web-logger';
3
3
  export class NotificationsQueue {
4
4
  notificationsList;
@@ -86,6 +86,13 @@ export class NotificationsQueue {
86
86
  this.logger.debug({ notificationId }, 'active queue tick skipped, notification not exist');
87
87
  return;
88
88
  }
89
+ eventBus.emit('notification', {
90
+ action: 'received',
91
+ payload: {
92
+ questionId: notification.data.questionId,
93
+ questionType: notification.data.questionType,
94
+ },
95
+ });
89
96
  const timeout = setTimeout(() => {
90
97
  const closureId = notificationId;
91
98
  const prevQueue = new Map(this.notificationsList.get());
@@ -120,6 +127,15 @@ export class NotificationsQueue {
120
127
  this.timeouts.delete(notificationId);
121
128
  }
122
129
  this.logger.debug({ notificationId }, 'notification hidden');
130
+ if (notification.hiding) {
131
+ eventBus.emit('notification', {
132
+ action: 'closed',
133
+ payload: {
134
+ questionId: notification.data.questionId,
135
+ questionType: notification.data.questionType,
136
+ },
137
+ });
138
+ }
123
139
  }, this.options.animationDelay || 0);
124
140
  this.timeouts.set(notificationId, timeout);
125
141
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/sdk-web-notifications",
3
- "version": "1.1.15",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "main": "./lib/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -9,10 +9,10 @@
9
9
  "package.json"
10
10
  ],
11
11
  "peerDependencies": {
12
- "@streamlayer/sdk-web-interfaces": "^1.1.15",
13
- "@streamlayer/sdk-web-logger": "^1.0.20",
14
- "@streamlayer/sdk-web-storage": "^1.0.20",
15
- "@streamlayer/sdk-web-types": "^1.6.3"
12
+ "@streamlayer/sdk-web-logger": "^1.0.21",
13
+ "@streamlayer/sdk-web-interfaces": "^1.2.0",
14
+ "@streamlayer/sdk-web-storage": "^1.0.21",
15
+ "@streamlayer/sdk-web-types": "^1.7.0"
16
16
  },
17
17
  "exports": {
18
18
  ".": {