@streamlayer/feature-gamification 0.35.0 → 0.36.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/deepLink.js +7 -3
- package/lib/gamification.js +5 -5
- package/package.json +9 -9
package/lib/deepLink.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createMapStore } from '@streamlayer/sdk-web-interfaces';
|
|
2
|
+
import { DEEP_LINK_USER_ID, DEEP_LINK_EVENT_ID } from '@streamlayer/sdk-web-core';
|
|
2
3
|
import { onMount } from 'nanostores';
|
|
3
4
|
import { $deepLink, generateShortLink } from './queries/deepLink';
|
|
4
5
|
export const deepLink = (transport, $eventId, $userId) => {
|
|
@@ -7,17 +8,20 @@ export const deepLink = (transport, $eventId, $userId) => {
|
|
|
7
8
|
const $branchLink = $deepLink(transport, [$eventId]);
|
|
8
9
|
const cancel = $branchLink.subscribe(async ({ data, error, loading }) => {
|
|
9
10
|
const mobileDeepLink = error ? 'https://masters.com' : data?.url;
|
|
10
|
-
|
|
11
|
+
const userId = $userId.get();
|
|
12
|
+
const eventId = $eventId.get();
|
|
13
|
+
if (!loading && mobileDeepLink && userId && eventId) {
|
|
11
14
|
$store.setKey('loading', true);
|
|
12
15
|
let search = window.location.search;
|
|
13
16
|
let hash = window.location.hash;
|
|
14
17
|
if ((search && hash) || hash) {
|
|
15
18
|
const params = new URLSearchParams(search);
|
|
16
|
-
params.append(
|
|
19
|
+
userId && params.append(DEEP_LINK_USER_ID, userId);
|
|
20
|
+
eventId && params.append(DEEP_LINK_EVENT_ID, eventId);
|
|
17
21
|
search = `?${params.toString()}`;
|
|
18
22
|
}
|
|
19
23
|
else {
|
|
20
|
-
hash =
|
|
24
|
+
hash = `#${`${DEEP_LINK_EVENT_ID}=${eventId}&${DEEP_LINK_USER_ID}=${userId}`}`;
|
|
21
25
|
}
|
|
22
26
|
const desktopLink = window.location.origin + window.location.pathname + search + hash;
|
|
23
27
|
const shortLink = await generateShortLink(transport, { web: desktopLink, mobile: mobileDeepLink });
|
package/lib/gamification.js
CHANGED
|
@@ -131,7 +131,7 @@ export class Gamification extends AbstractFeature {
|
|
|
131
131
|
type: NotificationType.QUESTION_RESOLVED,
|
|
132
132
|
action: () => this.openQuestion(id),
|
|
133
133
|
close: () => this.closeQuestion(id),
|
|
134
|
-
autoHideDuration:
|
|
134
|
+
autoHideDuration: correctAnswer?.youVoted ? 15000 : 12000,
|
|
135
135
|
id: notificationId,
|
|
136
136
|
data: {
|
|
137
137
|
questionType: QuestionType.PREDICTION,
|
|
@@ -230,7 +230,7 @@ export class Gamification extends AbstractFeature {
|
|
|
230
230
|
const instantView = {
|
|
231
231
|
heading: question.data.question.notification.title,
|
|
232
232
|
body: question.data.question.notification.body,
|
|
233
|
-
image: optionsValue
|
|
233
|
+
image: optionsValue?.image,
|
|
234
234
|
video: {
|
|
235
235
|
id: optionsValue?.video?.id || '',
|
|
236
236
|
url: optionsValue?.video?.url || '',
|
|
@@ -256,9 +256,9 @@ export class Gamification extends AbstractFeature {
|
|
|
256
256
|
else if (question.data.question.type === QuestionType.TWEET) {
|
|
257
257
|
const optionsValue = question.data.question.options?.options.value;
|
|
258
258
|
const tweetView = {
|
|
259
|
-
title: question.data.question.notification
|
|
260
|
-
body: question.data.question.notification
|
|
261
|
-
image: question.data.question.notification
|
|
259
|
+
title: question.data.question.notification?.title,
|
|
260
|
+
body: question.data.question.notification?.body,
|
|
261
|
+
image: question.data.question.notification?.image,
|
|
262
262
|
account: optionsValue?.tweetMeta?.account || '',
|
|
263
263
|
accountVerified: !!optionsValue?.tweetMeta?.accountVerified,
|
|
264
264
|
};
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/feature-gamification",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@bufbuild/protobuf": "^1.6.0",
|
|
6
6
|
"@fastify/deepmerge": "*",
|
|
7
|
-
"@streamlayer/sl-eslib": "^5.
|
|
7
|
+
"@streamlayer/sl-eslib": "^5.66.0",
|
|
8
8
|
"nanostores": "^0.9.5",
|
|
9
|
-
"@streamlayer/sdk-web-api": "^0.
|
|
10
|
-
"@streamlayer/sdk-web-core": "^0.
|
|
11
|
-
"@streamlayer/sdk-web-interfaces": "^0.20.
|
|
12
|
-
"@streamlayer/sdk-web-logger": "^0.5.
|
|
13
|
-
"@streamlayer/sdk-web-notifications": "^0.13.
|
|
14
|
-
"@streamlayer/sdk-web-storage": "^0.
|
|
15
|
-
"@streamlayer/sdk-web-types": "^0.
|
|
9
|
+
"@streamlayer/sdk-web-api": "^0.21.0",
|
|
10
|
+
"@streamlayer/sdk-web-core": "^0.19.0",
|
|
11
|
+
"@streamlayer/sdk-web-interfaces": "^0.20.2",
|
|
12
|
+
"@streamlayer/sdk-web-logger": "^0.5.13",
|
|
13
|
+
"@streamlayer/sdk-web-notifications": "^0.13.8",
|
|
14
|
+
"@streamlayer/sdk-web-storage": "^0.4.0",
|
|
15
|
+
"@streamlayer/sdk-web-types": "^0.22.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"tslib": "^2.6.2"
|