@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,7 +1,7 @@
1
- import { isLocale } from '../../core/locale';
1
+ import {} from '../../core/locale';
2
2
  export class ShortVideoAttachmentsLocalization {
3
- productLocalization;
4
- constructor(init) {
5
- this.productLocalization = isLocale(init) ? init : init.productLocalization || 'en';
3
+ productLocale;
4
+ constructor(locale) {
5
+ this.productLocale = locale;
6
6
  }
7
7
  }
@@ -1,14 +1,7 @@
1
1
  import { type Locale } from '../../core/locale';
2
- import type { IProductCardLocalization } from '../../products/product-card/product-card-localization';
3
- import type { ITimeAgoLocalization } from '../../ui/time-ago';
4
- export interface IShortVideoViewerLocalization {
5
- viewsCount?: (count: number) => string;
6
- timeAgoLocalization?: ITimeAgoLocalization | Locale;
7
- productLocalization?: IProductCardLocalization | Locale;
8
- }
9
2
  export declare class ShortVideoViewerLocalization {
10
3
  viewsCount: (count: number) => string;
11
- timeAgoLocalization: ITimeAgoLocalization | Locale;
12
- productLocalization: IProductCardLocalization | Locale;
13
- constructor(init: IShortVideoViewerLocalization | Locale);
4
+ timeAgoLocale: Locale;
5
+ productLocale: Locale;
6
+ constructor(locale: Locale);
14
7
  }
@@ -1,12 +1,12 @@
1
- import { isLocale } from '../../core/locale';
1
+ import {} from '../../core/locale';
2
2
  export class ShortVideoViewerLocalization {
3
3
  viewsCount;
4
- timeAgoLocalization;
5
- productLocalization;
6
- constructor(init) {
7
- this.viewsCount = isLocale(init) ? loc.viewsCount[init] : init.viewsCount || loc.viewsCount.en;
8
- this.timeAgoLocalization = isLocale(init) ? init : init.timeAgoLocalization || 'en';
9
- this.productLocalization = isLocale(init) ? init : init.productLocalization || 'en';
4
+ timeAgoLocale;
5
+ productLocale;
6
+ constructor(locale) {
7
+ this.viewsCount = loc.viewsCount[locale];
8
+ this.timeAgoLocale = locale;
9
+ this.productLocale = locale;
10
10
  }
11
11
  }
12
12
  const loc = {
@@ -1,20 +1,20 @@
1
1
  <script lang="ts">import { MediaCenter, MediaCenterMode } from '../../media-center/media-center';
2
2
  import { createShadowRoot } from '../../ui/shadow-dom';
3
3
  import { mount, unmount } from 'svelte';
4
- let { dataProvider, socialInteractionsHandler, localization, showStreamsCloudWatermark, disableBackground, analyticsHandler, on, mediaCenterDataProvider } = $props();
4
+ let { dataProvider, socialInteractionsHandler, locale, showStreamsCloudWatermark, disableBackground, analyticsHandler, on, mediaCenterConfig } = $props();
5
5
  const initHost = (node) => {
6
6
  const shadowRoot = createShadowRoot(node);
7
7
  const mounted = mount(MediaCenter, {
8
8
  target: shadowRoot,
9
9
  props: {
10
- dataProvider: mediaCenterDataProvider || null,
10
+ config: mediaCenterConfig || null,
11
11
  playerProps: {
12
- type: MediaCenterMode.ShortVideos,
12
+ mode: MediaCenterMode.ShortVideos,
13
13
  props: {
14
14
  dataProvider,
15
15
  socialInteractionsHandler,
16
16
  disableBackground,
17
- localization,
17
+ locale,
18
18
  showStreamsCloudWatermark,
19
19
  analyticsHandler,
20
20
  on
@@ -1,7 +1,7 @@
1
- import type { IMediaCenterDataProvider } from '../../media-center/data-provider';
1
+ import type { IMediaCenterConfig } from '../../media-center/config/types';
2
2
  import type { ShortVideoPlayerProps } from './types';
3
3
  type $$ComponentProps = ShortVideoPlayerProps & {
4
- mediaCenterDataProvider?: IMediaCenterDataProvider;
4
+ mediaCenterConfig?: IMediaCenterConfig;
5
5
  };
6
6
  declare const Cmp: import("svelte").Component<$$ComponentProps, {}, "">;
7
7
  type Cmp = ReturnType<typeof Cmp>;
@@ -71,10 +71,12 @@ const trackNavigationButtonsSize = (node) => {
71
71
  <div class="short-videos-player-controls__short-video-attachments" transition:slideHorizontally|local>
72
72
  <ShortVideoViewerAttachments
73
73
  shortVideo={shortVideo}
74
- localization={localization.shortVideoAttachmentsLocalization}
74
+ locale={localization.shortVideoAttachmentsLocale}
75
75
  on={{
76
76
  productClick: on.productClick,
77
- productImpression: on.productImpression
77
+ productImpression: on.productImpression,
78
+ adClick: on.adClick,
79
+ adImpression: on.adImpression
78
80
  }} />
79
81
  </div>
80
82
  {/if}
@@ -13,6 +13,8 @@ type Props = {
13
13
  closePlayer?: () => void;
14
14
  productClick?: (productId: string) => void;
15
15
  productImpression?: (productId: string, videoId: string) => void;
16
+ adClick?: (adId: string) => void;
17
+ adImpression?: (adId: string) => void;
16
18
  };
17
19
  };
18
20
  declare const Controls: import("svelte").Component<Props, {}, "">;
@@ -1,17 +1,17 @@
1
- import { type IMediaCenterDataProvider } from '../../media-center/data-provider';
1
+ import { type IMediaCenterConfig } from '../../media-center/config/types';
2
+ import type { IPostSocialInteractionsHandler } from '../short-video-viewer';
2
3
  import type { IPlayerItemsProvider } from '../../ui/player';
3
4
  import { default as ShortVideosPlayer } from './cmp.short-videos-player.svelte';
4
5
  import { mapToShortVideoPlayerModel } from './mapper';
5
- import type { IShortVideosPlayerLocalization } from './short-videos-player-localization';
6
6
  import { type PlayerSettings, type IShortVideoAnalyticsHandler, type ShortVideoPlayerModel } from './types';
7
7
  export { ShortVideosPlayer, type ShortVideoPlayerModel };
8
- export type { IShortVideosPlayerLocalization, IMediaCenterDataProvider, IPlayerItemsProvider, IShortVideoAnalyticsHandler };
8
+ export type { IMediaCenterConfig, IPlayerItemsProvider, IShortVideoAnalyticsHandler };
9
9
  export { mapToShortVideoPlayerModel };
10
10
  /**
11
11
  * Opens the short videos player modal.
12
12
  *
13
13
  * Two overloads (mutually exclusive):
14
- * - Provider mode: openShortVideosPlayer({ shortVideosProvider, mediaCenterDataProvider?, ...common })
14
+ * - Provider mode: openShortVideosPlayer({ shortVideosProvider, mediaCenterConfig?, ...common })
15
15
  * - IDs mode: openShortVideosPlayer({ ids, initiator, graphqlOrigin?, initialId?, mediaPageId?, ...common })
16
16
  *
17
17
  * @param init Configuration options.
@@ -19,8 +19,8 @@ export { mapToShortVideoPlayerModel };
19
19
  * Provider mode (overload 1)
20
20
  * @param {IPlayerItemsProvider<ShortVideoPlayerModel>} init.shortVideosProvider
21
21
  * Provider that supplies short-video items to the player.
22
- * @param {IMediaCenterDataProvider} [init.mediaCenterDataProvider]
23
- * Optional media-center data provider.
22
+ * @param {IMediaCenterConfig} [init.mediaCenterConfig]
23
+ * Optional media-center config.
24
24
  *
25
25
  * IDs mode (overload 2)
26
26
  * @param {string[]} init.ids
@@ -32,12 +32,12 @@ export { mapToShortVideoPlayerModel };
32
32
  * @param {string} [init.initialId]
33
33
  * ID of the video to open first (optional).
34
34
  * @param {string} [init.mediaPageId]
35
- * Optional media page ID used to construct an internal media-center data provider.
35
+ * Optional media page ID used to construct an internal media-center config.
36
36
  *
37
37
  * Common settings
38
38
  * @param {IPostSocialInteractionsHandler} [init.socialInteractionsHandler]
39
39
  * Handler for social interactions (like, share, etc.).
40
- * @param {IShortVideosPlayerLocalization | Locale} [init.localization]
40
+ * @param {Locale} [init.locale]
41
41
  * Localization for the player UI. If omitted, 'en' is used.
42
42
  * @param {boolean} [init.disableBackground]
43
43
  * If true, hides the player's background image.
@@ -60,7 +60,7 @@ export { mapToShortVideoPlayerModel };
60
60
  *
61
61
  * openShortVideosPlayer({
62
62
  * shortVideosProvider: myShortVideosProvider,
63
- * mediaCenterDataProvider: myMediaCenterDataProvider,
63
+ * mediaCenterConfig: mymediaCenterConfig,
64
64
  * localization: { next: 'Next', previous: 'Previous' },
65
65
  * showStreamsCloudWatermark: true,
66
66
  * on: {
@@ -90,7 +90,9 @@ export { mapToShortVideoPlayerModel };
90
90
  */
91
91
  export declare function openShortVideosPlayer(init: PlayerSettings & {
92
92
  shortVideosProvider: IPlayerItemsProvider<ShortVideoPlayerModel>;
93
- mediaCenterDataProvider?: IMediaCenterDataProvider;
93
+ mediaCenterConfig?: IMediaCenterConfig;
94
+ analyticsHandler?: IShortVideoAnalyticsHandler;
95
+ socialInteractionsHandler?: IPostSocialInteractionsHandler;
94
96
  }): void;
95
97
  export declare function openShortVideosPlayer(init: PlayerSettings & {
96
98
  ids: string[];
@@ -1,5 +1,6 @@
1
1
  import { toastrWarning } from '../../core/toastr';
2
- import { InternalMediaCenterDataProvider } from '../../media-center/data-provider';
2
+ import { InternalMediaCenterConfig } from '../../media-center/config/internal-media-center-config';
3
+ import {} from '../../media-center/config/types';
3
4
  import { MediaCenter, MediaCenterMode } from '../../media-center/media-center';
4
5
  import { ModalShadowHost } from '../../ui/shadow-dom';
5
6
  import { default as ShortVideosPlayer } from './cmp.short-videos-player.svelte';
@@ -11,7 +12,7 @@ import { mount, unmount } from 'svelte';
11
12
  export { ShortVideosPlayer };
12
13
  export { mapToShortVideoPlayerModel };
13
14
  export function openShortVideosPlayer(init) {
14
- const { shortVideosProvider, ids, graphqlOrigin, initialId, initiator, socialInteractionsHandler, disableBackground, localization, showStreamsCloudWatermark } = init;
15
+ const { shortVideosProvider, ids, graphqlOrigin, initialId, initiator, socialInteractionsHandler, disableBackground, locale, showStreamsCloudWatermark } = init;
15
16
  let dataProvider = shortVideosProvider;
16
17
  if (!dataProvider && ids) {
17
18
  dataProvider = new InternalShortVideoPlayerProvider({ ids, graphqlOrigin, initialId, initiator });
@@ -20,9 +21,9 @@ export function openShortVideosPlayer(init) {
20
21
  toastrWarning('Data provider is not specified.');
21
22
  return;
22
23
  }
23
- let mediaCenterDataProvider = init.mediaCenterDataProvider;
24
- if (!mediaCenterDataProvider && init.mediaPageId) {
25
- mediaCenterDataProvider = new InternalMediaCenterDataProvider(init.mediaPageId, graphqlOrigin);
24
+ let mediaCenterConfig = init.mediaCenterConfig;
25
+ if (!mediaCenterConfig && init.mediaPageId) {
26
+ mediaCenterConfig = new InternalMediaCenterConfig(init.mediaPageId, graphqlOrigin);
26
27
  }
27
28
  let analyticsHandler = init.analyticsHandler;
28
29
  if (!analyticsHandler && !init.shortVideosProvider) {
@@ -33,14 +34,14 @@ export function openShortVideosPlayer(init) {
33
34
  const mounted = mount(MediaCenter, {
34
35
  target: shadowHost.shadowRoot,
35
36
  props: {
36
- dataProvider: mediaCenterDataProvider || null,
37
+ config: mediaCenterConfig || null,
37
38
  playerProps: {
38
- type: MediaCenterMode.ShortVideos,
39
+ mode: MediaCenterMode.ShortVideos,
39
40
  props: {
40
41
  dataProvider,
41
42
  socialInteractionsHandler,
42
43
  disableBackground,
43
- localization,
44
+ locale,
44
45
  showStreamsCloudWatermark,
45
46
  analyticsHandler,
46
47
  on: {
@@ -5,4 +5,6 @@ export declare class InternalShortVideoAnalyticsHandler implements IShortVideoAn
5
5
  trackShortVideoView: (videoId: string) => void;
6
6
  trackShortVideoProductImpression: (productId: string, videoId: string) => void;
7
7
  trackShortVideoProductClick: (productId: string, videoId: string) => void;
8
+ trackAdImpression: (adId: string) => void;
9
+ trackAdClick: (adId: string) => void;
8
10
  }
@@ -10,4 +10,6 @@ export class InternalShortVideoAnalyticsHandler {
10
10
  trackShortVideoView = (videoId) => AppEventsTracker.trackShortVideoView(videoId);
11
11
  trackShortVideoProductImpression = (productId, videoId) => AppEventsTracker.trackShortVideoProductImpression(productId, videoId);
12
12
  trackShortVideoProductClick = (productId, videoId) => AppEventsTracker.trackShortVideoProductClick(productId, videoId);
13
+ trackAdImpression = (adId) => AppEventsTracker.trackAdImpression(adId);
14
+ trackAdClick = (adId) => AppEventsTracker.trackAdClick(adId);
13
15
  }
@@ -1,14 +1,7 @@
1
1
  import { type Locale } from '../../core/locale';
2
- import type { IShortVideoAttachmentsLocalization, IShortVideoViewerLocalization } from '../short-video-viewer';
3
- import type { ISwipeIndicatorLocalization } from '../../ui/swipe-indicator';
4
- export interface IShortVideosPlayerLocalization {
5
- shortVideoAttachmentsLocalization?: IShortVideoAttachmentsLocalization | Locale;
6
- shortVideoViewerLocalization?: IShortVideoViewerLocalization | Locale;
7
- swipeIndicatorLocalization?: ISwipeIndicatorLocalization | Locale;
8
- }
9
2
  export declare class ShortVideosPlayerLocalization {
10
- shortVideoAttachmentsLocalization: IShortVideoAttachmentsLocalization | Locale;
11
- shortVideoViewerLocalization: IShortVideoViewerLocalization | Locale;
12
- swipeIndicatorLocalization: ISwipeIndicatorLocalization | Locale;
13
- constructor(init: IShortVideosPlayerLocalization | Locale);
3
+ shortVideoAttachmentsLocale: Locale;
4
+ shortVideoViewerLocale: Locale;
5
+ swipeIndicatorLocale: Locale;
6
+ constructor(locale: Locale);
14
7
  }
@@ -1,11 +1,11 @@
1
- import { isLocale } from '../../core/locale';
1
+ import {} from '../../core/locale';
2
2
  export class ShortVideosPlayerLocalization {
3
- shortVideoAttachmentsLocalization;
4
- shortVideoViewerLocalization;
5
- swipeIndicatorLocalization;
6
- constructor(init) {
7
- this.shortVideoAttachmentsLocalization = isLocale(init) ? init : init.shortVideoAttachmentsLocalization || 'en';
8
- this.shortVideoViewerLocalization = isLocale(init) ? init : init.shortVideoViewerLocalization || 'en';
9
- this.swipeIndicatorLocalization = isLocale(init) ? init : init.swipeIndicatorLocalization || 'en';
3
+ shortVideoAttachmentsLocale;
4
+ shortVideoViewerLocale;
5
+ swipeIndicatorLocale;
6
+ constructor(locale) {
7
+ this.shortVideoAttachmentsLocale = locale;
8
+ this.shortVideoViewerLocale = locale;
9
+ this.swipeIndicatorLocale = locale;
10
10
  }
11
11
  }
@@ -19,8 +19,8 @@ import { InternalShortVideoPlayerProvider } from './internal-short-video-player-
19
19
  import { ShortVideosPlayerLocalization } from './short-videos-player-localization';
20
20
  import { ShortVideosPlayerUiManager } from './ui-manager.svelte';
21
21
  import { untrack } from 'svelte';
22
- let { dataProvider, socialInteractionsHandler, localization: localizationInit = 'en', showStreamsCloudWatermark, disableBackground, analyticsHandler, on, categoriesSwitcher, playerLogo = null, fadeContent = false } = $props();
23
- const localization = $derived(new ShortVideosPlayerLocalization(localizationInit));
22
+ let { dataProvider, socialInteractionsHandler, locale = 'en', showStreamsCloudWatermark, disableBackground, analyticsHandler, on, categoriesSwitcher, playerLogo = null, fadeContent = false } = $props();
23
+ const localization = $derived(new ShortVideosPlayerLocalization(locale));
24
24
  let everTouched = $state(false);
25
25
  let background = $state(null);
26
26
  let bufferIsLoading = $state(false);
@@ -97,6 +97,12 @@ const onShortVideoProductClick = (productId, videoId) => {
97
97
  const onShortVideoProductImpression = (productId, videoId) => {
98
98
  analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackShortVideoProductImpression(productId, videoId);
99
99
  };
100
+ const onShortVideoAdClick = (adId) => {
101
+ analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackAdClick(adId);
102
+ };
103
+ const onShortVideoAdImpression = (adId) => {
104
+ analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackAdImpression(adId);
105
+ };
100
106
  </script>
101
107
 
102
108
  <svelte:document onkeydown={(e) => handleEsc(e, onPlayerClose)} />
@@ -137,15 +143,17 @@ const onShortVideoProductImpression = (productId, videoId) => {
137
143
  autoplay="on-appearance"
138
144
  showAttachments={uiManager.showShortVideoOverlayAttachments}
139
145
  showControls={uiManager.showShortVideoOverlayControls}
140
- localization={localization.shortVideoViewerLocalization}
146
+ locale={localization.shortVideoViewerLocale}
141
147
  on={{
142
148
  productClick: (productId) => onShortVideoProductClick(productId, item.id),
143
- productImpression: (productId, videoId) => onShortVideoProductImpression(productId, videoId)
149
+ productImpression: (productId, videoId) => onShortVideoProductImpression(productId, videoId),
150
+ adClick: onShortVideoAdClick,
151
+ adImpression: onShortVideoAdImpression
144
152
  }} />
145
153
  {/snippet}
146
154
  </PlayerSlider>
147
155
  {#if uiManager.isMobileView && buffer.loaded.length > 1 && !everTouched}
148
- <SwipeIndicator localization={localization.swipeIndicatorLocalization} />
156
+ <SwipeIndicator locale={localization.swipeIndicatorLocale} />
149
157
  {/if}
150
158
  </div>
151
159
  </SpotlightLayout>
@@ -158,7 +166,9 @@ const onShortVideoProductImpression = (productId, videoId) => {
158
166
  on={{
159
167
  closePlayer: on?.playerClosed,
160
168
  productClick: (productId) => onShortVideoProductClick(productId, buffer?.current?.id || ''),
161
- productImpression: onShortVideoProductImpression
169
+ productImpression: onShortVideoProductImpression,
170
+ adClick: onShortVideoAdClick,
171
+ adImpression: onShortVideoAdImpression
162
172
  }} />
163
173
  {:else}
164
174
  <Loading positionFixedCenter={true} timeout={1000} />
@@ -1,26 +1,26 @@
1
1
  import type { Locale } from '../../core/locale';
2
2
  import type { ShortVideoViewerModel, IPostSocialInteractionsHandler } from '../short-video-viewer';
3
3
  import type { IPlayerItemsProvider } from '../../ui/player';
4
- import type { IShortVideosPlayerLocalization } from './short-videos-player-localization';
5
4
  export interface IShortVideoAnalyticsHandler {
6
5
  setOrganizationId: (organizationId: string) => void;
7
6
  trackShortVideoView: (videoId: string) => void;
8
7
  trackShortVideoProductImpression: (productId: string, videoId: string) => void;
9
8
  trackShortVideoProductClick: (productId: string, videoId: string) => void;
9
+ trackAdImpression: (adId: string) => void;
10
+ trackAdClick: (adId: string) => void;
10
11
  }
11
12
  export type ShortVideoPlayerModel = ShortVideoViewerModel & {
12
13
  analyticsOrganizationId: string | null;
13
14
  };
14
15
  export type ShortVideoPlayerProps = PlayerSettings & {
15
16
  dataProvider: IPlayerItemsProvider<ShortVideoPlayerModel>;
17
+ socialInteractionsHandler?: IPostSocialInteractionsHandler;
16
18
  analyticsHandler?: IShortVideoAnalyticsHandler;
17
19
  };
18
20
  export type PlayerSettings = {
19
- socialInteractionsHandler?: IPostSocialInteractionsHandler;
20
21
  disableBackground?: boolean;
21
- localization?: IShortVideosPlayerLocalization | Locale;
22
+ locale?: Locale;
22
23
  showStreamsCloudWatermark?: boolean;
23
- analyticsHandler?: IShortVideoAnalyticsHandler;
24
24
  on?: {
25
25
  playerClosed?: () => void;
26
26
  videoActivated?: (id: string) => void;
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">import { ProductCard } from '../products/product-card';
2
2
  import { onMount } from 'svelte';
3
- let { product, streamId, localization, includeBeforeNowPrefix, inert = false, on } = $props();
3
+ let { product, streamId, locale, includeBeforeNowPrefix, inert = false, on } = $props();
4
4
  let productElement;
5
5
  onMount(() => {
6
6
  if (productElement && (on === null || on === void 0 ? void 0 : on.impression)) {
@@ -21,5 +21,5 @@ onMount(() => {
21
21
  </script>
22
22
 
23
23
  <div bind:this={productElement}>
24
- <ProductCard product={product} localization={localization} includeBeforeNowPrefix={includeBeforeNowPrefix} inert={inert} on={on} />
24
+ <ProductCard product={product} locale={locale} includeBeforeNowPrefix={includeBeforeNowPrefix} inert={inert} on={on} />
25
25
  </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 { ProductCardModel } from '../products/product-card/types';
4
3
  type Props = {
5
4
  product: ProductCardModel;
6
5
  streamId: string;
7
- localization?: IProductCardLocalization | Locale;
6
+ locale?: Locale;
8
7
  includeBeforeNowPrefix?: boolean;
9
8
  inert?: boolean;
10
9
  on?: {
@@ -2,7 +2,7 @@
2
2
  import { StreamElementView } from './element-views';
3
3
  import { StreamComponentDataType } from './enums';
4
4
  import { onMount } from 'svelte';
5
- let { model, localization, on } = $props();
5
+ let { model, locale, on } = $props();
6
6
  const component = $derived.by(() => {
7
7
  return model.components.find((c) => (model.data ? c.dataType === model.data.type : c.dataType === StreamComponentDataType.NoData));
8
8
  });
@@ -62,7 +62,7 @@ onMount(() => {
62
62
  {#snippet slotContent()}
63
63
  {#if component && (!model.data || dataIsFilled)}
64
64
  {#each component.elements as element (element)}
65
- <StreamElementView model={element} data={model.data} localization={localization} on={on} />
65
+ <StreamElementView model={element} data={model.data} locale={locale} on={on} />
66
66
  {/each}
67
67
  {/if}
68
68
  {/snippet}
@@ -1,9 +1,8 @@
1
1
  import type { Locale } from '../../core/locale';
2
- import { type IStreamElementLocalization } from './element-views';
3
2
  import type { StreamSlot } from './slot';
4
3
  type Props = {
5
4
  model: StreamSlot;
6
- localization: IStreamElementLocalization | Locale;
5
+ locale: Locale;
7
6
  on?: {
8
7
  productClick: (productId: string) => void;
9
8
  productImpression?: (productId: string) => void;
@@ -1,16 +1,11 @@
1
- <script lang="ts">import {} from './stream-element-localization';
2
- import { StreamElementStyleDirection } from '../enums';
1
+ <script lang="ts">import { StreamElementStyleDirection } from '../enums';
3
2
  import { generateContainerStyles } from '../styles-transformer';
4
3
  import { default as StreamElement } from './cmp.stream-element.svelte';
5
- let { model, data, localization } = $props();
4
+ let { model, data, locale } = $props();
6
5
  </script>
7
6
 
8
7
  <div class="container-stream-element" style={generateContainerStyles(model.styles)}>
9
8
  {#each model.elements as element (element)}
10
- <StreamElement
11
- model={element}
12
- data={data}
13
- constainerDirection={model.styles?.direction ?? StreamElementStyleDirection.Vertical}
14
- localization={localization} />
9
+ <StreamElement model={element} data={data} constainerDirection={model.styles?.direction ?? StreamElementStyleDirection.Vertical} locale={locale} />
15
10
  {/each}
16
11
  </div>
@@ -1,11 +1,10 @@
1
1
  import type { Locale } from '../../../core/locale';
2
- import { type IStreamElementLocalization } from './stream-element-localization';
3
2
  import type { ContainerStreamElementModel } from '../elements';
4
3
  import type { StreamSlotData } from '../slot-data';
5
4
  type Props = {
6
5
  model: ContainerStreamElementModel;
7
6
  data: StreamSlotData | null;
8
- localization: IStreamElementLocalization | Locale;
7
+ locale: Locale;
9
8
  };
10
9
  declare const Cmp: import("svelte").Component<Props, {}, "">;
11
10
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,8 +1,8 @@
1
1
  <script lang="ts">var _a;
2
2
  import { PriceStreamElementLocalization } from './price-stream-element-localization';
3
3
  import { default as PriceElementView } from './price-element-view.svelte';
4
- let { model, data, localization: localizationInit } = $props();
5
- const localization = $derived(new PriceStreamElementLocalization(localizationInit));
4
+ let { model, data, locale } = $props();
5
+ const localization = $derived(new PriceStreamElementLocalization(locale));
6
6
  let baseMaxHeight = $derived(((_a = model.styles) === null || _a === void 0 ? void 0 : _a.height) || 32);
7
7
  let adjustedHeight = $derived(baseMaxHeight);
8
8
  </script>
@@ -1,11 +1,10 @@
1
1
  import type { Locale } from '../../../core/locale';
2
- import { type IPriceStreamElementLocalization } from './price-stream-element-localization';
3
2
  import type { PriceStreamElementModel } from '../elements';
4
3
  import type { StreamLayoutProductPriceModel } from '../models';
5
4
  type Props = {
6
5
  model: PriceStreamElementModel;
7
6
  data: StreamLayoutProductPriceModel;
8
- localization: IPriceStreamElementLocalization | Locale;
7
+ locale: Locale;
9
8
  };
10
9
  declare const Cmp: import("svelte").Component<Props, {}, "">;
11
10
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,13 +1,8 @@
1
1
  <script lang="ts">import { ShortVideoViewer } from '../../../short-videos/short-video-viewer';
2
2
  import { ShortVideoStreamElementLocalization } from './short-video-stream-element-localization';
3
3
  import { mapToShortVideoViewerModel } from '../models';
4
- let { data, localization: localizationInit, on } = $props();
5
- const localization = $derived(new ShortVideoStreamElementLocalization(localizationInit));
4
+ let { data, locale, on } = $props();
5
+ const localization = $derived(new ShortVideoStreamElementLocalization(locale));
6
6
  </script>
7
7
 
8
- <ShortVideoViewer
9
- model={mapToShortVideoViewerModel(data)}
10
- autoplay={false}
11
- showControls={false}
12
- localization={localization.shortVideoViewerLocalization}
13
- on={on} />
8
+ <ShortVideoViewer model={mapToShortVideoViewerModel(data)} autoplay={false} showControls={false} locale={localization.shortVideoViewerLocale} on={on} />
@@ -1,9 +1,8 @@
1
1
  import type { Locale } from '../../../core/locale';
2
- import { type IShortVideoStreamElementLocalization } from './short-video-stream-element-localization';
3
2
  import { type StreamLayoutShortVideoModel } from '../models';
4
3
  type Props = {
5
4
  data: StreamLayoutShortVideoModel;
6
- localization: IShortVideoStreamElementLocalization | Locale;
5
+ locale: Locale;
7
6
  on?: {
8
7
  progress?: (progress: number) => void;
9
8
  };
@@ -2,8 +2,8 @@
2
2
  import { StockStreamElementLocalization } from './stock-stream-element-localization';
3
3
  import { StockStreamElementLevel } from '../enums';
4
4
  import { mapFlexJustifyContent, transformNumericValue } from '../styles-transformer';
5
- let { model, heightOverrideDdu, localization: localizationInit } = $props();
6
- const localization = $derived(new StockStreamElementLocalization(localizationInit));
5
+ let { model, heightOverrideDdu, locale } = $props();
6
+ const localization = $derived(new StockStreamElementLocalization(locale));
7
7
  const height = $derived(heightOverrideDdu || ((_a = model.styles) === null || _a === void 0 ? void 0 : _a.height) || 16);
8
8
  const containerStyles = $derived.by(() => {
9
9
  var _a;
@@ -1,10 +1,9 @@
1
1
  import type { Locale } from '../../../core/locale';
2
- import { type IStockStreamElementLocalization } from './stock-stream-element-localization';
3
2
  import type { StockStreamElementModel } from '../elements';
4
3
  type Props = {
5
4
  model: StockStreamElementModel;
6
5
  heightOverrideDdu?: number;
7
- localization: IStockStreamElementLocalization | Locale;
6
+ locale: Locale;
8
7
  };
9
8
  declare const Cmp: import("svelte").Component<Props, {}, "">;
10
9
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,8 +1,8 @@
1
1
  <script lang="ts">import { AnnotationStreamElementView, ContainerStreamElementView, ImageRefStreamElementView, ImagesStreamElementView, PriceStreamElementView, ShortVideoStreamElementView, SpacerStreamElementView, StockStreamElementView, TextRefStreamElementView, TextStreamElementView, WebViewStreamElementView } from '.';
2
2
  import { StreamElementLocalization } from './stream-element-localization';
3
3
  import { StreamComponentDataType, StreamElementStyleDirection, StreamElementType } from '../enums';
4
- let { model, data, constainerDirection = StreamElementStyleDirection.Vertical, localization: localizationInit, on } = $props();
5
- const localization = $derived(new StreamElementLocalization(localizationInit));
4
+ let { model, data, constainerDirection = StreamElementStyleDirection.Vertical, locale, on } = $props();
5
+ const localization = $derived(new StreamElementLocalization(locale));
6
6
  const shortVideoModel = $derived.by(() => {
7
7
  if (!data) {
8
8
  return null;
@@ -44,17 +44,17 @@ const productModel = $derived.by(() => {
44
44
  {#if model.type === StreamElementType.Annotation}
45
45
  <AnnotationStreamElementView model={model} />
46
46
  {:else if model.type === StreamElementType.Container}
47
- <ContainerStreamElementView model={model} data={data} localization={localizationInit} />
47
+ <ContainerStreamElementView model={model} data={data} locale={locale} />
48
48
  {:else if model.type === StreamElementType.ImageRef && data}
49
49
  <ImageRefStreamElementView model={model} data={data} />
50
50
  {:else if model.type === StreamElementType.Images && imagesModel?.length}
51
51
  <ImagesStreamElementView model={model} data={imagesModel} />
52
52
  {:else if model.type === StreamElementType.Price && productModel}
53
- <PriceStreamElementView model={model} data={productModel.price} localization={localization.priceElementLocalization} />
53
+ <PriceStreamElementView model={model} data={productModel.price} locale={localization.priceElementLocalization} />
54
54
  {:else if model.type === StreamElementType.ShortVideo && shortVideoModel}
55
55
  <ShortVideoStreamElementView
56
56
  data={shortVideoModel}
57
- localization={localization.shortVideoElementLocalization}
57
+ locale={localization.shortVideoElementLocalization}
58
58
  on={on
59
59
  ? {
60
60
  progress: (progress: Number) => {
@@ -65,7 +65,7 @@ const productModel = $derived.by(() => {
65
65
  {:else if model.type === StreamElementType.Spacer}
66
66
  <SpacerStreamElementView model={model} parentContainerDirection={constainerDirection} />
67
67
  {:else if model.type === StreamElementType.Stock}
68
- <StockStreamElementView model={model} localization={localization.stockElementLocalization} />
68
+ <StockStreamElementView model={model} locale={localization.stockElementLocalization} />
69
69
  {:else if model.type === StreamElementType.Text}
70
70
  <TextStreamElementView model={model} />
71
71
  {:else if model.type === StreamElementType.TextRef && data}
@@ -1,5 +1,4 @@
1
1
  import type { Locale } from '../../../core/locale';
2
- import { type IStreamElementLocalization } from './stream-element-localization';
3
2
  import type { StreamElementModel } from '../elements';
4
3
  import { StreamElementStyleDirection } from '../enums';
5
4
  import type { StreamSlotData } from '../slot-data';
@@ -7,7 +6,7 @@ type Props = {
7
6
  model: StreamElementModel;
8
7
  data: StreamSlotData | null;
9
8
  constainerDirection?: StreamElementStyleDirection;
10
- localization: IStreamElementLocalization | Locale;
9
+ locale: Locale;
11
10
  on?: {
12
11
  progress?: (videoId: string, progress: number) => void;
13
12
  };
@@ -10,7 +10,3 @@ export { default as StockStreamElementView } from './cmp.stock-stream-element.sv
10
10
  export { default as TextRefStreamElementView } from './cmp.text-ref-stream-element.svelte';
11
11
  export { default as TextStreamElementView } from './cmp.text-stream-element.svelte';
12
12
  export { default as WebViewStreamElementView } from './cmp.web-view-stream-element.svelte';
13
- export type { IStreamElementLocalization } from './stream-element-localization';
14
- export type { IPriceStreamElementLocalization } from './price-stream-element-localization';
15
- export type { IStockStreamElementLocalization } from './stock-stream-element-localization';
16
- export type { IShortVideoStreamElementLocalization } from './short-video-stream-element-localization';