@streamscloud/embeddable 3.4.2 → 5.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 (112) hide show
  1. package/dist/ads/ad-card/cmp.ad-card.svelte +220 -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 +14 -0
  7. package/dist/ads/ad-card/operations.generated.d.ts +24 -0
  8. package/dist/ads/ad-card/operations.generated.js +48 -0
  9. package/dist/ads/ad-card/operations.graphql +21 -0
  10. package/dist/ads/ad-card/types.d.ts +18 -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 +219 -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 +145 -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 +46 -20
  33. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +4 -2
  34. package/dist/short-videos/short-video-viewer/index.d.ts +3 -7
  35. package/dist/short-videos/short-video-viewer/index.js +2 -5
  36. package/dist/short-videos/short-video-viewer/mapper.d.ts +1 -1
  37. package/dist/short-videos/short-video-viewer/mapper.js +25 -22
  38. package/dist/short-videos/short-video-viewer/operations.generated.d.ts +6 -8
  39. package/dist/short-videos/short-video-viewer/operations.generated.js +10 -17
  40. package/dist/short-videos/short-video-viewer/operations.graphql +8 -10
  41. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.d.ts +3 -7
  42. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.js +0 -14
  43. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.d.ts +3 -3
  44. package/dist/short-videos/short-video-viewer/types.d.ts +23 -13
  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 +15 -2
  47. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +25 -163
  48. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +7 -2
  49. package/dist/short-videos/short-videos-player/controls.svelte +125 -125
  50. package/dist/short-videos/short-videos-player/controls.svelte.d.ts +4 -2
  51. package/dist/short-videos/short-videos-player/index.d.ts +2 -0
  52. package/dist/short-videos/short-videos-player/index.js +12 -3
  53. package/dist/short-videos/short-videos-player/operations.generated.d.ts +6 -8
  54. package/dist/short-videos/short-videos-player/operations.generated.js +10 -17
  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 +211 -0
  58. package/dist/short-videos/short-videos-player/short-videos-player-view.svelte.d.ts +18 -0
  59. package/dist/short-videos/short-videos-player/types.d.ts +10 -8
  60. package/dist/short-videos/short-videos-player/ui-manager.svelte.d.ts +4 -3
  61. package/dist/short-videos/short-videos-player/ui-manager.svelte.js +9 -8
  62. package/dist/streams/layout/element-views/price-element-view.svelte +5 -4
  63. package/dist/streams/layout/models/mapper.js +10 -18
  64. package/dist/streams/layout/models/stream-layout-short-video-model.d.ts +1 -0
  65. package/dist/streams/stream-player/cmp.stream-player.svelte +23 -8
  66. package/dist/streams/stream-player/cmp.stream-player.svelte.d.ts +3 -1
  67. package/dist/streams/stream-player/controls.svelte +87 -74
  68. package/dist/streams/stream-player/controls.svelte.d.ts +2 -0
  69. package/dist/streams/stream-player/index.d.ts +2 -0
  70. package/dist/streams/stream-player/index.js +4 -3
  71. package/dist/streams/stream-player/mapper.d.ts +1 -1
  72. package/dist/streams/stream-player/mapper.js +1 -1
  73. package/dist/streams/stream-player/stream-overview.svelte +12 -1
  74. package/dist/streams/stream-player/stream-overview.svelte.d.ts +1 -0
  75. package/dist/streams/stream-player/stream-player-localization.d.ts +1 -3
  76. package/dist/streams/stream-player/stream-player-localization.js +0 -2
  77. package/dist/streams/stream-player/ui-manager.svelte.d.ts +4 -2
  78. package/dist/streams/stream-player/ui-manager.svelte.js +10 -5
  79. package/dist/ui/button/resources/button-theme.svelte +1 -0
  80. package/dist/ui/line-clamp/cmp.line-clamp.svelte +35 -13
  81. package/dist/ui/player/cmp.player-slider.svelte +74 -9
  82. package/dist/ui/progress/cmp.progress.svelte +4 -1
  83. package/dist/ui/seek-bar/cmp.seek-bar.svelte +112 -28
  84. package/dist/ui/seek-bar/cmp.seek-bar.svelte.d.ts +3 -0
  85. package/dist/ui/shadow-dom/index.d.ts +2 -1
  86. package/dist/ui/shadow-dom/index.js +2 -1
  87. package/dist/ui/shadow-dom/{shadow-host.d.ts → modal-shadow-host.d.ts} +1 -1
  88. package/dist/ui/shadow-dom/modal-shadow-host.js +21 -0
  89. package/dist/ui/shadow-dom/shadow-root-service.d.ts +1 -0
  90. package/dist/ui/shadow-dom/shadow-root-service.js +23 -0
  91. package/dist/ui/video/cmp.video.svelte +46 -38
  92. package/dist/ui/video/cmp.video.svelte.d.ts +3 -0
  93. package/dist/ui/video/index.d.ts +1 -0
  94. package/dist/ui/video/index.js +1 -0
  95. package/dist/ui/video/types.d.ts +4 -0
  96. package/dist/ui/video/types.js +5 -0
  97. package/package.json +5 -1
  98. package/dist/short-videos/short-video-viewer/cmp.ad.svelte +0 -140
  99. package/dist/short-videos/short-video-viewer/cmp.product.svelte +0 -168
  100. package/dist/short-videos/short-video-viewer/cmp.product.svelte.d.ts +0 -14
  101. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte +0 -125
  102. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte.d.ts +0 -14
  103. package/dist/short-videos/short-video-viewer/cmp.social-interactions.svelte +0 -69
  104. package/dist/short-videos/short-video-viewer/cmp.social-interactions.svelte.d.ts +0 -10
  105. package/dist/short-videos/short-video-viewer/description.svelte +0 -53
  106. package/dist/short-videos/short-video-viewer/description.svelte.d.ts +0 -9
  107. package/dist/short-videos/short-video-viewer/short-video-details-localization.d.ts +0 -14
  108. package/dist/short-videos/short-video-viewer/short-video-details-localization.js +0 -17
  109. package/dist/short-videos/short-video-viewer/short-video-product-localization.d.ts +0 -8
  110. package/dist/short-videos/short-videos-player/action-button.svelte +0 -38
  111. package/dist/short-videos/short-videos-player/action-button.svelte.d.ts +0 -10
  112. package/dist/ui/shadow-dom/shadow-host.js +0 -32
