@streamlayer/feature-gamification 0.1.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/README.md +7 -0
- package/package.json +21 -0
- package/src/index.d.ts +37 -0
- package/src/index.js +147 -0
- package/src/index.js.map +1 -0
- package/src/queries/actions.d.ts +7 -0
- package/src/queries/actions.js +14 -0
- package/src/queries/actions.js.map +1 -0
- package/src/queries/index.d.ts +295 -0
- package/src/queries/index.js +71 -0
- package/src/queries/index.js.map +1 -0
- package/src/queries/leaderboard.d.ts +3 -0
- package/src/queries/leaderboard.js +17 -0
- package/src/queries/leaderboard.js.map +1 -0
- package/src/queries/moderation.d.ts +3 -0
- package/src/queries/moderation.js +13 -0
- package/src/queries/moderation.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@streamlayer/feature-gamification",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@streamlayer/sdk-web-interfaces": "workspace:^",
|
|
6
|
+
"@swc/helpers": "~0.5.2",
|
|
7
|
+
"@streamlayer/sdk-web-api": "workspace:^",
|
|
8
|
+
"@bufbuild/protobuf": "^1.3.1",
|
|
9
|
+
"@streamlayer/sl-eslib": "^5.34.4",
|
|
10
|
+
"nanostores": "^0.9.3",
|
|
11
|
+
"tslib": "^2.6.2",
|
|
12
|
+
"@streamlayer/sdk-web-types": "workspace:^"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "./src/index.js",
|
|
16
|
+
"typings": "./src/index.d.ts",
|
|
17
|
+
"files": [
|
|
18
|
+
"src/"
|
|
19
|
+
],
|
|
20
|
+
"module": "./src/index.js"
|
|
21
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AbstractFeature, ApiStore, FeatureSource, type FeatureProps } from '@streamlayer/sdk-web-interfaces';
|
|
2
|
+
import type { GetApiResponseType } from '@streamlayer/sdk-web-api';
|
|
3
|
+
type StreamLayerContext = any;
|
|
4
|
+
import type { PlainMessage } from '@bufbuild/protobuf';
|
|
5
|
+
import type { GamesOverlaySettings } from '@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb';
|
|
6
|
+
import { ReadableAtom, WritableAtom } from 'nanostores';
|
|
7
|
+
import * as queries from './queries';
|
|
8
|
+
export declare class Gamification extends AbstractFeature<'games', PlainMessage<GamesOverlaySettings>> {
|
|
9
|
+
userSummary?: ApiStore<GetApiResponseType<typeof queries.$userSummary>>;
|
|
10
|
+
questions?: ApiStore<GetApiResponseType<typeof queries.$pickHistory>>;
|
|
11
|
+
leaderboardId: WritableAtom<string | undefined>;
|
|
12
|
+
slStreamId: ReadableAtom<string | undefined>;
|
|
13
|
+
userId: ReadableAtom<string | undefined>;
|
|
14
|
+
organizationId: ReadableAtom<string | undefined>;
|
|
15
|
+
openedQuestionId: WritableAtom<string | undefined>;
|
|
16
|
+
openedQuestion?: ApiStore<GetApiResponseType<typeof queries.$questionByUser>>;
|
|
17
|
+
activeQuestionId?: ApiStore<GetApiResponseType<typeof queries.$activeQuestion>>;
|
|
18
|
+
moderationId: ReadableAtom<string | undefined>;
|
|
19
|
+
feedId: ReadableAtom<string | undefined>;
|
|
20
|
+
onbordingComplete: WritableAtom<boolean | undefined>;
|
|
21
|
+
private notifications;
|
|
22
|
+
private transport;
|
|
23
|
+
constructor(config: FeatureProps, source: FeatureSource, instance: StreamLayerContext);
|
|
24
|
+
getCurrentSessionIdPrefix: (opts: {
|
|
25
|
+
prefix?: string;
|
|
26
|
+
userId?: string;
|
|
27
|
+
eventId?: string;
|
|
28
|
+
organizationId?: string;
|
|
29
|
+
}) => string;
|
|
30
|
+
connect: (transport: StreamLayerContext['transport']) => void;
|
|
31
|
+
submitInplay: () => Promise<void>;
|
|
32
|
+
submitAnswer: (questionId: string, answerId: string) => Promise<void>;
|
|
33
|
+
skipQuestion: (questionId: string) => Promise<void>;
|
|
34
|
+
openQuestion: (questionId: string) => void;
|
|
35
|
+
closeQuestion: () => void;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
package/src/index.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { AbstractFeature, ApiStore, SingleStore, createSingleStore,
|
|
2
|
+
// type StreamLayerContext,
|
|
3
|
+
} from '@streamlayer/sdk-web-interfaces';
|
|
4
|
+
import { QuestionStatus } from '@streamlayer/sdk-web-types';
|
|
5
|
+
import * as queries from './queries';
|
|
6
|
+
import * as actions from './queries/actions';
|
|
7
|
+
export class Gamification extends AbstractFeature {
|
|
8
|
+
// user statistics (leaderboard panel)
|
|
9
|
+
userSummary;
|
|
10
|
+
// questions list (pick history)
|
|
11
|
+
questions;
|
|
12
|
+
// pinned leaderboard id
|
|
13
|
+
leaderboardId;
|
|
14
|
+
// sl event id
|
|
15
|
+
slStreamId;
|
|
16
|
+
// current user id
|
|
17
|
+
userId;
|
|
18
|
+
organizationId;
|
|
19
|
+
// opened question, using to download statistics
|
|
20
|
+
openedQuestionId;
|
|
21
|
+
// opened question statistics
|
|
22
|
+
openedQuestion;
|
|
23
|
+
// last active question in feed
|
|
24
|
+
activeQuestionId;
|
|
25
|
+
// moderation id
|
|
26
|
+
moderationId;
|
|
27
|
+
// feed id (deprecated?)
|
|
28
|
+
feedId;
|
|
29
|
+
// pinned leaderboard id
|
|
30
|
+
onbordingComplete;
|
|
31
|
+
notifications;
|
|
32
|
+
transport;
|
|
33
|
+
constructor(config, source, instance) {
|
|
34
|
+
super(config, source);
|
|
35
|
+
this.leaderboardId = new SingleStore(createSingleStore(this.settings.getValue('pinnedLeaderboardId')), 'pinnedLeaderboardId').getStore();
|
|
36
|
+
this.slStreamId = instance.stores.slStreamId.getAtomStore();
|
|
37
|
+
this.userId = instance.stores.user.getAtomStore();
|
|
38
|
+
this.organizationId = instance.stores.organizationSettings.getAtomStore();
|
|
39
|
+
this.moderationId = new SingleStore(createSingleStore(), 'moderationId').getStore();
|
|
40
|
+
this.feedId = new SingleStore(createSingleStore(), 'feedId').getStore();
|
|
41
|
+
this.onbordingComplete = new SingleStore(createSingleStore(false), 'onbordingComplete').getStore();
|
|
42
|
+
this.openedQuestionId = new SingleStore(createSingleStore(), 'openedQuestionId').getStore();
|
|
43
|
+
this.notifications = instance.notifications;
|
|
44
|
+
this.transport = instance.transport;
|
|
45
|
+
if (!this.userId.get()) {
|
|
46
|
+
this.userId.subscribe((userId) => {
|
|
47
|
+
if (userId) {
|
|
48
|
+
this.connect(instance.transport);
|
|
49
|
+
const cached = localStorage.getItem(`sl-onbording:${userId}:${this.slStreamId.get()}`);
|
|
50
|
+
this.onbordingComplete.set(!!cached);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this.connect(instance.transport);
|
|
56
|
+
const userId = this.userId.get();
|
|
57
|
+
const cached = localStorage.getItem(`sl-onbording:${userId}:${this.slStreamId.get()}`);
|
|
58
|
+
this.onbordingComplete.set(!!cached);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
getCurrentSessionIdPrefix = (opts) => {
|
|
62
|
+
const eventId = opts.eventId || this.slStreamId.get();
|
|
63
|
+
const userId = opts.userId || this.userId.get();
|
|
64
|
+
const organizationId = opts.organizationId || this.organizationId.get();
|
|
65
|
+
return `${organizationId}:${userId}:${eventId}:${opts.prefix || ''}`;
|
|
66
|
+
};
|
|
67
|
+
connect = (transport) => {
|
|
68
|
+
this.userSummary = new ApiStore(queries.$userSummary(this.slStreamId, this.userId, transport), 'gamification:userSummary');
|
|
69
|
+
this.questions = new ApiStore(queries.$pickHistory(this.slStreamId, transport), 'gamification:questions');
|
|
70
|
+
this.activeQuestionId = new ApiStore(queries.$activeQuestion(this.slStreamId, transport), 'gamification:activeQuestionId');
|
|
71
|
+
this.openedQuestion = new ApiStore(queries.$questionByUser(this.openedQuestionId, transport), 'gamification:activeQuestionId');
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
73
|
+
let questionSubscription = undefined;
|
|
74
|
+
this.openedQuestionId.listen((questionId) => {
|
|
75
|
+
if (questionId) {
|
|
76
|
+
questionSubscription = queries.questionSubscription(questionId, transport);
|
|
77
|
+
questionSubscription.addListener('feed-subscription-opened-question', (response) => {
|
|
78
|
+
window.requestAnimationFrame(() => {
|
|
79
|
+
this.openedQuestion?.getStore().mutate(response.data?.attributes?.question);
|
|
80
|
+
this.openedQuestion?.getStore().invalidate();
|
|
81
|
+
this.userSummary?.getStore().invalidate();
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
questionSubscription.connect();
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
console.log('cleanup on close question');
|
|
88
|
+
this.openedQuestion?.getStore().mutate(undefined);
|
|
89
|
+
if (questionSubscription !== undefined) {
|
|
90
|
+
transport.removeSubscription(questionSubscription);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
this.activeQuestionId?.listen((question) => {
|
|
95
|
+
if (question?.data?.notification?.title) {
|
|
96
|
+
if (question.data.question.status === QuestionStatus.ACTIVE) {
|
|
97
|
+
this.notifications.add({
|
|
98
|
+
id: this.getCurrentSessionIdPrefix({ prefix: `notification-id:${question.data.question.id}` }),
|
|
99
|
+
data: question.data,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const feedSubscription = queries.feedSubscription(this.slStreamId, transport);
|
|
105
|
+
feedSubscription.addListener('feed-subscription-active-question', (response) => {
|
|
106
|
+
window.requestAnimationFrame(() => {
|
|
107
|
+
const $activeQuestionId = this.activeQuestionId?.getStore();
|
|
108
|
+
if ($activeQuestionId) {
|
|
109
|
+
$activeQuestionId.mutate(response.data?.attributes);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
feedSubscription.addListener('feed-subscription-questions-list', () => {
|
|
114
|
+
window.requestAnimationFrame(() => {
|
|
115
|
+
this.questions?.invalidate();
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
// onboarding
|
|
120
|
+
submitInplay = async () => {
|
|
121
|
+
const eventId = this.slStreamId.get();
|
|
122
|
+
if (eventId) {
|
|
123
|
+
await actions.submitInplay(this.transport, eventId);
|
|
124
|
+
this.onbordingComplete.set(true);
|
|
125
|
+
localStorage.setItem(`sl-onbording:${this.userId.get()}:${eventId}`, 'true');
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
submitAnswer = async (questionId, answerId) => {
|
|
129
|
+
await actions.submitAnswer(this.transport, { questionId, answerId });
|
|
130
|
+
this.questions?.invalidate();
|
|
131
|
+
};
|
|
132
|
+
skipQuestion = async (questionId) => {
|
|
133
|
+
await actions.skipQuestion(this.transport, questionId);
|
|
134
|
+
this.questions?.invalidate();
|
|
135
|
+
};
|
|
136
|
+
openQuestion = (questionId) => {
|
|
137
|
+
this.openedQuestionId.set(questionId);
|
|
138
|
+
this.notifications.markAsViewed(this.getCurrentSessionIdPrefix({ prefix: `notification-id:${questionId}` }));
|
|
139
|
+
};
|
|
140
|
+
closeQuestion = () => {
|
|
141
|
+
this.notifications.markAsViewed(this.getCurrentSessionIdPrefix({ prefix: `notification-id:${this.openedQuestionId.get()}` }));
|
|
142
|
+
window.requestAnimationFrame(() => {
|
|
143
|
+
this.openedQuestionId.set(undefined);
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/feature-gamification/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,QAAQ,EAGR,WAAW,EACX,iBAAiB;AACjB,2BAA2B;EAC5B,MAAM,iCAAiC,CAAA;AAMxC,OAAO,EAAE,cAAc,EAAE,MAAM,4B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CAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAA;QACpE,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,CAAA;IAC9B,CAAC,CAAA;IAED,YAAY,GAAG,KAAK,EAAE,UAAkB,EAAE,EAAE;QAC1C,MAAM,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;QACtD,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,CAAA;IAC9B,CAAC,CAAA;IAED,YAAY,GAAG,CAAC,UAAkB,EAAE,EAAE;QACpC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;QACrC,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,yBAAyB,CAAC,EAAE,MAAM,EAAE,mBAAmB,UAAU,EAAE,EAAE,CAAC,CAAC,CAAA;IAC9G,CAAC,CAAA;IAED,aAAa,GAAG,GAAG,EAAE;QACnB,IAAI,CAAC,aAAa,CAAC,YAAY,CAC7B,IAAI,CAAC,yBAAyB,CAAC,EAAE,MAAM,EAAE,mBAAmB,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,CAC7F,CAAA;QAED,MAAM,CAAC,qBAAqB,CAAC,GAAG,EAAE;YAChC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QACtC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Transport } from '@streamlayer/sdk-web-api';
|
|
2
|
+
export declare const submitAnswer: (transport: Transport, data: {
|
|
3
|
+
questionId: string;
|
|
4
|
+
answerId: string;
|
|
5
|
+
}) => Promise<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SubmitAnswerResponse>;
|
|
6
|
+
export declare const submitInplay: (transport: Transport, eventId: string) => Promise<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SubmitInplayResponse>;
|
|
7
|
+
export declare const skipQuestion: (transport: Transport, questionId: string) => Promise<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SkipQuestionResponse>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Feed } from '@streamlayer/sl-eslib/interactive/feed/interactive.feed_connect';
|
|
2
|
+
export const submitAnswer = (transport, data) => {
|
|
3
|
+
const { client } = transport.createPromiseClient(Feed, { method: 'submitAnswer' });
|
|
4
|
+
return client.submitAnswer({ data });
|
|
5
|
+
};
|
|
6
|
+
export const submitInplay = (transport, eventId) => {
|
|
7
|
+
const { client } = transport.createPromiseClient(Feed, { method: 'submitInplay' });
|
|
8
|
+
return client.submitInplay({ data: { eventId: +eventId } });
|
|
9
|
+
};
|
|
10
|
+
export const skipQuestion = (transport, questionId) => {
|
|
11
|
+
const { client } = transport.createPromiseClient(Feed, { method: 'skipQuestion' });
|
|
12
|
+
return client.skipQuestion({ data: { id: questionId } });
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../../../packages/feature-gamification/src/queries/actions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,iEAAiE,CAAA;AAEtF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,SAAoB,EAAE,IAA8C,EAAE,EAAE;IACnG,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAA;IAElF,OAAO,MAAM,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;AACtC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,SAAoB,EAAE,OAAe,EAAE,EAAE;IACpE,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAA;IAElF,OAAO,MAAM,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;AAC7D,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,SAAoB,EAAE,UAAkB,EAAE,EAAE;IACvE,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAA;IAElF,OAAO,MAAM,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,CAAC,CAAA;AAC1D,CAAC,CAAA"}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import type { Transport } from '@streamlayer/sdk-web-api';
|
|
2
|
+
import { ReadableAtom } from 'nanostores';
|
|
3
|
+
import type { SubscriptionRequest, SubscriptionResponse, VotingSubscriptionRequest, VotingSubscriptionResponse, QuestionSubscriptionRequest, QuestionSubscriptionResponse } from '@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb';
|
|
4
|
+
export declare const $activeQuestion: (slStreamId: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedQuestion | undefined, any>;
|
|
5
|
+
export declare const feedSubscription: ($slStreamId: ReadableAtom<string | undefined>, transport: Transport) => import("../../../../dist/packages/sdk-web-api/src/grpc/subscription").ServerStreamSubscription<import("@bufbuild/protobuf").ServiceType, import("@bufbuild/protobuf").Message<import("@bufbuild/protobuf").AnyMessage>, import("@bufbuild/protobuf").Message<import("@bufbuild/protobuf").AnyMessage>, never, never> | import("../../../../dist/packages/sdk-web-api/src/grpc/subscription").ServerStreamSubscription<{
|
|
6
|
+
readonly typeName: "streamlayer.interactive.feed.Feed";
|
|
7
|
+
readonly methods: {
|
|
8
|
+
readonly get: {
|
|
9
|
+
readonly name: "Get";
|
|
10
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").GetRequest;
|
|
11
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").GetResponse;
|
|
12
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
13
|
+
};
|
|
14
|
+
readonly subscription: {
|
|
15
|
+
readonly name: "Subscription";
|
|
16
|
+
readonly I: typeof SubscriptionRequest;
|
|
17
|
+
readonly O: typeof SubscriptionResponse;
|
|
18
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.ServerStreaming;
|
|
19
|
+
};
|
|
20
|
+
readonly votingSubscription: {
|
|
21
|
+
readonly name: "VotingSubscription";
|
|
22
|
+
readonly I: typeof VotingSubscriptionRequest;
|
|
23
|
+
readonly O: typeof VotingSubscriptionResponse;
|
|
24
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.ServerStreaming;
|
|
25
|
+
};
|
|
26
|
+
readonly questionSubscription: {
|
|
27
|
+
readonly name: "QuestionSubscription";
|
|
28
|
+
readonly I: typeof QuestionSubscriptionRequest;
|
|
29
|
+
readonly O: typeof QuestionSubscriptionResponse;
|
|
30
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.ServerStreaming;
|
|
31
|
+
};
|
|
32
|
+
readonly questionByUser: {
|
|
33
|
+
readonly name: "QuestionByUser";
|
|
34
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").QuestionByUserRequest;
|
|
35
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").QuestionByUserResponse;
|
|
36
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
37
|
+
};
|
|
38
|
+
readonly syncQuestion: {
|
|
39
|
+
readonly name: "SyncQuestion";
|
|
40
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SyncQuestionRequest;
|
|
41
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SyncQuestionResponse;
|
|
42
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
43
|
+
};
|
|
44
|
+
readonly getQuestion: {
|
|
45
|
+
readonly name: "GetQuestion";
|
|
46
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").GetQuestionRequest;
|
|
47
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").GetQuestionResponse;
|
|
48
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
49
|
+
};
|
|
50
|
+
readonly questionDetail: {
|
|
51
|
+
readonly name: "QuestionDetail";
|
|
52
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").QuestionDetailRequest;
|
|
53
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").QuestionDetailResponse;
|
|
54
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
55
|
+
};
|
|
56
|
+
readonly submitAnswer: {
|
|
57
|
+
readonly name: "SubmitAnswer";
|
|
58
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SubmitAnswerRequest;
|
|
59
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SubmitAnswerResponse;
|
|
60
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
61
|
+
};
|
|
62
|
+
readonly submitInplay: {
|
|
63
|
+
readonly name: "SubmitInplay";
|
|
64
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SubmitInplayRequest;
|
|
65
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SubmitInplayResponse;
|
|
66
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
67
|
+
};
|
|
68
|
+
readonly skipQuestion: {
|
|
69
|
+
readonly name: "SkipQuestion";
|
|
70
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SkipQuestionRequest;
|
|
71
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SkipQuestionResponse;
|
|
72
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
73
|
+
};
|
|
74
|
+
readonly pickHistory: {
|
|
75
|
+
readonly name: "PickHistory";
|
|
76
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").PickHistoryRequest;
|
|
77
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").PickHistoryResponse;
|
|
78
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
79
|
+
};
|
|
80
|
+
readonly insightHistory: {
|
|
81
|
+
readonly name: "InsightHistory";
|
|
82
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").InsightHistoryRequest;
|
|
83
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").InsightHistoryResponse;
|
|
84
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
85
|
+
};
|
|
86
|
+
readonly tweetHistory: {
|
|
87
|
+
readonly name: "TweetHistory";
|
|
88
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").TweetHistoryRequest;
|
|
89
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").TweetHistoryResponse;
|
|
90
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
91
|
+
};
|
|
92
|
+
readonly promotionHistory: {
|
|
93
|
+
readonly name: "PromotionHistory";
|
|
94
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").PromotionHistoryRequest;
|
|
95
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").PromotionHistoryResponse;
|
|
96
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
}, SubscriptionRequest, SubscriptionResponse, "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)>;
|
|
100
|
+
export declare const votingSubscription: (params: {
|
|
101
|
+
questionId: string;
|
|
102
|
+
feedId: string;
|
|
103
|
+
}, transport: Transport) => import("../../../../dist/packages/sdk-web-api/src/grpc/subscription").ServerStreamSubscription<import("@bufbuild/protobuf").ServiceType, import("@bufbuild/protobuf").Message<import("@bufbuild/protobuf").AnyMessage>, import("@bufbuild/protobuf").Message<import("@bufbuild/protobuf").AnyMessage>, never, never> | import("../../../../dist/packages/sdk-web-api/src/grpc/subscription").ServerStreamSubscription<{
|
|
104
|
+
readonly typeName: "streamlayer.interactive.feed.Feed";
|
|
105
|
+
readonly methods: {
|
|
106
|
+
readonly get: {
|
|
107
|
+
readonly name: "Get";
|
|
108
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").GetRequest;
|
|
109
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").GetResponse;
|
|
110
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
111
|
+
};
|
|
112
|
+
readonly subscription: {
|
|
113
|
+
readonly name: "Subscription";
|
|
114
|
+
readonly I: typeof SubscriptionRequest;
|
|
115
|
+
readonly O: typeof SubscriptionResponse;
|
|
116
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.ServerStreaming;
|
|
117
|
+
};
|
|
118
|
+
readonly votingSubscription: {
|
|
119
|
+
readonly name: "VotingSubscription";
|
|
120
|
+
readonly I: typeof VotingSubscriptionRequest;
|
|
121
|
+
readonly O: typeof VotingSubscriptionResponse;
|
|
122
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.ServerStreaming;
|
|
123
|
+
};
|
|
124
|
+
readonly questionSubscription: {
|
|
125
|
+
readonly name: "QuestionSubscription";
|
|
126
|
+
readonly I: typeof QuestionSubscriptionRequest;
|
|
127
|
+
readonly O: typeof QuestionSubscriptionResponse;
|
|
128
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.ServerStreaming;
|
|
129
|
+
};
|
|
130
|
+
readonly questionByUser: {
|
|
131
|
+
readonly name: "QuestionByUser";
|
|
132
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").QuestionByUserRequest;
|
|
133
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").QuestionByUserResponse;
|
|
134
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
135
|
+
};
|
|
136
|
+
readonly syncQuestion: {
|
|
137
|
+
readonly name: "SyncQuestion";
|
|
138
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SyncQuestionRequest;
|
|
139
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SyncQuestionResponse;
|
|
140
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
141
|
+
};
|
|
142
|
+
readonly getQuestion: {
|
|
143
|
+
readonly name: "GetQuestion";
|
|
144
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").GetQuestionRequest;
|
|
145
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").GetQuestionResponse;
|
|
146
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
147
|
+
};
|
|
148
|
+
readonly questionDetail: {
|
|
149
|
+
readonly name: "QuestionDetail";
|
|
150
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").QuestionDetailRequest;
|
|
151
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").QuestionDetailResponse;
|
|
152
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
153
|
+
};
|
|
154
|
+
readonly submitAnswer: {
|
|
155
|
+
readonly name: "SubmitAnswer";
|
|
156
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SubmitAnswerRequest;
|
|
157
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SubmitAnswerResponse;
|
|
158
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
159
|
+
};
|
|
160
|
+
readonly submitInplay: {
|
|
161
|
+
readonly name: "SubmitInplay";
|
|
162
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SubmitInplayRequest;
|
|
163
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SubmitInplayResponse;
|
|
164
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
165
|
+
};
|
|
166
|
+
readonly skipQuestion: {
|
|
167
|
+
readonly name: "SkipQuestion";
|
|
168
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SkipQuestionRequest;
|
|
169
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SkipQuestionResponse;
|
|
170
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
171
|
+
};
|
|
172
|
+
readonly pickHistory: {
|
|
173
|
+
readonly name: "PickHistory";
|
|
174
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").PickHistoryRequest;
|
|
175
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").PickHistoryResponse;
|
|
176
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
177
|
+
};
|
|
178
|
+
readonly insightHistory: {
|
|
179
|
+
readonly name: "InsightHistory";
|
|
180
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").InsightHistoryRequest;
|
|
181
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").InsightHistoryResponse;
|
|
182
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
183
|
+
};
|
|
184
|
+
readonly tweetHistory: {
|
|
185
|
+
readonly name: "TweetHistory";
|
|
186
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").TweetHistoryRequest;
|
|
187
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").TweetHistoryResponse;
|
|
188
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
189
|
+
};
|
|
190
|
+
readonly promotionHistory: {
|
|
191
|
+
readonly name: "PromotionHistory";
|
|
192
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").PromotionHistoryRequest;
|
|
193
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").PromotionHistoryResponse;
|
|
194
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
}, VotingSubscriptionRequest, VotingSubscriptionResponse, "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)>;
|
|
198
|
+
export declare const questionSubscription: (questionId: string, transport: Transport) => import("../../../../dist/packages/sdk-web-api/src/grpc/subscription").ServerStreamSubscription<import("@bufbuild/protobuf").ServiceType, import("@bufbuild/protobuf").Message<import("@bufbuild/protobuf").AnyMessage>, import("@bufbuild/protobuf").Message<import("@bufbuild/protobuf").AnyMessage>, never, never> | import("../../../../dist/packages/sdk-web-api/src/grpc/subscription").ServerStreamSubscription<{
|
|
199
|
+
readonly typeName: "streamlayer.interactive.feed.Feed";
|
|
200
|
+
readonly methods: {
|
|
201
|
+
readonly get: {
|
|
202
|
+
readonly name: "Get";
|
|
203
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").GetRequest;
|
|
204
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").GetResponse;
|
|
205
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
206
|
+
};
|
|
207
|
+
readonly subscription: {
|
|
208
|
+
readonly name: "Subscription";
|
|
209
|
+
readonly I: typeof SubscriptionRequest;
|
|
210
|
+
readonly O: typeof SubscriptionResponse;
|
|
211
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.ServerStreaming;
|
|
212
|
+
};
|
|
213
|
+
readonly votingSubscription: {
|
|
214
|
+
readonly name: "VotingSubscription";
|
|
215
|
+
readonly I: typeof VotingSubscriptionRequest;
|
|
216
|
+
readonly O: typeof VotingSubscriptionResponse;
|
|
217
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.ServerStreaming;
|
|
218
|
+
};
|
|
219
|
+
readonly questionSubscription: {
|
|
220
|
+
readonly name: "QuestionSubscription";
|
|
221
|
+
readonly I: typeof QuestionSubscriptionRequest;
|
|
222
|
+
readonly O: typeof QuestionSubscriptionResponse;
|
|
223
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.ServerStreaming;
|
|
224
|
+
};
|
|
225
|
+
readonly questionByUser: {
|
|
226
|
+
readonly name: "QuestionByUser";
|
|
227
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").QuestionByUserRequest;
|
|
228
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").QuestionByUserResponse;
|
|
229
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
230
|
+
};
|
|
231
|
+
readonly syncQuestion: {
|
|
232
|
+
readonly name: "SyncQuestion";
|
|
233
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SyncQuestionRequest;
|
|
234
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SyncQuestionResponse;
|
|
235
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
236
|
+
};
|
|
237
|
+
readonly getQuestion: {
|
|
238
|
+
readonly name: "GetQuestion";
|
|
239
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").GetQuestionRequest;
|
|
240
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").GetQuestionResponse;
|
|
241
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
242
|
+
};
|
|
243
|
+
readonly questionDetail: {
|
|
244
|
+
readonly name: "QuestionDetail";
|
|
245
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").QuestionDetailRequest;
|
|
246
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").QuestionDetailResponse;
|
|
247
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
248
|
+
};
|
|
249
|
+
readonly submitAnswer: {
|
|
250
|
+
readonly name: "SubmitAnswer";
|
|
251
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SubmitAnswerRequest;
|
|
252
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SubmitAnswerResponse;
|
|
253
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
254
|
+
};
|
|
255
|
+
readonly submitInplay: {
|
|
256
|
+
readonly name: "SubmitInplay";
|
|
257
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SubmitInplayRequest;
|
|
258
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SubmitInplayResponse;
|
|
259
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
260
|
+
};
|
|
261
|
+
readonly skipQuestion: {
|
|
262
|
+
readonly name: "SkipQuestion";
|
|
263
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SkipQuestionRequest;
|
|
264
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").SkipQuestionResponse;
|
|
265
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
266
|
+
};
|
|
267
|
+
readonly pickHistory: {
|
|
268
|
+
readonly name: "PickHistory";
|
|
269
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").PickHistoryRequest;
|
|
270
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").PickHistoryResponse;
|
|
271
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
272
|
+
};
|
|
273
|
+
readonly insightHistory: {
|
|
274
|
+
readonly name: "InsightHistory";
|
|
275
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").InsightHistoryRequest;
|
|
276
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").InsightHistoryResponse;
|
|
277
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
278
|
+
};
|
|
279
|
+
readonly tweetHistory: {
|
|
280
|
+
readonly name: "TweetHistory";
|
|
281
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").TweetHistoryRequest;
|
|
282
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").TweetHistoryResponse;
|
|
283
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
284
|
+
};
|
|
285
|
+
readonly promotionHistory: {
|
|
286
|
+
readonly name: "PromotionHistory";
|
|
287
|
+
readonly I: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").PromotionHistoryRequest;
|
|
288
|
+
readonly O: typeof import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").PromotionHistoryResponse;
|
|
289
|
+
readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
|
|
290
|
+
};
|
|
291
|
+
};
|
|
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
|
+
export declare const $questionByUser: ($questionId: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<import("@streamlayer/sl-eslib/interactive/interactive.common_pb").ExtendedQuestion | undefined, any>;
|
|
294
|
+
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)[] | undefined, any>;
|
|
295
|
+
export { $userSummary } from './leaderboard';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { atom } from 'nanostores';
|
|
2
|
+
import { Feed } from '@streamlayer/sl-eslib/interactive/feed/interactive.feed_connect';
|
|
3
|
+
export const $activeQuestion = (slStreamId, transport) => {
|
|
4
|
+
const { client, queryKey } = transport.createPromiseClient(Feed, { method: 'syncQuestion', params: [slStreamId] });
|
|
5
|
+
return transport.nanoquery.createFetcherStore(queryKey, {
|
|
6
|
+
fetcher: async (_, __, id) => {
|
|
7
|
+
if (!id) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
const res = await client.syncQuestion({
|
|
11
|
+
filter: {
|
|
12
|
+
eventId: id,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
return res.data?.attributes;
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
export const feedSubscription = ($slStreamId, transport) => {
|
|
20
|
+
const { client } = transport.createCallbackClient(Feed);
|
|
21
|
+
const params = atom({ eventId: $slStreamId.get() || '', feedId: '' });
|
|
22
|
+
$slStreamId.subscribe((eventId = '') => {
|
|
23
|
+
params.set({ eventId, feedId: '' });
|
|
24
|
+
});
|
|
25
|
+
const subscription = transport.addSubscription(client.subscription, params, { name: 'feedSubscription' });
|
|
26
|
+
return subscription;
|
|
27
|
+
};
|
|
28
|
+
export const votingSubscription = (params, transport) => {
|
|
29
|
+
const { client } = transport.createCallbackClient(Feed);
|
|
30
|
+
const subscription = transport.addSubscription(client.votingSubscription, params, { name: 'votingSubscription', withStore: true });
|
|
31
|
+
return subscription;
|
|
32
|
+
};
|
|
33
|
+
export const questionSubscription = (questionId, transport) => {
|
|
34
|
+
// const { queryKeyStr } = transport.createPromiseClient(Feed, {
|
|
35
|
+
// method: 'questionByUser',
|
|
36
|
+
// params: [$params.get().questionId],
|
|
37
|
+
// })
|
|
38
|
+
const { client } = transport.createCallbackClient(Feed);
|
|
39
|
+
const subscription = transport.addSubscription(client.questionSubscription, { questionId }, { name: 'questionSubscription' });
|
|
40
|
+
// subscription.addListener('user-question-subscription', (response) => {
|
|
41
|
+
// transport.nanoquery.utils.mutateCache((key) => key === queryKeyStr, response)
|
|
42
|
+
// })
|
|
43
|
+
return subscription;
|
|
44
|
+
};
|
|
45
|
+
export const $questionByUser = ($questionId, transport) => {
|
|
46
|
+
const { client, queryKey } = transport.createPromiseClient(Feed, { method: 'questionByUser', params: [$questionId] });
|
|
47
|
+
return transport.nanoquery.createFetcherStore(queryKey, {
|
|
48
|
+
fetcher: async (_, __, questionId) => {
|
|
49
|
+
const res = await client.questionByUser({
|
|
50
|
+
questionId: questionId,
|
|
51
|
+
});
|
|
52
|
+
return res.data?.attributes?.question;
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
export const $pickHistory = (slStreamId, transport) => {
|
|
57
|
+
const { client, queryKey } = transport.createPromiseClient(Feed, { method: 'pickHistory', params: [slStreamId] });
|
|
58
|
+
return transport.nanoquery.createFetcherStore(queryKey, {
|
|
59
|
+
fetcher: async (_, __, eventId) => {
|
|
60
|
+
if (!eventId) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
const res = await client.pickHistory({
|
|
64
|
+
eventId: eventId,
|
|
65
|
+
});
|
|
66
|
+
return res.data?.map(({ attributes }) => attributes);
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
export { $userSummary } from './leaderboard';
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/feature-gamification/src/queries/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,IAAI,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,iEAAiE,CAAA;AAUtF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,UAA4C,EAAE,SAAoB,EAAE,EAAE;IACpG,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;IAElH,OAAO,SAAS,CAAC,SAAS,CAAC,kBAAkB,CAAC,QAAQ,EAAE;QACtD,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;YAC3B,IAAI,CAAC,EAAE,EAAE;gBACP,OAAO,SAAS,CAAA;aACjB;YAED,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC;gBACpC,MAAM,EAAE;oBACN,OAAO,EAAE,EAAY;iBACtB;aACF,CAAC,CAAA;YAEF,OAAO,GAAG,CAAC,IAAI,EAAE,UAAU,CAAA;QAC7B,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,WAA6C,EAAE,S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EAAE,OAAiB;aAC3B,CAAC,CAAA;YAEF,OAAO,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,CAAA;QACtD,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Transport } from '@streamlayer/sdk-web-api';
|
|
2
|
+
import { ReadableAtom } from 'nanostores';
|
|
3
|
+
export declare const $userSummary: ($eventId: ReadableAtom<string | undefined>, $userId: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<import("@streamlayer/sl-eslib/interactive/leaderboard/interactive.leaderboard_pb").LeaderboardSummaryItem | undefined, any>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Leaderboard } from '@streamlayer/sl-eslib/interactive/leaderboard/interactive.leaderboard_connect';
|
|
2
|
+
export const $userSummary = ($eventId, $userId, transport) => {
|
|
3
|
+
const { client, queryKey } = transport.createPromiseClient(Leaderboard, {
|
|
4
|
+
method: 'summary',
|
|
5
|
+
params: [$eventId, $userId],
|
|
6
|
+
});
|
|
7
|
+
return transport.nanoquery.createFetcherStore(queryKey, {
|
|
8
|
+
fetcher: async (_, __, eventId, userId) => {
|
|
9
|
+
const res = await client.summary({
|
|
10
|
+
eventId: eventId,
|
|
11
|
+
userId: userId,
|
|
12
|
+
});
|
|
13
|
+
return res.data?.attributes;
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=leaderboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leaderboard.js","sourceRoot":"","sources":["../../../../../packages/feature-gamification/src/queries/leaderboard.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,+EAA+E,CAAA;AAE3G,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,QAA0C,EAC1C,OAAyC,EACzC,SAAoB,EACpB,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC,mBAAmB,CAAC,WAAW,EAAE;QACtE,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;KAC5B,CAAC,CAAA;IAEF,OAAO,SAAS,CAAC,SAAS,CAAC,kBAAkB,CAAC,QAAQ,EAAE;QACtD,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YACxC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;gBAC/B,OAAO,EAAE,OAA4B;gBACrC,MAAM,EAAE,MAAgB;aACzB,CAAC,CAAA;YAEF,OAAO,GAAG,CAAC,IAAI,EAAE,UAAU,CAAA;QAC7B,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Transport } from '@streamlayer/sdk-web-api';
|
|
2
|
+
import { ReadableAtom } from 'nanostores';
|
|
3
|
+
export declare const $moderation: (slStreamId: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").InteractiveFeed | undefined, any>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Feed } from '@streamlayer/sl-eslib/interactive/feed/interactive.feed_connect';
|
|
2
|
+
export const $moderation = (slStreamId, transport) => {
|
|
3
|
+
const { client, queryKey } = transport.createPromiseClient(Feed, { method: 'get', params: [slStreamId] });
|
|
4
|
+
return transport.nanoquery.createFetcherStore(queryKey, {
|
|
5
|
+
fetcher: async (_, __, id) => {
|
|
6
|
+
const res = await client.get({
|
|
7
|
+
eventId: id,
|
|
8
|
+
});
|
|
9
|
+
return res.data?.attributes;
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=moderation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moderation.js","sourceRoot":"","sources":["../../../../../packages/feature-gamification/src/queries/moderation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,iEAAiE,CAAA;AAEtF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,UAA4C,EAAE,SAAoB,EAAE,EAAE;IAChG,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;IAEzG,OAAO,SAAS,CAAC,SAAS,CAAC,kBAAkB,CAAC,QAAQ,EAAE;QACtD,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;YAC3B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC;gBAC3B,OAAO,EAAE,EAAY;aACtB,CAAC,CAAA;YAEF,OAAO,GAAG,CAAC,IAAI,EAAE,UAAU,CAAA;QAC7B,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA"}
|