@streamscloud/embeddable 17.0.4 → 18.0.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.
Files changed (27) hide show
  1. package/package.json +1 -5
  2. package/dist/feed-player/cmp.close-button.svelte +0 -40
  3. package/dist/feed-player/cmp.close-button.svelte.d.ts +0 -19
  4. package/dist/feed-player/cmp.feed-player.svelte +0 -542
  5. package/dist/feed-player/cmp.feed-player.svelte.d.ts +0 -15
  6. package/dist/feed-player/feed-player-localization.d.ts +0 -16
  7. package/dist/feed-player/feed-player-localization.js +0 -70
  8. package/dist/feed-player/index.d.ts +0 -3
  9. package/dist/feed-player/index.js +0 -2
  10. package/dist/feed-player/sidebar/article-tab.svelte +0 -98
  11. package/dist/feed-player/sidebar/article-tab.svelte.d.ts +0 -19
  12. package/dist/feed-player/sidebar/information-tab.svelte +0 -98
  13. package/dist/feed-player/sidebar/information-tab.svelte.d.ts +0 -26
  14. package/dist/feed-player/sidebar/playlist-tab.svelte +0 -115
  15. package/dist/feed-player/sidebar/playlist-tab.svelte.d.ts +0 -19
  16. package/dist/feed-player/sidebar/post-card.svelte +0 -127
  17. package/dist/feed-player/sidebar/post-card.svelte.d.ts +0 -24
  18. package/dist/feed-player/sidebar/recommended-tab.svelte +0 -169
  19. package/dist/feed-player/sidebar/recommended-tab.svelte.d.ts +0 -19
  20. package/dist/feed-player/sidebar/sidebar-panel.svelte +0 -71
  21. package/dist/feed-player/sidebar/sidebar-panel.svelte.d.ts +0 -28
  22. package/dist/feed-player/sidebar/sidebar-tab-bar.svelte +0 -49
  23. package/dist/feed-player/sidebar/sidebar-tab-bar.svelte.d.ts +0 -21
  24. package/dist/feed-player/sidebar/types.d.ts +0 -4
  25. package/dist/feed-player/sidebar/types.js +0 -1
  26. package/dist/feed-player/types.d.ts +0 -67
  27. package/dist/feed-player/types.js +0 -1
