@streamlayer/feature-gamification 1.5.0 → 1.5.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.
- package/lib/advertisement/index.js +10 -14
- package/package.json +8 -8
|
@@ -2,6 +2,7 @@ import { ApiStore, createMapStore, eventBus } from '@streamlayer/sdk-web-interfa
|
|
|
2
2
|
import { QuestionStatus } from '@streamlayer/sdk-web-types';
|
|
3
3
|
import { createLogger } from '@streamlayer/sdk-web-logger';
|
|
4
4
|
import { onMount } from 'nanostores';
|
|
5
|
+
import { NotificationEnabled } from '@streamlayer/sl-eslib/interactive/interactive.common_pb';
|
|
5
6
|
import { $promotionList, getPromotionDetail } from '../queries';
|
|
6
7
|
import { AdvertisementStorage } from './storage';
|
|
7
8
|
import { AdvertisementsQueue } from './queue';
|
|
@@ -43,6 +44,12 @@ export const advertisement = ($slStreamId, $feedSubscription, instance) => {
|
|
|
43
44
|
this.data.setKey('loading', true);
|
|
44
45
|
try {
|
|
45
46
|
const response = data || (await getPromotionDetail(advertisementId, transport));
|
|
47
|
+
instance.sdk.onAdvertisementActivate({
|
|
48
|
+
stage: 'activate',
|
|
49
|
+
id: advertisementId,
|
|
50
|
+
hasNotification: response?.notification?.enabled === NotificationEnabled.NOTIFICATION_ENABLED,
|
|
51
|
+
isShowed: !!storage.isShowed(advertisementId),
|
|
52
|
+
});
|
|
46
53
|
if (!response) {
|
|
47
54
|
this.data.setKey('error', new Error('No promotion found'));
|
|
48
55
|
}
|
|
@@ -98,11 +105,7 @@ export const advertisement = ($slStreamId, $feedSubscription, instance) => {
|
|
|
98
105
|
if (list.data) {
|
|
99
106
|
const last = list.data[list.data.length - 1];
|
|
100
107
|
if (last) {
|
|
101
|
-
|
|
102
|
-
stage: 'activate',
|
|
103
|
-
id: last.id,
|
|
104
|
-
isShowed: !!storage.isShowed(last.id),
|
|
105
|
-
});
|
|
108
|
+
show(last.id);
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
111
|
});
|
|
@@ -118,20 +121,13 @@ export const advertisement = ($slStreamId, $feedSubscription, instance) => {
|
|
|
118
121
|
return;
|
|
119
122
|
}
|
|
120
123
|
if (feedItem.status === QuestionStatus.RESOLVED) {
|
|
121
|
-
|
|
122
|
-
stage: 'deactivate',
|
|
123
|
-
id: feedItem.id,
|
|
124
|
-
});
|
|
124
|
+
hide(feedItem.id);
|
|
125
125
|
logger.debug({ feedItem }, 'resolved: %o');
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
if (feedItem.status === QuestionStatus.ACTIVE) {
|
|
129
129
|
logger.debug({ feedItem }, 'active: %o');
|
|
130
|
-
|
|
131
|
-
stage: 'activate',
|
|
132
|
-
id: feedItem.id,
|
|
133
|
-
isShowed: !!storage.isShowed(feedItem.id),
|
|
134
|
-
});
|
|
130
|
+
show(feedItem.id);
|
|
135
131
|
return;
|
|
136
132
|
}
|
|
137
133
|
logger.debug({ feedItem }, 'skip: %o');
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/feature-gamification",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@bufbuild/protobuf": "^1.10.0",
|
|
6
6
|
"@fastify/deepmerge": "^2.0.0",
|
|
7
7
|
"@streamlayer/sl-eslib": "^5.122.0",
|
|
8
8
|
"nanostores": "^0.10.3",
|
|
9
|
-
"@streamlayer/sdk-web-api": "^1.3.
|
|
10
|
-
"@streamlayer/sdk-web-core": "^1.2.
|
|
11
|
-
"@streamlayer/sdk-web-interfaces": "^1.1.
|
|
12
|
-
"@streamlayer/sdk-web-logger": "^1.0.
|
|
13
|
-
"@streamlayer/sdk-web-notifications": "^1.1.
|
|
14
|
-
"@streamlayer/sdk-web-storage": "^1.0.
|
|
15
|
-
"@streamlayer/sdk-web-types": "^1.4.
|
|
9
|
+
"@streamlayer/sdk-web-api": "^1.3.5",
|
|
10
|
+
"@streamlayer/sdk-web-core": "^1.2.5",
|
|
11
|
+
"@streamlayer/sdk-web-interfaces": "^1.1.9",
|
|
12
|
+
"@streamlayer/sdk-web-logger": "^1.0.14",
|
|
13
|
+
"@streamlayer/sdk-web-notifications": "^1.1.9",
|
|
14
|
+
"@streamlayer/sdk-web-storage": "^1.0.14",
|
|
15
|
+
"@streamlayer/sdk-web-types": "^1.4.2"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"tslib": "^2.7.0"
|