@streamscloud/embeddable 3.4.2 → 4.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 (98) hide show
  1. package/dist/ads/ad-card/cmp.ad-card.svelte +193 -0
  2. package/dist/{short-videos/short-video-viewer/cmp.ad.svelte.d.ts → ads/ad-card/cmp.ad-card.svelte.d.ts} +3 -2
  3. package/dist/ads/ad-card/index.d.ts +3 -0
  4. package/dist/ads/ad-card/index.js +2 -0
  5. package/dist/ads/ad-card/mapper.d.ts +3 -0
  6. package/dist/ads/ad-card/mapper.js +13 -0
  7. package/dist/ads/ad-card/operations.generated.d.ts +23 -0
  8. package/dist/ads/ad-card/operations.generated.js +47 -0
  9. package/dist/ads/ad-card/operations.graphql +20 -0
  10. package/dist/ads/ad-card/types.d.ts +17 -0
  11. package/dist/ads/ad-card/types.js +1 -0
  12. package/dist/core/locale.d.ts +3 -0
  13. package/dist/products/price-helper.d.ts +18 -3
  14. package/dist/products/price-helper.js +9 -6
  15. package/dist/products/product-card/cmp.product-card.svelte +218 -0
  16. package/dist/products/product-card/cmp.product-card.svelte.d.ts +15 -0
  17. package/dist/products/product-card/index.d.ts +4 -0
  18. package/dist/products/product-card/index.js +2 -0
  19. package/dist/products/product-card/mapper.d.ts +3 -0
  20. package/dist/products/product-card/mapper.js +22 -0
  21. package/dist/products/product-card/operations.generated.d.ts +26 -0
  22. package/dist/products/product-card/operations.generated.js +59 -0
  23. package/dist/products/product-card/operations.graphql +23 -0
  24. package/dist/products/product-card/product-card-localization.d.ts +8 -0
  25. package/dist/{short-videos/short-video-viewer/short-video-product-localization.js → products/product-card/product-card-localization.js} +1 -1
  26. package/dist/products/product-card/types.d.ts +12 -0
  27. package/dist/products/product-card/types.js +1 -0
  28. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +12 -40
  29. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte.d.ts +1 -1
  30. package/dist/short-videos/short-video-viewer/cmp.short-video-controls.svelte +134 -0
  31. package/dist/short-videos/short-video-viewer/cmp.short-video-controls.svelte.d.ts +19 -0
  32. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +45 -20
  33. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +1 -0
  34. package/dist/short-videos/short-video-viewer/index.d.ts +2 -6
  35. package/dist/short-videos/short-video-viewer/index.js +1 -4
  36. package/dist/short-videos/short-video-viewer/mapper.js +12 -42
  37. package/dist/short-videos/short-video-viewer/operations.generated.d.ts +5 -8
  38. package/dist/short-videos/short-video-viewer/operations.generated.js +98 -94
  39. package/dist/short-videos/short-video-viewer/operations.graphql +2 -42
  40. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.d.ts +3 -7
  41. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.js +0 -14
  42. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.d.ts +3 -3
  43. package/dist/short-videos/short-video-viewer/types.d.ts +9 -28
  44. package/dist/short-videos/short-video-viewer/types.js +1 -1
  45. package/dist/short-videos/short-video-viewer/ui-manager.svelte.d.ts +5 -0
  46. package/dist/short-videos/short-video-viewer/ui-manager.svelte.js +14 -1
  47. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +23 -163
  48. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +3 -2
  49. package/dist/short-videos/short-videos-player/controls.svelte +110 -127
  50. package/dist/short-videos/short-videos-player/controls.svelte.d.ts +2 -1
  51. package/dist/short-videos/short-videos-player/index.d.ts +2 -0
  52. package/dist/short-videos/short-videos-player/index.js +6 -3
  53. package/dist/short-videos/short-videos-player/operations.generated.d.ts +5 -8
  54. package/dist/short-videos/short-videos-player/operations.generated.js +77 -73
  55. package/dist/short-videos/short-videos-player/short-videos-player-localization.d.ts +1 -3
  56. package/dist/short-videos/short-videos-player/short-videos-player-localization.js +0 -2
  57. package/dist/short-videos/short-videos-player/short-videos-player-view.svelte +198 -0
  58. package/dist/short-videos/short-videos-player/short-videos-player-view.svelte.d.ts +14 -0
  59. package/dist/short-videos/short-videos-player/types.d.ts +2 -0
  60. package/dist/short-videos/short-videos-player/ui-manager.svelte.d.ts +3 -3
  61. package/dist/short-videos/short-videos-player/ui-manager.svelte.js +8 -8
  62. package/dist/streams/layout/element-views/price-element-view.svelte +5 -4
  63. package/dist/streams/layout/models/mapper.js +8 -17
  64. package/dist/streams/stream-player/cmp.stream-player.svelte +18 -5
  65. package/dist/streams/stream-player/cmp.stream-player.svelte.d.ts +1 -1
  66. package/dist/streams/stream-player/controls.svelte +66 -73
  67. package/dist/streams/stream-player/index.js +2 -2
  68. package/dist/streams/stream-player/stream-overview.svelte +12 -1
  69. package/dist/streams/stream-player/stream-overview.svelte.d.ts +1 -0
  70. package/dist/streams/stream-player/stream-player-localization.d.ts +1 -3
  71. package/dist/streams/stream-player/stream-player-localization.js +0 -2
  72. package/dist/streams/stream-player/ui-manager.svelte.d.ts +3 -2
  73. package/dist/streams/stream-player/ui-manager.svelte.js +9 -5
  74. package/dist/ui/button/resources/button-theme.svelte +1 -0
  75. package/dist/ui/shadow-dom/index.d.ts +2 -1
  76. package/dist/ui/shadow-dom/index.js +2 -1
  77. package/dist/ui/shadow-dom/{shadow-host.d.ts → modal-shadow-host.d.ts} +1 -1
  78. package/dist/ui/shadow-dom/modal-shadow-host.js +21 -0
  79. package/dist/ui/shadow-dom/shadow-root-service.d.ts +1 -0
  80. package/dist/ui/shadow-dom/shadow-root-service.js +23 -0
  81. package/dist/ui/video/cmp.video.svelte +2 -2
  82. package/dist/ui/video/cmp.video.svelte.d.ts +1 -0
  83. package/package.json +1 -1
  84. package/dist/short-videos/short-video-viewer/cmp.ad.svelte +0 -140
  85. package/dist/short-videos/short-video-viewer/cmp.product.svelte +0 -168
  86. package/dist/short-videos/short-video-viewer/cmp.product.svelte.d.ts +0 -14
  87. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte +0 -125
  88. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte.d.ts +0 -14
  89. package/dist/short-videos/short-video-viewer/cmp.social-interactions.svelte +0 -69
  90. package/dist/short-videos/short-video-viewer/cmp.social-interactions.svelte.d.ts +0 -10
  91. package/dist/short-videos/short-video-viewer/description.svelte +0 -53
  92. package/dist/short-videos/short-video-viewer/description.svelte.d.ts +0 -9
  93. package/dist/short-videos/short-video-viewer/short-video-details-localization.d.ts +0 -14
  94. package/dist/short-videos/short-video-viewer/short-video-details-localization.js +0 -17
  95. package/dist/short-videos/short-video-viewer/short-video-product-localization.d.ts +0 -8
  96. package/dist/short-videos/short-videos-player/action-button.svelte +0 -38
  97. package/dist/short-videos/short-videos-player/action-button.svelte.d.ts +0 -10
  98. package/dist/ui/shadow-dom/shadow-host.js +0 -32
