Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@streamlayer/feature-gamification

Package Overview
Dependencies
Maintainers
14
Versions
130
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.15.1 to 0.16.0

2

lib/gamification.d.ts

@@ -34,3 +34,3 @@ import { AbstractFeature, ApiStore, FeatureSource, type FeatureProps, type StreamLayerContext, createComputedStore } from '@streamlayer/sdk-web-interfaces';

/** user statistics (leaderboard panel) */
userSummary?: ApiStore<GetApiResponseType<typeof queries.$userSummary>>;
userSummary: ApiStore<GetApiResponseType<typeof queries.$userSummary>>;
/** questions list (pick history) */

@@ -37,0 +37,0 @@ questions?: ApiStore<GetApiResponseType<typeof queries.$pickHistory>>;

import { AbstractFeature, ApiStore, FeatureStatus, SingleStore, createSingleStore, createComputedStore, } from '@streamlayer/sdk-web-interfaces';
import { QuestionStatus, QuestionType, FeatureType, } from '@streamlayer/sdk-web-types';
import { QuestionStatus, QuestionType, FeatureType, SilenceSetting, } from '@streamlayer/sdk-web-types';
import { NotificationType } from '@streamlayer/sdk-web-notifications';

@@ -60,2 +60,3 @@ import '@streamlayer/sdk-web-core/store';

this.storage = new GamificationStorage();
this.userSummary = new ApiStore(queries.$userSummary(this.background.slStreamId, this.background.userId, instance.transport), 'gamification:userSummary');
this.leaderboardId = new SingleStore(createSingleStore(this.settings.getValue('pinnedLeaderboardId')), 'pinnedLeaderboardId').getStore();

@@ -94,16 +95,19 @@ this.onboardingStatus = new SingleStore(createSingleStore(OnboardingStatus.Unset), 'onboardingStatus').getStore();

if (question && question.data && this.onboardingStatus.get()) {
if (GamificationQuestionTypes.has(question.data.question.type) &&
if (question.data.question?.id !== undefined &&
question.data.question.notification !== undefined &&
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: () => this.openQuestion(question.data.question.id),
close: () => this.closeQuestion(question.data.question.id),
autoHideDuration: 5000,
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.notification.title,
color: question.data.notification.indicatorColor,
icon: question.data.notification.image,
imageMode: question.data.notification.imageMode,
imagePosition: question.data.notification.imagePosition,
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,
},

@@ -190,8 +194,3 @@ });

connect = (transport) => {
if (!this.userSummary) {
this.userSummary = new ApiStore(queries.$userSummary(this.background.slStreamId, this.background.userId, transport), 'gamification:userSummary');
}
else {
this.userSummary.invalidate();
}
this.userSummary.invalidate();
this.leaderboardList = new ApiStore(queries.$leaderboardList(this.background.slStreamId, this.leaderboardId, transport), 'gamification:leaderboardList');

@@ -198,0 +197,0 @@ if (!this.questions) {

import { AbstractFeature, ApiStore, FeatureStatus, createComputedStore, } from '@streamlayer/sdk-web-interfaces';
import { QuestionStatus, QuestionType, FeatureType } from '@streamlayer/sdk-web-types';
import { QuestionStatus, QuestionType, FeatureType, SilenceSetting } from '@streamlayer/sdk-web-types';
import { NotificationType } from '@streamlayer/sdk-web-notifications';

@@ -31,4 +31,5 @@ import '@streamlayer/sdk-web-core/store';

this.background.activeQuestionId.listen((question) => {
if (question &&
question.data &&
if (question?.data?.question?.id &&
question?.data?.question?.notification &&
question.data.moderation?.bypassNotifications?.inAppSilence !== SilenceSetting.ON &&
question.data.question.type === QuestionType.FACTOID &&

@@ -38,12 +39,12 @@ question.data.question.status === QuestionStatus.ACTIVE) {

type: NotificationType.QUESTION,
action: () => this.openHighlight(question.data.question.id),
close: () => this.closeHighlight(question.data.question.id),
autoHideDuration: 5000,
action: () => question.data?.question && this.openHighlight(question.data.question.id),
close: () => question.data?.question && this.closeHighlight(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.notification.title,
color: question.data.notification.indicatorColor,
icon: question.data.notification.image,
imageMode: question.data.notification.imageMode,
imagePosition: question.data.notification.imagePosition,
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,
},

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

{
"name": "@streamlayer/feature-gamification",
"version": "0.15.1",
"version": "0.16.0",
"peerDependencies": {

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

"nanostores": "^0.9.4",
"@streamlayer/sdk-web-interfaces": "^0.17.3",
"@streamlayer/sdk-web-core": "^0.11.4",
"@streamlayer/sdk-web-api": "^0.0.1",
"@streamlayer/sdk-web-types": "^0.15.1",
"@streamlayer/sdk-web-interfaces": "^0.18.0",
"@streamlayer/sdk-web-core": "^0.12.0",
"@streamlayer/sdk-web-api": "^0.0.2",
"@streamlayer/sdk-web-types": "^0.16.0",
"@streamlayer/sdk-web-storage": "^0.3.2",
"@streamlayer/sdk-web-logger": "^0.5.2",
"@streamlayer/sdk-web-notifications": "^0.9.3"
"@streamlayer/sdk-web-notifications": "^0.9.4"
},

@@ -17,0 +17,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