@streamscloud/embeddable 15.0.2 → 15.0.3
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,17 +1,16 @@
|
|
|
1
1
|
import { PostActionsHandler } from './post-actions-handler.svelte';
|
|
2
|
-
import { SvelteMap } from 'svelte/reactivity';
|
|
3
2
|
export class PostActionsGenerator {
|
|
4
3
|
socialInteractionsHandler;
|
|
5
4
|
sharingHandler;
|
|
6
5
|
callbacks;
|
|
7
|
-
handlers =
|
|
6
|
+
handlers = {};
|
|
8
7
|
constructor(init) {
|
|
9
8
|
this.socialInteractionsHandler = init.socialInteractionsHandler ?? null;
|
|
10
9
|
this.sharingHandler = init.sharingHandler ?? null;
|
|
11
10
|
this.callbacks = init.on;
|
|
12
11
|
}
|
|
13
12
|
getPostActionsHandler = (model) => {
|
|
14
|
-
let handler = this.handlers
|
|
13
|
+
let handler = this.handlers[model.id];
|
|
15
14
|
if (!handler) {
|
|
16
15
|
handler = new PostActionsHandler({
|
|
17
16
|
post: model,
|
|
@@ -21,7 +20,7 @@ export class PostActionsGenerator {
|
|
|
21
20
|
shareClicked: this.sharingHandler ? () => this.sharingHandler?.share(model.id) : undefined
|
|
22
21
|
}
|
|
23
22
|
});
|
|
24
|
-
this.handlers
|
|
23
|
+
this.handlers[model.id] = handler;
|
|
25
24
|
}
|
|
26
25
|
return handler;
|
|
27
26
|
};
|
|
@@ -11,16 +11,15 @@ import { initBufferFromProvider } from '../../ui/player/providers/service';
|
|
|
11
11
|
import IconDelete from '@fluentui/svg-icons/icons/delete_32_regular.svg?raw';
|
|
12
12
|
import IconEdit from '@fluentui/svg-icons/icons/edit_32_regular.svg?raw';
|
|
13
13
|
import { untrack } from 'svelte';
|
|
14
|
-
import { SvelteMap } from 'svelte/reactivity';
|
|
15
14
|
let { dataProvider, socialInteractionsHandler, sharingHandler, playerSettings, analyticsHandler, managementActions, closeOrchestrator, on } = $props();
|
|
16
15
|
let buffer = $state.raw(null);
|
|
17
|
-
let mappedPostsCache =
|
|
16
|
+
let mappedPostsCache = {};
|
|
18
17
|
$effect(() => {
|
|
19
18
|
void dataProvider;
|
|
20
19
|
untrack(() => {
|
|
21
20
|
contentPlayerConfig.playerBuffer = null;
|
|
22
21
|
buffer = null;
|
|
23
|
-
mappedPostsCache =
|
|
22
|
+
mappedPostsCache = {};
|
|
24
23
|
initBuffer(dataProvider);
|
|
25
24
|
});
|
|
26
25
|
});
|
|
@@ -92,11 +91,11 @@ const onAdImpression = (id) => {
|
|
|
92
91
|
analyticsHandler?.trackAdImpression(id);
|
|
93
92
|
};
|
|
94
93
|
const itemAsPostModel = (item) => {
|
|
95
|
-
if (mappedPostsCache
|
|
96
|
-
return mappedPostsCache
|
|
94
|
+
if (mappedPostsCache[item.id]) {
|
|
95
|
+
return mappedPostsCache[item.id];
|
|
97
96
|
}
|
|
98
97
|
const postModel = new PostModel(item);
|
|
99
|
-
mappedPostsCache
|
|
98
|
+
mappedPostsCache[item.id] = postModel;
|
|
100
99
|
return postModel;
|
|
101
100
|
};
|
|
102
101
|
const currentItemActions = $derived.by(() => {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { PostActionsHandler } from '../../posts/controls';
|
|
2
2
|
import IconShare from '@fluentui/svg-icons/icons/share_48_regular.svg?raw';
|
|
3
|
-
import { SvelteMap } from 'svelte/reactivity';
|
|
4
3
|
export class StreamActionsGenerator {
|
|
5
4
|
postSocialInteractionsHandler;
|
|
6
5
|
sharingHandler;
|
|
7
6
|
callbacks;
|
|
8
|
-
handlers =
|
|
7
|
+
handlers = {};
|
|
9
8
|
constructor(init) {
|
|
10
9
|
this.postSocialInteractionsHandler = init.postSocialInteractionsHandler ?? null;
|
|
11
10
|
this.sharingHandler = init.sharingHandler ?? null;
|
|
@@ -13,7 +12,7 @@ export class StreamActionsGenerator {
|
|
|
13
12
|
}
|
|
14
13
|
getPostActionsHandler = (data) => {
|
|
15
14
|
const { model, streamId, streamPageId } = data;
|
|
16
|
-
let handler = this.handlers
|
|
15
|
+
let handler = this.handlers[streamPageId];
|
|
17
16
|
if (!handler) {
|
|
18
17
|
handler = new PostActionsHandler({
|
|
19
18
|
post: model,
|
|
@@ -23,7 +22,7 @@ export class StreamActionsGenerator {
|
|
|
23
22
|
shareClicked: this.sharingHandler ? () => this.sharingHandler?.share(streamId) : undefined
|
|
24
23
|
}
|
|
25
24
|
});
|
|
26
|
-
this.handlers
|
|
25
|
+
this.handlers[streamPageId] = handler;
|
|
27
26
|
}
|
|
28
27
|
return handler;
|
|
29
28
|
};
|
|
@@ -14,11 +14,10 @@ import { StreamsPlayerBuffer } from './streams-player-buffer.svelte';
|
|
|
14
14
|
import IconDelete from '@fluentui/svg-icons/icons/delete_32_regular.svg?raw';
|
|
15
15
|
import IconEdit from '@fluentui/svg-icons/icons/edit_32_regular.svg?raw';
|
|
16
16
|
import { untrack } from 'svelte';
|
|
17
|
-
import { SvelteMap } from 'svelte/reactivity';
|
|
18
17
|
let { dataProvider, analyticsHandler, postSocialInteractionsHandler, sharingHandler, amplificationParameters, managementActions, playerSettings, closeOrchestrator, on } = $props();
|
|
19
18
|
const localization = $derived(new StreamPlayerLocalization(playerSettings?.locale ?? 'en'));
|
|
20
19
|
let currentStreamModel = $state(null);
|
|
21
|
-
let mappedPostsCache =
|
|
20
|
+
let mappedPostsCache = {};
|
|
22
21
|
let activePageId = $derived.by(() => buffer?.current?.id ?? '');
|
|
23
22
|
let buffer = $state(null);
|
|
24
23
|
let totalEngagementTimeSeconds = 0;
|
|
@@ -40,7 +39,7 @@ $effect(() => {
|
|
|
40
39
|
untrack(() => {
|
|
41
40
|
buffer = null;
|
|
42
41
|
contentPlayerConfig.playerBuffer = null;
|
|
43
|
-
mappedPostsCache =
|
|
42
|
+
mappedPostsCache = {};
|
|
44
43
|
initPlayerBuffer(dataProvider);
|
|
45
44
|
});
|
|
46
45
|
return () => { };
|
|
@@ -112,11 +111,11 @@ const itemAsPostModel = (item) => {
|
|
|
112
111
|
if (item.type !== 'short-video' || !item.shortVideo) {
|
|
113
112
|
return null;
|
|
114
113
|
}
|
|
115
|
-
if (mappedPostsCache
|
|
116
|
-
return mappedPostsCache
|
|
114
|
+
if (mappedPostsCache[item.shortVideo.id]) {
|
|
115
|
+
return mappedPostsCache[item.shortVideo.id];
|
|
117
116
|
}
|
|
118
117
|
const postModel = new PostModel(mapToPostModel(item.shortVideo));
|
|
119
|
-
mappedPostsCache
|
|
118
|
+
mappedPostsCache[item.shortVideo.id] = postModel;
|
|
120
119
|
return postModel;
|
|
121
120
|
};
|
|
122
121
|
const handleChangePage = (index) => {
|