@streamlayer/feature-gamification 0.16.0 → 0.17.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 +2 -2
- package/lib/gamification.js +4 -7
- package/lib/queries/index.d.ts +1 -1
- package/lib/queries/index.js +1 -1
- package/package.json +2 -2
package/lib/gamification.d.ts
CHANGED
|
@@ -33,11 +33,11 @@ export declare class Gamification extends AbstractFeature<'games', PlainMessage<
|
|
|
33
33
|
/** user statistics (leaderboard panel) */
|
|
34
34
|
userSummary: ApiStore<GetApiResponseType<typeof queries.$userSummary>>;
|
|
35
35
|
/** questions list (pick history) */
|
|
36
|
-
questions
|
|
36
|
+
questions: ApiStore<GetApiResponseType<typeof queries.$pickHistory>>;
|
|
37
37
|
/** pinned leaderboard id */
|
|
38
38
|
leaderboardId: WritableAtom<string | undefined>;
|
|
39
39
|
/** leaderboard list */
|
|
40
|
-
leaderboardList
|
|
40
|
+
leaderboardList: ApiStore<GetApiResponseType<typeof queries.$leaderboardList>>;
|
|
41
41
|
/** onboarding status */
|
|
42
42
|
onboardingStatus: WritableAtom<OnboardingStatus | undefined>;
|
|
43
43
|
/** opened question */
|
package/lib/gamification.js
CHANGED
|
@@ -58,6 +58,7 @@ export class Gamification extends AbstractFeature {
|
|
|
58
58
|
this.background = gamificationBackground(instance);
|
|
59
59
|
this.storage = new GamificationStorage();
|
|
60
60
|
this.userSummary = new ApiStore(queries.$userSummary(this.background.slStreamId, this.background.userId, instance.transport), 'gamification:userSummary');
|
|
61
|
+
this.questions = new ApiStore(queries.$pickHistory(this.background.slStreamId, instance.transport), 'gamification:questions');
|
|
61
62
|
this.leaderboardId = new SingleStore(createSingleStore(this.settings.getValue('pinnedLeaderboardId')), 'pinnedLeaderboardId').getStore();
|
|
62
63
|
this.onboardingStatus = new SingleStore(createSingleStore(OnboardingStatus.Unset), 'onboardingStatus').getStore();
|
|
63
64
|
this.notifications = instance.notifications;
|
|
@@ -70,6 +71,7 @@ export class Gamification extends AbstractFeature {
|
|
|
70
71
|
}
|
|
71
72
|
return undefined;
|
|
72
73
|
});
|
|
74
|
+
this.leaderboardList = new ApiStore(queries.$leaderboardList(this.background.slStreamId, this.leaderboardId, instance.transport), 'gamification:leaderboardList');
|
|
73
75
|
this.onboardingStatus.subscribe((onboardingStatus) => {
|
|
74
76
|
if (onboardingStatus === OnboardingStatus.Optional || OnboardingStatus.Required) {
|
|
75
77
|
this.showOnboardingInApp();
|
|
@@ -190,13 +192,8 @@ export class Gamification extends AbstractFeature {
|
|
|
190
192
|
};
|
|
191
193
|
connect = (transport) => {
|
|
192
194
|
this.userSummary.invalidate();
|
|
193
|
-
this.leaderboardList
|
|
194
|
-
|
|
195
|
-
this.questions = new ApiStore(queries.$pickHistory(this.background.slStreamId, transport), 'gamification:questions');
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
this.questions.invalidate();
|
|
199
|
-
}
|
|
195
|
+
this.leaderboardList.invalidate();
|
|
196
|
+
this.questions.invalidate();
|
|
200
197
|
this.background.feedSubscription.addListener('feed-subscription-prediction-close', (response) => {
|
|
201
198
|
window.requestAnimationFrame(async () => {
|
|
202
199
|
const question = response.data?.attributes?.question;
|
package/lib/queries/index.d.ts
CHANGED
|
@@ -292,7 +292,7 @@ export declare const questionSubscription: (questionId: string, transport: Trans
|
|
|
292
292
|
}, QuestionSubscriptionRequest, QuestionSubscriptionResponse, "subscription" | "votingSubscription" | "questionSubscription", ((request: import("@bufbuild/protobuf").PartialMessage<SubscriptionRequest>, messageCallback: (response: SubscriptionResponse) => void, closeCallback: (error: import("@connectrpc/connect").ConnectError | undefined) => void, options?: import("@connectrpc/connect").CallOptions | undefined) => () => void) | ((request: import("@bufbuild/protobuf").PartialMessage<VotingSubscriptionRequest>, messageCallback: (response: VotingSubscriptionResponse) => void, closeCallback: (error: import("@connectrpc/connect").ConnectError | undefined) => void, options?: import("@connectrpc/connect").CallOptions | undefined) => () => void) | ((request: import("@bufbuild/protobuf").PartialMessage<QuestionSubscriptionRequest>, messageCallback: (response: QuestionSubscriptionResponse) => void, closeCallback: (error: import("@connectrpc/connect").ConnectError | undefined) => void, options?: import("@connectrpc/connect").CallOptions | undefined) => () => void)>;
|
|
293
293
|
export declare const getQuestionByUser: (questionId: string, transport: Transport) => Promise<import("packages/sdk-web-types/lib").ExtendedQuestion | undefined>;
|
|
294
294
|
export declare const $questionByUser: ($questionId: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<import("packages/sdk-web-types/lib").ExtendedQuestion | undefined, any>;
|
|
295
|
-
export declare const $pickHistory: (slStreamId: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<(import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").PickHistory | undefined)[]
|
|
295
|
+
export declare const $pickHistory: (slStreamId: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<(import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").PickHistory | undefined)[], any>;
|
|
296
296
|
export declare const $insightHistory: (slStreamId: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<(import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").InsightHistory | undefined)[] | undefined, any>;
|
|
297
297
|
export { $userSummary, $leaderboardList } from './leaderboard';
|
|
298
298
|
export { $moderation } from './moderation';
|
package/lib/queries/index.js
CHANGED
|
@@ -58,7 +58,7 @@ export const $pickHistory = (slStreamId, transport) => {
|
|
|
58
58
|
return transport.nanoquery.createFetcherStore(queryKey, {
|
|
59
59
|
fetcher: async (_, __, eventId) => {
|
|
60
60
|
if (!eventId) {
|
|
61
|
-
return
|
|
61
|
+
return [];
|
|
62
62
|
}
|
|
63
63
|
const res = await client.pickHistory({
|
|
64
64
|
eventId: eventId,
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/feature-gamification",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@bufbuild/protobuf": "^1.4.2",
|
|
6
6
|
"@streamlayer/sl-eslib": "^5.45.1",
|
|
7
7
|
"nanostores": "^0.9.4",
|
|
8
8
|
"@streamlayer/sdk-web-interfaces": "^0.18.0",
|
|
9
|
-
"@streamlayer/sdk-web-core": "^0.
|
|
9
|
+
"@streamlayer/sdk-web-core": "^0.13.0",
|
|
10
10
|
"@streamlayer/sdk-web-api": "^0.0.2",
|
|
11
11
|
"@streamlayer/sdk-web-types": "^0.16.0",
|
|
12
12
|
"@streamlayer/sdk-web-storage": "^0.3.2",
|