New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@streamlayer/feature-gamification

Package Overview
Dependencies
Maintainers
14
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@streamlayer/feature-gamification - npm Package Compare versions

Comparing version 0.21.2 to 0.22.0

88

lib/gamification.js

@@ -93,2 +93,5 @@ import { AbstractFeature, ApiStore, FeatureStatus, SingleStore, createSingleStore, } from '@streamlayer/sdk-web-interfaces';

});
/**
* listen for active question and show in-app notification
*/
this.background.activeQuestionId.listen((question) => {

@@ -99,18 +102,45 @@ if (question && question.data && this.onboardingStatus.get()) {

question.data.moderation?.bypassNotifications?.inAppSilence !== SilenceSetting.ON &&
GamificationQuestionTypes.has(question.data.question.type) &&
question.data.question.status === QuestionStatus.ACTIVE) {
this.notifications.add({
type: NotificationType.QUESTION,
action: () => question.data?.question && this.openQuestion(question.data.question.id),
close: () => question.data?.question && this.closeQuestion(question.data.question.id),
autoHideDuration: +(question.data.moderation?.question?.appearance?.autoHideInterval || '1000'),
id: this.background.getCurrentSessionId({ prefix: 'notification', entity: question.data.question.id }),
data: {
title: question.data.question.notification.title,
color: question.data.question.notification.indicatorColor,
icon: question.data.question.notification.image,
imageMode: question.data.question.notification.imageMode,
imagePosition: question.data.question.notification.imagePosition,
},
});
if (GamificationQuestionTypes.has(question.data.question.type)) {
this.notifications.add({
type: NotificationType.QUESTION,
action: () => question.data?.question && this.openQuestion(question.data.question.id),
close: () => question.data?.question && this.closeQuestion(question.data.question.id),
autoHideDuration: 1000 * +(question.data.question?.appearance?.autoHideInterval || '5'),
id: this.background.getCurrentSessionId({ prefix: 'notification', entity: question.data.question.id }),
data: {
questionType: question.data.question.type,
question: {
title: question.data.question.notification.title,
},
},
});
}
else if (question.data.question.type === QuestionType.FACTOID) {
const instantView = {
heading: '',
body: '',
image: '',
video: {
id: '',
url: '',
thumbnailUrl: '',
},
webLink: {
label: '',
url: '',
},
};
this.notifications.add({
type: NotificationType.QUESTION,
action: () => question.data?.question && this.openQuestion(question.data.question.id),
close: () => question.data?.question && this.closeQuestion(question.data.question.id),
autoHideDuration: 1000 * +(question.data.question?.appearance?.autoHideInterval || '5'),
id: this.background.getCurrentSessionId({ prefix: 'notification', entity: question.data.question.id }),
data: {
questionType: question.data.question.type,
insight: instantView,
},
});
}
}

@@ -184,9 +214,12 @@ }

data: {
header: titleCard?.header,
title: titleCard?.title,
subtitle: titleCard?.subtitle,
graphicBg: titleCard?.appearance?.graphic,
icon: titleCard?.media?.icon,
sponsorLogo: titleCard?.media?.sponsorLogo,
primaryColor: overview?.appearance?.primaryColor,
questionType: QuestionType.UNSET,
onboarding: {
header: titleCard?.header,
title: titleCard?.title,
subtitle: titleCard?.subtitle,
graphicBg: titleCard?.appearance?.graphic,
icon: titleCard?.media?.icon,
sponsorLogo: titleCard?.media?.sponsorLogo,
primaryColor: overview?.appearance?.primaryColor,
},
},

@@ -213,3 +246,3 @@ });

this.notifications.add({
type: NotificationType.ONBOARDING,
type: NotificationType.QUESTION_RESOLVED,
action: () => this.openQuestion(id),

@@ -220,5 +253,8 @@ close: () => this.closeQuestion(id),

data: {
title: correctAnswer?.youVoted
? `Congratulations! You answered correctly! You won ${correctAnswer.points} pts!`
: `Better luck next time! Correct: ${correctAnswer?.text}!`,
questionType: QuestionType.PREDICTION,
question: {
title: correctAnswer?.youVoted
? `Congratulations! You answered correctly! You won ${correctAnswer.points} pts!`
: `Better luck next time! Correct: ${correctAnswer?.text}!`,
},
},

@@ -225,0 +261,0 @@ });

@@ -40,10 +40,9 @@ import { AbstractFeature, ApiStore, FeatureStatus, } from '@streamlayer/sdk-web-interfaces';

close: () => question.data?.question && this.closeHighlight(question.data.question.id),
autoHideDuration: +(question.data.moderation?.question?.appearance?.autoHideInterval || '1000'),
autoHideDuration: 1000 * +(question.data.question?.appearance?.autoHideInterval || '5'),
id: this.background.getCurrentSessionId({ prefix: 'notification', entity: question.data.question.id }),
data: {
title: question.data.question.notification.title,
color: question.data.question.notification.indicatorColor,
icon: question.data.question.notification.image,
imageMode: question.data.question.notification.imageMode,
imagePosition: question.data.question.notification.imagePosition,
questionType: question.data.question.type,
question: {
title: question.data.question.notification.title,
},
},

@@ -50,0 +49,0 @@ });

{
"name": "@streamlayer/feature-gamification",
"version": "0.21.2",
"version": "0.22.0",
"peerDependencies": {

@@ -10,8 +10,8 @@ "@bufbuild/protobuf": "^1.4.2",

"@streamlayer/sdk-web-api": "^0.0.1",
"@streamlayer/sdk-web-core": "^0.17.5",
"@streamlayer/sdk-web-interfaces": "^0.18.12",
"@streamlayer/sdk-web-core": "^0.17.6",
"@streamlayer/sdk-web-interfaces": "^0.18.13",
"@streamlayer/sdk-web-logger": "^0.0.2",
"@streamlayer/sdk-web-notifications": "^0.10.11",
"@streamlayer/sdk-web-notifications": "^0.11.0",
"@streamlayer/sdk-web-storage": "^0.0.2",
"@streamlayer/sdk-web-types": "^0.18.2"
"@streamlayer/sdk-web-types": "^0.19.0"
},

@@ -18,0 +18,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc