@streamlayer/feature-gamification 1.16.12 → 1.16.13
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 +9 -4
- package/lib/queries/index.js +10 -4
- package/package.json +8 -8
package/lib/gamification.js
CHANGED
|
@@ -470,10 +470,6 @@ export class Gamification extends AbstractFeature {
|
|
|
470
470
|
return () => { };
|
|
471
471
|
}
|
|
472
472
|
const openedFromBetPack = question?.openedFrom === 'bet-pack';
|
|
473
|
-
if (!openedFromBetPack) {
|
|
474
|
-
const query = queries.$questionByUser(questionId, this.transport);
|
|
475
|
-
query.invalidate();
|
|
476
|
-
}
|
|
477
473
|
this.notifications.close(this.background.getCurrentSessionId({
|
|
478
474
|
prefix: 'notification',
|
|
479
475
|
entity: questionId,
|
|
@@ -485,6 +481,15 @@ export class Gamification extends AbstractFeature {
|
|
|
485
481
|
const feedList = this.feedList.getStore().value?.data || [];
|
|
486
482
|
questionType = feedList.find((item) => item.id === questionId)?.attributes?.type;
|
|
487
483
|
}
|
|
484
|
+
if (!openedFromBetPack &&
|
|
485
|
+
(questionType === QuestionType.POLL ||
|
|
486
|
+
questionType === QuestionType.TRIVIA ||
|
|
487
|
+
questionType === QuestionType.PREDICTION)) {
|
|
488
|
+
const query = queries.$questionByUser(questionId, this.transport);
|
|
489
|
+
void queries.questionByUser(questionId, this.transport).then((d) => {
|
|
490
|
+
query.mutate(d);
|
|
491
|
+
});
|
|
492
|
+
}
|
|
488
493
|
const flags = {
|
|
489
494
|
eventId: this.background.slStreamId.get() || '',
|
|
490
495
|
userId: this.background.userId.get() || '',
|
package/lib/queries/index.js
CHANGED
|
@@ -67,14 +67,20 @@ export const questionByUser = async ($questionId, transport) => {
|
|
|
67
67
|
});
|
|
68
68
|
return res.data?.attributes?.question;
|
|
69
69
|
};
|
|
70
|
-
const storeCache = new Map();
|
|
71
70
|
export const $questionByUser = ($questionId, transport) => {
|
|
72
71
|
const { client, queryKey, queryKeyStr } = transport.createPromiseClient(Feed, {
|
|
73
72
|
method: 'questionByUser',
|
|
74
73
|
params: [$questionId],
|
|
75
74
|
});
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
let cacheKey = queryKeyStr;
|
|
76
|
+
if (typeof $questionId !== 'object') {
|
|
77
|
+
cacheKey += $questionId;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
cacheKey += 'atom';
|
|
81
|
+
}
|
|
82
|
+
if (transport.storeCache.has(cacheKey)) {
|
|
83
|
+
return transport.storeCache.get(cacheKey);
|
|
78
84
|
}
|
|
79
85
|
else {
|
|
80
86
|
const store = transport.nanoquery.createFetcherStore(queryKey, {
|
|
@@ -87,7 +93,7 @@ export const $questionByUser = ($questionId, transport) => {
|
|
|
87
93
|
dedupeTime: Infinity,
|
|
88
94
|
refetchInterval: Infinity,
|
|
89
95
|
});
|
|
90
|
-
storeCache.set(
|
|
96
|
+
transport.storeCache.set(cacheKey, store);
|
|
91
97
|
return store;
|
|
92
98
|
}
|
|
93
99
|
};
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/feature-gamification",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.13",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@bufbuild/protobuf": "^1.10.0",
|
|
6
6
|
"@fastify/deepmerge": "^2.0.0",
|
|
7
7
|
"@streamlayer/sl-eslib": "^5.149.1",
|
|
8
8
|
"uuid": "^11.1.0",
|
|
9
9
|
"nanostores": "^0.11.4",
|
|
10
|
-
"@streamlayer/sdk-web-api": "^1.8.
|
|
11
|
-
"@streamlayer/sdk-web-core": "^1.11.
|
|
12
|
-
"@streamlayer/sdk-web-interfaces": "^1.5.
|
|
13
|
-
"@streamlayer/sdk-web-logger": "^1.0.
|
|
14
|
-
"@streamlayer/sdk-web-notifications": "^1.3.
|
|
15
|
-
"@streamlayer/sdk-web-storage": "^1.0.
|
|
16
|
-
"@streamlayer/sdk-web-types": "^1.10.
|
|
10
|
+
"@streamlayer/sdk-web-api": "^1.8.13",
|
|
11
|
+
"@streamlayer/sdk-web-core": "^1.11.15",
|
|
12
|
+
"@streamlayer/sdk-web-interfaces": "^1.5.4",
|
|
13
|
+
"@streamlayer/sdk-web-logger": "^1.0.60",
|
|
14
|
+
"@streamlayer/sdk-web-notifications": "^1.3.22",
|
|
15
|
+
"@streamlayer/sdk-web-storage": "^1.0.60",
|
|
16
|
+
"@streamlayer/sdk-web-types": "^1.10.17"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"tslib": "^2.7.0"
|