@streamscloud/embeddable 5.1.3 → 6.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 (89) hide show
  1. package/dist/ads/ad-card/mapper.js +1 -1
  2. package/dist/core/continuation-token.d.ts +1 -0
  3. package/dist/core/continuation-token.js +3 -0
  4. package/dist/core/locale.d.ts +0 -1
  5. package/dist/core/locale.js +0 -12
  6. package/dist/core/media/media-item-url.service.d.ts +1 -1
  7. package/dist/core/media/media-item-url.service.js +1 -6
  8. package/dist/media-center/data-provider/index.d.ts +2 -0
  9. package/dist/media-center/data-provider/index.js +1 -0
  10. package/dist/media-center/data-provider/internal-media-center-data-provider.svelte.d.ts +8 -0
  11. package/dist/media-center/data-provider/internal-media-center-data-provider.svelte.js +44 -0
  12. package/dist/media-center/data-provider/operations.generated.d.ts +89 -0
  13. package/dist/media-center/data-provider/operations.generated.js +275 -0
  14. package/dist/media-center/data-provider/operations.graphql +25 -0
  15. package/dist/media-center/data-provider/types.d.ts +24 -0
  16. package/dist/media-center/data-provider/types.js +1 -0
  17. package/dist/media-center/index.d.ts +1 -0
  18. package/dist/media-center/index.js +1 -0
  19. package/dist/media-center/media-center/cmp.media-center.svelte +336 -0
  20. package/dist/media-center/media-center/cmp.media-center.svelte.d.ts +20 -0
  21. package/dist/media-center/media-center/index.d.ts +3 -0
  22. package/dist/media-center/media-center/index.js +2 -0
  23. package/dist/media-center/media-center/media-center-localization.d.ts +11 -0
  24. package/dist/media-center/media-center/media-center-localization.js +15 -0
  25. package/dist/media-center/media-center/overview.svelte +142 -0
  26. package/dist/media-center/media-center/overview.svelte.d.ts +13 -0
  27. package/dist/media-center/media-center/short-video-resources-generator.d.ts +8 -0
  28. package/dist/media-center/media-center/short-video-resources-generator.js +26 -0
  29. package/dist/media-center/media-center/types.d.ts +10 -0
  30. package/dist/media-center/media-center/types.js +5 -0
  31. package/dist/products/product-card/cmp.product-card.svelte +11 -6
  32. package/dist/products/product-card/mapper.js +3 -3
  33. package/dist/short-videos/short-video-card/cmp.short-video-card.svelte +118 -0
  34. package/dist/short-videos/short-video-card/cmp.short-video-card.svelte.d.ts +11 -0
  35. package/dist/short-videos/short-video-card/index.d.ts +2 -0
  36. package/dist/short-videos/short-video-card/index.js +1 -0
  37. package/dist/short-videos/short-video-card/types.d.ts +5 -0
  38. package/dist/short-videos/short-video-card/types.js +1 -0
  39. package/dist/short-videos/short-video-viewer/cmp.short-video-controls.svelte +3 -3
  40. package/dist/short-videos/short-video-viewer/cmp.short-video-controls.svelte.d.ts +2 -2
  41. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +8 -26
  42. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +2 -3
  43. package/dist/short-videos/short-video-viewer/index.d.ts +1 -1
  44. package/dist/short-videos/short-video-viewer/mapper.js +6 -3
  45. package/dist/short-videos/short-video-viewer/types.d.ts +8 -6
  46. package/dist/short-videos/short-video-viewer/ui-manager.svelte.d.ts +0 -5
  47. package/dist/short-videos/short-video-viewer/ui-manager.svelte.js +0 -11
  48. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +16 -12
  49. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +5 -15
  50. package/dist/short-videos/short-videos-player/controls.svelte +34 -3
  51. package/dist/short-videos/short-videos-player/controls.svelte.d.ts +3 -2
  52. package/dist/short-videos/short-videos-player/fade-mixins.scss +12 -0
  53. package/dist/short-videos/short-videos-player/index.d.ts +66 -36
  54. package/dist/short-videos/short-videos-player/index.js +40 -104
  55. package/dist/short-videos/short-videos-player/internal-short-video-player-provider.d.ts +17 -0
  56. package/dist/short-videos/short-videos-player/internal-short-video-player-provider.js +59 -0
  57. package/dist/short-videos/short-videos-player/operations.generated.d.ts +1 -0
  58. package/dist/short-videos/short-videos-player/operations.generated.js +2 -1
  59. package/dist/short-videos/short-videos-player/operations.graphql +1 -0
  60. package/dist/short-videos/short-videos-player/short-videos-player-view.svelte +36 -55
  61. package/dist/short-videos/short-videos-player/short-videos-player-view.svelte.d.ts +12 -15
  62. package/dist/short-videos/short-videos-player/types.d.ts +8 -29
  63. package/dist/short-videos/short-videos-player/types.js +1 -6
  64. package/dist/short-videos/short-videos-player/ui-manager.svelte.d.ts +6 -6
  65. package/dist/short-videos/short-videos-player/ui-manager.svelte.js +28 -16
  66. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +6 -1
  67. package/dist/streams/stream-page-viewer/index.d.ts +1 -0
  68. package/dist/streams/stream-page-viewer/index.js +1 -0
  69. package/dist/streams/stream-player/controls.svelte +2 -2
  70. package/dist/streams/stream-player/controls.svelte.d.ts +2 -2
  71. package/dist/streams/stream-player/index.d.ts +84 -27
  72. package/dist/streams/stream-player/index.js +46 -48
  73. package/dist/streams/stream-player/internal-stream-analytics-handler.d.ts +12 -0
  74. package/dist/streams/stream-player/internal-stream-analytics-handler.js +17 -0
  75. package/dist/streams/stream-player/internal-stream-player-data-provider.d.ts +10 -0
  76. package/dist/streams/stream-player/internal-stream-player-data-provider.js +48 -0
  77. package/dist/streams/stream-player/mapper.js +2 -0
  78. package/dist/streams/stream-player/operations.generated.d.ts +0 -2
  79. package/dist/streams/stream-player/operations.generated.js +2 -4
  80. package/dist/streams/stream-player/operations.graphql +0 -1
  81. package/dist/streams/stream-player/stream-player-buffer.svelte.d.ts +5 -5
  82. package/dist/streams/stream-player/stream-player-buffer.svelte.js +12 -27
  83. package/dist/streams/stream-player/{cmp.stream-player.svelte → stream-player.svelte} +19 -37
  84. package/dist/streams/stream-player/stream-player.svelte.d.ts +4 -0
  85. package/dist/streams/stream-player/types.d.ts +40 -0
  86. package/dist/ui/player/index.d.ts +1 -1
  87. package/dist/ui/player/player-buffer.svelte.d.ts +3 -3
  88. package/package.json +5 -1
  89. package/dist/streams/stream-player/cmp.stream-player.svelte.d.ts +0 -22
