@streamlayer/feature-gamification 0.26.7 → 0.27.1

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 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
- return { $store, fetch };
4
+ const desktopLink = `${window.location.host + window.location.pathname}%23sl_eid=${$eventId.get()}&sl_uid=${$userId.get()}`;
5
+ return { $store, fetch, desktopLink };
5
6
  };
@@ -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 * +(question.data.question?.appearance?.autoHideInterval || '5'),
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 * +(question.data.question?.appearance?.autoHideInterval || '5'),
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 * +(question.data.question?.appearance?.autoHideInterval || '5'),
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,
@@ -195,6 +195,7 @@ export class Gamification extends AbstractFeature {
195
195
  },
196
196
  },
197
197
  });
198
+ this.userSummary.invalidate();
198
199
  }
199
200
  });
200
201
  });
@@ -210,11 +211,13 @@ export class Gamification extends AbstractFeature {
210
211
  submitAnswer = async (questionId, answerId) => {
211
212
  await actions.submitAnswer(this.transport, { questionId, answerId });
212
213
  // Todo: add invalidate openedQuestion
213
- this.feedList?.invalidate();
214
+ this.feedList.invalidate();
215
+ this.userSummary.invalidate();
214
216
  };
215
217
  skipQuestion = async (questionId) => {
216
218
  await actions.skipQuestion(this.transport, questionId);
217
- this.feedList?.invalidate();
219
+ this.feedList.invalidate();
220
+ this.userSummary.invalidate();
218
221
  };
219
222
  openQuestion = (questionId) => {
220
223
  this.openFeature();
@@ -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("packages/sdk-web-types/lib").ExtendedQuestion | undefined>;
330
- export declare const $questionByUser: ($questionId: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<import("packages/sdk-web-types/lib").ExtendedQuestion | undefined, any>;
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>;
@@ -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,13 +1,13 @@
1
1
  {
2
2
  "name": "@streamlayer/feature-gamification",
3
- "version": "0.26.7",
3
+ "version": "0.27.1",
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.1",
10
- "@streamlayer/sdk-web-core": "^0.0.4",
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
12
  "@streamlayer/sdk-web-logger": "^0.0.1",
13
13
  "@streamlayer/sdk-web-notifications": "^0.13.4",