@@ -0,0 +1,198 @@
1
+ <script lang="ts">var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { handleEsc } from '../../core/document.event-handlers';
11
+ import { createLocalGQLClient } from '../../core/graphql';
12
+ import { mapShortVideoViewerModel, ShortVideoViewer } from '../short-video-viewer';
13
+ import { Loading } from '../../ui/loading';
14
+ import { PlayerBuffer, PlayerSlider } from '../../ui/player';
15
+ import { SpotlightLayout } from '../../ui/spotlight-layout';
16
+ import { SwipeIndicator } from '../../ui/swipe-indicator';
17
+ import { default as Controls } from './controls.svelte';
18
+ import { GetShortVideosDocument } from './operations.generated';
19
+ import { ShortVideosPlayerLocalization } from './short-videos-player-localization';
20
+ import { ShortVideosPlayerUiManager } from './ui-manager.svelte';
21
+ import { onMount } from 'svelte';
22
+ let { input, localization: localizationInit = 'en', showStreamsCloudWatermark, on } = $props();
23
+ const localization = $derived(new ShortVideosPlayerLocalization(localizationInit));
24
+ let everTouched = $state(false);
25
+ let background = $state(null);
26
+ let buffer = $state(input.type === 'provider' ? new PlayerBuffer(input.provider) : null);
27
+ const initBuffer = (input) => __awaiter(void 0, void 0, void 0, function* () {
28
+ var _a, _b;
29
+ try {
30
+ const { graphqlOrigin, ids, initialId } = input;
31
+ const graphql = createLocalGQLClient(graphqlOrigin, { 'x-initiator': input.initiator || 'player/short-videos' });
32
+ const payload = yield graphql
33
+ .query(GetShortVideosDocument, {
34
+ input: {
35
+ filter: {
36
+ ids
37
+ }
38
+ }
39
+ })
40
+ .toPromise();
41
+ const posts = ((_b = (_a = payload.data) === null || _a === void 0 ? void 0 : _a.shortVideos) === null || _b === void 0 ? void 0 : _b.items) || [];
42
+ const idOrder = new Map(ids.map((id, index) => [id, index]));
43
+ posts.sort((a, b) => {
44
+ var _a, _b;
45
+ return ((_a = idOrder.get(a.id)) !== null && _a !== void 0 ? _a : Infinity) - ((_b = idOrder.get(b.id)) !== null && _b !== void 0 ? _b : Infinity);
46
+ });
47
+ const index = initialId ? posts.findIndex((p) => p.id === initialId) : 0;
48
+ const provider = {
49
+ initialData: {
50
+ prefetchedItems: posts.map(mapShortVideoViewerModel),
51
+ startIndex: index
52
+ },
53
+ loadMore: () => __awaiter(void 0, void 0, void 0, function* () {
54
+ // No more items to load, as all are already prefetched
55
+ return [];
56
+ })
57
+ };
58
+ buffer = new PlayerBuffer(provider);
59
+ }
60
+ catch (_c) {
61
+ console.error('Failed to load short videos by IDs:', input.ids);
62
+ buffer = null; // Reset buffer on error
63
+ }
64
+ });
65
+ const uiManager = new ShortVideosPlayerUiManager();
66
+ onMount(() => {
67
+ if (input.type === 'ids') {
68
+ initBuffer(input);
69
+ }
70
+ });
71
+ const onItemActivated = (id) => {
72
+ const shortVideo = buffer === null || buffer === void 0 ? void 0 : buffer.loaded.find((x) => x.id === id);
73
+ if (!shortVideo) {
74
+ return;
75
+ }
76
+ background = shortVideo.media.isImage ? shortVideo.media.url : shortVideo.media.thumbnailUrl;
77
+ };
78
+ const contentMounted = (node) => {
79
+ const markAsTouched = () => {
80
+ everTouched = true;
81
+ node.removeEventListener('touchstart', markAsTouched);
82
+ node.removeEventListener('wheel', markAsTouched);
83
+ node.removeEventListener('click', markAsTouched);
84
+ node.removeEventListener('keypress', markAsTouched);
85
+ };
86
+ node.addEventListener('touchstart', markAsTouched);
87
+ node.addEventListener('wheel', markAsTouched);
88
+ node.addEventListener('click', markAsTouched);
89
+ node.addEventListener('keypress', markAsTouched);
90
+ };
91
+ const handleDimensionsChanged = (dimensions) => {
92
+ uiManager.updateDimensions({
93
+ mainViewColumnWidth: dimensions.mainSceneWidth,
94
+ viewTotalWidth: dimensions.totalWidth
95
+ });
96
+ };
97
+ const onPlayerClose = () => {
98
+ var _a;
99
+ (_a = on === null || on === void 0 ? void 0 : on.closePlayer) === null || _a === void 0 ? void 0 : _a.call(on);
100
+ };
101
+ </script>
102
+
103
+ <svelte:document onkeydown={(e) => handleEsc(e, onPlayerClose)} />
104
+
105
+ <div class="short-videos-player-container" style={background ? `--background-image: url(${background})` : null}>
106
+ <div class="short-videos-player" style={uiManager.globalCssVariables}>
107
+ {#if showStreamsCloudWatermark}
108
+ <div class="short-videos-player__watermark">
109
+ <a href="https://streamscloud.com/" tabindex="-1" aria-label="none">
110
+ <img src="https://embedabble-assets.streamscloud-cdn.com/watermark.svg" alt="StreamsCloud" />
111
+ </a>
112
+ </div>
113
+ {/if}
114
+ {#if buffer}
115
+ <SpotlightLayout ratio={9 / 16} on={{ dimensionsChanged: handleDimensionsChanged }}>
116
+ <div class="short-videos-player__content" use:contentMounted>
117
+ <PlayerSlider
118
+ buffer={buffer}
119
+ on={{
120
+ itemActivated: onItemActivated
121
+ }}>
122
+ {#snippet children({ item })}
123
+ <ShortVideoViewer
124
+ model={item}
125
+ autoplay="on-appearance"
126
+ showAttachments={uiManager.showShortVideoOverlay}
127
+ showControls={uiManager.showShortVideoOverlay}
128
+ localization={localization.shortVideoViewerLocalization} />
129
+ {/snippet}
130
+ </PlayerSlider>
131
+ {#if uiManager.isMobileView && buffer.loaded.length > 1 && !everTouched}
132
+ <SwipeIndicator localization={localization.swipeIndicatorLocalization} />
133
+ {/if}
134
+ </div>
135
+ </SpotlightLayout>
136
+ <Controls buffer={buffer} uiManager={uiManager} localization={localization} on={{ closePlayer: on?.closePlayer }} />
137
+ {:else}
138
+ <Loading positionFixedCenter={true} timeout={1000} />
139
+ {/if}
140
+ </div>
141
+ </div>
142
+
143
+ <style>@keyframes fadeIn {
144
+ 0% {
145
+ opacity: 1;
146
+ }
147
+ 50% {
148
+ opacity: 0.4;
149
+ }
150
+ 100% {
151
+ opacity: 1;
152
+ }
153
+ }
154
+ .short-videos-player-container {
155
+ width: 100%;
156
+ min-width: 100%;
157
+ max-width: 100%;
158
+ height: 100%;
159
+ min-height: 100%;
160
+ max-height: 100%;
161
+ container-type: inline-size;
162
+ display: flex;
163
+ position: relative;
164
+ background-color: rgba(0, 0, 0, 0.75);
165
+ background-image: var(--background-image);
166
+ background-size: cover;
167
+ background-blend-mode: multiply;
168
+ }
169
+
170
+ .short-videos-player {
171
+ display: flex;
172
+ flex: 1;
173
+ padding: 0.625rem 0;
174
+ backdrop-filter: blur(30px);
175
+ position: relative;
176
+ /* Set 'container-type: inline-size;' to reference container*/
177
+ }
178
+ @container (width < 576px) {
179
+ .short-videos-player {
180
+ padding: 0;
181
+ }
182
+ }
183
+ .short-videos-player__watermark {
184
+ position: absolute;
185
+ bottom: 5rem;
186
+ left: 5rem;
187
+ }
188
+ .short-videos-player__content {
189
+ width: 100%;
190
+ height: 100%;
191
+ --short-video-viewer--actions-panel--bottom: 5rem;
192
+ /* Set 'container-type: inline-size;' to reference container*/
193
+ }
194
+ @container (width < 576px) {
195
+ .short-videos-player__content {
196
+ --short-video-viewer--actions-panel--top: 5rem;
197
+ }
198
+ }</style>
@@ -0,0 +1,14 @@
1
+ import type { Locale } from '../../core/locale';
2
+ import { type IShortVideosPlayerLocalization } from './short-videos-player-localization';
3
+ import type { PlayerInput } from './types';
4
+ type Props = {
5
+ input: PlayerInput;
6
+ localization?: IShortVideosPlayerLocalization | Locale;
7
+ showStreamsCloudWatermark?: boolean;
8
+ on?: {
9
+ closePlayer?: () => void;
10
+ };
11
+ };
12
+ declare const ShortVideosPlayerView: import("svelte").Component<Props, {}, "">;
13
+ type ShortVideosPlayerView = ReturnType<typeof ShortVideosPlayerView>;
14
+ export default ShortVideosPlayerView;
@@ -17,6 +17,7 @@ export type OpenShortVideosPlayerInit = ProviderInit | IdsInit;
17
17
  type ProviderInit = {
18
18
  shortVideosProvider: PlayerItemsProvider<ShortVideoViewerModel>;
19
19
  localization?: IShortVideosPlayerLocalization | 'en' | 'no';
20
+ showStreamsCloudWatermark?: boolean;
20
21
  on?: {
21
22
  playerClosed?: () => void;
22
23
  };
@@ -27,6 +28,7 @@ type IdsInit = {
27
28
  initialId?: string;
28
29
  localization?: IShortVideosPlayerLocalization | 'en' | 'no';
29
30
  initiator?: string;
31
+ showStreamsCloudWatermark?: boolean;
30
32
  on?: {
31
33
  playerClosed?: () => void;
32
34
  };
@@ -1,10 +1,10 @@
1
1
  export declare class ShortVideosPlayerUiManager {
2
- detailsCollapsed: boolean;
2
+ showAttachments: boolean;
3
3
  globalCssVariables: string;
4
4
  isMobileView: boolean;
5
5
  showShortVideoOverlay: boolean;
6
- private readonly actionButtonSize;
7
- private readonly navigationButtonSize;
6
+ private readonly buttonSize;
7
+ private readonly iconSize;
8
8
  private readonly controlsOffsetHorizontal;
9
9
  private readonly controlsOffsetVertical;
10
10
  private viewTotalWidth;
@@ -1,9 +1,9 @@
1
1
  export class ShortVideosPlayerUiManager {
2
- detailsCollapsed = $state(true);
2
+ showAttachments = $state(true);
3
3
  globalCssVariables = $derived.by(() => {
4
4
  const values = [
5
- `--short-videos-player--action-button--size: ${this.actionButtonSize}px`,
6
- `--short-videos-player--navigation-button--size: ${this.navigationButtonSize}px`,
5
+ `--short-videos-player--button--size: ${this.buttonSize}px`,
6
+ `--short-videos-player--icon--size: ${this.iconSize}px`,
7
7
  `--short-videos-player--controls--offset-horizontal: ${this.controlsOffsetHorizontal}px`,
8
8
  `--short-videos-player--controls--offset-vertical: ${this.controlsOffsetVertical}px`,
9
9
  `--short-videos-player--sidebar--available-space: ${(this.viewTotalWidth - this.mainViewColumnWidth) / 2}px`
@@ -11,11 +11,11 @@ export class ShortVideosPlayerUiManager {
11
11
  return values.join(';');
12
12
  });
13
13
  isMobileView = $derived.by(() => this.viewTotalWidth <= 576);
14
- showShortVideoOverlay = $derived.by(() => (this.viewTotalWidth - this.mainViewColumnWidth) / 2 <= 70);
15
- actionButtonSize = 30;
16
- navigationButtonSize = 40;
17
- controlsOffsetHorizontal = 15;
18
- controlsOffsetVertical = 10;
14
+ showShortVideoOverlay = $derived.by(() => (this.viewTotalWidth - this.mainViewColumnWidth) / 2 <= 85);
15
+ buttonSize = 48;
16
+ iconSize = 28;
17
+ controlsOffsetHorizontal = 28;
18
+ controlsOffsetVertical = 28;
19
19
  viewTotalWidth = $state(0);
20
20
  mainViewColumnWidth = $state(0);
21
21
  updateDimensions = (dimensions) => {
@@ -22,20 +22,21 @@ const lineHeight = 1.2;
22
22
  const elementHeight = $derived(adjustedHeight);
23
23
  const priceHeight = $derived(model.stock ? elementHeight * 0.68 : elementHeight);
24
24
  const adjustableHeight = $derived(!!(on === null || on === void 0 ? void 0 : on.heightAdjusted));
25
+ const includeCurrency = $derived(model.includeCurrency || false);
25
26
  const currentPrice = $derived.by(() => {
26
27
  if (data.salePrice) {
27
- return toPriceRepresentation(data.salePrice, data.currency, model.includeCurrency || false);
28
+ return toPriceRepresentation({ amount: data.salePrice, currency: data.currency, includeCurrency });
28
29
  }
29
- return toPriceRepresentation(data.price, data.currency, model.includeCurrency || false);
30
+ return toPriceRepresentation({ amount: data.price, currency: data.currency, includeCurrency });
30
31
  });
31
32
  const saveValue = $derived.by(() => {
32
33
  if (data.salePrice) {
33
- return toPriceRepresentation(data.price - data.salePrice, data.currency, model.includeCurrency || false);
34
+ return toPriceRepresentation({ amount: data.price - data.salePrice, currency: data.currency, includeCurrency });
34
35
  }
35
36
  return 0;
36
37
  });
37
38
  const beforeValue = $derived.by(() => {
38
- return toPriceRepresentation(data.price, data.currency, model.includeCurrency || false);
39
+ return toPriceRepresentation({ amount: data.price, currency: data.currency, includeCurrency });
39
40
  });
40
41
  const elementContainerStyles = $derived.by(() => {
41
42
  var _a, _b;
@@ -16,26 +16,16 @@ export const mapToShortVideoViewerModel = (model) => {
16
16
  displayDate: model.header.postDisplayDate,
17
17
  viewsCount: model.header.postViewsCount
18
18
  },
19
+ enableSocialInteractions: model.enableSocialInteractions,
19
20
  ad: model.ad ? mapToAdViewModel(model.ad) : null,
20
21
  products: model.products.map(mapToProductCardModel)
21
22
  // uncomment if you want to test many products behavior
22
- /*.flatMap((x) => [
23
- { ...x, id: x.id + '1' },
24
- { ...x, id: x.id + '2' },
25
- { ...x, id: x.id + '3' },
26
- { ...x, id: x.id + '4' },
27
- { ...x, id: x.id + '5' },
28
- { ...x, id: x.id + '6' },
29
- { ...x, id: x.id + '7' },
30
- { ...x, id: x.id + '8' },
31
- { ...x, id: x.id + '9' },
32
- { ...x, id: x.id + '10' },
33
- { ...x, id: x.id + '11' },
34
- { ...x, id: x.id + '12' },
35
- { ...x, id: x.id + '13' },
36
- { ...x, id: x.id + '14' },
37
- { ...x, id: x.id + '15' }
38
- ])*/
23
+ // .flatMap(x =>
24
+ // Array.from({ length: 20 }, (_, i) => ({
25
+ // ...x,
26
+ // id: x.id + String(i + 1)
27
+ // }))
28
+ // )
39
29
  };
40
30
  };
41
31
  const mapToAdViewModel = (model) => {
@@ -56,6 +46,7 @@ const mapToProductCardModel = (model) => {
56
46
  title: model.title,
57
47
  image: model.image,
58
48
  link: model.link,
49
+ brandName: null,
59
50
  currency: model.currency,
60
51
  price: model.price,
61
52
  salePrice: model.salePrice,
@@ -27,7 +27,7 @@ import { StreamPlayerLocalization } from './stream-player-localization';
27
27
  import { StreamPlayerUiManager } from './ui-manager.svelte';
28
28
  import { AppEventsTracker } from '@streamscloud/streams-analytics-collector';
29
29
  import { onMount } from 'svelte';
30
- let { streamId, graphqlOrigin, localization: localizationInit, showStreamsCloudWatermark, initiator, on } = $props();
30
+ let { streamId, graphqlOrigin, localization: localizationInit = 'en', showStreamsCloudWatermark, initiator, on } = $props();
31
31
  const localization = $derived(new StreamPlayerLocalization(localizationInit));
32
32
  let model = $state(null);
33
33
  let buffer = $state.raw(null);
@@ -124,6 +124,9 @@ const handleDimensionsChanged = (dimensions) => {
124
124
  viewTotalWidth: dimensions.totalWidth
125
125
  });
126
126
  };
127
+ const handleOverviewWidthChanged = (width) => {
128
+ uiManager.updateOverviewWidth(width);
129
+ };
127
130
  const contentMounted = (node) => {
128
131
  const markAsTouched = () => {
129
132
  everTouched = true;
@@ -171,7 +174,7 @@ const onProgress = (pageId, videoId, progress) => {
171
174
 
172
175
  <svelte:document onkeydown={(e) => handleEsc(e, onPlayerClose)} />
173
176
 
174
- <div class="stream-player-container" style="--background-image: url({background})">
177
+ <div class="stream-player-container" style={background ? `--background-image: url(${background})` : null}>
175
178
  {#if loading}
176
179
  <Loading positionAbsoluteCenter={true} timeout={600} />
177
180
  {/if}
@@ -209,7 +212,8 @@ const onProgress = (pageId, videoId, progress) => {
209
212
  }}
210
213
  autoplay="on-appearance"
211
214
  localization={localization.shortVideoViewerLocalization}
212
- showAttachments={uiManager.showShortVideoOverlay} />
215
+ showAttachments={uiManager.showShortVideoOverlay}
216
+ showControls={uiManager.showShortVideoOverlay} />
213
217
  {/if}
214
218
  {/snippet}
215
219
  </PlayerSlider>
@@ -225,7 +229,10 @@ const onProgress = (pageId, videoId, progress) => {
225
229
  activePageId={activePageId}
226
230
  uiManager={uiManager}
227
231
  localization={localization}
228
- on={{ setCurrentItem: handleChangePage }} />
232
+ on={{
233
+ setCurrentItem: handleChangePage,
234
+ widthChanged: handleOverviewWidthChanged
235
+ }} />
229
236
  {/if}
230
237
  <Controls
231
238
  buffer={buffer}
@@ -282,10 +289,16 @@ const onProgress = (pageId, videoId, progress) => {
282
289
  .stream-player__watermark {
283
290
  position: absolute;
284
291
  bottom: 5rem;
285
- left: 20rem;
292
+ left: calc(var(--stream-player--overview--width) + 5rem);
286
293
  }
287
294
  .stream-player__content {
288
295
  width: 100%;
289
296
  height: 100%;
290
297
  --short-video-viewer--actions-panel--bottom: 5rem;
298
+ /* Set 'container-type: inline-size;' to reference container*/
299
+ }
300
+ @container (width < 576px) {
301
+ .stream-player__content {
302
+ --short-video-viewer--actions-panel--top: 5rem;
303
+ }
291
304
  }</style>
@@ -2,7 +2,7 @@ import type { Locale } from '../../core/locale';
2
2
  import { type IStreamPlayerLocalization } from './stream-player-localization';
3
3
  type Props = {
4
4
  streamId: string;
5
- localization: IStreamPlayerLocalization | Locale;
5
+ localization?: IStreamPlayerLocalization | Locale;
6
6
  graphqlOrigin?: string;
7
7
  showStreamsCloudWatermark?: boolean;
8
8
  initiator?: string;
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">var _a, _b;
2
+ import { slideHorizontally } from '../../core/transitions';
2
3
  import { ShortVideoViewerAttachmentsInline, ShortVideoViewerAttachments } from '../../short-videos/short-video-viewer';
3
- import { ShortVideoSocialInteractions } from '../../short-videos/short-video-viewer/index.js';
4
+ import { ShortVideoControls } from '../../short-videos/short-video-viewer/index.js';
4
5
  import { StreamElementType } from '../layout/enums';
5
6
  import { mapToShortVideoViewerModel } from '../layout/models';
6
7
  import { Icon } from '../../ui/icon';
@@ -45,42 +46,44 @@ const changeShowShortVideoAttachments = () => {
45
46
  };
46
47
  </script>
47
48
 
48
- <div class="stream-player-controls">
49
- <div class="stream-player-controls__left">
50
- {#if shortVideo && uiManager.shortVideoDetailsCollapsed && !uiManager.showShortVideoOverlay}
51
- <div class="stream-player-controls__short-video-overlay">
52
- {#if uiManager.showShortVideoAttachments}
53
- <div class="stream-player-controls__short-video-attachments-inline">
54
- <ShortVideoViewerAttachmentsInline model={shortVideo} />
55
- </div>
56
- {/if}
57
- <ShortVideoSocialInteractions model={shortVideo} on={{ attachmentsClicked: changeShowShortVideoAttachments }} />
49
+ {#if !uiManager.showShortVideoOverlay}
50
+ <div class="stream-player-controls">
51
+ <div class="stream-player-controls__left">
52
+ {#if shortVideo}
53
+ <div class="stream-player-controls__short-video-hub">
54
+ {#if uiManager.showShortVideoAttachments}
55
+ <div class="stream-player-controls__short-video-attachments-inline">
56
+ <ShortVideoViewerAttachmentsInline model={shortVideo} />
57
+ </div>
58
+ {/if}
59
+ <ShortVideoControls model={shortVideo} on={{ attachmentsClicked: changeShowShortVideoAttachments }} />
60
+ </div>
61
+ {/if}
62
+ <div class="stream-player-controls__navigation-buttons" class:stream-player-controls__navigation-buttons--single-web-view-page={singleWebViewPage}>
63
+ <button type="button" class="navigation-button" disabled={!buffer.canLoadPrevious} onclick={buffer.loadPrevious}>
64
+ <Icon src={IconChevronUp} />
65
+ </button>
66
+ <button type="button" class="navigation-button" disabled={!buffer.canLoadNext} onclick={buffer.loadNext}>
67
+ <Icon src={IconChevronDown} />
68
+ </button>
58
69
  </div>
59
- {/if}
60
- <div class="stream-player-controls__navigation-buttons" class:stream-player-controls__navigation-buttons--single-web-view-page={singleWebViewPage}>
61
- <button type="button" class="navigation-button" disabled={!buffer.canLoadPrevious} onclick={buffer.loadPrevious}>
62
- <Icon src={IconChevronUp} />
63
- </button>
64
- <button type="button" class="navigation-button" disabled={!buffer.canLoadNext} onclick={buffer.loadNext}>
65
- <Icon src={IconChevronDown} />
66
- </button>
70
+ </div>
71
+ <div class="stream-player-controls__right">
72
+ {#if shortVideo && uiManager.showShortVideoAttachments}
73
+ <div class="stream-player-controls__short-video-attachments" transition:slideHorizontally|local>
74
+ <ShortVideoViewerAttachments
75
+ shortVideo={shortVideo}
76
+ localization={localization.shortVideoAttachmentsLocalization}
77
+ on={{
78
+ productClick: on.productClick
79
+ }} />
80
+ </div>
81
+ {/if}
67
82
  </div>
68
83
  </div>
69
- <div class="stream-player-controls__right">
70
- {#if shortVideo && shortVideo.products && uiManager.showShortVideoAttachments}
71
- <div class="stream-player-controls__short-video-attachments">
72
- <ShortVideoViewerAttachments
73
- shortVideo={shortVideo}
74
- localization={localization.shortVideoAttachmentsLocalization}
75
- on={{
76
- productClick: on.productClick
77
- }} />
78
- </div>
79
- {/if}
80
- </div>
81
- </div>
84
+ {/if}
82
85
 
83
- <button type="button" class="close-button" onclick={on.closePlayer} class:close-button--left={uiManager.overviewCollapsed}>
86
+ <button type="button" class="close-button" onclick={on.closePlayer}>
84
87
  <Icon src={IconDismiss} />
85
88
  </button>
86
89
 
@@ -95,34 +98,6 @@ const changeShowShortVideoAttachments = () => {
95
98
  opacity: 1;
96
99
  }
97
100
  }
98
- .close-button {
99
- position: absolute;
100
- top: 0.9375rem;
101
- left: 15.1875rem;
102
- z-index: 1;
103
- width: var(--stream-player--button--size);
104
- min-width: var(--stream-player--button--size);
105
- max-width: var(--stream-player--button--size);
106
- height: var(--stream-player--button--size);
107
- min-height: var(--stream-player--button--size);
108
- max-height: var(--stream-player--button--size);
109
- background-color: rgba(0, 0, 0, 0.6);
110
- border: 0.0625rem solid #1c1c1e;
111
- border-radius: 50%;
112
- text-align: center;
113
- --icon--color: #ffffff;
114
- /* Set 'container-type: inline-size;' to reference container*/
115
- }
116
- .close-button--left {
117
- left: 0.625rem;
118
- }
119
- @container (width < 576px) {
120
- .close-button {
121
- left: unset;
122
- right: 0.625rem;
123
- }
124
- }
125
-
126
101
  .stream-player-controls {
127
102
  position: absolute;
128
103
  top: 0;
@@ -131,7 +106,6 @@ const changeShowShortVideoAttachments = () => {
131
106
  width: var(--stream-player--sidebar--available-space);
132
107
  display: flex;
133
108
  justify-content: space-between;
134
- gap: 2.5rem;
135
109
  padding: var(--stream-player--controls--offset-vertical) var(--stream-player--controls--offset-horizontal);
136
110
  container-type: inline-size;
137
111
  }
@@ -148,14 +122,8 @@ const changeShowShortVideoAttachments = () => {
148
122
  justify-content: space-between;
149
123
  align-items: flex-end;
150
124
  flex-direction: column;
151
- /* Set 'container-type: inline-size;' to reference container*/
152
- }
153
- @container (width < 9.375rem) {
154
- .stream-player-controls__right {
155
- display: none;
156
- }
157
125
  }
158
- .stream-player-controls__short-video-overlay {
126
+ .stream-player-controls__short-video-hub {
159
127
  gap: 2.5rem;
160
128
  display: flex;
161
129
  flex: 1;
@@ -163,6 +131,7 @@ const changeShowShortVideoAttachments = () => {
163
131
  flex-direction: column;
164
132
  align-items: flex-start;
165
133
  justify-content: flex-end;
134
+ --short-video-controls--icon--size: var(--stream-player--icon--size);
166
135
  }
167
136
  .stream-player-controls__short-video-attachments-inline {
168
137
  display: none;
@@ -215,11 +184,35 @@ const changeShowShortVideoAttachments = () => {
215
184
  flex-direction: column;
216
185
  gap: 1rem;
217
186
  z-index: 1;
187
+ }
188
+
189
+ .close-button {
190
+ width: var(--stream-player--button--size);
191
+ min-width: var(--stream-player--button--size);
192
+ max-width: var(--stream-player--button--size);
193
+ height: var(--stream-player--button--size);
194
+ min-height: var(--stream-player--button--size);
195
+ max-height: var(--stream-player--button--size);
196
+ background-color: rgba(0, 0, 0, 0.6);
197
+ border: 0.0625rem solid #1c1c1c;
198
+ border-radius: 50%;
199
+ text-align: center;
200
+ --icon--color: #ffffff;
201
+ --icon--size: var(--stream-player--icon--size);
202
+ position: absolute;
203
+ top: 0.9375rem;
204
+ left: calc(var(--stream-player--overview--width) + 0.625rem);
205
+ z-index: 1;
218
206
  /* Set 'container-type: inline-size;' to reference container*/
219
207
  }
220
- @container (width < 6.25rem) {
221
- .stream-player-controls__navigation-buttons {
222
- visibility: hidden;
208
+ .close-button:disabled {
209
+ opacity: 0.5;
210
+ cursor: default;
211
+ }
212
+ @container (width < 576px) {
213
+ .close-button {
214
+ left: unset;
215
+ right: 0.625rem;
223
216
  }
224
217
  }
225
218
 
@@ -231,7 +224,7 @@ const changeShowShortVideoAttachments = () => {
231
224
  min-height: var(--stream-player--button--size);
232
225
  max-height: var(--stream-player--button--size);
233
226
  background-color: rgba(0, 0, 0, 0.6);
234
- border: 0.0625rem solid #1c1c1e;
227
+ border: 0.0625rem solid #1c1c1c;
235
228
  border-radius: 50%;
236
229
  text-align: center;
237
230
  --icon--color: #ffffff;
@@ -1,5 +1,5 @@
1
1
  import { getLocale } from '../../core/locale';
2
- import { ShadowHost } from '../../ui/shadow-dom';
2
+ import { ModalShadowHost } from '../../ui/shadow-dom';
3
3
  import { default as StreamPlayer } from './cmp.stream-player.svelte';
4
4
  import { AppEventsTracker } from '@streamscloud/streams-analytics-collector';
5
5
  import { mount, unmount } from 'svelte';
@@ -28,7 +28,7 @@ import { mount, unmount } from 'svelte';
28
28
  */
29
29
  export const openStreamPlayer = (init) => {
30
30
  const { streamId, graphqlOrigin, localization, showStreamsCloudWatermark, initiator } = init;
31
- const shadowHost = new ShadowHost();
31
+ const shadowHost = new ModalShadowHost();
32
32
  const mounted = mount(StreamPlayer, {
33
33
  target: shadowHost.shadowRoot,
34
34
  props: {
@@ -8,10 +8,21 @@ import { TimeAgo } from '../../ui/time-ago';
8
8
  import { StreamPlayerLocalization } from './stream-player-localization';
9
9
  import IconPanelLeftText from '@fluentui/svg-icons/icons/panel_left_text_20_regular.svg?raw';
10
10
  let { model, buffer, activePageId, on, uiManager, localization } = $props();
11
+ const overviewAttached = (node) => {
12
+ const resizeObserver = new ResizeObserver(() => {
13
+ on.widthChanged(node.clientWidth);
14
+ });
15
+ resizeObserver.observe(node);
16
+ return {
17
+ destroy() {
18
+ resizeObserver.disconnect();
19
+ }
20
+ };
21
+ };
11
22
  </script>
12
23
 
13
24
  {#if !uiManager.overviewCollapsed}
14
- <div class="stream-overview" transition:slideHorizontally|local>
25
+ <div class="stream-overview" transition:slideHorizontally|local use:overviewAttached>
15
26
  <div class="stream-overview-info">
16
27
  <div class="stream-overview-owner">
17
28
  <div class="stream-overview-owner__image">
@@ -10,6 +10,7 @@ type Props = {
10
10
  localization: StreamPlayerLocalization;
11
11
  on: {
12
12
  setCurrentItem: (index: number) => void;
13
+ widthChanged: (width: number) => void;
13
14
  };
14
15
  };
15
16
  declare const StreamOverview: import("svelte").Component<Props, {}, "">;