@@ -0,0 +1,118 @@
1
+ <script lang="ts">import { Icon } from '../../ui/icon';
2
+ import { ImageRounded } from '../../ui/image';
3
+ import { LineClamp } from '../../ui/line-clamp';
4
+ import { ProportionalContainer } from '../../ui/proportional-container';
5
+ import IconPhone from '@fluentui/svg-icons/icons/phone_20_regular.svg?raw';
6
+ let { shortVideo, aspectRatio = 9 / 16, on } = $props();
7
+ </script>
8
+
9
+ <div class="short-video-card">
10
+ <div class="short-video-card__media">
11
+ <ProportionalContainer ratio={aspectRatio}>
12
+ <ImageRounded src={shortVideo.cover} alt="" noBorders={true} />
13
+ </ProportionalContainer>
14
+
15
+ <div class="short-video-card__media-icons">
16
+ <Icon src={IconPhone}></Icon>
17
+ </div>
18
+
19
+ <div class="short-video-card__gradient-overlay"></div>
20
+ </div>
21
+
22
+ {#if shortVideo.text}
23
+ <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>
27
+ </div>
28
+ {/if}
29
+
30
+ {#if on?.click}
31
+ <button type="button" onclick={on.click} class="short-video-card__link" aria-label="none">&nbsp;</button>
32
+ {/if}
33
+ </div>
34
+
35
+ <style>@keyframes fadeIn {
36
+ 0% {
37
+ opacity: 1;
38
+ }
39
+ 50% {
40
+ opacity: 0.4;
41
+ }
42
+ 100% {
43
+ opacity: 1;
44
+ }
45
+ }
46
+ .short-video-card {
47
+ position: relative;
48
+ overflow: hidden;
49
+ container-type: inline-size;
50
+ width: 100%;
51
+ border-radius: 0.375rem;
52
+ }
53
+ .short-video-card__media {
54
+ display: flex;
55
+ align-items: center;
56
+ justify-content: center;
57
+ --image--rounded--outer--border-radius: 1%;
58
+ }
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
+ .short-video-card__media-icons {
74
+ position: absolute;
75
+ top: 0.625em;
76
+ right: 0.625em;
77
+ display: flex;
78
+ align-items: center;
79
+ gap: 0.3125em;
80
+ --icon--size: 1.25em;
81
+ --icon--color: #ffffff;
82
+ }
83
+ .short-video-card__text {
84
+ font-weight: 500;
85
+ white-space: pre-line;
86
+ word-break: break-word;
87
+ display: -webkit-box;
88
+ overflow: hidden;
89
+ -webkit-box-orient: vertical;
90
+ line-clamp: 3;
91
+ -webkit-line-clamp: 3;
92
+ /* Set 'container-type: inline-size;' to reference container*/
93
+ }
94
+ .short-video-card__text-value {
95
+ font-size: 0.9375em;
96
+ line-height: 1.2;
97
+ }
98
+ @container (width < 350px) {
99
+ .short-video-card__text {
100
+ position: absolute;
101
+ bottom: 0;
102
+ left: 0;
103
+ right: 0;
104
+ background: linear-gradient(0deg, #000 0%, rgba(0, 0, 0, 0) 100%);
105
+ color: #ffffff;
106
+ font-size: 0.9375rem;
107
+ font-weight: 400;
108
+ padding: 0.78125rem 1rem;
109
+ padding-top: 2.5rem;
110
+ }
111
+ }
112
+ .short-video-card__link {
113
+ position: absolute;
114
+ top: 0;
115
+ left: 0;
116
+ width: 100%;
117
+ height: 100%;
118
+ }</style>
@@ -0,0 +1,11 @@
1
+ import type { ShortVideoCardModel } from './types';
2
+ type Props = {
3
+ shortVideo: ShortVideoCardModel;
4
+ aspectRatio?: number;
5
+ on?: {
6
+ click?: () => void;
7
+ };
8
+ };
9
+ declare const Cmp: import("svelte").Component<Props, {}, "">;
10
+ type Cmp = ReturnType<typeof Cmp>;
11
+ export default Cmp;
@@ -0,0 +1,2 @@
1
+ export { default as ShortVideoCard } from './cmp.short-video-card.svelte';
2
+ export type { ShortVideoCardModel } from './types';
@@ -0,0 +1 @@
1
+ export { default as ShortVideoCard } from './cmp.short-video-card.svelte';
@@ -0,0 +1,5 @@
1
+ export type ShortVideoCardModel = {
2
+ id: string;
3
+ text: string | null;
4
+ cover: string;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -49,19 +49,19 @@ const onLikeClicked = () => __awaiter(void 0, void 0, void 0, function* () {
49
49
  if (!socialInteractionsHandler) {
50
50
  return;
51
51
  }
52
- yield socialInteractionsHandler.onToggleLike(model.id);
52
+ yield socialInteractionsHandler.toggleLike(model.id);
53
53
  });
54
54
  const onShareClicked = () => __awaiter(void 0, void 0, void 0, function* () {
55
55
  if (!socialInteractionsHandler) {
56
56
  return;
57
57
  }
58
- yield socialInteractionsHandler.onShare(model.id);
58
+ yield socialInteractionsHandler.share(model.id);
59
59
  });
60
60
  const refreshIsLiked = () => __awaiter(void 0, void 0, void 0, function* () {
61
61
  if (!socialInteractionsHandler) {
62
62
  return;
63
63
  }
64
- isLikedStore = yield socialInteractionsHandler.isLiked(model.id);
64
+ isLikedStore = yield socialInteractionsHandler.getIsLiked(model.id);
65
65
  });
66
66
  </script>
67
67
 
@@ -1,4 +1,4 @@
1
- import type { ShortVideoSocialInteractionsHandler } from './types';
1
+ import type { IPostSocialInteractionsHandler } from './types';
2
2
  type Props = {
3
3
  model: {
4
4
  id: string;
@@ -9,7 +9,7 @@ type Props = {
9
9
  isImage: boolean;
10
10
  };
11
11
  };
12
- socialInteractionsHandler?: ShortVideoSocialInteractionsHandler;
12
+ socialInteractionsHandler?: IPostSocialInteractionsHandler;
13
13
  on?: {
14
14
  attachmentsClicked?: () => void;
15
15
  };
@@ -6,26 +6,9 @@ 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, availableSideSpace = 0, showAttachments = true, showControls = true, autoplay = 'on-appearance', localization: localizationInit = 'en', on } = $props();
9
+ let { model, socialInteractionsHandler, showAttachments = true, showControls = true, autoplay = 'on-appearance', localization: localizationInit = 'en', on } = $props();
10
10
  const localization = $derived(new ShortVideoViewerLocalization(localizationInit));
11
- let actionsPanelRef = $state.raw(null);
12
11
  const uiManager = new ShortVideoViewerUiManager();
13
- $effect(() => {
14
- if (actionsPanelRef) {
15
- const resizeObserver = new ResizeObserver(() => {
16
- if (actionsPanelRef) {
17
- uiManager.updateActionsPanelWidth(actionsPanelRef.clientWidth);
18
- }
19
- });
20
- resizeObserver.observe(actionsPanelRef);
21
- return () => {
22
- resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
23
- };
24
- }
25
- });
26
- $effect(() => {
27
- uiManager.updateAvailableSideSpace(availableSideSpace);
28
- });
29
12
  $effect(() => {
30
13
  uiManager.updateCanShowAttachments(showAttachments);
31
14
  uiManager.updateCanShowControls(showControls);
@@ -51,10 +34,7 @@ $effect(() => {
51
34
  {/if}
52
35
  </div>
53
36
 
54
- <div
55
- class="short-video-viewer__actions-panel"
56
- class:short-video-viewer__actions-panel--inside-frame={uiManager.showActionsInsideFrame}
57
- bind:this={actionsPanelRef}>
37
+ <div class="short-video-viewer__actions-panel" class:short-video-viewer__actions-panel--inside-frame={true}>
58
38
  {#if uiManager.showAttachments}
59
39
  <AttachmentsInline model={model} />
60
40
  {/if}
@@ -88,8 +68,6 @@ $effect(() => {
88
68
  }
89
69
  }
90
70
  .short-video-viewer {
91
- --_short-video-viewer--actions-panel--top: var(--short-video-viewer--actions-panel--top, 0.9375rem);
92
- --_short-video-viewer--actions-panel--bottom: var(--short-video-viewer--actions-panel--bottom, 0.9375rem);
93
71
  --video--media-fit: cover;
94
72
  width: 100%;
95
73
  min-width: 100%;
@@ -116,8 +94,8 @@ $effect(() => {
116
94
  .short-video-viewer__actions-panel {
117
95
  position: absolute;
118
96
  left: calc(100% + 0.625rem);
119
- top: var(--_short-video-viewer--actions-panel--top);
120
- bottom: var(--_short-video-viewer--actions-panel--bottom);
97
+ top: 0.9375rem;
98
+ bottom: 0.9375rem;
121
99
  gap: 2.5rem;
122
100
  display: flex;
123
101
  flex-direction: column;
@@ -128,12 +106,16 @@ $effect(() => {
128
106
  .short-video-viewer__actions-panel {
129
107
  left: auto;
130
108
  right: 0.625rem;
109
+ top: 5rem;
110
+ bottom: 5rem;
131
111
  align-items: flex-end;
132
112
  }
133
113
  }
134
114
  .short-video-viewer__actions-panel--inside-frame {
135
115
  left: auto;
136
116
  right: 0.625rem;
117
+ top: 5rem;
118
+ bottom: 5rem;
137
119
  align-items: flex-end;
138
120
  }
139
121
  .short-video-viewer__description {
@@ -1,10 +1,9 @@
1
1
  import type { Locale } from '../../core/locale';
2
2
  import { type IShortVideoViewerLocalization } from './short-video-viewer-localization';
3
- import type { ShortVideoSocialInteractionsHandler, ShortVideoViewerModel } from './types';
3
+ import type { IPostSocialInteractionsHandler, ShortVideoViewerModel } from './types';
4
4
  type Props = {
5
5
  model: ShortVideoViewerModel;
6
- socialInteractionsHandler?: ShortVideoSocialInteractionsHandler;
7
- availableSideSpace?: number;
6
+ socialInteractionsHandler?: IPostSocialInteractionsHandler;
8
7
  showAttachments?: boolean;
9
8
  showControls?: boolean;
10
9
  autoplay?: true | false | 'on-appearance';
@@ -2,7 +2,7 @@ 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 { default as ShortVideoViewerAttachmentsInline } from './cmp.attachments-inline.svelte';
5
- export type { ShortVideoViewerModel, ShortVideoSocialInteractionsHandler, ShortVideoAdCardModel, ShortVideoProductCardModel } from './types';
5
+ export type { ShortVideoViewerModel, IPostSocialInteractionsHandler, ShortVideoAdCardModel, ShortVideoProductCardModel } from './types';
6
6
  export type { IShortVideoViewerLocalization } from './short-video-viewer-localization';
7
7
  export type { IShortVideoAttachmentsLocalization } from './short-video-attachments-localization';
8
8
  export { mapToShortVideoViewerModel } from './mapper';
@@ -3,6 +3,9 @@ import { getMediaItemImageUrl } from '../../core/media';
3
3
  import { shouldUseSalePrice } from '../../products/price-helper';
4
4
  export const mapToShortVideoViewerModel = (payload) => {
5
5
  const mediaBlob = payload.postData.media[0];
6
+ if (!mediaBlob) {
7
+ console.warn('Short video media is missing. Unexpected behavior.');
8
+ }
6
9
  return {
7
10
  id: payload.id,
8
11
  media: mediaBlob.type === MediaType.Image
@@ -18,7 +21,7 @@ export const mapToShortVideoViewerModel = (payload) => {
18
21
  ad: payload.ad ? mapToShortVideoAdCardModel(payload.ad) : null,
19
22
  products: payload.allProducts.map((x) => mapToShortVideoProductCard(x))
20
23
  // uncomment if you want to test many products behavior
21
- // .flatMap(x =>
24
+ // .flatMap((x) =>
22
25
  // Array.from({ length: 20 }, (_, i) => ({
23
26
  // ...x,
24
27
  // id: x.id + String(i + 1)
@@ -30,7 +33,7 @@ const mapToShortVideoAdCardModel = (payload) => {
30
33
  return {
31
34
  id: payload.id,
32
35
  type: payload.type,
33
- image: getMediaItemImageUrl(payload.media[0]),
36
+ image: payload.media.length ? getMediaItemImageUrl(payload.media[0]) : null,
34
37
  title: payload.title,
35
38
  description: payload.description,
36
39
  price: payload.price,
@@ -53,7 +56,7 @@ const mapToShortVideoProductCard = (payload, referenceDate) => {
53
56
  shortDescription: payload.shortDescription,
54
57
  link: payload.link,
55
58
  brandName: payload.brand?.name || null,
56
- image: payload.media?.length ? getMediaItemImageUrl(payload.media[0]) : null,
59
+ image: payload.media.length ? getMediaItemImageUrl(payload.media[0]) : null,
57
60
  currency: payload.priceAndAvailability.currency,
58
61
  price: payload.priceAndAvailability.price,
59
62
  salePrice: effectiveSalePrice?.salePrice ?? null
@@ -9,7 +9,7 @@ export type ShortVideoViewerModel = {
9
9
  url: string;
10
10
  thumbnailUrl: string;
11
11
  };
12
- text?: string | null;
12
+ text: string | null;
13
13
  heading: ShortVideoViewerHeadingModel | null;
14
14
  enableSocialInteractions: boolean;
15
15
  products: ShortVideoProductCardModel[];
@@ -21,13 +21,14 @@ export type ShortVideoViewerHeadingModel = {
21
21
  displayDate: string;
22
22
  viewsCount: number;
23
23
  };
24
- export type ShortVideoSocialInteractionsHandler = {
25
- isLiked: (shortVideoId: string) => Promise<{
24
+ export interface IPostSocialInteractionsHandler {
25
+ getIsLiked: (shortVideoId: string) => PromiseLike<{
26
26
  readonly isLiked: boolean;
27
27
  }>;
28
- onToggleLike: (shortVideoId: string) => void;
29
- onShare: (shortVideoId: string) => void;
30
- };
28
+ toggleLike: (shortVideoId: string) => PromiseLike<void>;
29
+ share: (shortVideoId: string) => PromiseLike<void>;
30
+ }
31
+ type PromiseLike<T> = T | Promise<T>;
31
32
  export type ShortVideoProductCardModel = {
32
33
  id: string;
33
34
  title: string;
@@ -56,3 +57,4 @@ export type ShortVideoAdCardModel = {
56
57
  border: string;
57
58
  } | null;
58
59
  };
60
+ export {};
@@ -1,16 +1,11 @@
1
1
  export declare class ShortVideoViewerUiManager {
2
2
  readonly globalCssVariables: string;
3
- readonly showActionsInsideFrame: boolean;
4
3
  readonly showAttachments: boolean;
5
4
  readonly showControls: boolean;
6
5
  private readonly buttonSize;
7
- private actionsPanelWidth;
8
- private availableSideSpace;
9
6
  private canShowControls;
10
7
  private canShowAttachments;
11
8
  private enableAttachments;
12
- updateActionsPanelWidth: (value: number) => void;
13
- updateAvailableSideSpace: (value: number) => void;
14
9
  updateCanShowAttachments: (value: boolean) => void;
15
10
  updateCanShowControls: (value: boolean) => void;
16
11
  toggleEnableAttachments: () => void;
@@ -3,9 +3,6 @@ export class ShortVideoViewerUiManager {
3
3
  const values = [`--_short-video-viewer--button--size: ${this.buttonSize}px`];
4
4
  return values.join(';');
5
5
  });
6
- showActionsInsideFrame = $derived.by(() => {
7
- return this.actionsPanelWidth + 40 > this.availableSideSpace;
8
- });
9
6
  showAttachments = $derived.by(() => {
10
7
  return this.canShowAttachments && this.enableAttachments;
11
8
  });
@@ -13,20 +10,12 @@ export class ShortVideoViewerUiManager {
13
10
  return this.canShowControls;
14
11
  });
15
12
  buttonSize = 40;
16
- actionsPanelWidth = $state(0);
17
- availableSideSpace = $state(0);
18
13
  // is provided from the calling side
19
14
  canShowControls = $state(false);
20
15
  // is provided from the calling side
21
16
  canShowAttachments = $state(false);
22
17
  // managed internally by component
23
18
  enableAttachments = $state(true);
24
- updateActionsPanelWidth = (value) => {
25
- this.actionsPanelWidth = value;
26
- };
27
- updateAvailableSideSpace = (value) => {
28
- this.availableSideSpace = value;
29
- };
30
19
  updateCanShowAttachments = (value) => {
31
20
  this.canShowAttachments = value;
32
21
  };
@@ -1,20 +1,24 @@
1
- <script lang="ts">import {} from '../../core/locale';
1
+ <script lang="ts">import { MediaCenter, MediaCenterMode } from '../../media-center/media-center';
2
2
  import { createShadowRoot } from '../../ui/shadow-dom';
3
- import {} from './short-videos-player-localization';
4
- import { default as ShortVideosPlayerView } from './short-videos-player-view.svelte';
5
3
  import { mount, unmount } from 'svelte';
6
- let { input, socialInteractionsHandler, localization, showStreamsCloudWatermark, disableBackground, on } = $props();
4
+ let { dataProvider, socialInteractionsHandler, localization, showStreamsCloudWatermark, disableBackground, on, mediaCenterDataProvider } = $props();
7
5
  const initHost = (node) => {
8
6
  const shadowRoot = createShadowRoot(node);
9
- const mounted = mount(ShortVideosPlayerView, {
7
+ const mounted = mount(MediaCenter, {
10
8
  target: shadowRoot,
11
9
  props: {
12
- input,
13
- socialInteractionsHandler,
14
- localization,
15
- showStreamsCloudWatermark,
16
- disableBackground,
17
- on
10
+ dataProvider: mediaCenterDataProvider || null,
11
+ playerProps: {
12
+ type: MediaCenterMode.ShortVideos,
13
+ props: {
14
+ dataProvider,
15
+ socialInteractionsHandler,
16
+ disableBackground,
17
+ localization,
18
+ showStreamsCloudWatermark,
19
+ on
20
+ }
21
+ }
18
22
  }
19
23
  });
20
24
  return {
@@ -25,6 +29,6 @@ const initHost = (node) => {
25
29
  };
26
30
  </script>
27
31
 
28
- {#key input}
32
+ {#key dataProvider}
29
33
  <div class="short-videos-player-host" use:initHost></div>
30
34
  {/key}
@@ -1,18 +1,8 @@
1
- import { type Locale } from '../../core/locale';
2
- import type { ShortVideoSocialInteractionsHandler } from '../short-video-viewer';
3
- import { type IShortVideosPlayerLocalization } from './short-videos-player-localization';
4
- import type { PlayerInput } from './types';
5
- type Props = {
6
- input: PlayerInput;
7
- socialInteractionsHandler?: ShortVideoSocialInteractionsHandler;
8
- localization?: IShortVideosPlayerLocalization | Locale;
9
- showStreamsCloudWatermark?: boolean;
10
- disableBackground?: boolean;
11
- on?: {
12
- closePlayer?: () => void;
13
- videoActivated?: (id: string) => void;
14
- };
1
+ import type { IMediaCenterDataProvider } from '../../media-center/data-provider';
2
+ import type { ShortVideoPlayerProps } from './types';
3
+ type $$ComponentProps = ShortVideoPlayerProps & {
4
+ mediaCenterDataProvider?: IMediaCenterDataProvider;
15
5
  };
16
- declare const Cmp: import("svelte").Component<Props, {}, "">;
6
+ declare const Cmp: import("svelte").Component<$$ComponentProps, {}, "">;
17
7
  type Cmp = ReturnType<typeof Cmp>;
18
8
  export default Cmp;
@@ -5,7 +5,7 @@ import { ShortVideosPlayerLocalization } from './short-videos-player-localizatio
5
5
  import IconChevronDown from '@fluentui/svg-icons/icons/chevron_down_20_regular.svg?raw';
6
6
  import IconChevronUp from '@fluentui/svg-icons/icons/chevron_up_20_regular.svg?raw';
7
7
  import IconDismiss from '@fluentui/svg-icons/icons/dismiss_20_regular.svg?raw';
8
- let { buffer, uiManager, localization, socialInteractionsHandler, on } = $props();
8
+ let { buffer, uiManager, localization, socialInteractionsHandler, playerLogo, on } = $props();
9
9
  const shortVideo = $derived(buffer.current);
10
10
  const changeShowAttachments = () => {
11
11
  uiManager.showAttachments = !uiManager.showAttachments;
@@ -39,6 +39,11 @@ const changeShowAttachments = () => {
39
39
  </div>
40
40
  </div>
41
41
  <div class="short-videos-player-controls__right">
42
+ {#if playerLogo}
43
+ <div class="short-videos-player-controls__player-logo">
44
+ <img src={playerLogo} class="short-videos-player-controls__logo-img" alt="Player Logo" />
45
+ </div>
46
+ {/if}
42
47
  {#if shortVideo && uiManager.showAttachments}
43
48
  <div class="short-videos-player-controls__short-video-attachments" transition:slideHorizontally|local>
44
49
  <ShortVideoViewerAttachments
@@ -75,10 +80,10 @@ const changeShowAttachments = () => {
75
80
  top: 0;
76
81
  right: 0;
77
82
  height: 100%;
78
- width: var(--short-videos-player--sidebar--available-space);
83
+ width: var(--short-videos-player--controls--available-space);
79
84
  display: flex;
80
85
  justify-content: space-between;
81
- padding: var(--short-videos-player--controls--offset-vertical) var(--short-videos-player--controls--offset-horizontal);
86
+ padding: var(--short-videos-player--controls--padding);
82
87
  container-type: inline-size;
83
88
  }
84
89
  .short-videos-player-controls__left {
@@ -87,6 +92,9 @@ const changeShowAttachments = () => {
87
92
  gap: 2.3125rem;
88
93
  justify-content: flex-end;
89
94
  align-items: center;
95
+ padding-top: var(--short-videos-player--media-center-header--height);
96
+ opacity: var(--short-videos-player--elements-opacity);
97
+ transition: opacity 0.3s ease-in-out;
90
98
  }
91
99
  .short-videos-player-controls__right {
92
100
  flex: 1;
@@ -131,6 +139,27 @@ const changeShowAttachments = () => {
131
139
  justify-content: flex-end;
132
140
  --short-video-controls--icon--size: var(--short-videos-player--icon--size);
133
141
  }
142
+ .short-videos-player-controls__player-logo {
143
+ width: 11rem;
144
+ max-width: 11rem;
145
+ height: var(--short-videos-player--media-center-header--height);
146
+ min-height: var(--short-videos-player--media-center-header--height);
147
+ max-height: var(--short-videos-player--media-center-header--height);
148
+ display: flex;
149
+ justify-content: center;
150
+ align-items: center;
151
+ /* Set 'container-type: inline-size;' to reference container*/
152
+ }
153
+ @container (width < calc(11rem + 3.75rem)) {
154
+ .short-videos-player-controls__player-logo {
155
+ display: none;
156
+ }
157
+ }
158
+ .short-videos-player-controls__logo-img {
159
+ width: 6.25rem;
160
+ min-width: 6.25rem;
161
+ max-width: 6.25rem;
162
+ }
134
163
  .short-videos-player-controls__short-video-attachments-inline {
135
164
  display: none;
136
165
  /* Set 'container-type: inline-size;' to reference container*/
@@ -144,6 +173,8 @@ const changeShowAttachments = () => {
144
173
  flex: 1;
145
174
  width: 11rem;
146
175
  max-width: 11rem;
176
+ opacity: var(--short-videos-player--elements-opacity);
177
+ transition: opacity 0.3s ease-in-out;
147
178
  /* Set 'container-type: inline-size;' to reference container*/
148
179
  }
149
180
  @container (width < calc(11rem + 3.75rem)) {
@@ -1,4 +1,4 @@
1
- import { type ShortVideoSocialInteractionsHandler, type ShortVideoViewerModel } from '../short-video-viewer';
1
+ import { type IPostSocialInteractionsHandler, type ShortVideoViewerModel } from '../short-video-viewer';
2
2
  import type { IPlayerBuffer } from '../../ui/player';
3
3
  import { ShortVideosPlayerLocalization } from './short-videos-player-localization';
4
4
  import type { ShortVideosPlayerUiManager } from './ui-manager.svelte';
@@ -6,7 +6,8 @@ type Props = {
6
6
  buffer: IPlayerBuffer<ShortVideoViewerModel>;
7
7
  uiManager: ShortVideosPlayerUiManager;
8
8
  localization: ShortVideosPlayerLocalization;
9
- socialInteractionsHandler?: ShortVideoSocialInteractionsHandler;
9
+ socialInteractionsHandler?: IPostSocialInteractionsHandler;
10
+ playerLogo: string | null;
10
11
  on: {
11
12
  closePlayer?: () => void;
12
13
  productClick?: (productId: string) => void;
@@ -0,0 +1,12 @@
1
+ @mixin default-opacity {
2
+ --short-videos-player--elements-opacity: 1;
3
+ }
4
+
5
+ @mixin fade-opacity {
6
+ --short-videos-player--elements-opacity: 0;
7
+ }
8
+
9
+ @mixin handle-fade {
10
+ opacity: var(--short-videos-player--elements-opacity);
11
+ transition: opacity 0.3s ease-in-out;
12
+ }