@streamlayer/feature-gamification 0.20.0 → 0.21.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/lib/gamification.d.ts +5 -0
- package/lib/gamification.js +10 -0
- package/package.json +3 -3
package/lib/gamification.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { PlainMessage } from '@bufbuild/protobuf';
|
|
|
6
6
|
import { WritableAtom } from 'nanostores';
|
|
7
7
|
import * as queries from './queries';
|
|
8
8
|
import { leaderboard } from './leaderboard';
|
|
9
|
+
import { LeaderboardItem } from './queries/leaderboard';
|
|
9
10
|
import { GamificationBackground } from './';
|
|
10
11
|
/**
|
|
11
12
|
* Required: in-app should be displayed and questions not available
|
|
@@ -44,6 +45,8 @@ export declare class Gamification extends AbstractFeature<'games', PlainMessage<
|
|
|
44
45
|
onboardingStatus: WritableAtom<OnboardingStatus | undefined>;
|
|
45
46
|
/** opened question */
|
|
46
47
|
openedQuestion: GamificationBackground['openedQuestion'];
|
|
48
|
+
/** pinned leaderboard id */
|
|
49
|
+
openedUser: WritableAtom<LeaderboardItem | undefined>;
|
|
47
50
|
private notifications;
|
|
48
51
|
private transport;
|
|
49
52
|
private closeFeature;
|
|
@@ -66,4 +69,6 @@ export declare class Gamification extends AbstractFeature<'games', PlainMessage<
|
|
|
66
69
|
skipQuestion: (questionId: string) => Promise<void>;
|
|
67
70
|
openQuestion: (questionId: string) => void;
|
|
68
71
|
closeQuestion: (questionId?: string) => void;
|
|
72
|
+
openUser: (userId: string) => void;
|
|
73
|
+
closeUser: () => void;
|
|
69
74
|
}
|
package/lib/gamification.js
CHANGED
|
@@ -46,6 +46,8 @@ export class Gamification extends AbstractFeature {
|
|
|
46
46
|
onboardingStatus;
|
|
47
47
|
/** opened question */
|
|
48
48
|
openedQuestion;
|
|
49
|
+
/** pinned leaderboard id */
|
|
50
|
+
openedUser;
|
|
49
51
|
notifications;
|
|
50
52
|
transport;
|
|
51
53
|
closeFeature;
|
|
@@ -60,6 +62,7 @@ export class Gamification extends AbstractFeature {
|
|
|
60
62
|
this.storage = new GamificationStorage();
|
|
61
63
|
this.userSummary = new ApiStore(queries.$userSummary(this.background.slStreamId, this.background.userId, instance.transport), 'gamification:userSummary');
|
|
62
64
|
this.feedList = this.background.feedList;
|
|
65
|
+
this.openedUser = createSingleStore(undefined);
|
|
63
66
|
this.leaderboardId = new SingleStore(createSingleStore(this.settings.getValue('pinnedLeaderboardId')), 'pinnedLeaderboardId').getStore();
|
|
64
67
|
this.onboardingStatus = new SingleStore(createSingleStore(OnboardingStatus.Unset), 'onboardingStatus').getStore();
|
|
65
68
|
this.notifications = instance.notifications;
|
|
@@ -256,4 +259,11 @@ export class Gamification extends AbstractFeature {
|
|
|
256
259
|
closeQuestion = (questionId) => {
|
|
257
260
|
return this.background.closeQuestion(questionId);
|
|
258
261
|
};
|
|
262
|
+
openUser = (userId) => {
|
|
263
|
+
const user = this.leaderboardList.$store.get().data?.find((item) => item.userId === userId);
|
|
264
|
+
this.openedUser.set(user);
|
|
265
|
+
};
|
|
266
|
+
closeUser = () => {
|
|
267
|
+
this.openedUser.set(undefined);
|
|
268
|
+
};
|
|
259
269
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/feature-gamification",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@bufbuild/protobuf": "^1.4.2",
|
|
6
6
|
"@streamlayer/sl-eslib": "^5.53.5",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"@streamlayer/sdk-web-api": "^0.0.1",
|
|
11
11
|
"@streamlayer/sdk-web-types": "^0.18.0",
|
|
12
12
|
"@streamlayer/sdk-web-storage": "^0.3.10",
|
|
13
|
-
"@streamlayer/sdk-web-
|
|
14
|
-
"@streamlayer/sdk-web-
|
|
13
|
+
"@streamlayer/sdk-web-notifications": "^0.10.9",
|
|
14
|
+
"@streamlayer/sdk-web-logger": "^0.5.10"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"tslib": "^2.6.2"
|