@streamscloud/embeddable 6.5.1 → 7.0.0-1758321646285

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 (128) hide show
  1. package/dist/ads/ad-card/cmp.ad-card.svelte +29 -3
  2. package/dist/ads/ad-card/cmp.ad-card.svelte.d.ts +4 -0
  3. package/dist/core/enums.d.ts +3 -0
  4. package/dist/core/enums.js +4 -0
  5. package/dist/core/locale.d.ts +0 -4
  6. package/dist/core/locale.js +1 -12
  7. package/dist/media-center/config/internal-media-center-config.d.ts +9 -0
  8. package/dist/media-center/config/internal-media-center-config.js +81 -0
  9. package/dist/media-center/{data-provider → config}/operations.generated.d.ts +20 -3
  10. package/dist/media-center/{data-provider → config}/operations.generated.js +53 -2
  11. package/dist/media-center/{data-provider → config}/operations.graphql +15 -1
  12. package/dist/media-center/config/types.d.ts +52 -0
  13. package/dist/media-center/index.d.ts +1 -1
  14. package/dist/media-center/media-center/cmp.media-center.svelte +105 -66
  15. package/dist/media-center/media-center/cmp.media-center.svelte.d.ts +11 -11
  16. package/dist/media-center/media-center/index.d.ts +0 -1
  17. package/dist/media-center/media-center/media-center-localization.d.ts +3 -8
  18. package/dist/media-center/media-center/media-center-localization.js +12 -6
  19. package/dist/media-center/media-center/overview.svelte +14 -1
  20. package/dist/media-center/media-center/overview.svelte.d.ts +1 -0
  21. package/dist/media-center/media-center/short-video-resources-generator.d.ts +2 -2
  22. package/dist/media-center/media-center/short-video-resources-generator.js +2 -2
  23. package/dist/media-center/media-center/streams-in-category.svelte +100 -0
  24. package/dist/media-center/media-center/streams-in-category.svelte.d.ts +10 -0
  25. package/dist/media-center/media-center/types.d.ts +11 -0
  26. package/dist/products/product-card/cmp.product-card.svelte +2 -2
  27. package/dist/products/product-card/cmp.product-card.svelte.d.ts +1 -2
  28. package/dist/products/product-card/product-card-localization.d.ts +1 -4
  29. package/dist/products/product-card/product-card-localization.js +2 -2
  30. package/dist/short-videos/short-video-card/cmp.short-video-card.svelte +11 -46
  31. package/dist/short-videos/short-video-viewer/cmp.attachments-horizontal.svelte +17 -7
  32. package/dist/short-videos/short-video-viewer/cmp.attachments-horizontal.svelte.d.ts +2 -0
  33. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +9 -4
  34. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte.d.ts +3 -2
  35. package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte +2 -3
  36. package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte.d.ts +2 -2
  37. package/dist/short-videos/short-video-viewer/cmp.short-video-product-card.svelte +2 -2
  38. package/dist/short-videos/short-video-viewer/cmp.short-video-product-card.svelte.d.ts +1 -2
  39. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +5 -3
  40. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +3 -2
  41. package/dist/short-videos/short-video-viewer/index.d.ts +0 -2
  42. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.d.ts +2 -6
  43. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.js +4 -4
  44. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.d.ts +3 -10
  45. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.js +7 -7
  46. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +4 -4
  47. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +2 -2
  48. package/dist/short-videos/short-videos-player/controls.svelte +4 -2
  49. package/dist/short-videos/short-videos-player/controls.svelte.d.ts +2 -0
  50. package/dist/short-videos/short-videos-player/index.d.ts +12 -10
  51. package/dist/short-videos/short-videos-player/index.js +9 -8
  52. package/dist/short-videos/short-videos-player/internal-short-video-analytics-handler.d.ts +2 -0
  53. package/dist/short-videos/short-videos-player/internal-short-video-analytics-handler.js +2 -0
  54. package/dist/short-videos/short-videos-player/short-videos-player-localization.d.ts +4 -11
  55. package/dist/short-videos/short-videos-player/short-videos-player-localization.js +8 -8
  56. package/dist/short-videos/short-videos-player/short-videos-player-view.svelte +16 -6
  57. package/dist/short-videos/short-videos-player/types.d.ts +4 -4
  58. package/dist/streams/cmp.stream-product-card.svelte +2 -2
  59. package/dist/streams/cmp.stream-product-card.svelte.d.ts +1 -2
  60. package/dist/streams/layout/cmp.slot-content.svelte +2 -2
  61. package/dist/streams/layout/cmp.slot-content.svelte.d.ts +1 -2
  62. package/dist/streams/layout/element-views/cmp.container-stream-element.svelte +3 -8
  63. package/dist/streams/layout/element-views/cmp.container-stream-element.svelte.d.ts +1 -2
  64. package/dist/streams/layout/element-views/cmp.price-stream-element.svelte +2 -2
  65. package/dist/streams/layout/element-views/cmp.price-stream-element.svelte.d.ts +1 -2
  66. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +3 -8
  67. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte.d.ts +1 -2
  68. package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte +2 -2
  69. package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte.d.ts +1 -2
  70. package/dist/streams/layout/element-views/cmp.stream-element.svelte +6 -6
  71. package/dist/streams/layout/element-views/cmp.stream-element.svelte.d.ts +1 -2
  72. package/dist/streams/layout/element-views/index.d.ts +0 -4
  73. package/dist/streams/layout/element-views/price-element-view.svelte +1 -1
  74. package/dist/streams/layout/element-views/price-stream-element-localization.d.ts +2 -8
  75. package/dist/streams/layout/element-views/price-stream-element-localization.js +5 -5
  76. package/dist/streams/layout/element-views/short-video-stream-element-localization.d.ts +2 -6
  77. package/dist/streams/layout/element-views/short-video-stream-element-localization.js +4 -4
  78. package/dist/streams/layout/element-views/stock-stream-element-localization.d.ts +1 -4
  79. package/dist/streams/layout/element-views/stock-stream-element-localization.js +2 -2
  80. package/dist/streams/layout/element-views/stream-element-localization.d.ts +4 -12
  81. package/dist/streams/layout/element-views/stream-element-localization.js +5 -5
  82. package/dist/streams/stream-card/cmp.stream-card.svelte +89 -0
  83. package/dist/streams/stream-card/cmp.stream-card.svelte.d.ts +11 -0
  84. package/dist/streams/stream-card/index.d.ts +2 -0
  85. package/dist/streams/stream-card/index.js +1 -0
  86. package/dist/streams/stream-card/types.d.ts +6 -0
  87. package/dist/streams/stream-card/types.js +1 -0
  88. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte +3 -3
  89. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte.d.ts +1 -2
  90. package/dist/streams/stream-page-viewer/index.d.ts +0 -1
  91. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.d.ts +2 -6
  92. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.js +3 -3
  93. package/dist/streams/stream-player/controls.svelte +1 -1
  94. package/dist/streams/stream-player/index.d.ts +15 -10
  95. package/dist/streams/stream-player/index.js +11 -8
  96. package/dist/streams/stream-player/internal-stream-player-data-provider.d.ts +2 -0
  97. package/dist/streams/stream-player/internal-stream-player-data-provider.js +2 -2
  98. package/dist/streams/stream-player/stream-overview.svelte +1 -1
  99. package/dist/streams/stream-player/stream-player-localization.d.ts +6 -19
  100. package/dist/streams/stream-player/stream-player-localization.js +14 -14
  101. package/dist/streams/stream-player/stream-player.svelte +6 -6
  102. package/dist/streams/stream-player/types.d.ts +4 -4
  103. package/dist/ui/line-clamp/cmp.line-clamp.svelte +2 -2
  104. package/dist/ui/line-clamp/cmp.line-clamp.svelte.d.ts +1 -2
  105. package/dist/ui/line-clamp/index.d.ts +0 -1
  106. package/dist/ui/line-clamp/index.js +0 -1
  107. package/dist/ui/line-clamp/line-clamp-localization.d.ts +1 -5
  108. package/dist/ui/line-clamp/line-clamp-localization.js +4 -4
  109. package/dist/ui/shadow-dom/{reset.scss → reset-shadow.css} +31 -44
  110. package/dist/ui/shadow-dom/shadow-root-service.js +2 -2
  111. package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte +2 -2
  112. package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte.d.ts +1 -2
  113. package/dist/ui/swipe-indicator/index.d.ts +0 -1
  114. package/dist/ui/swipe-indicator/swipe-indicator-localization.d.ts +1 -4
  115. package/dist/ui/swipe-indicator/swipe-indicator-localization.js +3 -3
  116. package/dist/ui/time-ago/cmp.time-ago.svelte +2 -2
  117. package/dist/ui/time-ago/cmp.time-ago.svelte.d.ts +1 -2
  118. package/dist/ui/time-ago/index.d.ts +0 -1
  119. package/dist/ui/time-ago/time-ago-localization.d.ts +1 -11
  120. package/dist/ui/time-ago/time-ago-localization.js +10 -10
  121. package/package.json +1 -1
  122. package/dist/media-center/data-provider/index.d.ts +0 -2
  123. package/dist/media-center/data-provider/index.js +0 -1
  124. package/dist/media-center/data-provider/internal-media-center-data-provider.svelte.d.ts +0 -8
  125. package/dist/media-center/data-provider/internal-media-center-data-provider.svelte.js +0 -46
  126. package/dist/media-center/data-provider/types.d.ts +0 -24
  127. /package/dist/media-center/{data-provider → config}/types.js +0 -0
  128. /package/dist/ui/shadow-dom/{normalize.scss → normalize-shadow.css} +0 -0
