@streamscloud/embeddable 7.1.0 → 7.2.0-1759185799768
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.
- package/dist/content-player/cmp.content-player.svelte +83 -46
- package/dist/content-player/controls-and-attachments.svelte +9 -6
- package/dist/content-player/ui-manager.svelte.d.ts +6 -6
- package/dist/content-player/ui-manager.svelte.js +11 -11
- package/dist/media-center/config/internal-media-center-config.js +1 -2
- package/dist/media-center/config/operations.generated.d.ts +2 -5
- package/dist/media-center/config/operations.generated.js +5 -15
- package/dist/media-center/config/operations.graphql +2 -5
- package/dist/media-center/config/types.d.ts +2 -2
- package/dist/media-center/media-center/cmp.media-center.svelte +1 -1
- package/dist/short-videos/short-videos-player/operations.generated.js +4 -4
- package/dist/short-videos/short-videos-player/operations.graphql +1 -1
- package/dist/streams/stream-player/stream-player-view.svelte +11 -14
- package/package.json +1 -1
- package/dist/ui/spotlight-layout/cmp.spotlight-layout.svelte +0 -120
- package/dist/ui/spotlight-layout/cmp.spotlight-layout.svelte.d.ts +0 -18
- package/dist/ui/spotlight-layout/index.d.ts +0 -1
- package/dist/ui/spotlight-layout/index.js +0 -1
|
@@ -12,7 +12,6 @@ import { PostViewer } from '../posts/post-viewer';
|
|
|
12
12
|
import { Icon } from '../ui/icon';
|
|
13
13
|
import { Loading } from '../ui/loading';
|
|
14
14
|
import { PlayerSlider } from '../ui/player-slider';
|
|
15
|
-
import { SpotlightLayout } from '../ui/spotlight-layout';
|
|
16
15
|
import { SwipeIndicator } from '../ui/swipe-indicator';
|
|
17
16
|
import { default as ControlsAndAttachments } from './controls-and-attachments.svelte';
|
|
18
17
|
import { default as OverviewPanel } from './overview-panel.svelte';
|
|
@@ -33,18 +32,15 @@ $effect(() => {
|
|
|
33
32
|
}
|
|
34
33
|
});
|
|
35
34
|
});
|
|
36
|
-
const handleDimensionsChanged = (dimensions) => {
|
|
37
|
-
uiManager.setDialogDimensions({
|
|
38
|
-
mainViewColumnWidth: dimensions.mainSceneWidth,
|
|
39
|
-
viewTotalWidth: dimensions.totalWidth
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
35
|
const handleMediaCenterHeaderMounted = (data) => {
|
|
43
36
|
uiManager.setMediaCenterHeaderHeight(data.height);
|
|
44
37
|
};
|
|
45
|
-
const
|
|
38
|
+
const handleContentPlayerMounted = (node) => {
|
|
46
39
|
const markAsTouched = () => {
|
|
47
40
|
everTouched = true;
|
|
41
|
+
removeListeners();
|
|
42
|
+
};
|
|
43
|
+
const removeListeners = () => {
|
|
48
44
|
node.removeEventListener('touchstart', markAsTouched);
|
|
49
45
|
node.removeEventListener('wheel', markAsTouched);
|
|
50
46
|
node.removeEventListener('click', markAsTouched);
|
|
@@ -54,6 +50,48 @@ const handleContentAreaMounted = (node) => {
|
|
|
54
50
|
node.addEventListener('wheel', markAsTouched);
|
|
55
51
|
node.addEventListener('click', markAsTouched);
|
|
56
52
|
node.addEventListener('keypress', markAsTouched);
|
|
53
|
+
let resizeObserver = new ResizeObserver(() => {
|
|
54
|
+
const { width: playerWidth, height: playerHeight } = node.getBoundingClientRect();
|
|
55
|
+
const parentAspectRatio = playerWidth / playerHeight;
|
|
56
|
+
const ratio = 9 / 16;
|
|
57
|
+
let width;
|
|
58
|
+
let height;
|
|
59
|
+
let margin;
|
|
60
|
+
let contentWidthNumber = playerWidth;
|
|
61
|
+
if (parentAspectRatio > ratio) {
|
|
62
|
+
// container is wider than main content
|
|
63
|
+
contentWidthNumber = playerHeight * ratio;
|
|
64
|
+
width = `${contentWidthNumber}px`;
|
|
65
|
+
height = '100%';
|
|
66
|
+
margin = '0 auto';
|
|
67
|
+
}
|
|
68
|
+
else if (parentAspectRatio < ratio) {
|
|
69
|
+
// main content is wider than container
|
|
70
|
+
width = '100%';
|
|
71
|
+
height = `${playerWidth / ratio}px`;
|
|
72
|
+
margin = 'auto 0';
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
// fallback case
|
|
76
|
+
width = '100%';
|
|
77
|
+
height = '100%';
|
|
78
|
+
margin = '0';
|
|
79
|
+
}
|
|
80
|
+
node.style.setProperty('--_content-player--content--width', width);
|
|
81
|
+
node.style.setProperty('--_content-player--content--height', height);
|
|
82
|
+
node.style.setProperty('--_content-player--content--margin', margin);
|
|
83
|
+
uiManager.setDialogDimensions({
|
|
84
|
+
contentViewWidth: contentWidthNumber,
|
|
85
|
+
playerTotalWidth: node.getBoundingClientRect().width
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
resizeObserver.observe(node);
|
|
89
|
+
return {
|
|
90
|
+
destroy: () => {
|
|
91
|
+
removeListeners();
|
|
92
|
+
resizeObserver.disconnect();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
57
95
|
};
|
|
58
96
|
</script>
|
|
59
97
|
|
|
@@ -73,13 +111,13 @@ const handleContentAreaMounted = (node) => {
|
|
|
73
111
|
{/snippet}
|
|
74
112
|
<div class="content-player-container__media-center">
|
|
75
113
|
{@render config.mediaCenterControlsPanel({
|
|
76
|
-
maxItemsWidth: Math.min(uiManager.
|
|
114
|
+
maxItemsWidth: Math.min(uiManager.contentViewWidth * 1.4, uiManager.playerTotalWidth),
|
|
77
115
|
onMounted: handleMediaCenterHeaderMounted,
|
|
78
116
|
closeButton: config.callbacks?.close && closeButton
|
|
79
117
|
})}
|
|
80
118
|
</div>
|
|
81
119
|
{/if}
|
|
82
|
-
<div class="content-player">
|
|
120
|
+
<div class="content-player" use:handleContentPlayerMounted>
|
|
83
121
|
{#if config.showStreamsCloudWatermark}
|
|
84
122
|
<div class="content-player__watermark">
|
|
85
123
|
<a href="https://streamscloud.com/" tabindex="-1" aria-label="none">
|
|
@@ -88,36 +126,35 @@ const handleContentAreaMounted = (node) => {
|
|
|
88
126
|
</div>
|
|
89
127
|
{/if}
|
|
90
128
|
{#if config.playerBuffer}
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
{
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
</SpotlightLayout>
|
|
129
|
+
<PlayerSlider buffer={config.playerBuffer} on={config.playerSliderCallbacks}>
|
|
130
|
+
{#snippet children({ item })}
|
|
131
|
+
{@const postModel = config.itemAsPostViewerModel(item)}
|
|
132
|
+
<div class="content-player__content">
|
|
133
|
+
{#if postModel}
|
|
134
|
+
<PostViewer
|
|
135
|
+
model={postModel}
|
|
136
|
+
socialInteractionsHandler={config.socialInteractionsHandler}
|
|
137
|
+
showAttachments={config.uiManager.showPostOverlayAttachments}
|
|
138
|
+
showControls={config.uiManager.showPostOverlayControls}
|
|
139
|
+
autoplay="on-appearance"
|
|
140
|
+
locale={config.locale}
|
|
141
|
+
on={{
|
|
142
|
+
progress: (progress) => config.callbacks?.videoProgress?.(item.id, postModel.id, progress),
|
|
143
|
+
productClick: (productId) => config.callbacks?.productClick?.(productId, postModel.id),
|
|
144
|
+
productImpression: (productId) => config.callbacks?.productImpression?.(productId, postModel.id),
|
|
145
|
+
adClick: (adId) => config.callbacks?.adClick?.(adId, postModel.id),
|
|
146
|
+
adImpression: (adId) => config.callbacks?.adImpression?.(adId, postModel.id)
|
|
147
|
+
}} />
|
|
148
|
+
{:else if nonPostItemView}
|
|
149
|
+
{@render nonPostItemView({ item })}
|
|
150
|
+
{/if}
|
|
151
|
+
|
|
152
|
+
{#if uiManager.isMobileView && config.playerBuffer && config.playerBuffer.loaded.length > 1 && !everTouched}
|
|
153
|
+
<SwipeIndicator locale={config.locale} />
|
|
154
|
+
{/if}
|
|
155
|
+
</div>
|
|
156
|
+
{/snippet}
|
|
157
|
+
</PlayerSlider>
|
|
121
158
|
{#if overviewPanelContent}
|
|
122
159
|
<OverviewPanel contentFaded={config.fadeContent} uiManager={uiManager}>
|
|
123
160
|
{@render overviewPanelContent()}
|
|
@@ -179,6 +216,8 @@ const handleContentAreaMounted = (node) => {
|
|
|
179
216
|
padding: var(--content-player--padding);
|
|
180
217
|
backdrop-filter: blur(30px);
|
|
181
218
|
position: relative;
|
|
219
|
+
opacity: var(--content-player--elements-opacity);
|
|
220
|
+
transition: opacity 0.3s ease-in-out;
|
|
182
221
|
/* Set 'container-type: inline-size;' to reference container*/
|
|
183
222
|
}
|
|
184
223
|
@container (width < 576px) {
|
|
@@ -190,14 +229,12 @@ const handleContentAreaMounted = (node) => {
|
|
|
190
229
|
position: absolute;
|
|
191
230
|
bottom: 5rem;
|
|
192
231
|
left: calc(var(--content-player--overview--width) + 5rem);
|
|
193
|
-
opacity: var(--content-player--elements-opacity);
|
|
194
|
-
transition: opacity 0.3s ease-in-out;
|
|
195
232
|
}
|
|
196
233
|
.content-player__content {
|
|
197
|
-
width: 100
|
|
198
|
-
height: 100
|
|
199
|
-
|
|
200
|
-
|
|
234
|
+
width: var(--_content-player--content--width, 100%);
|
|
235
|
+
height: var(--_content-player--content--height, 100%);
|
|
236
|
+
margin: var(--_content-player--content--margin, 0);
|
|
237
|
+
position: relative;
|
|
201
238
|
}
|
|
202
239
|
|
|
203
240
|
.close-button {
|
|
@@ -49,7 +49,7 @@ const trackNavigationButtonsSize = (node) => {
|
|
|
49
49
|
{#if !uiManager.showPostOverlayControls}
|
|
50
50
|
<div class="controls-and-attachments__left">
|
|
51
51
|
{#if currentItemPostContainer}
|
|
52
|
-
<div class="controls-and-
|
|
52
|
+
<div class="controls-and-attachments__post-controls">
|
|
53
53
|
<PostControls
|
|
54
54
|
model={currentItemPostContainer}
|
|
55
55
|
socialInteractionsHandler={config.socialInteractionsHandler}
|
|
@@ -80,7 +80,7 @@ const trackNavigationButtonsSize = (node) => {
|
|
|
80
80
|
</div>
|
|
81
81
|
{/if}
|
|
82
82
|
{#if currentItemPostContainer && uiManager.showAttachments && (currentItemPostContainer.products.length || currentItemPostContainer.ads.length)}
|
|
83
|
-
<div class="controls-and-
|
|
83
|
+
<div class="controls-and-attachments__post-attachments" transition:slideHorizontally|local>
|
|
84
84
|
<PostAttachments
|
|
85
85
|
container={currentItemPostContainer}
|
|
86
86
|
locale={config.locale}
|
|
@@ -124,6 +124,7 @@ const trackNavigationButtonsSize = (node) => {
|
|
|
124
124
|
justify-content: space-between;
|
|
125
125
|
padding: var(--content-player--controls--padding);
|
|
126
126
|
container-type: inline-size;
|
|
127
|
+
pointer-events: none;
|
|
127
128
|
}
|
|
128
129
|
.controls-and-attachments--with-logo {
|
|
129
130
|
padding-top: 0;
|
|
@@ -140,7 +141,6 @@ const trackNavigationButtonsSize = (node) => {
|
|
|
140
141
|
.controls-and-attachments__right {
|
|
141
142
|
flex: 1;
|
|
142
143
|
display: flex;
|
|
143
|
-
justify-content: space-between;
|
|
144
144
|
align-items: flex-end;
|
|
145
145
|
flex-direction: column;
|
|
146
146
|
overflow-x: hidden;
|
|
@@ -169,7 +169,7 @@ const trackNavigationButtonsSize = (node) => {
|
|
|
169
169
|
.controls-and-attachments__right:hover::-webkit-scrollbar-thumb {
|
|
170
170
|
background: var(--custom-scrollbar-color, #7d7d7d);
|
|
171
171
|
}
|
|
172
|
-
.controls-and-
|
|
172
|
+
.controls-and-attachments__post-controls {
|
|
173
173
|
gap: 2.5rem;
|
|
174
174
|
display: flex;
|
|
175
175
|
flex: 1;
|
|
@@ -177,7 +177,8 @@ const trackNavigationButtonsSize = (node) => {
|
|
|
177
177
|
flex-direction: column;
|
|
178
178
|
align-items: flex-start;
|
|
179
179
|
justify-content: flex-end;
|
|
180
|
-
|
|
180
|
+
pointer-events: auto;
|
|
181
|
+
--post-controls--icon--size: 1.75rem;
|
|
181
182
|
}
|
|
182
183
|
.controls-and-attachments__player-logo {
|
|
183
184
|
width: var(--content-player--controls--logo--max-width);
|
|
@@ -194,10 +195,11 @@ const trackNavigationButtonsSize = (node) => {
|
|
|
194
195
|
min-width: 6.25rem;
|
|
195
196
|
max-width: 6.25rem;
|
|
196
197
|
}
|
|
197
|
-
.controls-and-
|
|
198
|
+
.controls-and-attachments__post-attachments {
|
|
198
199
|
flex: 1;
|
|
199
200
|
width: var(--content-player--controls--attachments--max-width);
|
|
200
201
|
max-width: var(--content-player--controls--attachments--max-width);
|
|
202
|
+
pointer-events: auto;
|
|
201
203
|
opacity: var(--content-player--elements-opacity);
|
|
202
204
|
transition: opacity 0.3s ease-in-out;
|
|
203
205
|
}
|
|
@@ -206,6 +208,7 @@ const trackNavigationButtonsSize = (node) => {
|
|
|
206
208
|
flex-direction: column;
|
|
207
209
|
gap: 1rem;
|
|
208
210
|
z-index: 1;
|
|
211
|
+
pointer-events: auto;
|
|
209
212
|
}
|
|
210
213
|
|
|
211
214
|
.close-button {
|
|
@@ -7,21 +7,21 @@ export declare class ContentPlayerUIManager {
|
|
|
7
7
|
showPostOverlayAttachments: boolean;
|
|
8
8
|
showPostOverlayControls: boolean;
|
|
9
9
|
private _backgroundImageUrl;
|
|
10
|
-
private
|
|
11
|
-
private
|
|
10
|
+
private _playerTotalWidth;
|
|
11
|
+
private _contentViewWidth;
|
|
12
12
|
private _mediaCenterHeaderHeight;
|
|
13
13
|
private _overviewWidth;
|
|
14
14
|
private _controlsAttachmentsPanelWidth;
|
|
15
15
|
private _controlsNavitagionButtonsWidth;
|
|
16
16
|
private _controlsAvailableSpace;
|
|
17
17
|
private _controlsContentWidth;
|
|
18
|
-
get
|
|
19
|
-
get
|
|
18
|
+
get playerTotalWidth(): number;
|
|
19
|
+
get contentViewWidth(): number;
|
|
20
20
|
get backgroundImageUrl(): string | null;
|
|
21
21
|
get overviewWidth(): number;
|
|
22
22
|
setDialogDimensions: (dimensions: {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
playerTotalWidth: number;
|
|
24
|
+
contentViewWidth: number;
|
|
25
25
|
}) => void;
|
|
26
26
|
setOverviewWidth: (width: number) => void;
|
|
27
27
|
setMediaCenterHeaderHeight: (height: number) => void;
|
|
@@ -21,24 +21,24 @@ export class ContentPlayerUIManager {
|
|
|
21
21
|
}
|
|
22
22
|
return values.join(';');
|
|
23
23
|
});
|
|
24
|
-
isMobileView = $derived.by(() => this.
|
|
25
|
-
viewInitialized = $derived.by(() => !!this.
|
|
24
|
+
isMobileView = $derived.by(() => this._playerTotalWidth <= 576);
|
|
25
|
+
viewInitialized = $derived.by(() => !!this._playerTotalWidth && !!this._contentViewWidth);
|
|
26
26
|
showPostOverlayAttachments = $derived.by(() => this.viewInitialized && this._controlsAttachmentsPanelWidth < CONTROLS_ATTACHMENTS_MAX_WIDTH + 10);
|
|
27
27
|
showPostOverlayControls = $derived.by(() => this.viewInitialized && this._controlsContentWidth < this._controlsNavitagionButtonsWidth);
|
|
28
28
|
_backgroundImageUrl = $state(null);
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
_playerTotalWidth = $state(0);
|
|
30
|
+
_contentViewWidth = $state(0);
|
|
31
31
|
_mediaCenterHeaderHeight = $state(0);
|
|
32
32
|
_overviewWidth = $state(0);
|
|
33
33
|
_controlsAttachmentsPanelWidth = $state(0);
|
|
34
34
|
_controlsNavitagionButtonsWidth = $state(0);
|
|
35
|
-
_controlsAvailableSpace = $derived.by(() => (this.
|
|
35
|
+
_controlsAvailableSpace = $derived.by(() => (this._playerTotalWidth - this._contentViewWidth) / 2);
|
|
36
36
|
_controlsContentWidth = $derived.by(() => this._controlsAvailableSpace - CONTROLS_PADDING_HORIZONTAL * 2);
|
|
37
|
-
get
|
|
38
|
-
return this.
|
|
37
|
+
get playerTotalWidth() {
|
|
38
|
+
return this._playerTotalWidth;
|
|
39
39
|
}
|
|
40
|
-
get
|
|
41
|
-
return this.
|
|
40
|
+
get contentViewWidth() {
|
|
41
|
+
return this._contentViewWidth;
|
|
42
42
|
}
|
|
43
43
|
get backgroundImageUrl() {
|
|
44
44
|
return this._backgroundImageUrl;
|
|
@@ -47,8 +47,8 @@ export class ContentPlayerUIManager {
|
|
|
47
47
|
return this._overviewWidth;
|
|
48
48
|
}
|
|
49
49
|
setDialogDimensions = (dimensions) => {
|
|
50
|
-
this.
|
|
51
|
-
this.
|
|
50
|
+
this._playerTotalWidth = dimensions.playerTotalWidth;
|
|
51
|
+
this._contentViewWidth = dimensions.contentViewWidth;
|
|
52
52
|
};
|
|
53
53
|
setOverviewWidth = (width) => {
|
|
54
54
|
this._overviewWidth = width;
|
|
@@ -75,8 +75,7 @@ export class InternalMediaCenterConfig {
|
|
|
75
75
|
const settings = payload.data.embedMediaPagePlayerSettings;
|
|
76
76
|
return {
|
|
77
77
|
logo: settings.logo?.url || null,
|
|
78
|
-
|
|
79
|
-
streamCategories: settings.streamCategories.map((c) => ({ id: c.id, name: c.name }))
|
|
78
|
+
contentCategories: settings.contentCategories.map((c) => ({ id: c.id, name: c.name, parentId: c.parentId }))
|
|
80
79
|
};
|
|
81
80
|
};
|
|
82
81
|
}
|
|
@@ -8,13 +8,10 @@ export type GetMediaPageSettingsQuery = {
|
|
|
8
8
|
logo: {
|
|
9
9
|
url: string;
|
|
10
10
|
} | null;
|
|
11
|
-
|
|
12
|
-
id: string;
|
|
13
|
-
name: string;
|
|
14
|
-
}>;
|
|
15
|
-
streamCategories: Array<{
|
|
11
|
+
contentCategories: Array<{
|
|
16
12
|
id: string;
|
|
17
13
|
name: string;
|
|
14
|
+
parentId: string | null;
|
|
18
15
|
}>;
|
|
19
16
|
} | null;
|
|
20
17
|
};
|
|
@@ -44,23 +44,13 @@ export const GetMediaPageSettingsDocument = {
|
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
kind: 'Field',
|
|
47
|
-
name: { kind: 'Name', value: '
|
|
47
|
+
name: { kind: 'Name', value: 'contentCategories' },
|
|
48
48
|
selectionSet: {
|
|
49
49
|
kind: 'SelectionSet',
|
|
50
50
|
selections: [
|
|
51
51
|
{ kind: 'Field', name: { kind: 'Name', value: 'id' } },
|
|
52
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'name' } }
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
kind: 'Field',
|
|
58
|
-
name: { kind: 'Name', value: 'streamCategories' },
|
|
59
|
-
selectionSet: {
|
|
60
|
-
kind: 'SelectionSet',
|
|
61
|
-
selections: [
|
|
62
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'id' } },
|
|
63
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'name' } }
|
|
52
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'name' } },
|
|
53
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'parentId' } }
|
|
64
54
|
]
|
|
65
55
|
}
|
|
66
56
|
}
|
|
@@ -120,7 +110,7 @@ export const GetShortVideosDocument = {
|
|
|
120
110
|
},
|
|
121
111
|
{
|
|
122
112
|
kind: 'FragmentDefinition',
|
|
123
|
-
name: { kind: 'Name', value: '
|
|
113
|
+
name: { kind: 'Name', value: 'PostViewerPayloadFragment' },
|
|
124
114
|
typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Post' } },
|
|
125
115
|
selectionSet: {
|
|
126
116
|
kind: 'SelectionSet',
|
|
@@ -294,7 +284,7 @@ export const GetShortVideosDocument = {
|
|
|
294
284
|
selectionSet: {
|
|
295
285
|
kind: 'SelectionSet',
|
|
296
286
|
selections: [
|
|
297
|
-
{ kind: 'FragmentSpread', name: { kind: 'Name', value: '
|
|
287
|
+
{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'PostViewerPayloadFragment' } },
|
|
298
288
|
{
|
|
299
289
|
kind: 'Field',
|
|
300
290
|
name: { kind: 'Name', value: 'ownerProfile' },
|
|
@@ -37,12 +37,12 @@ export interface IMediaCenterConfig {
|
|
|
37
37
|
}
|
|
38
38
|
export type MediaCenterSettings = {
|
|
39
39
|
logo: string | null;
|
|
40
|
-
|
|
41
|
-
streamCategories: MediaCenterCategoryModel[];
|
|
40
|
+
contentCategories: MediaCenterCategoryModel[];
|
|
42
41
|
};
|
|
43
42
|
export type MediaCenterCategoryModel = {
|
|
44
43
|
id: string;
|
|
45
44
|
name: string;
|
|
45
|
+
parentId: string | null;
|
|
46
46
|
};
|
|
47
47
|
export type MediaCenterStreamPreviewModel = {
|
|
48
48
|
id: string;
|
|
@@ -44,7 +44,7 @@ let streamsInCategoryData = $state.raw(null);
|
|
|
44
44
|
let scrollResizeObserver = null;
|
|
45
45
|
const overlayActivated = $derived(overviewOpened || streamsInCategoryOpened);
|
|
46
46
|
const categories = $derived.by(() => {
|
|
47
|
-
return (mediaCenterSettings === null || mediaCenterSettings === void 0 ? void 0 : mediaCenterSettings.
|
|
47
|
+
return (mediaCenterSettings === null || mediaCenterSettings === void 0 ? void 0 : mediaCenterSettings.contentCategories.filter((c) => !c.parentId)) || [];
|
|
48
48
|
});
|
|
49
49
|
const logo = $derived.by(() => {
|
|
50
50
|
if (!mediaCenterSettings) {
|
|
@@ -8,7 +8,7 @@ export const ShortVideosPlayerPayloadFragmentDoc = {
|
|
|
8
8
|
selectionSet: {
|
|
9
9
|
kind: 'SelectionSet',
|
|
10
10
|
selections: [
|
|
11
|
-
{ kind: 'FragmentSpread', name: { kind: 'Name', value: '
|
|
11
|
+
{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'PostViewerPayloadFragment' } },
|
|
12
12
|
{
|
|
13
13
|
kind: 'Field',
|
|
14
14
|
name: { kind: 'Name', value: 'ownerProfile' },
|
|
@@ -25,7 +25,7 @@ export const ShortVideosPlayerPayloadFragmentDoc = {
|
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
kind: 'FragmentDefinition',
|
|
28
|
-
name: { kind: 'Name', value: '
|
|
28
|
+
name: { kind: 'Name', value: 'PostViewerPayloadFragment' },
|
|
29
29
|
typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Post' } },
|
|
30
30
|
selectionSet: {
|
|
31
31
|
kind: 'SelectionSet',
|
|
@@ -242,7 +242,7 @@ export const GetShortVideosDocument = {
|
|
|
242
242
|
},
|
|
243
243
|
{
|
|
244
244
|
kind: 'FragmentDefinition',
|
|
245
|
-
name: { kind: 'Name', value: '
|
|
245
|
+
name: { kind: 'Name', value: 'PostViewerPayloadFragment' },
|
|
246
246
|
typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Post' } },
|
|
247
247
|
selectionSet: {
|
|
248
248
|
kind: 'SelectionSet',
|
|
@@ -416,7 +416,7 @@ export const GetShortVideosDocument = {
|
|
|
416
416
|
selectionSet: {
|
|
417
417
|
kind: 'SelectionSet',
|
|
418
418
|
selections: [
|
|
419
|
-
{ kind: 'FragmentSpread', name: { kind: 'Name', value: '
|
|
419
|
+
{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'PostViewerPayloadFragment' } },
|
|
420
420
|
{
|
|
421
421
|
kind: 'Field',
|
|
422
422
|
name: { kind: 'Name', value: 'ownerProfile' },
|
|
@@ -30,13 +30,21 @@ let maxPageIndexViewed = 0;
|
|
|
30
30
|
$effect(() => {
|
|
31
31
|
void streamId;
|
|
32
32
|
untrack(() => {
|
|
33
|
-
if (currentStreamModel) {
|
|
34
|
-
finalizeStreamTracking(currentStreamModel.id);
|
|
35
|
-
}
|
|
36
33
|
buffer = null;
|
|
37
34
|
contentPlayerConfig.playerBuffer = null;
|
|
38
35
|
initNewStream(streamId);
|
|
39
36
|
});
|
|
37
|
+
return () => {
|
|
38
|
+
console.warn('finalize');
|
|
39
|
+
stopActivityTracking();
|
|
40
|
+
if (currentStreamModel) {
|
|
41
|
+
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackStreamEngagementTime(currentStreamModel.id, totalEngagementTimeSeconds);
|
|
42
|
+
if (buffer && buffer.loaded.length > 0) {
|
|
43
|
+
let scrollDepth = Math.round(((maxPageIndexViewed + 1) / buffer.loaded.length) * 100);
|
|
44
|
+
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackStreamScrollDepth(currentStreamModel.id, scrollDepth);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
40
48
|
});
|
|
41
49
|
$effect(() => contentPlayerConfig.updateMediaCenterData(mediaCenterData));
|
|
42
50
|
const initNewStream = (streamId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -139,19 +147,8 @@ const onStreamProductClick = (productId) => {
|
|
|
139
147
|
const onStreamProductImpression = (productId) => {
|
|
140
148
|
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackStreamProductImpression(productId, streamId);
|
|
141
149
|
};
|
|
142
|
-
const finalizeStreamTracking = (id) => {
|
|
143
|
-
stopActivityTracking();
|
|
144
|
-
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackStreamEngagementTime(id, totalEngagementTimeSeconds);
|
|
145
|
-
if (buffer && buffer.loaded.length > 0) {
|
|
146
|
-
let scrollDepth = Math.round(((maxPageIndexViewed + 1) / buffer.loaded.length) * 100);
|
|
147
|
-
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackStreamScrollDepth(id, scrollDepth);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
150
|
const onPlayerClose = () => {
|
|
151
151
|
var _a;
|
|
152
|
-
if (currentStreamModel) {
|
|
153
|
-
finalizeStreamTracking(currentStreamModel.id);
|
|
154
|
-
}
|
|
155
152
|
(_a = on === null || on === void 0 ? void 0 : on.playerClosed) === null || _a === void 0 ? void 0 : _a.call(on);
|
|
156
153
|
};
|
|
157
154
|
const onProgress = (pageId, videoId, progress) => {
|
package/package.json
CHANGED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
<script lang="ts">let { ratio, children, left = undefined, right = undefined, on } = $props();
|
|
2
|
-
let containerRef = $state.raw(null);
|
|
3
|
-
let mainSceneRef = $state.raw(null);
|
|
4
|
-
let leftSidebarRef = $state.raw(null);
|
|
5
|
-
let rightSidebarRef = $state.raw(null);
|
|
6
|
-
const notifyDimensionChanged = () => {
|
|
7
|
-
var _a;
|
|
8
|
-
if (!containerRef || !mainSceneRef || !leftSidebarRef || !rightSidebarRef) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
(_a = on === null || on === void 0 ? void 0 : on.dimensionsChanged) === null || _a === void 0 ? void 0 : _a.call(on, {
|
|
12
|
-
mainSceneWidth: mainSceneRef.getBoundingClientRect().width,
|
|
13
|
-
leftSidebarWidth: leftSidebarRef.getBoundingClientRect().width,
|
|
14
|
-
rightSidebarWidth: rightSidebarRef.getBoundingClientRect().width,
|
|
15
|
-
totalWidth: containerRef.getBoundingClientRect().width
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
let computedMainSceneStyle = $state('width: 100%; height: 100%');
|
|
19
|
-
const calcMainSceneSize = () => {
|
|
20
|
-
if (!containerRef) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const { width: parentWidth, height: parentHeight } = containerRef.getBoundingClientRect();
|
|
24
|
-
const parentAspectRatio = parentWidth / parentHeight;
|
|
25
|
-
let width;
|
|
26
|
-
let height;
|
|
27
|
-
let margin;
|
|
28
|
-
if (parentAspectRatio > ratio) {
|
|
29
|
-
// container is wider than main content
|
|
30
|
-
width = `${parentHeight * ratio}px`;
|
|
31
|
-
height = '100%';
|
|
32
|
-
margin = '0 auto';
|
|
33
|
-
}
|
|
34
|
-
else if (parentAspectRatio < ratio) {
|
|
35
|
-
// main content is wider than container
|
|
36
|
-
width = '100%';
|
|
37
|
-
height = `${parentWidth / ratio}px`;
|
|
38
|
-
margin = 'auto 0';
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
// fallback case
|
|
42
|
-
width = '100%';
|
|
43
|
-
height = '100%';
|
|
44
|
-
margin = '0';
|
|
45
|
-
}
|
|
46
|
-
computedMainSceneStyle = `--_spotlight-layout--main--width: ${width}; --_spotlight-layout--main--height: ${height}; --_spotlight-layout--main--margin: ${margin};`;
|
|
47
|
-
};
|
|
48
|
-
$effect(() => {
|
|
49
|
-
let mainSceneSizeCalculationObserver = new ResizeObserver(calcMainSceneSize);
|
|
50
|
-
let dimentionsChangedObserver = new ResizeObserver(notifyDimensionChanged);
|
|
51
|
-
if (containerRef && mainSceneRef && leftSidebarRef && rightSidebarRef) {
|
|
52
|
-
mainSceneSizeCalculationObserver.observe(mainSceneRef);
|
|
53
|
-
dimentionsChangedObserver.observe(containerRef);
|
|
54
|
-
dimentionsChangedObserver.observe(mainSceneRef);
|
|
55
|
-
dimentionsChangedObserver.observe(leftSidebarRef);
|
|
56
|
-
dimentionsChangedObserver.observe(rightSidebarRef);
|
|
57
|
-
}
|
|
58
|
-
return () => {
|
|
59
|
-
mainSceneSizeCalculationObserver.disconnect();
|
|
60
|
-
dimentionsChangedObserver.disconnect();
|
|
61
|
-
};
|
|
62
|
-
});
|
|
63
|
-
export {};
|
|
64
|
-
</script>
|
|
65
|
-
|
|
66
|
-
<div class="spotlight-layout" bind:this={containerRef}>
|
|
67
|
-
<div class="spotlight-layout__sidebar" bind:this={leftSidebarRef}>
|
|
68
|
-
{#if left}
|
|
69
|
-
{@render left()}
|
|
70
|
-
{/if}
|
|
71
|
-
</div>
|
|
72
|
-
|
|
73
|
-
<div class="spotlight-layout__main-scene" bind:this={mainSceneRef} style={computedMainSceneStyle}>
|
|
74
|
-
{@render children()}
|
|
75
|
-
</div>
|
|
76
|
-
<div class="spotlight-layout__sidebar" bind:this={rightSidebarRef}>
|
|
77
|
-
{#if right}
|
|
78
|
-
{@render right()}
|
|
79
|
-
{/if}
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
|
|
83
|
-
<style>@keyframes fadeIn {
|
|
84
|
-
0% {
|
|
85
|
-
opacity: 1;
|
|
86
|
-
}
|
|
87
|
-
50% {
|
|
88
|
-
opacity: 0.4;
|
|
89
|
-
}
|
|
90
|
-
100% {
|
|
91
|
-
opacity: 1;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
.spotlight-layout {
|
|
95
|
-
width: 100%;
|
|
96
|
-
min-width: 100%;
|
|
97
|
-
max-width: 100%;
|
|
98
|
-
height: 100%;
|
|
99
|
-
min-height: 100%;
|
|
100
|
-
max-height: 100%;
|
|
101
|
-
container-type: inline-size;
|
|
102
|
-
display: flex;
|
|
103
|
-
}
|
|
104
|
-
.spotlight-layout__main-scene {
|
|
105
|
-
width: var(--_spotlight-layout--main--width);
|
|
106
|
-
height: var(--_spotlight-layout--main--height);
|
|
107
|
-
margin: var(--_spotlight-layout--main--margin);
|
|
108
|
-
position: relative;
|
|
109
|
-
display: flex;
|
|
110
|
-
align-items: center;
|
|
111
|
-
justify-content: center;
|
|
112
|
-
/* Set 'container-type: inline-size;' to reference container*/
|
|
113
|
-
}
|
|
114
|
-
@container (width < 576px) {
|
|
115
|
-
.spotlight-layout__main-scene {
|
|
116
|
-
width: 100%;
|
|
117
|
-
height: 100%;
|
|
118
|
-
margin: 0;
|
|
119
|
-
}
|
|
120
|
-
}</style>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
type Props = {
|
|
3
|
-
ratio: number;
|
|
4
|
-
children: Snippet;
|
|
5
|
-
left?: Snippet;
|
|
6
|
-
right?: Snippet;
|
|
7
|
-
on?: {
|
|
8
|
-
dimensionsChanged?: (dimensions: {
|
|
9
|
-
mainSceneWidth: number;
|
|
10
|
-
leftSidebarWidth: number;
|
|
11
|
-
rightSidebarWidth: number;
|
|
12
|
-
totalWidth: number;
|
|
13
|
-
}) => void;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
17
|
-
type Cmp = ReturnType<typeof Cmp>;
|
|
18
|
-
export default Cmp;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as SpotlightLayout } from './cmp.spotlight-layout.svelte';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as SpotlightLayout } from './cmp.spotlight-layout.svelte';
|