@streamlayer/feature-gamification
Advanced tools
Comparing version 0.40.1 to 0.41.0
@@ -112,3 +112,3 @@ import { ApiStore, SingleStore, createSingleStore } from '@streamlayer/sdk-web-interfaces'; | ||
})); | ||
instance.sdk.onMount(() => { | ||
instance.sdk.onMount({ name: 'gamification-background' }, () => { | ||
return () => { | ||
@@ -115,0 +115,0 @@ this.activeQuestionId.off(); |
@@ -113,3 +113,3 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
this.cancels.add(this.settings.subscribe(this.checkInteractiveFlag)); | ||
instance.sdk.onMount(() => { | ||
instance.sdk.onMount({ name: 'gamification', clear: true }, () => { | ||
return () => { | ||
@@ -310,2 +310,4 @@ for (const cancel of this.cancels) { | ||
const data = $questionByUser(questionId, this.transport); | ||
const cancel = data.subscribe(() => { }); | ||
const extendedQuestionBeforeVote = { ...(data.get().data || {}) }; | ||
const updateQuestionAndFieldList = () => { | ||
@@ -327,3 +329,2 @@ const feedList = this.feedList.getValues().data; | ||
}); | ||
const cancel = data.subscribe(() => { }); | ||
const extendedQuestion = data.get().data; | ||
@@ -335,2 +336,3 @@ cancel(); | ||
const votedAnswer = extendedQuestion.answers[votedAnswerIdx]; | ||
const percentsEqual = extendedQuestion.answers.every(({ percentageDecimal }, index) => percentageDecimal === extendedQuestionBeforeVote?.answers[index].percentageDecimal); | ||
// @ts-ignore | ||
@@ -350,5 +352,7 @@ feedList[questionIndex].attributes.attributes.value.answerId = answerId; | ||
extendedQuestion.answers[votedAnswerIdx].youVoted = true; | ||
extendedQuestion.answers.forEach((answer) => { | ||
answer.percentageDecimal = 0; | ||
}); | ||
if (percentsEqual) { | ||
extendedQuestion.answers.forEach((answer) => { | ||
answer.percentageDecimal = 0; | ||
}); | ||
} | ||
if (correctAnswer?.id === answerId) { | ||
@@ -389,3 +393,5 @@ extendedQuestion.answers[votedAnswerIdx].pointsEarned = | ||
entity: questionId, | ||
})); | ||
}), { | ||
animateHiding: false, | ||
}); | ||
let questionType = question?.attributes?.type; | ||
@@ -392,0 +398,0 @@ if (!questionType) { |
@@ -93,3 +93,3 @@ import { createSingleStore, eventBus } from '@streamlayer/sdk-web-interfaces'; | ||
// close previous onboarding notification, f.e moderation was disabled onboarding | ||
notifications.close(background.getCurrentSessionId({ prefix: 'onboarding' }), false); | ||
notifications.close(background.getCurrentSessionId({ prefix: 'onboarding' }), { markAsViewed: false }); | ||
} | ||
@@ -96,0 +96,0 @@ } |
{ | ||
"name": "@streamlayer/feature-gamification", | ||
"version": "0.40.1", | ||
"version": "0.41.0", | ||
"peerDependencies": { | ||
"@bufbuild/protobuf": "^1.8.0", | ||
"@fastify/deepmerge": "^1.3.0", | ||
"@streamlayer/sl-eslib": "^5.84.0", | ||
"@streamlayer/sl-eslib": "^5.85.0", | ||
"nanostores": "^0.10.0", | ||
"@streamlayer/sdk-web-api": "^0.24.3", | ||
"@streamlayer/sdk-web-core": "^0.22.3", | ||
"@streamlayer/sdk-web-interfaces": "^0.21.1", | ||
"@streamlayer/sdk-web-logger": "^0.5.19", | ||
"@streamlayer/sdk-web-notifications": "^0.15.2", | ||
"@streamlayer/sdk-web-storage": "^0.4.6", | ||
"@streamlayer/sdk-web-types": "^0.23.1" | ||
"@streamlayer/sdk-web-api": "^0.25.0", | ||
"@streamlayer/sdk-web-core": "^0.23.0", | ||
"@streamlayer/sdk-web-logger": "^0.5.20", | ||
"@streamlayer/sdk-web-interfaces": "^0.22.0", | ||
"@streamlayer/sdk-web-notifications": "^0.16.0", | ||
"@streamlayer/sdk-web-storage": "^0.4.7", | ||
"@streamlayer/sdk-web-types": "^0.23.2" | ||
}, | ||
@@ -17,0 +17,0 @@ "devDependencies": { |
106441
2039