@@ -1,3 +1,2 @@
1
1
  export { default as MediaCenter } from './cmp.media-center.svelte';
2
2
  export { MediaCenterMode } from './types';
3
- export type { IMediaCenterLocalization } from './media-center-localization';
@@ -1,13 +1,8 @@
1
1
  import { type Locale } from '../../core/locale';
2
- import type { IProductCardLocalization } from '../../products/product-card/product-card-localization';
3
- export interface IMediaCenterLocalization {
4
- shortVideosSectionTitle?: string;
5
- overviewLabel?: string;
6
- productLocalization?: IProductCardLocalization | Locale;
7
- }
8
2
  export declare class MediaCenterLocalization {
9
3
  shortVideosSectionTitle: string;
4
+ streamsSectionTitle: string;
10
5
  overviewLabel: string;
11
- productLocalization: IProductCardLocalization | Locale;
12
- constructor(init: IMediaCenterLocalization | Locale);
6
+ productLocale: Locale;
7
+ constructor(locale: Locale);
13
8
  }
@@ -1,12 +1,14 @@
1
- import { isLocale } from '../../core/locale';
1
+ import {} from '../../core/locale';
2
2
  export class MediaCenterLocalization {
3
3
  shortVideosSectionTitle;
4
+ streamsSectionTitle;
4
5
  overviewLabel;
5
- productLocalization;
6
- constructor(init) {
7
- this.shortVideosSectionTitle = isLocale(init) ? loc.shortVideosSectionTitle[init] : init.shortVideosSectionTitle || loc.shortVideosSectionTitle.en;
8
- this.overviewLabel = isLocale(init) ? loc.overviewLabel[init] : init.overviewLabel || loc.overviewLabel.en;
9
- this.productLocalization = isLocale(init) ? init : init.productLocalization || 'en';
6
+ productLocale;
7
+ constructor(locale) {
8
+ this.shortVideosSectionTitle = loc.shortVideosSectionTitle[locale];
9
+ this.streamsSectionTitle = loc.streamsSectionTitle[locale];
10
+ this.overviewLabel = loc.overviewLabel[locale];
11
+ this.productLocale = locale;
10
12
  }
11
13
  }
12
14
  const loc = {
@@ -14,6 +16,10 @@ const loc = {
14
16
  en: 'Popular Short Videos',
15
17
  no: 'Populære korte videoer'
16
18
  },
19
+ streamsSectionTitle: {
20
+ en: 'Latest Streams',
21
+ no: 'Siste Streams'
22
+ },
17
23
  overviewLabel: {
18
24
  en: 'Overview',
19
25
  no: 'Oversikt'
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">import { ProductCard } from '../../products/product-card';
2
2
  import { ShortVideoCard } from '../../short-videos/short-video-card';
3
+ import { StreamCard } from '../../streams/stream-card';
3
4
  import { MediaCenterLocalization } from './media-center-localization';
4
5
  let { data, localization, on } = $props();
5
6
  const shortVideoSectionItems = $derived.by(() => {
@@ -39,6 +40,18 @@ const shortVideoSectionItems = $derived.by(() => {
39
40
 
40
41
  <div class="media-center-overview">
41
42
  <div class="media-center-overview__content">
43
+ {#if data.streams.length}
44
+ <div class="media-center-overview__section">
45
+ <div class="media-center-overview__section-header media-center-overview__section-header--blue">
46
+ {localization.streamsSectionTitle}
47
+ </div>
48
+ <div class="media-center-overview__section-content">
49
+ {#each data.streams as item (item.id)}
50
+ <StreamCard stream={item} on={{ click: () => on.streamSelected(item.id) }}></StreamCard>
51
+ {/each}
52
+ </div>
53
+ </div>
54
+ {/if}
42
55
  {#if shortVideoSectionItems.length}
43
56
  <div class="media-center-overview__section">
44
57
  <div class="media-center-overview__section-header media-center-overview__section-header--red">
@@ -54,7 +67,7 @@ const shortVideoSectionItems = $derived.by(() => {
54
67
  </div>
55
68
  {:else if item.kind === 'product'}
56
69
  <div class="media-center-overview__card-wrapper" data-theme="dark">
57
- <ProductCard product={item.data} localization={localization.productLocalization} />
70
+ <ProductCard product={item.data} locale={localization.productLocale} />
58
71
  </div>
59
72
  {/if}
60
73
  {/each}
@@ -6,6 +6,7 @@ type Props = {
6
6
  localization: MediaCenterLocalization;
7
7
  on: {
8
8
  shortVideoSelected: (shortVideo: ShortVideoPlayerModel) => void;
9
+ streamSelected: (id: string) => void;
9
10
  };
10
11
  };
11
12
  declare const Overview: import("svelte").Component<Props, {}, "">;
@@ -1,8 +1,8 @@
1
1
  import type { ShortVideoPlayerModel } from '../../short-videos/short-videos-player';
2
2
  import type { IPlayerItemsProvider } from '../../ui/player';
3
- import type { IMediaCenterDataProvider } from '../data-provider';
3
+ import type { IMediaCenterConfig } from '../config/types';
4
4
  export declare const makeShortVideosProvider: (data: {
5
- dataProvider: IMediaCenterDataProvider;
5
+ config: IMediaCenterConfig;
6
6
  categoryId?: string;
7
7
  prefetchedItems?: ShortVideoPlayerModel[];
8
8
  }) => IPlayerItemsProvider<ShortVideoPlayerModel>;
@@ -1,10 +1,10 @@
1
1
  import { ContinuationToken } from '../../core/continuation-token';
2
2
  import { CursorDataLoader } from '../../core/data-loaders';
3
3
  export const makeShortVideosProvider = (data) => {
4
- const { dataProvider, categoryId, prefetchedItems = [] } = data;
4
+ const { config, categoryId, prefetchedItems = [] } = data;
5
5
  const loader = new CursorDataLoader({
6
6
  loadPage: async (continuationToken) => {
7
- const result = await dataProvider.getShortVideosCursor({
7
+ const result = await config.shortVideosPlayer.getShortVideosCursor({
8
8
  filter: { categoryId, excludeIds: prefetchedItems.length ? prefetchedItems.map((i) => i.id) : undefined },
9
9
  continuationToken: continuationToken.toNextChunkString(),
10
10
  limit: 20
@@ -0,0 +1,100 @@
1
+ <script lang="ts">import { StreamCard } from '../../streams/stream-card';
2
+ let { data, on } = $props();
3
+ </script>
4
+
5
+ <div class="streams-in-category">
6
+ <div class="streams-in-category__content">
7
+ {#if data.streams.length}
8
+ <div class="streams-in-category__section">
9
+ <div class="streams-in-category__section-header streams-in-category__section-header--blue">
10
+ {data.categoryName}
11
+ </div>
12
+ <div class="streams-in-category__section-content">
13
+ {#each data.streams as item (item.id)}
14
+ <StreamCard stream={item} on={{ click: () => on.streamSelected(item.id) }}></StreamCard>
15
+ {/each}
16
+ </div>
17
+ </div>
18
+ {/if}
19
+ </div>
20
+ </div>
21
+
22
+ <style>@keyframes fadeIn {
23
+ 0% {
24
+ opacity: 1;
25
+ }
26
+ 50% {
27
+ opacity: 0.4;
28
+ }
29
+ 100% {
30
+ opacity: 1;
31
+ }
32
+ }
33
+ .streams-in-category {
34
+ background: transparent;
35
+ width: 100%;
36
+ display: flex;
37
+ justify-content: center;
38
+ padding: 1.25rem 1.875rem;
39
+ /* Set 'container-type: inline-size;' to reference container*/
40
+ }
41
+ @container (width < 576px) {
42
+ .streams-in-category {
43
+ padding: 0.625rem 0.9375rem;
44
+ }
45
+ }
46
+ .streams-in-category__content {
47
+ width: 100%;
48
+ max-width: 73.75rem;
49
+ display: flex;
50
+ flex-direction: column;
51
+ gap: 2.25rem;
52
+ }
53
+ .streams-in-category__section {
54
+ display: flex;
55
+ flex-direction: column;
56
+ gap: 1rem;
57
+ }
58
+ .streams-in-category__section-header {
59
+ display: flex;
60
+ align-items: center;
61
+ gap: 0.6875rem;
62
+ font-size: 1.125rem;
63
+ line-height: 1.75rem;
64
+ font-weight: 500;
65
+ color: #ffffff;
66
+ text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 6px rgba(0, 0, 0, 0.05);
67
+ }
68
+ .streams-in-category__section-header::before {
69
+ content: "";
70
+ display: inline-block;
71
+ width: 0.3125rem;
72
+ height: 1.625rem;
73
+ border-radius: 0.125rem;
74
+ background: #5a8dec;
75
+ }
76
+ .streams-in-category__section-content {
77
+ --product-card--aspect-ratio: 9/16;
78
+ --product-card--border-radius: 0.375rem;
79
+ display: grid;
80
+ gap: 2rem 1.25rem;
81
+ grid-template-columns: repeat(5, minmax(0, 1fr));
82
+ /* Set 'container-type: inline-size;' to reference container*/
83
+ /* Set 'container-type: inline-size;' to reference container*/
84
+ /* Set 'container-type: inline-size;' to reference container*/
85
+ }
86
+ @container (width < 992px) {
87
+ .streams-in-category__section-content {
88
+ grid-template-columns: repeat(4, minmax(0, 1fr));
89
+ }
90
+ }
91
+ @container (width < 768px) {
92
+ .streams-in-category__section-content {
93
+ grid-template-columns: repeat(3, minmax(0, 1fr));
94
+ }
95
+ }
96
+ @container (width < 576px) {
97
+ .streams-in-category__section-content {
98
+ grid-template-columns: repeat(2, minmax(0, 1fr));
99
+ }
100
+ }</style>
@@ -0,0 +1,10 @@
1
+ import type { StreamInCategoryData } from './types';
2
+ type Props = {
3
+ data: StreamInCategoryData;
4
+ on: {
5
+ streamSelected: (id: string) => void;
6
+ };
7
+ };
8
+ declare const StreamsInCategory: import("svelte").Component<Props, {}, "">;
9
+ type StreamsInCategory = ReturnType<typeof StreamsInCategory>;
10
+ export default StreamsInCategory;
@@ -5,6 +5,17 @@ export declare enum MediaCenterMode {
5
5
  Stream = "stream"
6
6
  }
7
7
  export type OverviewData = {
8
+ streams: MediaCenterStreamModel[];
8
9
  shortVideos: ShortVideoPlayerModel[];
9
10
  products: ProductCardModel[];
10
11
  };
12
+ export type StreamInCategoryData = {
13
+ categoryName: string;
14
+ streams: MediaCenterStreamModel[];
15
+ };
16
+ export type MediaCenterStreamModel = {
17
+ id: string;
18
+ title: string;
19
+ subTitle: string | null;
20
+ cover: string | null;
21
+ };
@@ -3,8 +3,8 @@ import { Image } from '../../ui/image';
3
3
  import { LineClamp } from '../../ui/line-clamp';
4
4
  import { ProportionalContainer } from '../../ui/proportional-container';
5
5
  import { ProductCardLocalization } from './product-card-localization';
6
- let { product, includeBeforeNowPrefix, inert = false, localization: localizationInit = 'en', on } = $props();
7
- const localization = $derived(new ProductCardLocalization(localizationInit));
6
+ let { product, includeBeforeNowPrefix, inert = false, locale = 'en', on } = $props();
7
+ const localization = $derived(new ProductCardLocalization(locale));
8
8
  const showDescriptionPresented = $derived(product.shortDescription && product.shortDescription.length > 0);
9
9
  const onProductClicked = (event) => {
10
10
  event.preventDefault();
@@ -1,9 +1,8 @@
1
1
  import type { Locale } from '../../core/locale';
2
- import { type IProductCardLocalization } from './product-card-localization';
3
2
  import type { ProductCardModel } from './types';
4
3
  type Props = {
5
4
  product: ProductCardModel;
6
- localization?: IProductCardLocalization | Locale;
5
+ locale?: Locale;
7
6
  includeBeforeNowPrefix?: boolean;
8
7
  inert?: boolean;
9
8
  on?: {
@@ -1,8 +1,5 @@
1
1
  import { type Locale } from '../../core/locale';
2
- export interface IProductCardLocalization {
3
- beforeNowPrefix?: string | null;
4
- }
5
2
  export declare class ProductCardLocalization {
6
3
  beforeNowPrefix: string | null;
7
- constructor(init: IProductCardLocalization | Locale);
4
+ constructor(init: Locale);
8
5
  }
@@ -1,8 +1,8 @@
1
- import { isLocale } from '../../core/locale';
1
+ import {} from '../../core/locale';
2
2
  export class ProductCardLocalization {
3
3
  beforeNowPrefix;
4
4
  constructor(init) {
5
- this.beforeNowPrefix = isLocale(init) ? loc.beforeNowPrefix[init] : init?.beforeNowPrefix || loc.beforeNowPrefix.en;
5
+ this.beforeNowPrefix = loc.beforeNowPrefix[init];
6
6
  }
7
7
  }
8
8
  const loc = {
@@ -15,15 +15,11 @@ let { shortVideo, aspectRatio = 9 / 16, on } = $props();
15
15
  <div class="short-video-card__media-icons">
16
16
  <Icon src={IconPhone}></Icon>
17
17
  </div>
18
-
19
- <div class="short-video-card__gradient-overlay"></div>
20
18
  </div>
21
19
 
22
20
  {#if shortVideo.text}
23
21
  <div class="short-video-card__text">
24
- <div class="short-video-card__text-value">
25
- <LineClamp value={shortVideo.text} maxLines={2} enableShowMore={false} />
26
- </div>
22
+ <LineClamp value={shortVideo.text} maxLines={2} enableShowMore={false} />
27
23
  </div>
28
24
  {/if}
29
25
 
@@ -56,20 +52,6 @@ let { shortVideo, aspectRatio = 9 / 16, on } = $props();
56
52
  justify-content: center;
57
53
  --image--rounded--outer--border-radius: 1%;
58
54
  }
59
- .short-video-card__gradient-overlay {
60
- /* Set 'container-type: inline-size;' to reference container*/
61
- }
62
- @container (width < 350px) {
63
- .short-video-card__gradient-overlay {
64
- position: absolute;
65
- bottom: 0;
66
- left: 0;
67
- right: 0;
68
- height: 80px;
69
- background: linear-gradient(0deg, #000000 0%, rgba(0, 0, 0, 0) 100%);
70
- pointer-events: none;
71
- }
72
- }
73
55
  .short-video-card__media-icons {
74
56
  position: absolute;
75
57
  top: 0.625em;
@@ -82,33 +64,16 @@ let { shortVideo, aspectRatio = 9 / 16, on } = $props();
82
64
  --icon--filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.2));
83
65
  }
84
66
  .short-video-card__text {
85
- font-weight: 500;
86
- white-space: pre-line;
87
- word-break: break-word;
88
- display: -webkit-box;
89
- overflow: hidden;
90
- -webkit-box-orient: vertical;
91
- line-clamp: 3;
92
- -webkit-line-clamp: 3;
93
- /* Set 'container-type: inline-size;' to reference container*/
94
- }
95
- .short-video-card__text-value {
96
- font-size: 0.9375em;
97
- line-height: 1.2;
98
- }
99
- @container (width < 350px) {
100
- .short-video-card__text {
101
- position: absolute;
102
- bottom: 0;
103
- left: 0;
104
- right: 0;
105
- background: linear-gradient(0deg, #000 0%, rgba(0, 0, 0, 0) 100%);
106
- color: #ffffff;
107
- font-size: 0.9375rem;
108
- font-weight: 400;
109
- padding: 0.78125rem 1rem;
110
- padding-top: 2.5rem;
111
- }
67
+ position: absolute;
68
+ bottom: 0;
69
+ left: 0;
70
+ right: 0;
71
+ background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 30%, rgba(0, 0, 0, 0.01) 100%);
72
+ color: #ffffff;
73
+ font-size: 0.75rem;
74
+ font-weight: 400;
75
+ padding: 0.75rem 0.75rem;
76
+ padding-top: 2.5rem;
112
77
  }
113
78
  .short-video-card__link {
114
79
  position: absolute;
@@ -13,6 +13,7 @@ const attachmentsToShow = $derived.by(() => {
13
13
  image: p.image,
14
14
  link: p.link,
15
15
  productId: p.id,
16
+ adId: null,
16
17
  price: {
17
18
  amount: p.salePrice || p.price,
18
19
  currency: p.currency
@@ -29,6 +30,7 @@ const attachmentsToShow = $derived.by(() => {
29
30
  image: a.image,
30
31
  link: ((_a = a.ctaButton) === null || _a === void 0 ? void 0 : _a.url) || null,
31
32
  productId: null,
33
+ adId: a.id,
32
34
  price: a.price && a.currency
33
35
  ? {
34
36
  amount: a.price,
@@ -47,6 +49,9 @@ const handleAttachmentClick = (attachment) => {
47
49
  if (attachment.productId && (on === null || on === void 0 ? void 0 : on.productClick)) {
48
50
  on.productClick(attachment.productId);
49
51
  }
52
+ if (attachment.adId && (on === null || on === void 0 ? void 0 : on.adClick)) {
53
+ on.adClick(attachment.adId);
54
+ }
50
55
  if (attachment.link) {
51
56
  window.open(attachment.link, '_blank');
52
57
  }
@@ -54,7 +59,7 @@ const handleAttachmentClick = (attachment) => {
54
59
  let attachmentElements = $state({});
55
60
  let observer = null;
56
61
  $effect(() => {
57
- if ((on === null || on === void 0 ? void 0 : on.productImpression) && Object.keys(attachmentElements).length > 0) {
62
+ if (((on === null || on === void 0 ? void 0 : on.productImpression) || (on === null || on === void 0 ? void 0 : on.adImpression)) && Object.keys(attachmentElements).length > 0) {
58
63
  if (observer) {
59
64
  observer.disconnect();
60
65
  }
@@ -62,15 +67,19 @@ $effect(() => {
62
67
  entries.forEach((entry) => {
63
68
  if (entry.isIntersecting && entry.intersectionRatio >= 0.1) {
64
69
  const productId = entry.target.getAttribute('data-product-id');
65
- if (productId) {
70
+ const adId = entry.target.getAttribute('data-ad-id');
71
+ if (productId && (on === null || on === void 0 ? void 0 : on.productImpression)) {
66
72
  on.productImpression(productId, model.id);
67
- observer === null || observer === void 0 ? void 0 : observer.unobserve(entry.target); // Only track once per session
68
73
  }
74
+ else if (adId && (on === null || on === void 0 ? void 0 : on.adImpression)) {
75
+ on.adImpression(adId);
76
+ }
77
+ observer === null || observer === void 0 ? void 0 : observer.unobserve(entry.target); // Only track once per session
69
78
  }
70
79
  });
71
80
  }, { threshold: 0.1 });
72
81
  Object.entries(attachmentElements).forEach(([key, element]) => {
73
- if (element && key.startsWith('product-')) {
82
+ if (element && (key.startsWith('product-') || key.startsWith('ad-'))) {
74
83
  observer === null || observer === void 0 ? void 0 : observer.observe(element);
75
84
  }
76
85
  });
@@ -85,7 +94,7 @@ $effect(() => {
85
94
  </script>
86
95
 
87
96
  <div class="attachments-horizontal" use:horizontalWheelScroll use:swallowTouch>
88
- {#each attachmentsToShow as attachment, index (attachment)}
97
+ {#each attachmentsToShow as attachment (attachment)}
89
98
  <div
90
99
  class="attachments-horizontal__item"
91
100
  class:attachments-horizontal__item--single={attachmentsToShow.length === 1}
@@ -93,8 +102,9 @@ $effect(() => {
93
102
  onclick={() => handleAttachmentClick(attachment)}
94
103
  onkeydown={() => {}}
95
104
  role="none"
96
- bind:this={attachmentElements[attachment.productId ? `product-${attachment.productId}` : `ad-${index}`]}
97
- data-product-id={attachment.productId || undefined}>
105
+ bind:this={attachmentElements[attachment.productId ? `product-${attachment.productId}` : `ad-${attachment.adId}`]}
106
+ data-product-id={attachment.productId || undefined}
107
+ data-ad-id={attachment.adId || undefined}>
98
108
  <div class="attachments-card" class:attachments-card--single={attachmentsToShow.length === 1}>
99
109
  <div class="attachments-card__thumb">
100
110
  <ImageRounded src={attachment.image} alt="" noBorders={true} />
@@ -4,6 +4,8 @@ type Props = {
4
4
  on?: {
5
5
  productClick?: (productId: string) => void;
6
6
  productImpression?: (productId: string, videoId: string) => void;
7
+ adClick?: (adId: string) => void;
8
+ adImpression?: (adId: string) => void;
7
9
  };
8
10
  };
9
11
  declare const Cmp: import("svelte").Component<Props, {}, "">;
@@ -2,14 +2,19 @@
2
2
  import { default as ShortVideoProductCard } from './cmp.short-video-product-card.svelte';
3
3
  import { ShortVideoAttachmentsLocalization } from './short-video-attachments-localization';
4
4
  import {} from './types';
5
- let { shortVideo, localization: localizationInit = 'en', on } = $props();
6
- const localization = $derived(new ShortVideoAttachmentsLocalization(localizationInit));
5
+ let { shortVideo, locale = 'en', on } = $props();
6
+ const localization = $derived(new ShortVideoAttachmentsLocalization(locale));
7
7
  </script>
8
8
 
9
9
  {#if shortVideo.hasAttachments}
10
10
  <div class="short-video-attachments">
11
11
  {#if shortVideo.ad}
12
- <AdCard ad={shortVideo.ad} />
12
+ <AdCard
13
+ ad={shortVideo.ad}
14
+ on={{
15
+ adClick: on?.adClick,
16
+ impression: on?.adImpression
17
+ }} />
13
18
  {/if}
14
19
 
15
20
  {#if shortVideo.products.length}
@@ -17,7 +22,7 @@ const localization = $derived(new ShortVideoAttachmentsLocalization(localization
17
22
  <ShortVideoProductCard
18
23
  product={product}
19
24
  videoId={shortVideo.id}
20
- localization={localization.productLocalization}
25
+ locale={localization.productLocale}
21
26
  on={{
22
27
  productClick: on?.productClick,
23
28
  impression: on?.productImpression
@@ -1,12 +1,13 @@
1
1
  import type { Locale } from '../../core/locale';
2
- import { type IShortVideoAttachmentsLocalization } from './short-video-attachments-localization';
3
2
  import { type ShortVideoViewerModel } from './types';
4
3
  type Props = {
5
4
  shortVideo: ShortVideoViewerModel;
6
- localization?: IShortVideoAttachmentsLocalization | Locale;
5
+ locale?: Locale;
7
6
  on?: {
8
7
  productClick?: (productId: string) => void;
9
8
  productImpression?: (productId: string, videoId: string) => void;
9
+ adClick?: (adId: string) => void;
10
+ adImpression?: (adId: string) => void;
10
11
  };
11
12
  };
12
13
  declare const Cmp: import("svelte").Component<Props, {}, "">;
@@ -1,8 +1,7 @@
1
1
  <script lang="ts">import { ImageRound } from '../../ui/image';
2
2
  import { TimeAgo } from '../../ui/time-ago';
3
3
  import { ShortVideoViewerLocalization } from './short-video-viewer-localization';
4
- let { model, localization: localizationInit } = $props();
5
- const localization = $derived(new ShortVideoViewerLocalization(localizationInit));
4
+ let { model, localization } = $props();
6
5
  </script>
7
6
 
8
7
  <div class="short-video-heading">
@@ -13,7 +12,7 @@ const localization = $derived(new ShortVideoViewerLocalization(localizationInit)
13
12
  <div class="short-video-heading__info">
14
13
  <div class="short-video-heading__source-name">{model.name}</div>
15
14
  <p class="short-video-heading__metadata">
16
- <TimeAgo date={model.displayDate} localization={localization.timeAgoLocalization} />
15
+ <TimeAgo date={model.displayDate} locale={localization.timeAgoLocale} />
17
16
  {#if Number.isInteger(model.viewsCount) && model.viewsCount}
18
17
  <span>&middot;</span>
19
18
  {localization.viewsCount(model.viewsCount)}
@@ -1,8 +1,8 @@
1
- import { type IShortVideoViewerLocalization } from './short-video-viewer-localization';
1
+ import { ShortVideoViewerLocalization } from './short-video-viewer-localization';
2
2
  import type { ShortVideoViewerHeadingModel } from './types';
3
3
  type Props = {
4
4
  model: ShortVideoViewerHeadingModel;
5
- localization: IShortVideoViewerLocalization;
5
+ localization: ShortVideoViewerLocalization;
6
6
  };
7
7
  declare const Cmp: import("svelte").Component<Props, {}, "">;
8
8
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">import { ProductCard } from '../../products/product-card';
2
2
  import { onMount } from 'svelte';
3
- let { product, videoId, localization, includeBeforeNowPrefix, inert = false, on } = $props();
3
+ let { product, videoId, locale, includeBeforeNowPrefix, inert = false, on } = $props();
4
4
  let productElement;
5
5
  const productData = product;
6
6
  onMount(() => {
@@ -22,5 +22,5 @@ onMount(() => {
22
22
  </script>
23
23
 
24
24
  <div bind:this={productElement}>
25
- <ProductCard product={productData} localization={localization} includeBeforeNowPrefix={includeBeforeNowPrefix} inert={inert} on={on} />
25
+ <ProductCard product={productData} locale={locale} includeBeforeNowPrefix={includeBeforeNowPrefix} inert={inert} on={on} />
26
26
  </div>
@@ -1,10 +1,9 @@
1
1
  import type { Locale } from '../../core/locale';
2
- import type { IProductCardLocalization } from '../../products/product-card/product-card-localization';
3
2
  import type { ShortVideoProductCardModel } from './types';
4
3
  type Props = {
5
4
  product: ShortVideoProductCardModel;
6
5
  videoId: string;
7
- localization?: IProductCardLocalization | Locale;
6
+ locale?: Locale;
8
7
  includeBeforeNowPrefix?: boolean;
9
8
  inert?: boolean;
10
9
  on?: {
@@ -6,8 +6,8 @@ import { default as ShortVideoControls } from './cmp.short-video-controls.svelte
6
6
  import { default as ShortVideoHeading } from './cmp.short-video-heading.svelte';
7
7
  import { ShortVideoViewerLocalization } from './short-video-viewer-localization';
8
8
  import { ShortVideoViewerUiManager } from './ui-manager.svelte';
9
- let { model, socialInteractionsHandler, showAttachments = true, showControls = true, autoplay = 'on-appearance', localization: localizationInit = 'en', on } = $props();
10
- const localization = $derived(new ShortVideoViewerLocalization(localizationInit));
9
+ let { model, socialInteractionsHandler, showAttachments = true, showControls = true, autoplay = 'on-appearance', locale = 'en', on } = $props();
10
+ const localization = $derived(new ShortVideoViewerLocalization(locale));
11
11
  const uiManager = new ShortVideoViewerUiManager();
12
12
  $effect(() => {
13
13
  uiManager.updateCanShowAttachments(showAttachments);
@@ -60,7 +60,9 @@ const trackControlsPanelSize = (node) => {
60
60
  model={model}
61
61
  on={{
62
62
  productClick: on?.productClick,
63
- productImpression: on?.productImpression
63
+ productImpression: on?.productImpression,
64
+ adClick: on?.adClick,
65
+ adImpression: on?.adImpression
64
66
  }} />
65
67
  </div>
66
68
  {/if}
@@ -1,5 +1,4 @@
1
1
  import type { Locale } from '../../core/locale';
2
- import { type IShortVideoViewerLocalization } from './short-video-viewer-localization';
3
2
  import type { IPostSocialInteractionsHandler, ShortVideoViewerModel } from './types';
4
3
  type Props = {
5
4
  model: ShortVideoViewerModel;
@@ -7,11 +6,13 @@ type Props = {
7
6
  showAttachments?: boolean;
8
7
  showControls?: boolean;
9
8
  autoplay?: true | false | 'on-appearance';
10
- localization?: IShortVideoViewerLocalization | Locale;
9
+ locale?: Locale;
11
10
  on?: {
12
11
  progress?: (progress: number) => void;
13
12
  productClick?: (productId: string) => void;
14
13
  productImpression?: (productId: string, videoId: string) => void;
14
+ adClick?: (adId: string) => void;
15
+ adImpression?: (adId: string) => void;
15
16
  };
16
17
  };
17
18
  declare const Cmp: import("svelte").Component<Props, {}, "">;
@@ -2,6 +2,4 @@ export { default as ShortVideoViewer } from './cmp.short-video-viewer.svelte';
2
2
  export { default as ShortVideoControls } from './cmp.short-video-controls.svelte';
3
3
  export { default as ShortVideoViewerAttachments } from './cmp.attachments.svelte';
4
4
  export type { ShortVideoViewerModel, IPostSocialInteractionsHandler, ShortVideoAdCardModel, ShortVideoProductCardModel } from './types';
5
- export type { IShortVideoViewerLocalization } from './short-video-viewer-localization';
6
- export type { IShortVideoAttachmentsLocalization } from './short-video-attachments-localization';
7
5
  export { mapToShortVideoViewerModel } from './mapper';
@@ -1,9 +1,5 @@
1
1
  import { type Locale } from '../../core/locale';
2
- import type { IProductCardLocalization } from '../../products/product-card/product-card-localization';
3
- export interface IShortVideoAttachmentsLocalization {
4
- productLocalization?: IProductCardLocalization | Locale;
5
- }
6
2
  export declare class ShortVideoAttachmentsLocalization {
7
- productLocalization: IProductCardLocalization | Locale;
8
- constructor(init: IShortVideoAttachmentsLocalization | Locale);
3
+ productLocale: Locale;
4
+ constructor(locale: Locale);
9
5
  }