@streamscloud/embeddable 17.0.2 → 17.0.4
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 +34 -23
- package/dist/feed-player/sidebar/sidebar-panel.svelte +2 -2
- package/dist/feed-player/sidebar/sidebar-panel.svelte.d.ts +1 -0
- package/dist/feed-player/sidebar/sidebar-tab-bar.svelte +6 -2
- package/dist/feed-player/sidebar/sidebar-tab-bar.svelte.d.ts +1 -0
- package/dist/feed-player/types.d.ts +1 -0
- 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
|
@@ -22,6 +22,8 @@ $effect(() => {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
const localization = new FeedPlayerLocalization();
|
|
25
|
+
// ── Mode ──
|
|
26
|
+
const isPreview = $derived(settings?.mode === 'preview');
|
|
25
27
|
// ── Background mode ──
|
|
26
28
|
const isGlassBackground = $derived(settings?.background === 'glass');
|
|
27
29
|
const isTransparentBackground = $derived(settings?.background === 'transparent');
|
|
@@ -249,8 +251,12 @@ const onAdImpression = (adId) => {
|
|
|
249
251
|
};
|
|
250
252
|
// ── Action buttons (like, share, attachments toggle) ──
|
|
251
253
|
const postActionsGenerator = untrack(() => new PostActionsGenerator({
|
|
252
|
-
socialInteractionsHandler
|
|
253
|
-
|
|
254
|
+
get socialInteractionsHandler() {
|
|
255
|
+
return socialInteractionsHandler;
|
|
256
|
+
},
|
|
257
|
+
get sharingHandler() {
|
|
258
|
+
return sharingHandler;
|
|
259
|
+
},
|
|
254
260
|
on: { attachmentClicked: () => (sidebarCollapsed = !sidebarCollapsed) }
|
|
255
261
|
}));
|
|
256
262
|
const itemActions = $derived.by(() => {
|
|
@@ -292,13 +298,15 @@ const itemActions = $derived.by(() => {
|
|
|
292
298
|
enableAttachments={false}
|
|
293
299
|
enableControls={showControlsOverlay}
|
|
294
300
|
autoplay="on-appearance"
|
|
295
|
-
on={
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
301
|
+
on={isPreview
|
|
302
|
+
? {}
|
|
303
|
+
: {
|
|
304
|
+
productClick: onProductClick,
|
|
305
|
+
productImpression: onProductImpression,
|
|
306
|
+
adClick: onAdClick,
|
|
307
|
+
adImpression: onAdImpression,
|
|
308
|
+
articleReadMore: (id) => on?.articleReadMore?.(id)
|
|
309
|
+
}} />
|
|
302
310
|
</div>
|
|
303
311
|
{/snippet}
|
|
304
312
|
</FeedSlider>
|
|
@@ -344,22 +352,25 @@ const itemActions = $derived.by(() => {
|
|
|
344
352
|
model={currentPostModel}
|
|
345
353
|
trackingParams={currentTrackingParams}
|
|
346
354
|
selectedProductId={selectedProductId}
|
|
355
|
+
interactionsDisabled={isPreview}
|
|
347
356
|
recommendedHandler={recommendedHandler}
|
|
348
357
|
playlistHandler={playlistHandler}
|
|
349
|
-
on={
|
|
350
|
-
tabChange:
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
358
|
+
on={isPreview
|
|
359
|
+
? { tabChange: () => {} }
|
|
360
|
+
: {
|
|
361
|
+
tabChange: handleTabChange,
|
|
362
|
+
productClick: onProductClick,
|
|
363
|
+
productImpression: onProductImpression,
|
|
364
|
+
productBuy: on?.productBuy,
|
|
365
|
+
productSelect: (id) => {
|
|
366
|
+
selectedProductId = id;
|
|
367
|
+
handleTabChange('product');
|
|
368
|
+
},
|
|
369
|
+
adClick: onAdClick,
|
|
370
|
+
adImpression: onAdImpression,
|
|
371
|
+
articleReadMore: on?.articleReadMore,
|
|
372
|
+
postActivate: (id) => buffer?.tryActivateItemById(id)
|
|
373
|
+
}} />
|
|
363
374
|
</div>
|
|
364
375
|
{/if}
|
|
365
376
|
</div>
|
|
@@ -10,11 +10,11 @@ const selectedProduct = $derived.by(() => {
|
|
|
10
10
|
}
|
|
11
11
|
return model.attachments.products.find((p) => p.id === selectedProductId) ?? null;
|
|
12
12
|
});
|
|
13
|
-
let { tabs, activeTabId, model, trackingParams, selectedProductId, recommendedHandler, playlistHandler, on } = $props();
|
|
13
|
+
let { tabs, activeTabId, model, trackingParams, selectedProductId, interactionsDisabled, recommendedHandler, playlistHandler, on } = $props();
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
16
|
<div class="sidebar-panel">
|
|
17
|
-
<SidebarTabBar tabs={tabs} activeTabId={activeTabId} on={{ tabChange: on.tabChange }} />
|
|
17
|
+
<SidebarTabBar tabs={tabs} activeTabId={activeTabId} disabled={interactionsDisabled} on={{ tabChange: on.tabChange }} />
|
|
18
18
|
|
|
19
19
|
<div class="sidebar-panel__content">
|
|
20
20
|
{#if activeTabId === 'information'}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<script lang="ts">let { tabs, activeTabId, on } = $props();
|
|
1
|
+
<script lang="ts">let { tabs, activeTabId, disabled, on } = $props();
|
|
2
2
|
export {};
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
|
-
<div class="sidebar-tab-bar">
|
|
5
|
+
<div class="sidebar-tab-bar" class:sidebar-tab-bar--disabled={disabled}>
|
|
6
6
|
{#each tabs as tab (tab.id)}
|
|
7
7
|
<button type="button" class="sidebar-tab-bar__tab" class:sidebar-tab-bar__tab--active={tab.id === activeTabId} onclick={() => on.tabChange(tab.id)}>
|
|
8
8
|
{tab.label}
|
|
@@ -42,4 +42,8 @@ export {};
|
|
|
42
42
|
.sidebar-tab-bar__tab--active {
|
|
43
43
|
font-weight: 500;
|
|
44
44
|
color: var(--_sidebar-tab-bar--color-active);
|
|
45
|
+
}
|
|
46
|
+
.sidebar-tab-bar--disabled .sidebar-tab-bar__tab:not(.sidebar-tab-bar__tab--active) {
|
|
47
|
+
pointer-events: none;
|
|
48
|
+
opacity: 0.5;
|
|
45
49
|
}</style>
|
|
@@ -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.4",
|
|
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
|
},
|