@streamscloud/embeddable 17.0.2 → 17.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.
- package/dist/feed-player/cmp.feed-player.svelte +6 -2
- package/dist/posts/controls/index.d.ts +1 -1
- package/dist/posts/controls/post-actions-generator.svelte.d.ts +8 -10
- package/dist/posts/controls/post-actions-generator.svelte.js +12 -12
- package/dist/posts/controls/post-actions-handler.svelte.d.ts +8 -11
- package/dist/posts/controls/post-actions-handler.svelte.js +13 -13
- package/dist/posts/posts-player/posts-player-view.svelte +6 -2
- package/dist/streams/controls/stream-actions-generator.svelte.d.ts +8 -10
- package/dist/streams/controls/stream-actions-generator.svelte.js +14 -14
- package/dist/streams/streams-player/streams-player-view.svelte +6 -2
- package/package.json +2 -2
|
@@ -249,8 +249,12 @@ const onAdImpression = (adId) => {
|
|
|
249
249
|
};
|
|
250
250
|
// ── Action buttons (like, share, attachments toggle) ──
|
|
251
251
|
const postActionsGenerator = untrack(() => new PostActionsGenerator({
|
|
252
|
-
socialInteractionsHandler
|
|
253
|
-
|
|
252
|
+
get socialInteractionsHandler() {
|
|
253
|
+
return socialInteractionsHandler;
|
|
254
|
+
},
|
|
255
|
+
get sharingHandler() {
|
|
256
|
+
return sharingHandler;
|
|
257
|
+
},
|
|
254
258
|
on: { attachmentClicked: () => (sidebarCollapsed = !sidebarCollapsed) }
|
|
255
259
|
}));
|
|
256
260
|
const itemActions = $derived.by(() => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { PostActionsGenerator } from './post-actions-generator.svelte';
|
|
2
|
-
export { PostActionsHandler } from './post-actions-handler.svelte';
|
|
2
|
+
export { PostActionsHandler, type PostActionsHandlerProps } from './post-actions-handler.svelte';
|
|
@@ -3,18 +3,16 @@ import type { IPostSharingHandler } from '../sharing';
|
|
|
3
3
|
import type { IPostSocialInteractionsHandler } from '../social-interactions';
|
|
4
4
|
import { PostActionsHandler } from './post-actions-handler.svelte';
|
|
5
5
|
export declare class PostActionsGenerator {
|
|
6
|
-
private
|
|
7
|
-
private sharingHandler;
|
|
8
|
-
private callbacks;
|
|
6
|
+
private props;
|
|
9
7
|
private handlers;
|
|
10
|
-
constructor(
|
|
11
|
-
socialInteractionsHandler: IPostSocialInteractionsHandler | undefined;
|
|
12
|
-
sharingHandler: IPostSharingHandler | undefined;
|
|
13
|
-
on: PostActionCallbacks;
|
|
14
|
-
});
|
|
8
|
+
constructor(props: PostActionsGeneratorProps);
|
|
15
9
|
getPostActionsHandler: (model: PostModel) => PostActionsHandler;
|
|
16
10
|
}
|
|
17
|
-
type
|
|
18
|
-
|
|
11
|
+
type PostActionsGeneratorProps = {
|
|
12
|
+
readonly socialInteractionsHandler: IPostSocialInteractionsHandler | undefined;
|
|
13
|
+
readonly sharingHandler: IPostSharingHandler | undefined;
|
|
14
|
+
readonly on: {
|
|
15
|
+
attachmentClicked: () => void;
|
|
16
|
+
};
|
|
19
17
|
};
|
|
20
18
|
export {};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { PostActionsHandler } from './post-actions-handler.svelte';
|
|
2
2
|
export class PostActionsGenerator {
|
|
3
|
-
|
|
4
|
-
sharingHandler;
|
|
5
|
-
callbacks;
|
|
3
|
+
props;
|
|
6
4
|
handlers = {};
|
|
7
|
-
constructor(
|
|
8
|
-
this.
|
|
9
|
-
this.sharingHandler = init.sharingHandler ?? null;
|
|
10
|
-
this.callbacks = init.on;
|
|
5
|
+
constructor(props) {
|
|
6
|
+
this.props = props;
|
|
11
7
|
}
|
|
12
8
|
getPostActionsHandler = (model) => {
|
|
13
9
|
let handler = this.handlers[model.id];
|
|
14
10
|
if (!handler) {
|
|
11
|
+
const props = this.props;
|
|
15
12
|
handler = new PostActionsHandler({
|
|
16
13
|
post: model,
|
|
17
|
-
socialInteractionsHandler
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
get socialInteractionsHandler() {
|
|
15
|
+
return props.socialInteractionsHandler ?? null;
|
|
16
|
+
},
|
|
17
|
+
get shareClicked() {
|
|
18
|
+
const sh = props.sharingHandler;
|
|
19
|
+
return sh ? () => sh.share(model.id) : undefined;
|
|
20
|
+
},
|
|
21
|
+
attachmentClicked: props.on.attachmentClicked
|
|
22
22
|
});
|
|
23
23
|
this.handlers[model.id] = handler;
|
|
24
24
|
}
|
|
@@ -4,23 +4,20 @@ import type { IconColor } from '@streamscloud/kit/ui/icon';
|
|
|
4
4
|
export declare class PostActionsHandler {
|
|
5
5
|
readonly actions: PostAction[];
|
|
6
6
|
private post;
|
|
7
|
-
private
|
|
8
|
-
private callbacks;
|
|
7
|
+
private props;
|
|
9
8
|
private isLikedStore;
|
|
10
|
-
constructor(
|
|
11
|
-
post: PostModel;
|
|
12
|
-
socialInteractionsHandler: IPostSocialInteractionsHandler | null;
|
|
13
|
-
callbacks: PostActionCallbacks;
|
|
14
|
-
});
|
|
9
|
+
constructor(props: PostActionsHandlerProps);
|
|
15
10
|
private initIsLikedStore;
|
|
16
11
|
}
|
|
12
|
+
export type PostActionsHandlerProps = {
|
|
13
|
+
post: PostModel;
|
|
14
|
+
readonly socialInteractionsHandler: IPostSocialInteractionsHandler | null;
|
|
15
|
+
readonly shareClicked: (() => void) | undefined;
|
|
16
|
+
attachmentClicked: () => void;
|
|
17
|
+
};
|
|
17
18
|
type PostAction = {
|
|
18
19
|
icon: string;
|
|
19
20
|
iconColor?: IconColor;
|
|
20
21
|
callback: () => void;
|
|
21
22
|
};
|
|
22
|
-
type PostActionCallbacks = {
|
|
23
|
-
attachmentClicked: () => void;
|
|
24
|
-
shareClicked?: () => void;
|
|
25
|
-
};
|
|
26
23
|
export {};
|
|
@@ -9,19 +9,20 @@ export class PostActionsHandler {
|
|
|
9
9
|
actions = $derived.by(() => {
|
|
10
10
|
const result = [];
|
|
11
11
|
if (this.post.attachments) {
|
|
12
|
-
result.push({ icon: IconShoppingBag, callback: this.
|
|
12
|
+
result.push({ icon: IconShoppingBag, callback: this.props.attachmentClicked });
|
|
13
13
|
}
|
|
14
|
-
if (this.post.enableSocialInteractions && this.socialInteractionsHandler) {
|
|
14
|
+
if (this.post.enableSocialInteractions && this.props.socialInteractionsHandler) {
|
|
15
15
|
result.push({
|
|
16
16
|
icon: this.isLikedStore.isLiked ? IconHeartFilled : IconHeart,
|
|
17
17
|
iconColor: this.isLikedStore.isLiked ? 'red' : undefined,
|
|
18
|
-
callback: () => this.socialInteractionsHandler?.toggleLike(this.post.id)
|
|
18
|
+
callback: () => this.props.socialInteractionsHandler?.toggleLike(this.post.id)
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
const shareClicked = this.props.shareClicked;
|
|
22
|
+
if (shareClicked) {
|
|
22
23
|
result.push({
|
|
23
24
|
icon: IconShare,
|
|
24
|
-
callback: () =>
|
|
25
|
+
callback: () => shareClicked()
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
if (this.post.media && !this.post.media.currentItem.isImage) {
|
|
@@ -33,23 +34,22 @@ export class PostActionsHandler {
|
|
|
33
34
|
return result;
|
|
34
35
|
});
|
|
35
36
|
post;
|
|
36
|
-
|
|
37
|
-
callbacks;
|
|
37
|
+
props;
|
|
38
38
|
isLikedStore = $state.raw({
|
|
39
39
|
get isLiked() {
|
|
40
40
|
return false;
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
constructor(
|
|
44
|
-
this.post =
|
|
45
|
-
this.
|
|
46
|
-
this.callbacks = init.callbacks;
|
|
43
|
+
constructor(props) {
|
|
44
|
+
this.post = props.post;
|
|
45
|
+
this.props = props;
|
|
47
46
|
this.initIsLikedStore();
|
|
48
47
|
}
|
|
49
48
|
initIsLikedStore = async () => {
|
|
50
|
-
|
|
49
|
+
const handler = this.props.socialInteractionsHandler;
|
|
50
|
+
if (!handler) {
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
this.isLikedStore = await
|
|
53
|
+
this.isLikedStore = await handler.getIsLiked(this.post.id);
|
|
54
54
|
};
|
|
55
55
|
}
|
|
@@ -79,8 +79,12 @@ const contentPlayerConfig = untrack(() => new PlayerConfig({
|
|
|
79
79
|
}
|
|
80
80
|
}));
|
|
81
81
|
const postActionsGenerator = untrack(() => new PostActionsGenerator({
|
|
82
|
-
socialInteractionsHandler
|
|
83
|
-
|
|
82
|
+
get socialInteractionsHandler() {
|
|
83
|
+
return socialInteractionsHandler;
|
|
84
|
+
},
|
|
85
|
+
get sharingHandler() {
|
|
86
|
+
return sharingHandler;
|
|
87
|
+
},
|
|
84
88
|
on: { attachmentClicked: () => (contentPlayerConfig.uiManager.attachmentsCollapsed = !contentPlayerConfig.uiManager.attachmentsCollapsed) }
|
|
85
89
|
}));
|
|
86
90
|
const onProductClick = (id, postId) => {
|
|
@@ -3,15 +3,9 @@ import type { PostModel } from '../../posts/model';
|
|
|
3
3
|
import type { IPostSocialInteractionsHandler } from '../../posts/social-interactions';
|
|
4
4
|
import type { IStreamSharingHandler } from '../sharing';
|
|
5
5
|
export declare class StreamActionsGenerator {
|
|
6
|
-
private
|
|
7
|
-
private sharingHandler;
|
|
8
|
-
private callbacks;
|
|
6
|
+
private props;
|
|
9
7
|
private handlers;
|
|
10
|
-
constructor(
|
|
11
|
-
postSocialInteractionsHandler: IPostSocialInteractionsHandler | undefined;
|
|
12
|
-
sharingHandler: IStreamSharingHandler | undefined;
|
|
13
|
-
on: StreamActionCallbacks;
|
|
14
|
-
});
|
|
8
|
+
constructor(props: StreamActionsGeneratorProps);
|
|
15
9
|
getPostActionsHandler: (data: {
|
|
16
10
|
model: PostModel;
|
|
17
11
|
streamId: string;
|
|
@@ -25,7 +19,11 @@ export declare class StreamActionsGenerator {
|
|
|
25
19
|
callback: () => (void | Promise<void>) | undefined;
|
|
26
20
|
}[];
|
|
27
21
|
}
|
|
28
|
-
type
|
|
29
|
-
|
|
22
|
+
type StreamActionsGeneratorProps = {
|
|
23
|
+
readonly postSocialInteractionsHandler: IPostSocialInteractionsHandler | undefined;
|
|
24
|
+
readonly sharingHandler: IStreamSharingHandler | undefined;
|
|
25
|
+
readonly on: {
|
|
26
|
+
attachmentClicked: () => void;
|
|
27
|
+
};
|
|
30
28
|
};
|
|
31
29
|
export {};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { PostActionsHandler } from '../../posts/controls';
|
|
2
2
|
import IconShare from '@fluentui/svg-icons/icons/share_48_regular.svg?raw';
|
|
3
3
|
export class StreamActionsGenerator {
|
|
4
|
-
|
|
5
|
-
sharingHandler;
|
|
6
|
-
callbacks;
|
|
4
|
+
props;
|
|
7
5
|
handlers = {};
|
|
8
|
-
constructor(
|
|
9
|
-
this.
|
|
10
|
-
this.sharingHandler = init.sharingHandler ?? null;
|
|
11
|
-
this.callbacks = init.on;
|
|
6
|
+
constructor(props) {
|
|
7
|
+
this.props = props;
|
|
12
8
|
}
|
|
13
9
|
getPostActionsHandler = (data) => {
|
|
14
10
|
const { model, streamId, streamPageId } = data;
|
|
15
11
|
let handler = this.handlers[streamPageId];
|
|
16
12
|
if (!handler) {
|
|
13
|
+
const props = this.props;
|
|
17
14
|
handler = new PostActionsHandler({
|
|
18
15
|
post: model,
|
|
19
|
-
socialInteractionsHandler
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
get socialInteractionsHandler() {
|
|
17
|
+
return props.postSocialInteractionsHandler ?? null;
|
|
18
|
+
},
|
|
19
|
+
get shareClicked() {
|
|
20
|
+
const sh = props.sharingHandler;
|
|
21
|
+
return sh ? () => sh.share(streamId) : undefined;
|
|
22
|
+
},
|
|
23
|
+
attachmentClicked: props.on.attachmentClicked
|
|
24
24
|
});
|
|
25
25
|
this.handlers[streamPageId] = handler;
|
|
26
26
|
}
|
|
27
27
|
return handler;
|
|
28
28
|
};
|
|
29
29
|
getGeneralStreamPageActions = (data) => {
|
|
30
|
-
if (!this.sharingHandler) {
|
|
30
|
+
if (!this.props.sharingHandler) {
|
|
31
31
|
return [];
|
|
32
32
|
}
|
|
33
33
|
const { streamId, streamPageId } = data;
|
|
@@ -35,7 +35,7 @@ export class StreamActionsGenerator {
|
|
|
35
35
|
return [
|
|
36
36
|
{
|
|
37
37
|
icon: IconShare,
|
|
38
|
-
callback: () => this.sharingHandler?.share(streamId)
|
|
38
|
+
callback: () => this.props.sharingHandler?.share(streamId)
|
|
39
39
|
}
|
|
40
40
|
];
|
|
41
41
|
};
|
|
@@ -100,8 +100,12 @@ const contentPlayerConfig = untrack(() => new PlayerConfig({
|
|
|
100
100
|
}
|
|
101
101
|
}));
|
|
102
102
|
const streamActionsGenerator = untrack(() => new StreamActionsGenerator({
|
|
103
|
-
postSocialInteractionsHandler
|
|
104
|
-
|
|
103
|
+
get postSocialInteractionsHandler() {
|
|
104
|
+
return postSocialInteractionsHandler;
|
|
105
|
+
},
|
|
106
|
+
get sharingHandler() {
|
|
107
|
+
return sharingHandler;
|
|
108
|
+
},
|
|
105
109
|
on: { attachmentClicked: () => (contentPlayerConfig.uiManager.attachmentsCollapsed = !contentPlayerConfig.uiManager.attachmentsCollapsed) }
|
|
106
110
|
}));
|
|
107
111
|
const itemAsPostModel = (item) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamscloud/embeddable",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.0.3",
|
|
4
4
|
"author": "StreamsCloud",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
}
|
|
147
147
|
},
|
|
148
148
|
"peerDependencies": {
|
|
149
|
-
"@streamscloud/kit": "
|
|
149
|
+
"@streamscloud/kit": ">=0.2.28",
|
|
150
150
|
"@streamscloud/streams-analytics-collector": "^4.0.1",
|
|
151
151
|
"svelte": "^5.51.0"
|
|
152
152
|
},
|