@streamlayer/feature-gamification 1.12.3 → 1.13.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.
- package/lib/gamification.js +33 -1
- package/package.json +8 -8
package/lib/gamification.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
2
|
import { AbstractFeature, ApiStore, SingleStore, createSingleStore, eventBus, } from '@streamlayer/sdk-web-interfaces';
|
|
3
|
-
import { QuestionStatus, QuestionType, FeatureType, SilenceSetting, PickHistoryStatus, } from '@streamlayer/sdk-web-types';
|
|
3
|
+
import { QuestionStatus, QuestionType, FeatureType, SilenceSetting, PickHistoryStatus, UseAsNotification, } from '@streamlayer/sdk-web-types';
|
|
4
4
|
import { NotificationType } from '@streamlayer/sdk-web-notifications';
|
|
5
5
|
import '@streamlayer/sdk-web-core/store';
|
|
6
6
|
import * as queries from './queries';
|
|
@@ -422,6 +422,7 @@ export class Gamification extends AbstractFeature {
|
|
|
422
422
|
questionOpenedFrom: question?.openedFrom,
|
|
423
423
|
},
|
|
424
424
|
});
|
|
425
|
+
this.openFeature();
|
|
425
426
|
return this.background.openQuestion(questionId, question);
|
|
426
427
|
};
|
|
427
428
|
getFeedItem = (id) => {
|
|
@@ -506,6 +507,11 @@ export class Gamification extends AbstractFeature {
|
|
|
506
507
|
question: {
|
|
507
508
|
title: question.data.question.notification.title,
|
|
508
509
|
},
|
|
510
|
+
inApp: {
|
|
511
|
+
notification: question.data.question.notification,
|
|
512
|
+
appearance: question.data.question.appearance,
|
|
513
|
+
sponsorship: question.data.question.sponsorship,
|
|
514
|
+
},
|
|
509
515
|
},
|
|
510
516
|
});
|
|
511
517
|
}
|
|
@@ -540,12 +546,32 @@ export class Gamification extends AbstractFeature {
|
|
|
540
546
|
questionId: question.data.question.id,
|
|
541
547
|
questionType: question.data.question.type,
|
|
542
548
|
insight: instantView,
|
|
549
|
+
inApp: {
|
|
550
|
+
useMediaFromContent: optionsValue.useAsNotification === UseAsNotification.ENABLED,
|
|
551
|
+
notification: question.data.question.notification,
|
|
552
|
+
appearance: question.data.question.appearance,
|
|
553
|
+
sponsorship: question.data.question.sponsorship,
|
|
554
|
+
},
|
|
543
555
|
},
|
|
544
556
|
});
|
|
545
557
|
}
|
|
546
558
|
else if (question.data.question.type === QuestionType.TWEET &&
|
|
547
559
|
question.data.question.notification !== undefined) {
|
|
548
560
|
const optionsValue = question.data.question.options?.options.value;
|
|
561
|
+
const tweetMedia = {
|
|
562
|
+
image: '',
|
|
563
|
+
video: '',
|
|
564
|
+
};
|
|
565
|
+
if (optionsValue.tweetMeta?.tweet?.meta?.extendedEntities?.media?.[0]) {
|
|
566
|
+
const media = optionsValue.tweetMeta.tweet.meta.extendedEntities.media;
|
|
567
|
+
if (media) {
|
|
568
|
+
const res = media.find(({ type }) => type === 'photo') || media[0];
|
|
569
|
+
tweetMedia.image = res.mediaUrlHttps;
|
|
570
|
+
if (res.type === 'video') {
|
|
571
|
+
tweetMedia.video = res.url;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
549
575
|
const tweetView = {
|
|
550
576
|
title: question.data.question.notification?.title,
|
|
551
577
|
body: question.data.question.notification?.body,
|
|
@@ -554,6 +580,7 @@ export class Gamification extends AbstractFeature {
|
|
|
554
580
|
accountVerified: !!optionsValue?.tweetMeta?.accountVerified,
|
|
555
581
|
tweet: optionsValue?.tweetMeta?.tweet,
|
|
556
582
|
tweetId: question.data.question.id,
|
|
583
|
+
tweetMedia,
|
|
557
584
|
};
|
|
558
585
|
this.notifications.add({
|
|
559
586
|
type: NotificationType.QUESTION,
|
|
@@ -566,6 +593,11 @@ export class Gamification extends AbstractFeature {
|
|
|
566
593
|
questionId: question.data.question.id,
|
|
567
594
|
questionType: question.data.question.type,
|
|
568
595
|
tweet: tweetView,
|
|
596
|
+
inApp: {
|
|
597
|
+
notification: question.data.question.notification,
|
|
598
|
+
appearance: question.data.question.appearance,
|
|
599
|
+
sponsorship: question.data.question.sponsorship,
|
|
600
|
+
},
|
|
569
601
|
},
|
|
570
602
|
});
|
|
571
603
|
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/feature-gamification",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@bufbuild/protobuf": "^1.10.0",
|
|
6
6
|
"@fastify/deepmerge": "^2.0.0",
|
|
7
7
|
"@streamlayer/sl-eslib": "^5.130.0",
|
|
8
8
|
"nanostores": "^0.10.3",
|
|
9
|
-
"@streamlayer/sdk-web-api": "^1.6.
|
|
10
|
-
"@streamlayer/sdk-web-
|
|
11
|
-
"@streamlayer/sdk-web-
|
|
12
|
-
"@streamlayer/sdk-web-
|
|
13
|
-
"@streamlayer/sdk-web-notifications": "^1.
|
|
14
|
-
"@streamlayer/sdk-web-storage": "^1.0.
|
|
15
|
-
"@streamlayer/sdk-web-types": "^1.
|
|
9
|
+
"@streamlayer/sdk-web-api": "^1.6.17",
|
|
10
|
+
"@streamlayer/sdk-web-interfaces": "^1.4.4",
|
|
11
|
+
"@streamlayer/sdk-web-logger": "^1.0.38",
|
|
12
|
+
"@streamlayer/sdk-web-core": "^1.9.0",
|
|
13
|
+
"@streamlayer/sdk-web-notifications": "^1.3.0",
|
|
14
|
+
"@streamlayer/sdk-web-storage": "^1.0.38",
|
|
15
|
+
"@streamlayer/sdk-web-types": "^1.9.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"tslib": "^2.7.0"
|