@streamlayer/feature-gamification 1.4.1 → 1.5.0
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.
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { createMapStore, StreamLayerContext } from '@streamlayer/sdk-web-interfaces';
|
|
2
2
|
import { PromotionOptions } from '@streamlayer/sdk-web-types';
|
|
3
|
+
import { QuestionNotification } from '@streamlayer/sl-eslib/interactive/interactive.common_pb';
|
|
3
4
|
import { type GamificationBackground } from '../background';
|
|
4
5
|
import { getPromotionDetail } from '../queries';
|
|
5
6
|
type AdvertisementData = {
|
|
6
7
|
loading?: boolean;
|
|
7
8
|
error?: unknown;
|
|
8
|
-
data?:
|
|
9
|
+
data?: {
|
|
10
|
+
promotions: PromotionOptions;
|
|
11
|
+
notification?: QuestionNotification;
|
|
12
|
+
};
|
|
9
13
|
};
|
|
10
14
|
export type Advertisement = {
|
|
11
15
|
autoHideDuration: number;
|
|
@@ -31,7 +31,7 @@ export const advertisement = ($slStreamId, $feedSubscription, instance) => {
|
|
|
31
31
|
action: 'received',
|
|
32
32
|
payload: {
|
|
33
33
|
advertisementId,
|
|
34
|
-
advertisementType: data?.type,
|
|
34
|
+
advertisementType: data?.promotions.type,
|
|
35
35
|
},
|
|
36
36
|
});
|
|
37
37
|
queue.addToQueue({
|
|
@@ -89,7 +89,7 @@ export const advertisement = ($slStreamId, $feedSubscription, instance) => {
|
|
|
89
89
|
action: 'opened',
|
|
90
90
|
payload: {
|
|
91
91
|
advertisementId: advertisement.id,
|
|
92
|
-
advertisementType: advertisementData.data?.type,
|
|
92
|
+
advertisementType: advertisementData.data?.promotions.type,
|
|
93
93
|
},
|
|
94
94
|
});
|
|
95
95
|
return advertisement;
|
|
@@ -164,7 +164,10 @@ export const advertisement = ($slStreamId, $feedSubscription, instance) => {
|
|
|
164
164
|
}
|
|
165
165
|
if (feedItem.status === QuestionStatus.ACTIVE) {
|
|
166
166
|
logger.debug({ feedItem }, 'active: %o');
|
|
167
|
-
show(feedItem.id,
|
|
167
|
+
show(feedItem.id, {
|
|
168
|
+
promotions: promotionItem,
|
|
169
|
+
notification: response.data?.attributes?.question?.notification,
|
|
170
|
+
});
|
|
168
171
|
return;
|
|
169
172
|
}
|
|
170
173
|
logger.debug({ feedItem }, 'skip: %o');
|
package/lib/queries/index.d.ts
CHANGED
|
@@ -350,7 +350,10 @@ export declare const questionSubscription: (questionId: string, transport: Trans
|
|
|
350
350
|
export declare const getQuestionByUser: (questionId: string, transport: Transport) => Promise<import("@streamlayer/sl-eslib/interactive/interactive.common_pb").ExtendedQuestion | undefined>;
|
|
351
351
|
export declare const getQuestionDetail: (questionId: string, transport: Transport) => Promise<import("@streamlayer/sl-eslib/interactive/interactive.common_pb").Question | undefined>;
|
|
352
352
|
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>;
|
|
353
|
-
export declare const getPromotionDetail: (promoId: string, transport: Transport) => Promise<
|
|
353
|
+
export declare const getPromotionDetail: (promoId: string, transport: Transport) => Promise<{
|
|
354
|
+
promotions: import("@streamlayer/sl-eslib/interactive/interactive.common_pb").QuestionOptions_PromotionOptions;
|
|
355
|
+
notification: import("@streamlayer/sl-eslib/interactive/interactive.common_pb").QuestionNotification | undefined;
|
|
356
|
+
} | undefined>;
|
|
354
357
|
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>;
|
|
355
358
|
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>;
|
|
356
359
|
export declare const $promotionList: ($slStreamId: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<({
|
package/lib/queries/index.js
CHANGED
|
@@ -83,7 +83,7 @@ export const getPromotionDetail = async (promoId, transport) => {
|
|
|
83
83
|
const promotions = res.data?.attributes?.options?.options.case === 'promotion'
|
|
84
84
|
? res.data?.attributes?.options?.options.value
|
|
85
85
|
: undefined;
|
|
86
|
-
return promotions;
|
|
86
|
+
return promotions ? { promotions, notification: res.data?.attributes?.notification } : undefined;
|
|
87
87
|
};
|
|
88
88
|
export const $pickHistory = (slStreamId, transport) => {
|
|
89
89
|
const { client, queryKey } = transport.createPromiseClient(Feed, { method: 'pickHistory', params: [slStreamId] });
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/feature-gamification",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@bufbuild/protobuf": "^1.10.0",
|
|
6
6
|
"@fastify/deepmerge": "^2.0.0",
|
|
7
7
|
"@streamlayer/sl-eslib": "^5.122.0",
|
|
8
8
|
"nanostores": "^0.10.3",
|
|
9
|
-
"@streamlayer/sdk-web-api": "^1.3.
|
|
10
|
-
"@streamlayer/sdk-web-core": "^1.2.
|
|
11
|
-
"@streamlayer/sdk-web-interfaces": "^1.1.
|
|
12
|
-
"@streamlayer/sdk-web-logger": "^1.0.
|
|
13
|
-
"@streamlayer/sdk-web-notifications": "^1.1.
|
|
14
|
-
"@streamlayer/sdk-web-storage": "^1.0.
|
|
15
|
-
"@streamlayer/sdk-web-types": "^1.
|
|
9
|
+
"@streamlayer/sdk-web-api": "^1.3.3",
|
|
10
|
+
"@streamlayer/sdk-web-core": "^1.2.3",
|
|
11
|
+
"@streamlayer/sdk-web-interfaces": "^1.1.7",
|
|
12
|
+
"@streamlayer/sdk-web-logger": "^1.0.12",
|
|
13
|
+
"@streamlayer/sdk-web-notifications": "^1.1.7",
|
|
14
|
+
"@streamlayer/sdk-web-storage": "^1.0.12",
|
|
15
|
+
"@streamlayer/sdk-web-types": "^1.4.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"tslib": "^2.7.0"
|