@@ -1,169 +0,0 @@
1
- <script lang="ts">import { ProductCard } from '../../products/product-card';
2
- import { FeedPlayerLocalization } from '../feed-player-localization';
3
- import { default as PostCard } from './post-card.svelte';
4
- import { Image } from '@streamscloud/kit/ui/image';
5
- import { untrack } from 'svelte';
6
- const { handler, currentPostId, trackingParams } = $props();
7
- const localization = new FeedPlayerLocalization();
8
- let data = $state.raw(null);
9
- $effect(() => {
10
- const postId = currentPostId;
11
- untrack(() => {
12
- data = null;
13
- const load = async () => {
14
- data = await handler.getRecommendations(postId);
15
- };
16
- void load();
17
- });
18
- });
19
- </script>
20
-
21
- {#if data}
22
- <div class="recommended-tab">
23
- {#if data.relatedPosts.length}
24
- <div class="recommended-tab__section">
25
- <div class="recommended-tab__section-title">{localization.relatedPosts}</div>
26
- <div class="recommended-tab__posts">
27
- {#each data.relatedPosts as post (post.id)}
28
- <PostCard post={post} thumbnailWidth={82} thumbnailHeight={146} thumbnailRadius={6} on={{ click: () => handler.onPostSelect?.(post.id) }} />
29
- {/each}
30
- </div>
31
- </div>
32
- {/if}
33
-
34
- {#if data.suggestedPlaylists.length}
35
- <div class="recommended-tab__section">
36
- <div class="recommended-tab__section-title">{localization.suggestedPlaylist}</div>
37
- <div class="recommended-tab__playlists">
38
- {#each data.suggestedPlaylists as playlist (playlist.id)}
39
- <div class="recommended-tab__playlist-card" onclick={() => handler.onPlaylistSelect?.(playlist.id)} onkeydown={() => {}} role="none">
40
- <div class="recommended-tab__playlist-thumbnail">
41
- <Image src={playlist.thumbnailUrl} />
42
- </div>
43
- <div class="recommended-tab__playlist-info">
44
- <div class="recommended-tab__playlist-name">{playlist.name}</div>
45
- <div class="recommended-tab__playlist-count">{localization.postsCount(playlist.postsCount)}</div>
46
- <div
47
- class="recommended-tab__playlist-link"
48
- onclick={(e: MouseEvent) => {
49
- e.stopPropagation();
50
- handler.onPlaylistShow?.(playlist.id);
51
- }}
52
- onkeydown={() => {}}
53
- role="none">
54
- {localization.showList}
55
- </div>
56
- </div>
57
- </div>
58
- {/each}
59
- </div>
60
- </div>
61
- {/if}
62
-
63
- {#if data.suggestedProducts.length}
64
- <div class="recommended-tab__section">
65
- <div class="recommended-tab__section-title">{localization.suggestedProducts}</div>
66
- <div class="recommended-tab__products">
67
- {#each data.suggestedProducts as product (product.id)}
68
- <div class="recommended-tab__product-wrapper">
69
- <ProductCard product={product} trackingParams={trackingParams} on={{ click: handler.onProductSelect, buy: handler.onProductBuy }} />
70
- </div>
71
- {/each}
72
- </div>
73
- </div>
74
- {/if}
75
- </div>
76
- {/if}
77
-
78
- <!--
79
- @component
80
- Recommended tab — shows related posts, suggested playlists, and suggested products.
81
-
82
- ### CSS Custom Properties
83
- | Property | Description | Default |
84
- |---|---|---|
85
- | `--recommended-tab--section-gap` | Gap between sections | `24px` |
86
- | `--recommended-tab--link-color` | "Show list" link color | `#144ab0` |
87
- -->
88
-
89
- <style>.recommended-tab {
90
- --_recommended-tab--background: var(--recommended-tab--background, rgba(255, 255, 255, 0.8));
91
- --_recommended-tab--border-color: var(--recommended-tab--border-color, #f9fafb);
92
- --_recommended-tab--section-gap: var(--recommended-tab--section-gap, 1.5rem);
93
- --_recommended-tab--link-color: var(--recommended-tab--link-color, #144ab0);
94
- display: flex;
95
- flex-direction: column;
96
- gap: var(--_recommended-tab--section-gap);
97
- background: var(--_recommended-tab--background);
98
- border: 1px solid var(--_recommended-tab--border-color);
99
- padding: 1rem 1rem 1.5rem;
100
- min-height: 100%;
101
- }
102
- .recommended-tab__section {
103
- display: flex;
104
- flex-direction: column;
105
- gap: 0.5rem;
106
- }
107
- .recommended-tab__section-title {
108
- font-size: 1rem;
109
- font-weight: 500;
110
- }
111
- .recommended-tab__posts {
112
- display: flex;
113
- flex-direction: column;
114
- gap: 0.75rem;
115
- }
116
- .recommended-tab__playlists {
117
- display: flex;
118
- flex-direction: column;
119
- gap: 0.75rem;
120
- }
121
- .recommended-tab__playlist-card {
122
- display: flex;
123
- gap: 1rem;
124
- align-items: flex-end;
125
- background: white;
126
- border-radius: 0.375rem;
127
- overflow: hidden;
128
- cursor: pointer;
129
- }
130
- .recommended-tab__playlist-thumbnail {
131
- flex-shrink: 0;
132
- width: 6.0625rem;
133
- height: 9.125rem;
134
- --sc-kit--image--object-fit: cover;
135
- --sc-kit--image--border-radius: 0.25rem;
136
- }
137
- .recommended-tab__playlist-info {
138
- display: flex;
139
- flex-direction: column;
140
- gap: 0.25rem;
141
- padding: 0.5rem 0;
142
- min-width: 0;
143
- height: 9.125rem;
144
- }
145
- .recommended-tab__playlist-name {
146
- font-size: 0.875rem;
147
- font-weight: 600;
148
- }
149
- .recommended-tab__playlist-count {
150
- font-size: 0.75rem;
151
- font-weight: 400;
152
- color: #999;
153
- flex: 1;
154
- }
155
- .recommended-tab__playlist-link {
156
- font-size: 0.75rem;
157
- font-weight: 500;
158
- color: var(--_recommended-tab--link-color);
159
- cursor: pointer;
160
- }
161
- .recommended-tab__products {
162
- display: flex;
163
- gap: 0.75rem;
164
- overflow-x: auto;
165
- scrollbar-width: none;
166
- }
167
- .recommended-tab__product-wrapper {
168
- flex: 0 0 10.0625rem;
169
- }</style>
@@ -1,19 +0,0 @@
1
- import type { TrackingParams } from '../../marketing-tracking';
2
- import type { IFeedPlayerRecommendedHandler } from '../types';
3
- type Props = {
4
- handler: IFeedPlayerRecommendedHandler;
5
- currentPostId: string;
6
- trackingParams: TrackingParams;
7
- };
8
- /**
9
- * Recommended tab — shows related posts, suggested playlists, and suggested products.
10
- *
11
- * ### CSS Custom Properties
12
- * | Property | Description | Default |
13
- * |---|---|---|
14
- * | `--recommended-tab--section-gap` | Gap between sections | `24px` |
15
- * | `--recommended-tab--link-color` | "Show list" link color | `#144ab0` |
16
- */
17
- declare const RecommendedTab: import("svelte").Component<Props, {}, "">;
18
- type RecommendedTab = ReturnType<typeof RecommendedTab>;
19
- export default RecommendedTab;
@@ -1,71 +0,0 @@
1
- <script lang="ts">import { ProductCard } from '../../products/product-card';
2
- import { default as ArticleTab } from './article-tab.svelte';
3
- import { default as InformationTab } from './information-tab.svelte';
4
- import { default as PlaylistTab } from './playlist-tab.svelte';
5
- import { default as RecommendedTab } from './recommended-tab.svelte';
6
- import { default as SidebarTabBar } from './sidebar-tab-bar.svelte';
7
- const selectedProduct = $derived.by(() => {
8
- if (!selectedProductId || !model.attachments) {
9
- return null;
10
- }
11
- return model.attachments.products.find((p) => p.id === selectedProductId) ?? null;
12
- });
13
- let { tabs, activeTabId, model, trackingParams, selectedProductId, interactionsDisabled, recommendedHandler, playlistHandler, on } = $props();
14
- </script>
15
-
16
- <div class="sidebar-panel">
17
- <SidebarTabBar tabs={tabs} activeTabId={activeTabId} disabled={interactionsDisabled} on={{ tabChange: on.tabChange }} />
18
-
19
- <div class="sidebar-panel__content">
20
- {#if activeTabId === 'information'}
21
- <InformationTab
22
- model={model}
23
- trackingParams={trackingParams}
24
- selectedProductId={selectedProductId}
25
- on={{
26
- productImpression: on.productImpression,
27
- productBuy: on.productBuy,
28
- productSelect: on.productSelect,
29
- adClick: on.adClick,
30
- adImpression: on.adImpression
31
- }} />
32
- {:else if activeTabId === 'product' && selectedProduct}
33
- <div class="sidebar-panel__product">
34
- <ProductCard
35
- product={selectedProduct}
36
- trackingParams={trackingParams}
37
- on={{
38
- click: on.productClick,
39
- buy: on.productBuy
40
- }} />
41
- </div>
42
- {:else if activeTabId === 'article'}
43
- <ArticleTab model={model} on={{ readMore: on.articleReadMore }} />
44
- {:else if activeTabId === 'recommended' && recommendedHandler}
45
- <RecommendedTab handler={recommendedHandler} currentPostId={model.id} trackingParams={trackingParams} />
46
- {:else if activeTabId === 'playlist' && playlistHandler}
47
- <PlaylistTab handler={playlistHandler} activePostId={model.id} on={{ postActivate: on.postActivate }} />
48
- {/if}
49
- </div>
50
- </div>
51
-
52
- <style>.sidebar-panel {
53
- display: flex;
54
- flex-direction: column;
55
- gap: 1rem;
56
- height: 100%;
57
- overflow: hidden;
58
- }
59
- .sidebar-panel__content {
60
- flex: 1;
61
- min-height: 0;
62
- overflow-y: auto;
63
- overflow-x: hidden;
64
- overscroll-behavior: contain;
65
- scrollbar-width: none;
66
- border-radius: 0.5rem;
67
- }
68
- .sidebar-panel__product {
69
- padding: 0.75rem;
70
- --product-card--aspect-ratio: auto;
71
- }</style>
@@ -1,28 +0,0 @@
1
- import type { TrackingParams } from '../../marketing-tracking';
2
- import type { PostModel } from '../../posts/model';
3
- import type { IFeedPlayerPlaylistHandler, IFeedPlayerRecommendedHandler } from '../types';
4
- import type { SidebarTab } from './types';
5
- type Props = {
6
- tabs: SidebarTab[];
7
- activeTabId: string;
8
- model: PostModel;
9
- trackingParams: TrackingParams;
10
- selectedProductId: string | null;
11
- interactionsDisabled?: boolean;
12
- recommendedHandler?: IFeedPlayerRecommendedHandler;
13
- playlistHandler?: IFeedPlayerPlaylistHandler;
14
- on: {
15
- tabChange: (id: string) => void;
16
- productClick?: (productId: string) => void;
17
- productImpression?: (productId: string) => void;
18
- productBuy?: (productId: string) => void;
19
- productSelect?: (productId: string) => void;
20
- adClick?: (adId: string) => void;
21
- adImpression?: (adId: string) => void;
22
- articleReadMore?: (articleId: string) => void;
23
- postActivate?: (postId: string) => void;
24
- };
25
- };
26
- declare const SidebarPanel: import("svelte").Component<Props, {}, "">;
27
- type SidebarPanel = ReturnType<typeof SidebarPanel>;
28
- export default SidebarPanel;
@@ -1,49 +0,0 @@
1
- <script lang="ts">let { tabs, activeTabId, disabled, on } = $props();
2
- export {};
3
- </script>
4
-
5
- <div class="sidebar-tab-bar" class:sidebar-tab-bar--disabled={disabled}>
6
- {#each tabs as tab (tab.id)}
7
- <button type="button" class="sidebar-tab-bar__tab" class:sidebar-tab-bar__tab--active={tab.id === activeTabId} onclick={() => on.tabChange(tab.id)}>
8
- {tab.label}
9
- </button>
10
- {/each}
11
- </div>
12
-
13
- <!--
14
- @component
15
- Tab bar for the feed player sidebar.
16
-
17
- ### CSS Custom Properties
18
- | Property | Description | Default |
19
- |---|---|---|
20
- | `--sidebar-tab-bar--color` | Inactive tab text color | `#9ca3af` |
21
- | `--sidebar-tab-bar--color-active` | Active tab text color | `currentColor` |
22
- -->
23
-
24
- <style>.sidebar-tab-bar {
25
- --_sidebar-tab-bar--color: var(--sidebar-tab-bar--color, #9ca3af);
26
- --_sidebar-tab-bar--color-active: var(--sidebar-tab-bar--color-active, currentColor);
27
- display: flex;
28
- gap: 2.25rem;
29
- flex-shrink: 0;
30
- }
31
- .sidebar-tab-bar__tab {
32
- font-size: 0.75rem;
33
- font-weight: 400;
34
- line-height: 1rem;
35
- color: var(--_sidebar-tab-bar--color);
36
- background: none;
37
- border: none;
38
- padding: 0;
39
- cursor: pointer;
40
- white-space: nowrap;
41
- }
42
- .sidebar-tab-bar__tab--active {
43
- font-weight: 500;
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;
49
- }</style>
@@ -1,21 +0,0 @@
1
- import type { SidebarTab } from './types';
2
- type Props = {
3
- tabs: SidebarTab[];
4
- activeTabId: string;
5
- disabled?: boolean;
6
- on: {
7
- tabChange: (id: string) => void;
8
- };
9
- };
10
- /**
11
- * Tab bar for the feed player sidebar.
12
- *
13
- * ### CSS Custom Properties
14
- * | Property | Description | Default |
15
- * |---|---|---|
16
- * | `--sidebar-tab-bar--color` | Inactive tab text color | `#9ca3af` |
17
- * | `--sidebar-tab-bar--color-active` | Active tab text color | `currentColor` |
18
- */
19
- declare const SidebarTabBar: import("svelte").Component<Props, {}, "">;
20
- type SidebarTabBar = ReturnType<typeof SidebarTabBar>;
21
- export default SidebarTabBar;
@@ -1,4 +0,0 @@
1
- export type SidebarTab = {
2
- id: string;
3
- label: string;
4
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,67 +0,0 @@
1
- import type { TrackingParams } from '../marketing-tracking';
2
- import type { IPostModel } from '../posts/model';
3
- import type { IPostAnalyticsHandler } from '../posts/posts-player';
4
- import type { IPostSharingHandler } from '../posts/sharing';
5
- import type { IPostSocialInteractionsHandler } from '../posts/social-interactions';
6
- import type { ProductCardModel } from '../products/product-card';
7
- import type { AppLocaleValue } from '@streamscloud/kit/core/locale';
8
- import type { IPlayerDataProvider } from '@streamscloud/kit/ui/player/providers';
9
- import type { Snippet } from 'svelte';
10
- export type FeedPlayerPostPreview = {
11
- id: string;
12
- thumbnailUrl: string | null;
13
- title: string | null;
14
- description: string | null;
15
- displayDate: string;
16
- viewsCount: number;
17
- durationSeconds: number | null;
18
- };
19
- export type FeedPlayerSuggestedPlaylist = {
20
- id: string;
21
- name: string;
22
- postsCount: number;
23
- thumbnailUrl: string | null;
24
- };
25
- export type FeedPlayerRecommendedData = {
26
- relatedPosts: FeedPlayerPostPreview[];
27
- suggestedPlaylists: FeedPlayerSuggestedPlaylist[];
28
- suggestedProducts: ProductCardModel[];
29
- };
30
- export interface IFeedPlayerRecommendedHandler {
31
- getRecommendations: (postId: string) => Promise<FeedPlayerRecommendedData>;
32
- onPostSelect?: (postId: string) => void;
33
- onPlaylistSelect?: (playlistId: string) => void;
34
- onPlaylistShow?: (playlistId: string) => void;
35
- onProductSelect?: (productId: string) => void;
36
- onProductBuy?: (productId: string) => void;
37
- }
38
- export type FeedPlayerPlaylistData = {
39
- name: string;
40
- updatedAt: string;
41
- posts: FeedPlayerPostPreview[];
42
- };
43
- export interface IFeedPlayerPlaylistHandler {
44
- getPlaylist: () => Promise<FeedPlayerPlaylistData>;
45
- }
46
- export type FeedPlayerProps = {
47
- dataProvider: IPlayerDataProvider<IPostModel>;
48
- socialInteractionsHandler?: IPostSocialInteractionsHandler;
49
- sharingHandler?: IPostSharingHandler;
50
- analyticsHandler?: IPostAnalyticsHandler;
51
- recommendedHandler?: IFeedPlayerRecommendedHandler;
52
- playlistHandler?: IFeedPlayerPlaylistHandler;
53
- trackingParams?: TrackingParams;
54
- settings?: FeedPlayerSettings;
55
- header?: Snippet;
56
- on?: {
57
- postActivated?: (id: string) => void;
58
- productBuy?: (productId: string) => void;
59
- articleReadMore?: (articleId: string) => void;
60
- closed?: () => void;
61
- };
62
- };
63
- export type FeedPlayerSettings = {
64
- locale?: AppLocaleValue;
65
- background?: 'solid' | 'glass' | 'transparent';
66
- mode?: 'default' | 'preview';
67
- };
@@ -1 +0,0 @@
1
- export {};