@@ -0,0 +1,211 @@
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 { mapToShortVideoViewerModel, 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, socialInteractionsHandler, localization: localizationInit = 'en', showStreamsCloudWatermark, disableBackground, 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(mapToShortVideoViewerModel),
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
+ var _a;
73
+ const shortVideo = buffer === null || buffer === void 0 ? void 0 : buffer.loaded.find((x) => x.id === id);
74
+ if (!shortVideo) {
75
+ return;
76
+ }
77
+ background = shortVideo.media.isImage ? shortVideo.media.url : shortVideo.media.thumbnailUrl;
78
+ (_a = on === null || on === void 0 ? void 0 : on.videoActivated) === null || _a === void 0 ? void 0 : _a.call(on, id);
79
+ };
80
+ const contentMounted = (node) => {
81
+ const markAsTouched = () => {
82
+ everTouched = true;
83
+ node.removeEventListener('touchstart', markAsTouched);
84
+ node.removeEventListener('wheel', markAsTouched);
85
+ node.removeEventListener('click', markAsTouched);
86
+ node.removeEventListener('keypress', markAsTouched);
87
+ };
88
+ node.addEventListener('touchstart', markAsTouched);
89
+ node.addEventListener('wheel', markAsTouched);
90
+ node.addEventListener('click', markAsTouched);
91
+ node.addEventListener('keypress', markAsTouched);
92
+ };
93
+ const handleDimensionsChanged = (dimensions) => {
94
+ uiManager.updateDimensions({
95
+ mainViewColumnWidth: dimensions.mainSceneWidth,
96
+ viewTotalWidth: dimensions.totalWidth
97
+ });
98
+ };
99
+ const onPlayerClose = () => {
100
+ var _a;
101
+ (_a = on === null || on === void 0 ? void 0 : on.closePlayer) === null || _a === void 0 ? void 0 : _a.call(on);
102
+ };
103
+ </script>
104
+
105
+ <svelte:document onkeydown={(e) => handleEsc(e, onPlayerClose)} />
106
+
107
+ <div
108
+ class="short-videos-player-container"
109
+ class:short-videos-player-container--background-enabled={!disableBackground}
110
+ style={background && !disableBackground ? `--background-image: url(${background})` : null}>
111
+ <div class="short-videos-player" style={uiManager.globalCssVariables}>
112
+ {#if showStreamsCloudWatermark}
113
+ <div class="short-videos-player__watermark">
114
+ <a href="https://streamscloud.com/" tabindex="-1" aria-label="none">
115
+ <img src="https://embedabble-assets.streamscloud-cdn.com/watermark.svg" alt="StreamsCloud" />
116
+ </a>
117
+ </div>
118
+ {/if}
119
+ {#if buffer}
120
+ <SpotlightLayout ratio={9 / 16} on={{ dimensionsChanged: handleDimensionsChanged }}>
121
+ <div class="short-videos-player__content" use:contentMounted>
122
+ <PlayerSlider
123
+ buffer={buffer}
124
+ on={{
125
+ itemActivated: onItemActivated
126
+ }}>
127
+ {#snippet children({ item })}
128
+ <ShortVideoViewer
129
+ model={item}
130
+ socialInteractionsHandler={socialInteractionsHandler}
131
+ autoplay="on-appearance"
132
+ showAttachments={uiManager.showShortVideoOverlay}
133
+ showControls={uiManager.showShortVideoOverlay}
134
+ localization={localization.shortVideoViewerLocalization} />
135
+ {/snippet}
136
+ </PlayerSlider>
137
+ {#if uiManager.isMobileView && buffer.loaded.length > 1 && !everTouched}
138
+ <SwipeIndicator localization={localization.swipeIndicatorLocalization} />
139
+ {/if}
140
+ </div>
141
+ </SpotlightLayout>
142
+ <Controls
143
+ buffer={buffer}
144
+ uiManager={uiManager}
145
+ localization={localization}
146
+ socialInteractionsHandler={socialInteractionsHandler}
147
+ on={{ closePlayer: on?.closePlayer }} />
148
+ {:else}
149
+ <Loading positionFixedCenter={true} timeout={1000} />
150
+ {/if}
151
+ </div>
152
+ </div>
153
+
154
+ <style>@keyframes fadeIn {
155
+ 0% {
156
+ opacity: 1;
157
+ }
158
+ 50% {
159
+ opacity: 0.4;
160
+ }
161
+ 100% {
162
+ opacity: 1;
163
+ }
164
+ }
165
+ .short-videos-player-container {
166
+ width: 100%;
167
+ min-width: 100%;
168
+ max-width: 100%;
169
+ height: 100%;
170
+ min-height: 100%;
171
+ max-height: 100%;
172
+ container-type: inline-size;
173
+ display: flex;
174
+ position: relative;
175
+ }
176
+ .short-videos-player-container--background-enabled {
177
+ background-color: #c1c1c1;
178
+ background-image: var(--background-image);
179
+ background-size: cover;
180
+ background-blend-mode: multiply;
181
+ }
182
+
183
+ .short-videos-player {
184
+ display: flex;
185
+ flex: 1;
186
+ padding: 0.625rem 0;
187
+ backdrop-filter: blur(30px);
188
+ position: relative;
189
+ /* Set 'container-type: inline-size;' to reference container*/
190
+ }
191
+ @container (width < 576px) {
192
+ .short-videos-player {
193
+ padding: 0;
194
+ }
195
+ }
196
+ .short-videos-player__watermark {
197
+ position: absolute;
198
+ bottom: 5rem;
199
+ left: 5rem;
200
+ }
201
+ .short-videos-player__content {
202
+ width: 100%;
203
+ height: 100%;
204
+ --short-video-viewer--actions-panel--bottom: 5rem;
205
+ /* Set 'container-type: inline-size;' to reference container*/
206
+ }
207
+ @container (width < 576px) {
208
+ .short-videos-player__content {
209
+ --short-video-viewer--actions-panel--top: 5rem;
210
+ }
211
+ }</style>
@@ -0,0 +1,18 @@
1
+ import type { Locale } from '../../core/locale';
2
+ import { type ShortVideoSocialInteractionsHanlder } 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?: ShortVideoSocialInteractionsHanlder;
8
+ localization?: IShortVideosPlayerLocalization | Locale;
9
+ showStreamsCloudWatermark?: boolean;
10
+ disableBackground?: boolean;
11
+ on?: {
12
+ closePlayer?: () => void;
13
+ videoActivated?: (id: string) => void;
14
+ };
15
+ };
16
+ declare const ShortVideosPlayerView: import("svelte").Component<Props, {}, "">;
17
+ type ShortVideosPlayerView = ReturnType<typeof ShortVideosPlayerView>;
18
+ export default ShortVideosPlayerView;
@@ -1,4 +1,4 @@
1
- import type { ShortVideoViewerModel } from '../..';
1
+ import type { ShortVideoViewerModel, ShortVideoSocialInteractionsHanlder } from '../short-video-viewer';
2
2
  import type { PlayerItemsProvider } from '../../ui/player';
3
3
  import type { IShortVideosPlayerLocalization } from './short-videos-player-localization';
4
4
  export type PlayerInput = ProviderPlayerInput | IdsPlayerInput;
@@ -14,21 +14,23 @@ export type IdsPlayerInput = {
14
14
  initiator?: string;
15
15
  };
16
16
  export type OpenShortVideosPlayerInit = ProviderInit | IdsInit;
17
- type ProviderInit = {
17
+ type ProviderInit = PlayerSettings & {
18
18
  shortVideosProvider: PlayerItemsProvider<ShortVideoViewerModel>;
19
- localization?: IShortVideosPlayerLocalization | 'en' | 'no';
20
- on?: {
21
- playerClosed?: () => void;
22
- };
23
19
  };
24
- type IdsInit = {
20
+ type IdsInit = PlayerSettings & {
25
21
  ids: string[];
26
22
  graphqlOrigin?: string;
27
23
  initialId?: string;
28
- localization?: IShortVideosPlayerLocalization | 'en' | 'no';
29
24
  initiator?: string;
25
+ };
26
+ type PlayerSettings = {
27
+ socialInteractionsHandler?: ShortVideoSocialInteractionsHanlder;
28
+ disableBackground?: boolean;
29
+ localization?: IShortVideosPlayerLocalization | 'en' | 'no';
30
+ showStreamsCloudWatermark?: boolean;
30
31
  on?: {
31
32
  playerClosed?: () => void;
33
+ videoActivated?: (id: string) => void;
32
34
  };
33
35
  };
34
36
  export declare const isShortVideosProviderInit: (init: unknown) => init is ProviderInit;
@@ -1,10 +1,11 @@
1
1
  export declare class ShortVideosPlayerUiManager {
2
- detailsCollapsed: boolean;
2
+ showAttachments: boolean;
3
3
  globalCssVariables: string;
4
4
  isMobileView: boolean;
5
+ viewInitialized: boolean;
5
6
  showShortVideoOverlay: boolean;
6
- private readonly actionButtonSize;
7
- private readonly navigationButtonSize;
7
+ private readonly buttonSize;
8
+ private readonly iconSize;
8
9
  private readonly controlsOffsetHorizontal;
9
10
  private readonly controlsOffsetVertical;
10
11
  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,12 @@ 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
+ viewInitialized = $derived.by(() => !!this.viewTotalWidth && !!this.mainViewColumnWidth);
15
+ showShortVideoOverlay = $derived.by(() => this.viewInitialized && (this.viewTotalWidth - this.mainViewColumnWidth) / 2 <= 85);
16
+ buttonSize = 48;
17
+ iconSize = 28;
18
+ controlsOffsetHorizontal = 28;
19
+ controlsOffsetVertical = 28;
19
20
  viewTotalWidth = $state(0);
20
21
  mainViewColumnWidth = $state(0);
21
22
  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) => {
@@ -47,7 +37,8 @@ const mapToAdViewModel = (model) => {
47
37
  description: model.description,
48
38
  price: model.price,
49
39
  currency: model.currency,
50
- ctaButton: model.ctaButton
40
+ ctaButton: model.ctaButton,
41
+ priceInfoLabel: model.priceInfo
51
42
  };
52
43
  };
53
44
  const mapToProductCardModel = (model) => {
@@ -56,6 +47,7 @@ const mapToProductCardModel = (model) => {
56
47
  title: model.title,
57
48
  image: model.image,
58
49
  link: model.link,
50
+ brandName: null,
59
51
  currency: model.currency,
60
52
  price: model.price,
61
53
  salePrice: model.salePrice,
@@ -18,6 +18,7 @@ export type StreamLayoutShortVideoAdModel = {
18
18
  title: string;
19
19
  description: string | null;
20
20
  price: number | null;
21
+ priceInfo: string | null;
21
22
  currency: Currency | null;
22
23
  ctaButton: {
23
24
  background: string;
@@ -19,7 +19,7 @@ import { PlayerSlider } from '../../ui/player';
19
19
  import { SpotlightLayout } from '../../ui/spotlight-layout';
20
20
  import { SwipeIndicator } from '../../ui/swipe-indicator';
21
21
  import { default as Controls } from './controls.svelte';
22
- import { mapStreamPlayerModel } from './mapper';
22
+ import { mapToStreamPlayerModel } from './mapper';
23
23
  import { GetStreamDocument } from './operations.generated';
24
24
  import { default as Overview } from './stream-overview.svelte';
25
25
  import { StreamPlayerBuffer } from './stream-player-buffer.svelte';
@@ -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, shortVideoSocialInteractionsHandler, initiator, on } = $props();
31
31
  const localization = $derived(new StreamPlayerLocalization(localizationInit));
32
32
  let model = $state(null);
33
33
  let buffer = $state.raw(null);
@@ -72,7 +72,7 @@ onMount(() => __awaiter(void 0, void 0, void 0, function* () {
72
72
  image: ((_d = streamPayload.data.stream.cover) === null || _d === void 0 ? void 0 : _d.url) || null
73
73
  });
74
74
  // start tracking the stream
75
- model = mapStreamPlayerModel(streamPayload.data.stream);
75
+ model = mapToStreamPlayerModel(streamPayload.data.stream);
76
76
  buffer = new StreamPlayerBuffer({ graphql, streamId });
77
77
  AppEventsTracker.trackStreamView(streamPayload.data.stream.id);
78
78
  startActivityTracking();
@@ -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}
@@ -208,8 +211,10 @@ const onProgress = (pageId, videoId, progress) => {
208
211
  progress: (progress) => onProgress(item.id, item.shortVideo.id, progress)
209
212
  }}
210
213
  autoplay="on-appearance"
214
+ socialInteractionsHandler={shortVideoSocialInteractionsHandler}
211
215
  localization={localization.shortVideoViewerLocalization}
212
- showAttachments={uiManager.showShortVideoOverlay} />
216
+ showAttachments={uiManager.showShortVideoOverlay}
217
+ showControls={uiManager.showShortVideoOverlay} />
213
218
  {/if}
214
219
  {/snippet}
215
220
  </PlayerSlider>
@@ -225,12 +230,16 @@ const onProgress = (pageId, videoId, progress) => {
225
230
  activePageId={activePageId}
226
231
  uiManager={uiManager}
227
232
  localization={localization}
228
- on={{ setCurrentItem: handleChangePage }} />
233
+ on={{
234
+ setCurrentItem: handleChangePage,
235
+ widthChanged: handleOverviewWidthChanged
236
+ }} />
229
237
  {/if}
230
238
  <Controls
231
239
  buffer={buffer}
232
240
  uiManager={uiManager}
233
241
  localization={localization}
242
+ shortVideoSocialInteractionsHandler={shortVideoSocialInteractionsHandler}
234
243
  on={{
235
244
  closePlayer: () => onPlayerClose(),
236
245
  productClick: (productId: String) => onProductCardClick(productId)
@@ -260,7 +269,7 @@ const onProgress = (pageId, videoId, progress) => {
260
269
  container-type: inline-size;
261
270
  display: flex;
262
271
  position: relative;
263
- background-color: rgba(0, 0, 0, 0.75);
272
+ background-color: #c1c1c1;
264
273
  background-image: var(--background-image);
265
274
  background-size: cover;
266
275
  background-blend-mode: multiply;
@@ -282,10 +291,16 @@ const onProgress = (pageId, videoId, progress) => {
282
291
  .stream-player__watermark {
283
292
  position: absolute;
284
293
  bottom: 5rem;
285
- left: 20rem;
294
+ left: calc(var(--stream-player--overview--width) + 5rem);
286
295
  }
287
296
  .stream-player__content {
288
297
  width: 100%;
289
298
  height: 100%;
290
299
  --short-video-viewer--actions-panel--bottom: 5rem;
300
+ /* Set 'container-type: inline-size;' to reference container*/
301
+ }
302
+ @container (width < 576px) {
303
+ .stream-player__content {
304
+ --short-video-viewer--actions-panel--top: 5rem;
305
+ }
291
306
  }</style>
@@ -1,10 +1,12 @@
1
1
  import type { Locale } from '../../core/locale';
2
+ import { type ShortVideoSocialInteractionsHanlder } from '../../short-videos/short-video-viewer';
2
3
  import { type IStreamPlayerLocalization } from './stream-player-localization';
3
4
  type Props = {
4
5
  streamId: string;
5
- localization: IStreamPlayerLocalization | Locale;
6
+ localization?: IStreamPlayerLocalization | Locale;
6
7
  graphqlOrigin?: string;
7
8
  showStreamsCloudWatermark?: boolean;
9
+ shortVideoSocialInteractionsHandler?: ShortVideoSocialInteractionsHanlder;
8
10
  initiator?: string;
9
11
  on?: {
10
12
  closePlayer?: () => void;