@streamlayer/feature-gamification 0.26.6 → 0.27.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/deepLink.d.ts +2 -1
- package/lib/deepLink.js +3 -2
- package/lib/gamification.js +8 -6
- package/lib/queries/index.d.ts +2 -2
- package/lib/queries/index.js +4 -0
- package/package.json +7 -7
package/lib/deepLink.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Transport } from '@streamlayer/sdk-web-api';
|
|
2
2
|
import { ReadableAtom } from 'nanostores';
|
|
3
|
-
export declare const deepLink: (transport: Transport, $eventId: ReadableAtom<string | undefined>) => {
|
|
3
|
+
export declare const deepLink: (transport: Transport, $eventId: ReadableAtom<string | undefined>, $userId: ReadableAtom<string | undefined>) => {
|
|
4
4
|
$store: import("@nanostores/query").FetcherStore<import("@streamlayer/sl-eslib/sdkSettings/client/client_pb").DeepLink | undefined, any>;
|
|
5
5
|
fetch: typeof fetch;
|
|
6
|
+
desktopLink: string;
|
|
6
7
|
};
|
package/lib/deepLink.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { $deepLink } from './queries/deepLink';
|
|
2
|
-
export const deepLink = (transport, $eventId) => {
|
|
2
|
+
export const deepLink = (transport, $eventId, $userId) => {
|
|
3
3
|
const $store = $deepLink(transport, [$eventId]);
|
|
4
|
-
|
|
4
|
+
const desktopLink = `${window.location.host + window.location.pathname}%23sl_eid=${$eventId.get()}&sl_uid=${$userId.get()}`;
|
|
5
|
+
return { $store, fetch, desktopLink };
|
|
5
6
|
};
|
package/lib/gamification.js
CHANGED
|
@@ -60,7 +60,7 @@ export class Gamification extends AbstractFeature {
|
|
|
60
60
|
this.closeFeature = instance.sdk.closeFeature;
|
|
61
61
|
this.openFeature = () => instance.sdk.openFeature(FeatureType.GAMES);
|
|
62
62
|
this.openedQuestion = this.background.openedQuestion;
|
|
63
|
-
this.deepLink = deepLink(this.transport, this.background.slStreamId);
|
|
63
|
+
this.deepLink = deepLink(this.transport, this.background.slStreamId, this.background.userId);
|
|
64
64
|
this.leaderboardList = leaderboard(this.transport, this.background.slStreamId);
|
|
65
65
|
this.status.subscribe((status) => {
|
|
66
66
|
if (status === FeatureStatus.Ready) {
|
|
@@ -84,7 +84,7 @@ export class Gamification extends AbstractFeature {
|
|
|
84
84
|
type: NotificationType.QUESTION,
|
|
85
85
|
action: () => question.data?.question && this.openQuestion(question.data.question.id),
|
|
86
86
|
close: () => question.data?.question && this.closeQuestion(question.data.question.id),
|
|
87
|
-
autoHideDuration: 1000 *
|
|
87
|
+
autoHideDuration: 1000 * 60,
|
|
88
88
|
id: this.background.getCurrentSessionId({ prefix: 'notification', entity: question.data.question.id }),
|
|
89
89
|
data: {
|
|
90
90
|
questionType: question.data.question.type,
|
|
@@ -114,7 +114,7 @@ export class Gamification extends AbstractFeature {
|
|
|
114
114
|
type: NotificationType.QUESTION,
|
|
115
115
|
action: () => question.data?.question && this.openQuestion(question.data.question.id),
|
|
116
116
|
close: () => question.data?.question && this.closeQuestion(question.data.question.id),
|
|
117
|
-
autoHideDuration: 1000 *
|
|
117
|
+
autoHideDuration: 1000 * 120,
|
|
118
118
|
id: this.background.getCurrentSessionId({ prefix: 'notification', entity: question.data.question.id }),
|
|
119
119
|
data: {
|
|
120
120
|
questionType: question.data.question.type,
|
|
@@ -141,7 +141,7 @@ export class Gamification extends AbstractFeature {
|
|
|
141
141
|
type: NotificationType.QUESTION,
|
|
142
142
|
action: () => question.data?.question && this.openQuestion(question.data.question.id),
|
|
143
143
|
close: () => question.data?.question && this.closeQuestion(question.data.question.id),
|
|
144
|
-
autoHideDuration: 1000 *
|
|
144
|
+
autoHideDuration: 1000 * 120,
|
|
145
145
|
id: this.background.getCurrentSessionId({ prefix: 'notification', entity: question.data.question.id }),
|
|
146
146
|
data: {
|
|
147
147
|
questionType: question.data.question.type,
|
|
@@ -210,11 +210,13 @@ export class Gamification extends AbstractFeature {
|
|
|
210
210
|
submitAnswer = async (questionId, answerId) => {
|
|
211
211
|
await actions.submitAnswer(this.transport, { questionId, answerId });
|
|
212
212
|
// Todo: add invalidate openedQuestion
|
|
213
|
-
this.feedList
|
|
213
|
+
this.feedList.invalidate();
|
|
214
|
+
this.userSummary.invalidate();
|
|
214
215
|
};
|
|
215
216
|
skipQuestion = async (questionId) => {
|
|
216
217
|
await actions.skipQuestion(this.transport, questionId);
|
|
217
|
-
this.feedList
|
|
218
|
+
this.feedList.invalidate();
|
|
219
|
+
this.userSummary.invalidate();
|
|
218
220
|
};
|
|
219
221
|
openQuestion = (questionId) => {
|
|
220
222
|
this.openFeature();
|
package/lib/queries/index.d.ts
CHANGED
|
@@ -326,8 +326,8 @@ export declare const questionSubscription: (questionId: string, transport: Trans
|
|
|
326
326
|
};
|
|
327
327
|
};
|
|
328
328
|
}, QuestionSubscriptionRequest, QuestionSubscriptionResponse, "subscription" | "votingSubscription" | "questionSubscription" | "feedSubscription", ((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) | ((request: import("@bufbuild/protobuf").PartialMessage<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedSubscriptionRequest>, messageCallback: (response: import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedSubscriptionResponse) => void, closeCallback: (error: import("@connectrpc/connect").ConnectError | undefined) => void, options?: import("@connectrpc/connect").CallOptions | undefined) => () => void)>;
|
|
329
|
-
export declare const getQuestionByUser: (questionId: string, transport: Transport) => Promise<import("
|
|
330
|
-
export declare const $questionByUser: ($questionId: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<import("
|
|
329
|
+
export declare const getQuestionByUser: (questionId: string, transport: Transport) => Promise<import("@streamlayer/sdk-web-types").ExtendedQuestion | undefined>;
|
|
330
|
+
export declare const $questionByUser: ($questionId: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<import("@streamlayer/sdk-web-types").ExtendedQuestion | undefined, any>;
|
|
331
331
|
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>;
|
|
332
332
|
export declare const $feedList: (slStreamId: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedItem[], any>;
|
|
333
333
|
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>;
|
package/lib/queries/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { QuestionStatus } from '@streamlayer/sdk-web-types';
|
|
1
2
|
import { atom } from 'nanostores';
|
|
2
3
|
import { Feed } from '@streamlayer/sl-eslib/interactive/feed/interactive.feed_connect';
|
|
3
4
|
export const $activeQuestion = (slStreamId, transport) => {
|
|
@@ -76,6 +77,9 @@ export const $feedList = (slStreamId, transport) => {
|
|
|
76
77
|
}
|
|
77
78
|
const res = await client.list({
|
|
78
79
|
eventId: eventId,
|
|
80
|
+
filter: {
|
|
81
|
+
statuses: [QuestionStatus.ACTIVE, QuestionStatus.RESOLVED],
|
|
82
|
+
},
|
|
79
83
|
});
|
|
80
84
|
return res.data;
|
|
81
85
|
},
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/feature-gamification",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@bufbuild/protobuf": "^1.4.2",
|
|
6
6
|
"@streamlayer/sl-eslib": "^5.53.6",
|
|
7
7
|
"@fastify/deepmerge": "*",
|
|
8
8
|
"nanostores": "^0.9.5",
|
|
9
|
-
"@streamlayer/sdk-web-api": "^0.0
|
|
10
|
-
"@streamlayer/sdk-web-core": "^0.0.
|
|
9
|
+
"@streamlayer/sdk-web-api": "^0.1.0",
|
|
10
|
+
"@streamlayer/sdk-web-core": "^0.0.5",
|
|
11
11
|
"@streamlayer/sdk-web-interfaces": "^0.0.1",
|
|
12
|
-
"@streamlayer/sdk-web-logger": "^0.0.
|
|
13
|
-
"@streamlayer/sdk-web-notifications": "^0.13.
|
|
14
|
-
"@streamlayer/sdk-web-
|
|
15
|
-
"@streamlayer/sdk-web-
|
|
12
|
+
"@streamlayer/sdk-web-logger": "^0.0.1",
|
|
13
|
+
"@streamlayer/sdk-web-notifications": "^0.13.4",
|
|
14
|
+
"@streamlayer/sdk-web-types": "^0.0.1",
|
|
15
|
+
"@streamlayer/sdk-web-storage": "^0.0.4"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"tslib": "^2.6.2"
|