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

@streamlayer/feature-gamification

Package Overview
Dependencies
Maintainers
0
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 1.0.0 to 1.1.0

lib/advertisement/index.d.ts

4

lib/background.d.ts

@@ -8,2 +8,3 @@ import { ApiStore, type StreamLayerContext } from '@streamlayer/sdk-web-interfaces';

import { detail } from './detail';
import { advertisement } from './advertisement';
export declare enum InteractiveAllowed {

@@ -48,2 +49,3 @@ ALLOWED = "allowed",

questionSubscription?: ReturnType<typeof queries.questionSubscription>;
advertisement: ReturnType<typeof advertisement>;
private notifications;

@@ -74,3 +76,3 @@ private log;

openQuestion: (questionId: string, question?: FeedItem & {
openedFrom?: 'list' | 'notification';
openedFrom?: "list" | "notification";
}) => void;

@@ -77,0 +79,0 @@ /**

@@ -7,2 +7,3 @@ import { ApiStore, SingleStore, createSingleStore } from '@streamlayer/sdk-web-interfaces';

import { detail } from './detail';
import { advertisement } from './advertisement';
export var InteractiveAllowed;

@@ -43,2 +44,3 @@ (function (InteractiveAllowed) {

questionSubscription;
advertisement;
notifications;

@@ -123,2 +125,3 @@ log;

});
this.advertisement = advertisement(this.feedList, this.feedSubscription, instance.transport);
}

@@ -125,0 +128,0 @@ /**

@@ -37,7 +37,16 @@ import { createMapStore } from '@streamlayer/sdk-web-interfaces';

const desktopLink = window.location.origin + window.location.pathname + search + hash;
const shortLink = await generateShortLink(transport, { web: desktopLink, mobile: mobileDeepLink });
$store.set({
data: shortLink.data?.link,
loading: false,
});
try {
const shortLink = await generateShortLink(transport, { web: desktopLink, mobile: mobileDeepLink });
$store.set({
data: shortLink.data?.link,
loading: false,
});
}
catch (error) {
$store.set({
loading: false,
error: 'Failed to generate short link',
data: undefined,
});
}
}

@@ -44,0 +53,0 @@ else {

@@ -8,7 +8,7 @@ import type { Transport } from '@streamlayer/sdk-web-api';

question?: FeedItem & {
openedFrom?: 'list' | 'notification';
openedFrom?: "list" | "notification";
};
} | undefined>, $feedList: ReturnType<GamificationBackground['feedList']['getStore']>) => {
} | undefined>, $feedList: ReturnType<GamificationBackground["feedList"]["getStore"]>) => {
$store: ReadableAtom<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedItem | (import("@bufbuild/protobuf").PlainMessage<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedItem> & {
openedFrom?: "list" | "notification" | undefined;
openedFrom?: "list" | "notification";
}) | undefined>;

@@ -15,0 +15,0 @@ $extendedStore: import("@nanostores/query").FetcherStore<import("@bufbuild/protobuf").PlainMessage<import("@streamlayer/sl-eslib/interactive/interactive.common_pb").ExtendedQuestion>, any>;

@@ -5,2 +5,2 @@ import type { Transport } from '@streamlayer/sdk-web-api';

import { Gamification } from '.';
export declare const friendSummary: ($eventId: ReadableAtom<string | undefined>, $userId: ReadableAtom<string | undefined>, $friends: Gamification['friends'], friendId: string, transport: Transport) => Promise<LeaderboardItem | undefined>;
export declare const friendSummary: ($eventId: ReadableAtom<string | undefined>, $userId: ReadableAtom<string | undefined>, $friends: Gamification["friends"], friendId: string, transport: Transport) => Promise<LeaderboardItem | undefined>;

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

openedQuestionId: GamificationBackground['openedQuestionId'];
advertisement: GamificationBackground['advertisement'];
private notifications;

@@ -67,3 +68,3 @@ private transport;

openQuestion: (questionId?: string, question?: FeedItem & {
openedFrom?: 'list' | 'notification';
openedFrom?: "list" | "notification";
}) => void | (() => void);

@@ -70,0 +71,0 @@ closeQuestion: (questionId?: string) => void;

@@ -52,2 +52,3 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */

openedQuestionId;
advertisement;
notifications;

@@ -64,2 +65,3 @@ transport;

this.background = new GamificationBackground(instance);
this.advertisement = this.background.advertisement;
this.feedSubscription = this.background.feedSubscription;

@@ -219,2 +221,6 @@ this.activeQuestionId = this.background.activeQuestionId;

}
// skip promotions, they are tracked in the advertisement
if (feedItem.attributes.attributes.case === 'promotion') {
return;
}
// skip questions with status other than active or resolved

