@streamscloud/embeddable 17.0.0-1775740482426 → 17.0.0-1775767961522

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,7 +1,7 @@
1
- <script lang="ts">import { default as CloseButton } from './cmp.close-button.svelte';
2
- import { PostActionsGenerator } from '../posts/controls';
1
+ <script lang="ts">import { PostActionsGenerator } from '../posts/controls';
3
2
  import { getPostCoverImage, PostModel } from '../posts/model';
4
3
  import { PostViewer } from '../posts/post-viewer';
4
+ import { default as CloseButton } from './cmp.close-button.svelte';
5
5
  import { FeedPlayerLocalization } from './feed-player-localization';
6
6
  import { default as SidebarPanel } from './sidebar/sidebar-panel.svelte';
7
7
  import IconChevronDown from '@fluentui/svg-icons/icons/chevron_down_28_regular.svg?raw';
@@ -264,8 +264,6 @@ const itemActions = $derived.by(() => {
264
264
  class:feed-player--transparent={isTransparentBackground}
265
265
  style:--_feed-player--background-image-url={backgroundImageUrl ? `url(${backgroundImageUrl})` : undefined}
266
266
  use:handleRootResize>
267
-
268
-
269
267
  <div class="feed-player__main">
270
268
  {#if header}
271
269
  <div class="feed-player__header">
@@ -314,8 +312,6 @@ const itemActions = $derived.by(() => {
314
312
  {/if}
315
313
  </div>
316
314
  {/if}
317
-
318
-
319
315
  </div>
320
316
  {#if buffer}
321
317
  <div class="feed-player__sidebar-container">
@@ -326,31 +322,33 @@ const itemActions = $derived.by(() => {
326
322
  {/if}
327
323
 
328
324
  {#if sidebarWidth > 0 && currentPostModel}
329
- <div class="feed-player__sidebar" class:feed-player__sidebar--with-close={on?.closed} style:--_--feed-player--sidebar--width={SIDEBAR_WIDTH+'px'}
330
- transition:slideHorizontally|local>
325
+ <div
326
+ class="feed-player__sidebar"
327
+ class:feed-player__sidebar--with-close={on?.closed}
328
+ style:--_--feed-player--sidebar--width={SIDEBAR_WIDTH + 'px'}
329
+ transition:slideHorizontally|local>
331
330
  <SidebarPanel
332
331
  tabs={visibleTabs}
333
332
  activeTabId={activeSidebarTab}
334
333
  model={currentPostModel}
335
334
  trackingParams={currentTrackingParams}
336
335
  selectedProductId={selectedProductId}
337
- {recommendedHandler}
338
- {playlistHandler}
336
+ recommendedHandler={recommendedHandler}
337
+ playlistHandler={playlistHandler}
339
338
  on={{
340
- tabChange: handleTabChange,
341
- productClick: onProductClick,
342
- productImpression: onProductImpression,
343
- productBuy: on?.productBuy,
344
- productSelect: (id) => {
345
- selectedProductId = id;
346
- handleTabChange('product');
347
- },
348
- adClick: onAdClick,
349
- adImpression: onAdImpression,
350
- articleReadMore: on?.articleReadMore,
351
- postActivate: (id) => buffer?.tryActivateItemById(id),
352
- playlistSelect: (id) => on?.playlistSelect?.(id)
353
- }} />
339
+ tabChange: handleTabChange,
340
+ productClick: onProductClick,
341
+ productImpression: onProductImpression,
342
+ productBuy: on?.productBuy,
343
+ productSelect: (id) => {
344
+ selectedProductId = id;
345
+ handleTabChange('product');
346
+ },
347
+ adClick: onAdClick,
348
+ adImpression: onAdImpression,
349
+ articleReadMore: on?.articleReadMore,
350
+ postActivate: (id) => buffer?.tryActivateItemById(id)
351
+ }} />
354
352
  </div>
355
353
  {/if}
356
354
  </div>
@@ -13,7 +13,7 @@ let { model, trackingParams, selectedProductId, on } = $props();
13
13
  <div class="information-tab__ad-wrapper">
14
14
  <AdCard
15
15
  ad={ad}
16
- {trackingParams}
16
+ trackingParams={trackingParams}
17
17
  on={{
18
18
  click: on?.adClick,
19
19
  impression: on?.adImpression
@@ -26,11 +26,7 @@ let { model, trackingParams, selectedProductId, on } = $props();
26
26
  {#if model.attachments.products.length}
27
27
  <div class="information-tab__products">
28
28
  {#each model.attachments.products as product (product.id)}
29
- <div
30
- class="information-tab__product-wrapper"
31
- onclick={() => on?.productSelect?.(product.id)}
32
- onkeydown={() => {}}
33
- role="none">
29
+ <div class="information-tab__product-wrapper" onclick={() => on?.productSelect?.(product.id)} onkeydown={() => {}} role="none">
34
30
  {#if selectedProductId === product.id}
35
31
  <div class="information-tab__checkmark">
36
32
  <Icon src={IconCheckmarkCircle24} />
@@ -39,7 +35,7 @@ let { model, trackingParams, selectedProductId, on } = $props();
39
35
  <ProductCard
40
36
  product={product}
41
37
  inert={true}
42
- {trackingParams}
38
+ trackingParams={trackingParams}
43
39
  on={{
44
40
  impression: on?.productImpression,
45
41
  buy: on?.productBuy
@@ -13,8 +13,9 @@ $effect(() => {
13
13
  });
14
14
  });
15
15
  const currentPostIndex = $derived.by(() => {
16
- if (!data)
16
+ if (!data) {
17
17
  return -1;
18
+ }
18
19
  return data.posts.findIndex((p) => p.id === activePostId);
19
20
  });
20
21
  const formatDate = (dateString) => {
@@ -22,12 +23,15 @@ const formatDate = (dateString) => {
22
23
  const now = new Date();
23
24
  const diffMs = now.getTime() - date.getTime();
24
25
  const diffDays = Math.floor(diffMs / 86400000);
25
- if (diffDays === 0)
26
+ if (diffDays === 0) {
26
27
  return 'Today';
27
- if (diffDays === 1)
28
+ }
29
+ if (diffDays === 1) {
28
30
  return 'Yesterday';
29
- if (diffDays < 7)
31
+ }
32
+ if (diffDays < 7) {
30
33
  return `${diffDays} days ago`;
34
+ }
31
35
  return date.toLocaleDateString();
32
36
  };
33
37
  </script>
@@ -45,7 +49,7 @@ const formatDate = (dateString) => {
45
49
  <div class="playlist-tab__list">
46
50
  {#each data.posts as post (post.id)}
47
51
  <PostCard
48
- {post}
52
+ post={post}
49
53
  thumbnailWidth={146}
50
54
  thumbnailHeight={260}
51
55
  thumbnailRadius={8}
@@ -12,21 +12,20 @@ const formatDate = (dateString) => {
12
12
  const now = new Date();
13
13
  const diffMs = now.getTime() - date.getTime();
14
14
  const diffDays = Math.floor(diffMs / 86400000);
15
- if (diffDays === 0)
15
+ if (diffDays === 0) {
16
16
  return 'Today';
17
- if (diffDays === 1)
17
+ }
18
+ if (diffDays === 1) {
18
19
  return 'Yesterday';
19
- if (diffDays < 7)
20
+ }
21
+ if (diffDays < 7) {
20
22
  return `${diffDays} days ago`;
23
+ }
21
24
  return date.toLocaleDateString();
22
25
  };
23
26
  </script>
24
27
 
25
- <div
26
- class="post-card"
27
- onclick={on?.click}
28
- onkeydown={() => {}}
29
- role="none">
28
+ <div class="post-card" onclick={on?.click} onkeydown={() => {}} role="none">
30
29
  <div
31
30
  class="post-card__thumbnail"
32
31
  class:post-card__thumbnail--active={active}
@@ -45,7 +44,7 @@ const formatDate = (dateString) => {
45
44
  {#if post.description}
46
45
  <div class="post-card__description">{post.description}</div>
47
46
  {/if}
48
- <div class="post-card__meta">{formatDate(post.displayDate)} · {localization.viewsLabel(post.viewsCount)}</div>
47
+ <div class="post-card__meta">{formatDate(post.displayDate)} · {localization.viewsLabel(post.viewsCount)}</div>
49
48
  </div>
50
49
  </div>
51
50
 
@@ -3,7 +3,7 @@ import { FeedPlayerLocalization } from '../feed-player-localization';
3
3
  import { default as PostCard } from './post-card.svelte';
4
4
  import { Image } from '@streamscloud/kit/ui/image';
5
5
  import { untrack } from 'svelte';
6
- const { handler, currentPostId, trackingParams, on } = $props();
6
+ const { handler, currentPostId, trackingParams } = $props();
7
7
  const localization = new FeedPlayerLocalization();
8
8
  let data = $state.raw(null);
9
9
  $effect(() => {
@@ -24,7 +24,7 @@ $effect(() => {
24
24
  <div class="recommended-tab__section-title">{localization.relatedPosts}</div>
25
25
  <div class="recommended-tab__posts">
26
26
  {#each data.relatedPosts as post (post.id)}
27
- <PostCard {post} thumbnailWidth={82} thumbnailHeight={146} thumbnailRadius={6} on={{ click: () => on?.postActivate?.(post.id) }} />
27
+ <PostCard post={post} thumbnailWidth={82} thumbnailHeight={146} thumbnailRadius={6} on={{ click: () => handler.onPostSelect?.(post.id) }} />
28
28
  {/each}
29
29
  </div>
30
30
  </div>
@@ -42,11 +42,9 @@ $effect(() => {
42
42
  <div class="recommended-tab__playlist-info">
43
43
  <div class="recommended-tab__playlist-name">{playlist.name}</div>
44
44
  <div class="recommended-tab__playlist-count">{localization.postsCount(playlist.postsCount)}</div>
45
- <div
46
- class="recommended-tab__playlist-link"
47
- onclick={() => on?.playlistSelect?.(playlist.id)}
48
- onkeydown={() => {}}
49
- role="none">{localization.showList}</div>
45
+ <div class="recommended-tab__playlist-link" onclick={() => handler.onPlaylistSelect?.(playlist.id)} onkeydown={() => {}} role="none">
46
+ {localization.showList}
47
+ </div>
50
48
  </div>
51
49
  </div>
52
50
  {/each}
@@ -60,10 +58,7 @@ $effect(() => {
60
58
  <div class="recommended-tab__products">
61
59
  {#each data.suggestedProducts as product (product.id)}
62
60
  <div class="recommended-tab__product-wrapper">
63
- <ProductCard
64
- {product}
65
- {trackingParams}
66
- on={{ buy: on?.productBuy }} />
61
+ <ProductCard product={product} trackingParams={trackingParams} on={{ click: handler.onProductSelect, buy: handler.onProductBuy }} />
67
62
  </div>
68
63
  {/each}
69
64
  </div>
@@ -4,11 +4,6 @@ type Props = {
4
4
  handler: IFeedPlayerRecommendedHandler;
5
5
  currentPostId: string;
6
6
  trackingParams: TrackingParams;
7
- on?: {
8
- postActivate?: (postId: string) => void;
9
- playlistSelect?: (playlistId: string) => void;
10
- productBuy?: (productId: string) => void;
11
- };
12
7
  };
13
8
  /**
14
9
  * Recommended tab — shows related posts, suggested playlists, and suggested products.
@@ -22,7 +22,7 @@ let { tabs, activeTabId, model, trackingParams, selectedProductId, recommendedHa
22
22
  {#if activeTabId === 'information'}
23
23
  <InformationTab
24
24
  model={model}
25
- {trackingParams}
25
+ trackingParams={trackingParams}
26
26
  selectedProductId={selectedProductId}
27
27
  on={{
28
28
  productImpression: on.productImpression,
@@ -35,7 +35,7 @@ let { tabs, activeTabId, model, trackingParams, selectedProductId, recommendedHa
35
35
  <div class="sidebar-panel__product">
36
36
  <ProductCard
37
37
  product={selectedProduct}
38
- {trackingParams}
38
+ trackingParams={trackingParams}
39
39
  on={{
40
40
  click: on.productClick,
41
41
  buy: on.productBuy
@@ -47,17 +47,9 @@ let { tabs, activeTabId, model, trackingParams, selectedProductId, recommendedHa
47
47
  <RecommendedTab
48
48
  handler={recommendedHandler}
49
49
  currentPostId={model.id}
50
- {trackingParams}
51
- on={{
52
- postActivate: on.postActivate,
53
- playlistSelect: on.playlistSelect,
54
- productBuy: on.productBuy
55
- }} />
50
+ trackingParams={trackingParams} />
56
51
  {:else if activeTabId === 'playlist' && playlistHandler}
57
- <PlaylistTab
58
- handler={playlistHandler}
59
- activePostId={model.id}
60
- on={{ postActivate: on.postActivate }} />
52
+ <PlaylistTab handler={playlistHandler} activePostId={model.id} on={{ postActivate: on.postActivate }} />
61
53
  {/if}
62
54
  </div>
63
55
  </div>
@@ -20,7 +20,6 @@ type Props = {
20
20
  adImpression?: (adId: string) => void;
21
21
  articleReadMore?: (articleId: string) => void;
22
22
  postActivate?: (postId: string) => void;
23
- playlistSelect?: (playlistId: string) => void;
24
23
  };
25
24
  };
26
25
  declare const SidebarPanel: import("svelte").Component<Props, {}, "">;
@@ -1,9 +1,9 @@
1
1
  import type { TrackingParams } from '../marketing-tracking';
2
2
  import type { IPostModel } from '../posts/model';
3
3
  import type { IPostAnalyticsHandler } from '../posts/posts-player';
4
- import type { ProductCardModel } from '../products/product-card';
5
4
  import type { IPostSharingHandler } from '../posts/sharing';
6
5
  import type { IPostSocialInteractionsHandler } from '../posts/social-interactions';
6
+ import type { ProductCardModel } from '../products/product-card';
7
7
  import type { AppLocaleValue } from '@streamscloud/kit/core/locale';
8
8
  import type { IPlayerDataProvider } from '@streamscloud/kit/ui/player/providers';
9
9
  import type { Snippet } from 'svelte';
@@ -29,6 +29,10 @@ export type FeedPlayerRecommendedData = {
29
29
  };
30
30
  export interface IFeedPlayerRecommendedHandler {
31
31
  getRecommendations: (postId: string) => Promise<FeedPlayerRecommendedData>;
32
+ onPostSelect?: (postId: string) => void;
33
+ onPlaylistSelect?: (playlistId: string) => void;
34
+ onProductSelect?: (productId: string) => void;
35
+ onProductBuy?: (productId: string) => void;
32
36
  }
33
37
  export type FeedPlayerPlaylistData = {
34
38
  name: string;
@@ -52,7 +56,6 @@ export type FeedPlayerProps = {
52
56
  postActivated?: (id: string) => void;
53
57
  productBuy?: (productId: string) => void;
54
58
  articleReadMore?: (articleId: string) => void;
55
- playlistSelect?: (playlistId: string) => void;
56
59
  closed?: () => void;
57
60
  };
58
61
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/embeddable",
3
- "version": "17.0.0-1775740482426",
3
+ "version": "17.0.0-1775767961522",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",