@streamlayer/feature-gamification 1.16.0 → 1.16.2

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.
@@ -273,6 +273,10 @@ export class Gamification extends AbstractFeature {
273
273
  feedItem.attributes.status !== QuestionStatus.RESOLVED) {
274
274
  return;
275
275
  }
276
+ // allow only insight cards when onboarding not completed
277
+ if (!this.isInteractiveAllowed && InteractiveQuestionTypes.has(feedItem.attributes.type)) {
278
+ return;
279
+ }
276
280
  if (questionIndex !== -1) {
277
281
  if (feedItem.attributes.attributes.case === 'question' &&
278
282
  feedList[questionIndex].attributes?.attributes.case === 'question') {
@@ -344,7 +348,18 @@ export class Gamification extends AbstractFeature {
344
348
  this.background.feedSubscription.removeListener('feed-subscription-questions-list');
345
349
  };
346
350
  betPackVote = async (questionId, answerId) => {
347
- await actions.submitAnswer(this.transport, { questionId, answerId });
351
+ try {
352
+ await actions.submitAnswer(this.transport, { questionId, answerId });
353
+ }
354
+ catch (error) {
355
+ if (error.message === ERROR.ALREADY_VOTED) {
356
+ const data = $questionByUser(questionId, this.transport);
357
+ const cancel = data.subscribe(() => { });
358
+ data.invalidate();
359
+ cancel();
360
+ }
361
+ throw error;
362
+ }
348
363
  const betPackList = { ...this.betPack.getValues().data };
349
364
  const question = betPackList?.[questionId];
350
365
  if (question) {
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@streamlayer/feature-gamification",
3
- "version": "1.16.0",
3
+ "version": "1.16.2",
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.0",
11
- "@streamlayer/sdk-web-core": "^1.11.2",
12
- "@streamlayer/sdk-web-interfaces": "^1.4.13",
13
- "@streamlayer/sdk-web-logger": "^1.0.47",
14
- "@streamlayer/sdk-web-notifications": "^1.3.9",
15
- "@streamlayer/sdk-web-storage": "^1.0.47",
16
- "@streamlayer/sdk-web-types": "^1.10.4"
10
+ "@streamlayer/sdk-web-api": "^1.8.2",
11
+ "@streamlayer/sdk-web-core": "^1.11.4",
12
+ "@streamlayer/sdk-web-interfaces": "^1.4.15",
13
+ "@streamlayer/sdk-web-logger": "^1.0.49",
14
+ "@streamlayer/sdk-web-notifications": "^1.3.11",
15
+ "@streamlayer/sdk-web-storage": "^1.0.49",
16
+ "@streamlayer/sdk-web-types": "^1.10.6"
17
17
  },
18
18
  "devDependencies": {
19
19
  "tslib": "^2.7.0"