@streamlayer/feature-gamification 0.18.1 → 0.18.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/background.js +1 -3
- package/lib/gamification.d.ts +4 -1
- package/lib/gamification.js +2 -2
- package/package.json +8 -8
package/lib/background.js
CHANGED
|
@@ -57,15 +57,13 @@ export class GamificationBackground {
|
|
|
57
57
|
this.questionSubscription = queries.questionSubscription(questionId, instance.transport);
|
|
58
58
|
this.questionSubscription.addListener('feed-subscription-opened-question', (response) => {
|
|
59
59
|
window.requestAnimationFrame(() => {
|
|
60
|
-
this.openedQuestion
|
|
61
|
-
this.openedQuestion?.getStore().invalidate();
|
|
60
|
+
this.openedQuestion.getStore().mutate(response.data?.attributes?.question);
|
|
62
61
|
});
|
|
63
62
|
});
|
|
64
63
|
this.questionSubscription.connect();
|
|
65
64
|
}
|
|
66
65
|
else {
|
|
67
66
|
this.log.info('cleanup on close question');
|
|
68
|
-
this.openedQuestion?.getStore().mutate(undefined);
|
|
69
67
|
if (this.questionSubscription !== undefined) {
|
|
70
68
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
71
69
|
instance.transport.removeSubscription(this.questionSubscription);
|
package/lib/gamification.d.ts
CHANGED
|
@@ -41,7 +41,10 @@ export declare class Gamification extends AbstractFeature<'games', PlainMessage<
|
|
|
41
41
|
/** onboarding status */
|
|
42
42
|
onboardingStatus: WritableAtom<OnboardingStatus | undefined>;
|
|
43
43
|
/** opened question */
|
|
44
|
-
openedQuestion: ReturnType<typeof createComputedStore<
|
|
44
|
+
openedQuestion: ReturnType<typeof createComputedStore<{
|
|
45
|
+
loading: boolean;
|
|
46
|
+
data?: ExtendedQuestion;
|
|
47
|
+
}>>;
|
|
45
48
|
private notifications;
|
|
46
49
|
private transport;
|
|
47
50
|
private closeFeature;
|
package/lib/gamification.js
CHANGED
|
@@ -67,9 +67,9 @@ export class Gamification extends AbstractFeature {
|
|
|
67
67
|
this.openFeature = () => instance.sdk.openFeature(FeatureType.GAMES);
|
|
68
68
|
this.openedQuestion = createComputedStore(this.background.openedQuestion.getStore(), (openedQuestion) => {
|
|
69
69
|
if (openedQuestion.data?.type && GamificationQuestionTypes.has(openedQuestion.data.type)) {
|
|
70
|
-
return openedQuestion.data;
|
|
70
|
+
return { loading: false, data: openedQuestion.data };
|
|
71
71
|
}
|
|
72
|
-
return undefined;
|
|
72
|
+
return { loading: openedQuestion.loading, data: undefined };
|
|
73
73
|
});
|
|
74
74
|
this.leaderboardList = new ApiStore(queries.$leaderboardList(this.background.slStreamId, this.leaderboardId, instance.transport), 'gamification:leaderboardList');
|
|
75
75
|
this.onboardingStatus.subscribe((onboardingStatus) => {
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/feature-gamification",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@bufbuild/protobuf": "^1.4.2",
|
|
6
6
|
"@streamlayer/sl-eslib": "^5.52.0",
|
|
7
7
|
"nanostores": "^0.9.5",
|
|
8
|
-
"@streamlayer/sdk-web-interfaces": "^0.18.
|
|
9
|
-
"@streamlayer/sdk-web-core": "^0.15.
|
|
10
|
-
"@streamlayer/sdk-web-api": "^0.0.
|
|
11
|
-
"@streamlayer/sdk-web-types": "^0.16.
|
|
12
|
-
"@streamlayer/sdk-web-storage": "^0.3.
|
|
13
|
-
"@streamlayer/sdk-web-logger": "^0.5.
|
|
14
|
-
"@streamlayer/sdk-web-notifications": "^0.10.
|
|
8
|
+
"@streamlayer/sdk-web-interfaces": "^0.18.5",
|
|
9
|
+
"@streamlayer/sdk-web-core": "^0.15.1",
|
|
10
|
+
"@streamlayer/sdk-web-api": "^0.0.7",
|
|
11
|
+
"@streamlayer/sdk-web-types": "^0.16.5",
|
|
12
|
+
"@streamlayer/sdk-web-storage": "^0.3.7",
|
|
13
|
+
"@streamlayer/sdk-web-logger": "^0.5.7",
|
|
14
|
+
"@streamlayer/sdk-web-notifications": "^0.10.4"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"tslib": "^2.6.2"
|