@@ -279,2 +285,3 @@ if (feedItem.attributes.status !== QuestionStatus.ACTIVE &&

feedList.unshift(feedItem);
console.log('feedItem', feedItem);
eventBus.emit('poll', {

@@ -281,0 +288,0 @@ action: 'received',

export { GamificationBackground } from './background';
export { Gamification } from './gamification';
export { Advertisement } from './advertisement';
declare module '@streamlayer/sdk-web-interfaces' {

@@ -4,0 +5,0 @@ interface StreamLayerContext {

@@ -17,3 +17,3 @@ import type { Transport } from '@streamlayer/sdk-web-api';

};
export declare const leaderboard: (transport: Transport, $eventId: ReadableAtom<string | undefined>, $userId: ReadableAtom<string | undefined>, $friends: Gamification['friends'], options?: LeaderboardOptions) => {
export declare const leaderboard: (transport: Transport, $eventId: ReadableAtom<string | undefined>, $userId: ReadableAtom<string | undefined>, $friends: Gamification["friends"], options?: LeaderboardOptions) => {
$store: import("nanostores").MapStore<LeaderboardStore>;

@@ -20,0 +20,0 @@ fetchMore: (page?: number) => void;

@@ -13,6 +13,11 @@ import { Client } from '@streamlayer/sl-eslib/sdkSettings/client/client_connect';

}
const res = await client.generateDeepLink({
data: { gamification: true, externalEventId: externalEventId, eventId: eventId },
});
return res.data?.attributes;
try {
const res = await client.generateDeepLink({
data: { gamification: true, externalEventId: externalEventId, eventId: eventId },
});
return res.data?.attributes;
}
catch (error) {
return undefined;
}
},

@@ -19,0 +24,0 @@ dedupeTime: 1000 * 60 * 60 * 24, // 24 hours

@@ -112,3 +112,3 @@ import type { Transport } from '@streamlayer/sdk-web-api';

};
}, SubscriptionRequest, SubscriptionResponse, "subscription" | "votingSubscription" | "questionSubscription" | "feedSubscription", ((request: import("@bufbuild/protobuf").PartialMessage<SubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions | undefined) => AsyncIterable<SubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<VotingSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions | undefined) => AsyncIterable<VotingSubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<QuestionSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions | undefined) => AsyncIterable<QuestionSubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions | undefined) => AsyncIterable<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedSubscriptionResponse>)>;
}, SubscriptionRequest, SubscriptionResponse, "subscription" | "votingSubscription" | "questionSubscription" | "feedSubscription", ((request: import("@bufbuild/protobuf").PartialMessage<SubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions) => AsyncIterable<SubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<VotingSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions) => AsyncIterable<VotingSubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<QuestionSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions) => AsyncIterable<QuestionSubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions) => AsyncIterable<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedSubscriptionResponse>)>;
export declare const votingSubscription: (params: {

@@ -223,3 +223,3 @@ questionId: string;

};
}, VotingSubscriptionRequest, VotingSubscriptionResponse, "subscription" | "votingSubscription" | "questionSubscription" | "feedSubscription", ((request: import("@bufbuild/protobuf").PartialMessage<SubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions | undefined) => AsyncIterable<SubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<VotingSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions | undefined) => AsyncIterable<VotingSubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<QuestionSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions | undefined) => AsyncIterable<QuestionSubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions | undefined) => AsyncIterable<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedSubscriptionResponse>)>;
}, VotingSubscriptionRequest, VotingSubscriptionResponse, "subscription" | "votingSubscription" | "questionSubscription" | "feedSubscription", ((request: import("@bufbuild/protobuf").PartialMessage<SubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions) => AsyncIterable<SubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<VotingSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions) => AsyncIterable<VotingSubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<QuestionSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions) => AsyncIterable<QuestionSubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions) => AsyncIterable<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedSubscriptionResponse>)>;
export declare const questionSubscription: (questionId: string, transport: Transport) => import("packages/sdk-web-api/lib/grpc/subscription").ServerStreamSubscription<import("@bufbuild/protobuf").ServiceType, import("@bufbuild/protobuf").Message<import("@bufbuild/protobuf").AnyMessage>, import("@bufbuild/protobuf").Message<import("@bufbuild/protobuf").AnyMessage>, never, never> | import("packages/sdk-web-api/lib/grpc/subscription").ServerStreamSubscription<{

@@ -331,6 +331,7 @@ readonly typeName: "streamlayer.interactive.feed.Feed";

};
}, QuestionSubscriptionRequest, QuestionSubscriptionResponse, "subscription" | "votingSubscription" | "questionSubscription" | "feedSubscription", ((request: import("@bufbuild/protobuf").PartialMessage<SubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions | undefined) => AsyncIterable<SubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<VotingSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions | undefined) => AsyncIterable<VotingSubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<QuestionSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions | undefined) => AsyncIterable<QuestionSubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions | undefined) => AsyncIterable<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedSubscriptionResponse>)>;
}, QuestionSubscriptionRequest, QuestionSubscriptionResponse, "subscription" | "votingSubscription" | "questionSubscription" | "feedSubscription", ((request: import("@bufbuild/protobuf").PartialMessage<SubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions) => AsyncIterable<SubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<VotingSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions) => AsyncIterable<VotingSubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<QuestionSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions) => AsyncIterable<QuestionSubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions) => AsyncIterable<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedSubscriptionResponse>)>;
export declare const getQuestionByUser: (questionId: string, transport: Transport) => Promise<import("@streamlayer/sl-eslib/interactive/interactive.common_pb").ExtendedQuestion | undefined>;
export declare const getQuestionDetail: (questionId: string, transport: Transport) => Promise<import("@streamlayer/sl-eslib/interactive/interactive.common_pb").Question | undefined>;
export declare const $questionByUser: ($questionId: ReadableAtom<string | undefined> | string, transport: Transport) => import("@nanostores/query").FetcherStore<import("@bufbuild/protobuf").PlainMessage<import("@streamlayer/sl-eslib/interactive/interactive.common_pb").ExtendedQuestion>, any>;
export declare const getPromotionDetail: (promoId: string, transport: Transport) => Promise<import("@streamlayer/sl-eslib/interactive/interactive.common_pb").QuestionOptions_PromotionOptions | undefined>;
export declare const $pickHistory: (slStreamId: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<(import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").PickHistory | undefined)[], any>;

@@ -337,0 +338,0 @@ export declare const $feedList: ($slStreamId: ReadableAtom<string | undefined>, $interactiveAllowed: ReadableAtom<InteractiveAllowed>, transport: Transport) => import("@nanostores/query").FetcherStore<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedItem[], any>;

@@ -24,2 +24,3 @@ import { QuestionStatus, QuestionType } from '@streamlayer/sdk-web-types';

export const feedSubscription = ($slStreamId, transport) => {
console.log('feedSubscription', $slStreamId);
const { client } = transport.createStreamClient(Feed);

@@ -69,2 +70,15 @@ const params = atom({ eventId: $slStreamId.get() || '', feedId: '' });

};
export const getPromotionDetail = async (promoId, transport) => {
if (!promoId) {
return undefined;
}
const { client } = transport.createPromiseClient(Feed, { method: 'getQuestion', params: [promoId] });
const res = await client.getQuestion({
id: promoId,
});
const promotions = res.data?.attributes?.options?.options.case === 'promotion'
? res.data?.attributes?.options?.options.value
: undefined;
return promotions;
};
export const $pickHistory = (slStreamId, transport) => {

@@ -71,0 +85,0 @@ const { client, queryKey } = transport.createPromiseClient(Feed, { method: 'pickHistory', params: [slStreamId] });

@@ -5,5 +5,5 @@ import type { Transport } from '@streamlayer/sdk-web-api';

import { Gamification } from '.';
export declare const summary: ($eventId: ReadableAtom<string | undefined>, $userId: ReadableAtom<string | undefined>, $friends: Gamification['friends'], transport: Transport) => {
export declare const summary: ($eventId: ReadableAtom<string | undefined>, $userId: ReadableAtom<string | undefined>, $friends: Gamification["friends"], transport: Transport) => {
$store: import("nanostores").MapStore<LeaderboardSummaryItem | undefined>;
invalidate: () => void;
};
{
"name": "@streamlayer/feature-gamification",
"version": "1.0.0",
"version": "1.1.0",
"peerDependencies": {
"@bufbuild/protobuf": "^1.8.0",
"@fastify/deepmerge": "^1.3.0",
"@streamlayer/sl-eslib": "^5.85.0",
"nanostores": "^0.10.0",
"@streamlayer/sdk-web-api": "^1.0.0",
"@streamlayer/sdk-web-core": "^1.0.0",
"@streamlayer/sdk-web-interfaces": "^1.0.0",
"@streamlayer/sdk-web-logger": "^1.0.0",
"@streamlayer/sdk-web-notifications": "^1.0.0",
"@streamlayer/sdk-web-storage": "^1.0.0",
"@streamlayer/sdk-web-types": "^1.0.0"
"@bufbuild/protobuf": "^1.10.0",
"@fastify/deepmerge": "^2.0.0",
"@streamlayer/sl-eslib": "^5.104.1",
"nanostores": "^0.10.3",
"@streamlayer/sdk-web-api": "^1.1.0",
"@streamlayer/sdk-web-core": "^1.0.1",
"@streamlayer/sdk-web-interfaces": "^1.0.1",
"@streamlayer/sdk-web-logger": "^1.0.1",
"@streamlayer/sdk-web-notifications": "^1.0.1",
"@streamlayer/sdk-web-storage": "^1.0.1",
"@streamlayer/sdk-web-types": "^1.1.0"
},
"devDependencies": {
"tslib": "^2.6.2"
"tslib": "^2.6.3"
},

@@ -20,0 +20,0 @@ "type": "module",

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