@streamlayer/feature-gamification 1.16.11 → 1.16.12

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 CHANGED
@@ -77,7 +77,8 @@ export class GamificationBackground {
77
77
  this.questionSubscription.addListener('feed-subscription-opened-question', (response) => {
78
78
  const question = response.data?.attributes?.question;
79
79
  this.openedQuestion.updateExtendedQuestion(question);
80
- if (question?.type === QuestionType.PREDICTION &&
80
+ if (this.betPack &&
81
+ question?.type === QuestionType.PREDICTION &&
81
82
  (question.status === QuestionStatus.ACTIVE || question.status === QuestionStatus.RESOLVED)) {
82
83
  const betPackData = this.betPack.getValues().data?.data || {};
83
84
  const betPackItem = betPackData?.[question.id];
@@ -129,7 +130,8 @@ export class GamificationBackground {
129
130
  this.feedSubscription = queries.feedSubscription(this.slStreamId, instance.transport);
130
131
  this.cancels.add(this.feedSubscription.addListener('bet-pack-update', async (response) => {
131
132
  const question = response.data?.attributes?.question;
132
- if (question?.type === QuestionType.PREDICTION &&
133
+ if (this.betPack &&
134
+ question?.type === QuestionType.PREDICTION &&
133
135
  (question.status === QuestionStatus.ACTIVE || question.status === QuestionStatus.RESOLVED)) {
134
136
  const betPackData = this.betPack.getValues().data?.data || {};
135
137
  const betPackItem = betPackData?.[question.id];
@@ -354,6 +354,9 @@ export class Gamification extends AbstractFeature {
354
354
  this.background.feedSubscription.removeListener('feed-subscription-questions-list');
355
355
  };
356
356
  betPackVote = async (questionId, answerId) => {
357
+ if (!this.betPack) {
358
+ return;
359
+ }
357
360
  try {
358
361
  await actions.submitAnswer(this.transport, { questionId, answerId });
359
362
  }
@@ -467,6 +470,10 @@ export class Gamification extends AbstractFeature {
467
470
  return () => { };
468
471
  }
469
472
  const openedFromBetPack = question?.openedFrom === 'bet-pack';
473
+ if (!openedFromBetPack) {
474
+ const query = queries.$questionByUser(questionId, this.transport);
475
+ query.invalidate();
476
+ }
470
477
  this.notifications.close(this.background.getCurrentSessionId({
471
478
  prefix: 'notification',
472
479
  entity: questionId,
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@streamlayer/feature-gamification",
3
- "version": "1.16.11",
3
+ "version": "1.16.12",
4
4
  "peerDependencies": {
5
5
  "@bufbuild/protobuf": "^1.10.0",
6
6
  "@fastify/deepmerge": "^2.0.0",
7
7
  "@streamlayer/sl-eslib": "^5.149.1",
8
8
  "uuid": "^11.1.0",
9
9
  "nanostores": "^0.11.4",
10
- "@streamlayer/sdk-web-api": "^1.8.11",
11
- "@streamlayer/sdk-web-core": "^1.11.13",
12
- "@streamlayer/sdk-web-interfaces": "^1.5.2",
13
- "@streamlayer/sdk-web-logger": "^1.0.58",
14
- "@streamlayer/sdk-web-notifications": "^1.3.20",
15
- "@streamlayer/sdk-web-storage": "^1.0.58",
16
- "@streamlayer/sdk-web-types": "^1.10.15"
10
+ "@streamlayer/sdk-web-api": "^1.8.12",
11
+ "@streamlayer/sdk-web-core": "^1.11.14",
12
+ "@streamlayer/sdk-web-interfaces": "^1.5.3",
13
+ "@streamlayer/sdk-web-logger": "^1.0.59",
14
+ "@streamlayer/sdk-web-notifications": "^1.3.21",
15
+ "@streamlayer/sdk-web-storage": "^1.0.59",
16
+ "@streamlayer/sdk-web-types": "^1.10.16"
17
17
  },
18
18
  "devDependencies": {
19
19
  "tslib": "^2.7.0"