@streamscloud/embeddable 7.0.1 → 7.0.2-1759149696160
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/ads/ad-card/cmp.ad-card.svelte +13 -12
- package/dist/ads/ad-card/cmp.ad-card.svelte.d.ts +2 -2
- package/dist/content-player/cmp.content-player.svelte +224 -0
- package/dist/content-player/cmp.content-player.svelte.d.ts +33 -0
- package/dist/content-player/content-player-config.svelte.d.ts +49 -0
- package/dist/content-player/content-player-config.svelte.js +43 -0
- package/dist/content-player/controls-and-attachments.svelte +275 -0
- package/dist/content-player/controls-and-attachments.svelte.d.ts +28 -0
- package/dist/content-player/fade-mixins.scss +12 -0
- package/dist/content-player/index.d.ts +2 -0
- package/dist/content-player/index.js +2 -0
- package/dist/content-player/overview-panel.svelte +85 -0
- package/dist/content-player/overview-panel.svelte.d.ts +10 -0
- package/dist/{streams/stream-player → content-player}/ui-manager.svelte.d.ts +10 -9
- package/dist/content-player/ui-manager.svelte.js +68 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/media-center/config/internal-media-center-config.js +2 -1
- package/dist/media-center/config/types.d.ts +1 -1
- package/dist/media-center/media-center/cmp.media-center.svelte +13 -9
- package/dist/media-center/media-center/overview.svelte +3 -2
- package/dist/media-center/media-center/short-video-resources-generator.d.ts +1 -1
- package/dist/media-center/model/types.d.ts +12 -0
- package/dist/posts/attachments/cmp.attachments.svelte +50 -0
- package/dist/{short-videos/short-video-viewer → posts/attachments}/cmp.attachments.svelte.d.ts +3 -3
- package/dist/posts/attachments/index.d.ts +1 -0
- package/dist/posts/attachments/index.js +1 -0
- package/dist/{short-videos/short-video-viewer/cmp.short-video-controls.svelte → posts/controls/cmp.controls.svelte} +21 -26
- package/dist/posts/controls/cmp.controls.svelte.d.ts +11 -0
- package/dist/posts/controls/index.d.ts +1 -0
- package/dist/posts/controls/index.js +1 -0
- package/dist/posts/index.d.ts +4 -0
- package/dist/posts/index.js +2 -0
- package/dist/posts/model/types.d.ts +13 -0
- package/dist/posts/model/types.js +1 -0
- package/dist/{short-videos/short-video-viewer/cmp.attachments-horizontal.svelte → posts/post-viewer/attachments-horizontal.svelte} +2 -3
- package/dist/posts/post-viewer/attachments-horizontal.svelte.d.ts +13 -0
- package/dist/posts/post-viewer/cmp.post-viewer.svelte +120 -0
- package/dist/{short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts → posts/post-viewer/cmp.post-viewer.svelte.d.ts} +3 -2
- package/dist/posts/post-viewer/heading.svelte +76 -0
- package/dist/posts/post-viewer/heading.svelte.d.ts +9 -0
- package/dist/posts/post-viewer/index.d.ts +4 -0
- package/dist/posts/post-viewer/index.js +3 -0
- package/dist/posts/post-viewer/mapper.d.ts +3 -0
- package/dist/{short-videos/short-video-viewer → posts/post-viewer}/mapper.js +33 -17
- package/dist/{short-videos/short-video-viewer → posts/post-viewer}/operations.generated.d.ts +2 -2
- package/dist/{short-videos/short-video-viewer → posts/post-viewer}/operations.generated.js +2 -2
- package/dist/{short-videos/short-video-viewer → posts/post-viewer}/operations.graphql +1 -1
- package/dist/posts/post-viewer/post-media.svelte +20 -0
- package/dist/posts/post-viewer/post-media.svelte.d.ts +12 -0
- package/dist/{short-videos/short-video-viewer/short-video-viewer-localization.d.ts → posts/post-viewer/post-viewer-localization.d.ts} +2 -3
- package/dist/{short-videos/short-video-viewer/short-video-viewer-localization.js → posts/post-viewer/post-viewer-localization.js} +3 -5
- package/dist/{short-videos/short-video-viewer → posts/post-viewer}/types.d.ts +24 -25
- package/dist/{short-videos/short-video-viewer → posts/post-viewer}/ui-manager.svelte.d.ts +5 -3
- package/dist/{short-videos/short-video-viewer → posts/post-viewer}/ui-manager.svelte.js +11 -4
- package/dist/posts/post-viewer/utils.d.ts +2 -0
- package/dist/posts/post-viewer/utils.js +13 -0
- package/dist/posts/social-interactions/index.d.ts +1 -0
- package/dist/posts/social-interactions/index.js +1 -0
- package/dist/posts/social-interactions/types.d.ts +9 -0
- package/dist/posts/social-interactions/types.js +1 -0
- package/dist/products/product-card/cmp.product-card.svelte +27 -8
- package/dist/products/product-card/cmp.product-card.svelte.d.ts +2 -1
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +11 -17
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +1 -5
- package/dist/short-videos/short-videos-player/index.d.ts +20 -5
- package/dist/short-videos/short-videos-player/internal-short-video-analytics-handler.d.ts +1 -1
- package/dist/short-videos/short-videos-player/internal-short-video-analytics-handler.js +1 -1
- package/dist/short-videos/short-videos-player/internal-short-video-player-provider.d.ts +1 -1
- package/dist/short-videos/short-videos-player/mapper.js +2 -2
- package/dist/short-videos/short-videos-player/short-videos-player-view.svelte +50 -216
- package/dist/short-videos/short-videos-player/short-videos-player-view.svelte.d.ts +2 -9
- package/dist/short-videos/short-videos-player/types.d.ts +6 -7
- package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +3 -3
- package/dist/streams/layout/models/index.d.ts +1 -1
- package/dist/streams/layout/models/index.js +1 -1
- package/dist/streams/layout/models/mapper.d.ts +2 -2
- package/dist/streams/layout/models/mapper.js +6 -6
- package/dist/streams/stream-player/index.d.ts +25 -4
- package/dist/streams/stream-player/internal-stream-analytics-handler.d.ts +2 -0
- package/dist/streams/stream-player/internal-stream-analytics-handler.js +2 -0
- package/dist/streams/stream-player/stream-overview.svelte +47 -122
- package/dist/streams/stream-player/stream-overview.svelte.d.ts +1 -4
- package/dist/streams/stream-player/stream-player-buffer.svelte.d.ts +1 -1
- package/dist/streams/stream-player/stream-player-localization.d.ts +1 -5
- package/dist/streams/stream-player/stream-player-localization.js +2 -10
- package/dist/streams/stream-player/stream-player-view.svelte +229 -0
- package/dist/streams/stream-player/stream-player-view.svelte.d.ts +8 -0
- package/dist/streams/stream-player/types.d.ts +4 -4
- package/dist/ui/{player → player-slider}/cmp.player-slider.svelte.d.ts +2 -10
- package/dist/ui/{player → player-slider}/types.d.ts +9 -0
- package/dist/ui/player-slider/types.js +1 -0
- package/package.json +1 -1
- package/dist/short-videos/short-video-viewer/cmp.attachments-horizontal.svelte.d.ts +0 -13
- package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +0 -52
- package/dist/short-videos/short-video-viewer/cmp.short-video-controls.svelte.d.ts +0 -19
- package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte +0 -89
- package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte.d.ts +0 -9
- package/dist/short-videos/short-video-viewer/cmp.short-video-product-card.svelte +0 -26
- package/dist/short-videos/short-video-viewer/cmp.short-video-product-card.svelte.d.ts +0 -16
- package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +0 -146
- package/dist/short-videos/short-video-viewer/index.d.ts +0 -5
- package/dist/short-videos/short-video-viewer/index.js +0 -4
- package/dist/short-videos/short-video-viewer/mapper.d.ts +0 -3
- package/dist/short-videos/short-video-viewer/short-video-attachments-localization.d.ts +0 -5
- package/dist/short-videos/short-video-viewer/short-video-attachments-localization.js +0 -7
- package/dist/short-videos/short-videos-player/controls.svelte +0 -261
- package/dist/short-videos/short-videos-player/controls.svelte.d.ts +0 -22
- package/dist/short-videos/short-videos-player/fade-mixins.scss +0 -12
- package/dist/short-videos/short-videos-player/short-videos-player-localization.d.ts +0 -7
- package/dist/short-videos/short-videos-player/short-videos-player-localization.js +0 -11
- package/dist/short-videos/short-videos-player/ui-manager.svelte.d.ts +0 -24
- package/dist/short-videos/short-videos-player/ui-manager.svelte.js +0 -47
- package/dist/streams/cmp.stream-product-card.svelte +0 -25
- package/dist/streams/cmp.stream-product-card.svelte.d.ts +0 -16
- package/dist/streams/stream-player/controls.svelte +0 -301
- package/dist/streams/stream-player/controls.svelte.d.ts +0 -20
- package/dist/streams/stream-player/fade-mixins.scss +0 -12
- package/dist/streams/stream-player/stream-player.svelte +0 -393
- package/dist/streams/stream-player/stream-player.svelte.d.ts +0 -16
- package/dist/streams/stream-player/ui-manager.svelte.js +0 -63
- /package/dist/{streams/stream-player → content-player}/button-mixins.scss +0 -0
- /package/dist/{ui/player → media-center/model}/types.js +0 -0
- /package/dist/{short-videos/short-video-viewer → posts/post-viewer}/types.js +0 -0
- /package/dist/ui/{player → player-slider}/cmp.player-slider.svelte +0 -0
- /package/dist/ui/{player → player-slider}/index.d.ts +0 -0
- /package/dist/ui/{player → player-slider}/index.js +0 -0
- /package/dist/ui/{player → player-slider}/player-buffer.svelte.d.ts +0 -0
- /package/dist/ui/{player → player-slider}/player-buffer.svelte.js +0 -0
- /package/dist/ui/{player → player-slider}/prevent-slider-scroll.d.ts +0 -0
- /package/dist/ui/{player → player-slider}/prevent-slider-scroll.js +0 -0
- /package/dist/ui/{player → player-slider}/wheel-gestures-adapter.d.ts +0 -0
- /package/dist/ui/{player → player-slider}/wheel-gestures-adapter.js +0 -0
|
@@ -1,89 +1,63 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
import { Icon } from '../../ui/icon';
|
|
3
|
-
import { Image, ImageRound } from '../../ui/image';
|
|
1
|
+
<script lang="ts">import { Image, ImageRound } from '../../ui/image';
|
|
4
2
|
import { InfiniteScrolling } from '../../ui/infinite-scrolling';
|
|
5
3
|
import { LineClamp } from '../../ui/line-clamp';
|
|
6
4
|
import { ProportionalContainer } from '../../ui/proportional-container';
|
|
7
5
|
import { TimeAgo } from '../../ui/time-ago';
|
|
8
6
|
import { StreamPlayerLocalization } from './stream-player-localization';
|
|
9
|
-
|
|
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
|
-
};
|
|
7
|
+
let { model, buffer, activePageId, on, localization } = $props();
|
|
22
8
|
</script>
|
|
23
9
|
|
|
24
|
-
|
|
25
|
-
<div class="stream-overview"
|
|
26
|
-
<div class="stream-overview-
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
<LineClamp maxLines={1}>
|
|
34
|
-
{model.header.name}
|
|
35
|
-
</LineClamp>
|
|
36
|
-
</div>
|
|
37
|
-
<div class="stream-overview-owner__meta">
|
|
38
|
-
<LineClamp maxLines={1}>
|
|
39
|
-
<TimeAgo date={model.publishedAt || model.createdAt} locale={localization.timeAgoLocale} />
|
|
40
|
-
</LineClamp>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
<div class="stream-overview-info__title">
|
|
45
|
-
<LineClamp maxLines={2}>
|
|
46
|
-
{model.title}
|
|
10
|
+
<div class="stream-overview-info">
|
|
11
|
+
<div class="stream-overview-owner">
|
|
12
|
+
<div class="stream-overview-owner__image">
|
|
13
|
+
<ImageRound src={model.header.image} />
|
|
14
|
+
</div>
|
|
15
|
+
<div class="stream-overview-owner__body">
|
|
16
|
+
<div class="stream-overview-owner__name">
|
|
17
|
+
<LineClamp maxLines={1}>
|
|
18
|
+
{model.header.name}
|
|
47
19
|
</LineClamp>
|
|
48
20
|
</div>
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
</LineClamp>
|
|
54
|
-
</div>
|
|
55
|
-
{/if}
|
|
56
|
-
<div class="stream-overview-info__pages">
|
|
57
|
-
{localization.pagesCount(model.pagesCount)}
|
|
21
|
+
<div class="stream-overview-owner__meta">
|
|
22
|
+
<LineClamp maxLines={1}>
|
|
23
|
+
<TimeAgo date={model.publishedAt || model.createdAt} locale={localization.locale} />
|
|
24
|
+
</LineClamp>
|
|
58
25
|
</div>
|
|
59
26
|
</div>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
</ProportionalContainer>
|
|
72
|
-
</button>
|
|
73
|
-
{/each}
|
|
74
|
-
</div>
|
|
75
|
-
</InfiniteScrolling>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="stream-overview-info__title">
|
|
29
|
+
<LineClamp maxLines={2}>
|
|
30
|
+
{model.title}
|
|
31
|
+
</LineClamp>
|
|
32
|
+
</div>
|
|
33
|
+
{#if model.subTitle}
|
|
34
|
+
<div class="stream-overview-info__subtitle">
|
|
35
|
+
<LineClamp maxLines={3}>
|
|
36
|
+
{model.subTitle}
|
|
37
|
+
</LineClamp>
|
|
76
38
|
</div>
|
|
39
|
+
{/if}
|
|
40
|
+
<div class="stream-overview-info__pages">
|
|
41
|
+
{localization.pagesCount(model.pagesCount)}
|
|
77
42
|
</div>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
43
|
+
</div>
|
|
44
|
+
<div class="stream-overview-pages">
|
|
45
|
+
<InfiniteScrolling loadMore={buffer.loadMore}>
|
|
46
|
+
<div class="stream-overview-pages__grid">
|
|
47
|
+
{#each buffer.loaded as item, index (item.id)}
|
|
48
|
+
<button
|
|
49
|
+
type="button"
|
|
50
|
+
class="stream-overview-pages__page"
|
|
51
|
+
class:stream-overview-pages__page--active={activePageId === item.id}
|
|
52
|
+
onclick={() => on.setCurrentItem(index)}>
|
|
53
|
+
<ProportionalContainer ratio={9 / 16}>
|
|
54
|
+
<Image src={item.cover} />
|
|
55
|
+
</ProportionalContainer>
|
|
56
|
+
</button>
|
|
57
|
+
{/each}
|
|
58
|
+
</div>
|
|
59
|
+
</InfiniteScrolling>
|
|
60
|
+
</div>
|
|
87
61
|
|
|
88
62
|
<style>@keyframes fadeIn {
|
|
89
63
|
0% {
|
|
@@ -96,55 +70,6 @@ const overviewAttached = (node) => {
|
|
|
96
70
|
opacity: 1;
|
|
97
71
|
}
|
|
98
72
|
}
|
|
99
|
-
.stream-overview {
|
|
100
|
-
background: #1c1c1c;
|
|
101
|
-
height: 100%;
|
|
102
|
-
min-height: 100%;
|
|
103
|
-
max-height: 100%;
|
|
104
|
-
width: 13.75rem;
|
|
105
|
-
min-width: 13.75rem;
|
|
106
|
-
max-width: 13.75rem;
|
|
107
|
-
display: flex;
|
|
108
|
-
flex-direction: column;
|
|
109
|
-
min-height: 0;
|
|
110
|
-
padding-bottom: 0.9375rem;
|
|
111
|
-
overflow: hidden;
|
|
112
|
-
position: absolute;
|
|
113
|
-
top: 0;
|
|
114
|
-
left: 0;
|
|
115
|
-
height: 100%;
|
|
116
|
-
z-index: 1;
|
|
117
|
-
/* Set 'container-type: inline-size;' to reference container*/
|
|
118
|
-
}
|
|
119
|
-
@container (width < 576px) {
|
|
120
|
-
.stream-overview {
|
|
121
|
-
width: calc(100% - 80px);
|
|
122
|
-
min-width: calc(100% - 80px);
|
|
123
|
-
max-width: calc(100% - 80px);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.toggle-collapsed-button {
|
|
128
|
-
position: absolute;
|
|
129
|
-
bottom: 0.625rem;
|
|
130
|
-
left: 12rem;
|
|
131
|
-
z-index: 1;
|
|
132
|
-
--icon--color: #ffffff;
|
|
133
|
-
--icon--size: 1.25rem;
|
|
134
|
-
opacity: var(--stream-player--elements-opacity);
|
|
135
|
-
transition: opacity 0.3s ease-in-out;
|
|
136
|
-
/* Set 'container-type: inline-size;' to reference container*/
|
|
137
|
-
}
|
|
138
|
-
.toggle-collapsed-button--left {
|
|
139
|
-
left: 0.625rem;
|
|
140
|
-
}
|
|
141
|
-
@container (width < 576px) {
|
|
142
|
-
.toggle-collapsed-button {
|
|
143
|
-
left: unset;
|
|
144
|
-
right: 0.625rem;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
73
|
.stream-overview-info {
|
|
149
74
|
padding: 1rem;
|
|
150
75
|
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import type { StreamPlayerBuffer } from './stream-player-buffer.svelte';
|
|
2
2
|
import { StreamPlayerLocalization } from './stream-player-localization';
|
|
3
3
|
import type { StreamPlayerModel } from './types';
|
|
4
|
-
import type { StreamPlayerUiManager } from './ui-manager.svelte';
|
|
5
4
|
type Props = {
|
|
6
5
|
model: StreamPlayerModel;
|
|
7
|
-
activePageId: string;
|
|
8
6
|
buffer: StreamPlayerBuffer;
|
|
9
|
-
|
|
7
|
+
activePageId: string;
|
|
10
8
|
localization: StreamPlayerLocalization;
|
|
11
9
|
on: {
|
|
12
10
|
setCurrentItem: (index: number) => void;
|
|
13
|
-
widthChanged: (width: number) => void;
|
|
14
11
|
};
|
|
15
12
|
};
|
|
16
13
|
declare const StreamOverview: import("svelte").Component<Props, {}, "">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type StreamPageViewerModel } from '../stream-page-viewer';
|
|
2
|
-
import type { IPlayerBuffer } from '../../ui/player';
|
|
2
|
+
import type { IPlayerBuffer } from '../../ui/player-slider';
|
|
3
3
|
import type { IStreamPlayerDataProvider } from './types';
|
|
4
4
|
export declare class StreamPlayerBuffer implements IPlayerBuffer<StreamPageViewerModel> {
|
|
5
5
|
readonly loaded: StreamPageViewerModel[];
|
|
@@ -2,10 +2,6 @@ import { type Locale } from '../../core/locale';
|
|
|
2
2
|
export declare class StreamPlayerLocalization {
|
|
3
3
|
streamNotFound: string;
|
|
4
4
|
pagesCount: (count: number) => string;
|
|
5
|
-
|
|
6
|
-
streamPageViewerLocale: Locale;
|
|
7
|
-
shortVideoAttachmentsLocale: Locale;
|
|
8
|
-
shortVideoViewerLocale: Locale;
|
|
9
|
-
swipeIndicatorLocale: Locale;
|
|
5
|
+
locale: Locale;
|
|
10
6
|
constructor(locale: Locale);
|
|
11
7
|
}
|
|
@@ -2,19 +2,11 @@ import {} from '../../core/locale';
|
|
|
2
2
|
export class StreamPlayerLocalization {
|
|
3
3
|
streamNotFound;
|
|
4
4
|
pagesCount;
|
|
5
|
-
|
|
6
|
-
streamPageViewerLocale;
|
|
7
|
-
shortVideoAttachmentsLocale;
|
|
8
|
-
shortVideoViewerLocale;
|
|
9
|
-
swipeIndicatorLocale;
|
|
5
|
+
locale;
|
|
10
6
|
constructor(locale) {
|
|
11
7
|
this.streamNotFound = loc.streamNotFound[locale];
|
|
12
8
|
this.pagesCount = loc.pagesCount[locale];
|
|
13
|
-
this.
|
|
14
|
-
this.streamPageViewerLocale = locale;
|
|
15
|
-
this.shortVideoAttachmentsLocale = locale;
|
|
16
|
-
this.shortVideoViewerLocale = locale;
|
|
17
|
-
this.swipeIndicatorLocale = locale;
|
|
9
|
+
this.locale = locale;
|
|
18
10
|
}
|
|
19
11
|
}
|
|
20
12
|
const loc = {
|
|
@@ -0,0 +1,229 @@
|
|
|
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 { ContentPlayer, ContentPlayerConfig } from '../../content-player';
|
|
11
|
+
import { preloadImage } from '../../core/image-preloader';
|
|
12
|
+
import { toastrWarning } from '../../core/toastr';
|
|
13
|
+
import { mapToPostViewerModel } from '../layout/models';
|
|
14
|
+
import { StreamPageViewer } from '../stream-page-viewer';
|
|
15
|
+
import { default as Overview } from './stream-overview.svelte';
|
|
16
|
+
import { StreamPlayerBuffer } from './stream-player-buffer.svelte';
|
|
17
|
+
import { StreamPlayerLocalization } from './stream-player-localization';
|
|
18
|
+
import { untrack } from 'svelte';
|
|
19
|
+
let { streamId, dataProvider, analyticsHandler, locale = 'en', showStreamsCloudWatermark, postSocialInteractionsHandler, on, mediaCenterData } = $props();
|
|
20
|
+
const localization = $derived(new StreamPlayerLocalization(locale));
|
|
21
|
+
let currentStreamModel = $state(null);
|
|
22
|
+
let activePageId = $derived.by(() => { var _a, _b; return (_b = (_a = buffer === null || buffer === void 0 ? void 0 : buffer.current) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : ''; });
|
|
23
|
+
let buffer = $state(null);
|
|
24
|
+
let totalEngagementTimeSeconds = 0;
|
|
25
|
+
let inactiveTimeSeconds = 10; // // Mark as inactive after 10 seconds of no activity
|
|
26
|
+
let isActive = true;
|
|
27
|
+
let activityTimeout = null;
|
|
28
|
+
let trackingInterval = null;
|
|
29
|
+
let maxPageIndexViewed = 0;
|
|
30
|
+
$effect(() => {
|
|
31
|
+
void streamId;
|
|
32
|
+
untrack(() => {
|
|
33
|
+
if (currentStreamModel) {
|
|
34
|
+
finalizeStreamTracking(currentStreamModel.id);
|
|
35
|
+
}
|
|
36
|
+
buffer = null;
|
|
37
|
+
contentPlayerConfig.playerBuffer = null;
|
|
38
|
+
initNewStream(streamId);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
$effect(() => contentPlayerConfig.updateMediaCenterData(mediaCenterData));
|
|
42
|
+
const initNewStream = (streamId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
var _a;
|
|
44
|
+
const stream = yield dataProvider.getStream(streamId);
|
|
45
|
+
if (!stream) {
|
|
46
|
+
toastrWarning(localization.streamNotFound);
|
|
47
|
+
onPlayerClose();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (stream.organizationId) {
|
|
51
|
+
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.setOrganizationId(stream.organizationId);
|
|
52
|
+
}
|
|
53
|
+
(_a = on === null || on === void 0 ? void 0 : on.streamActivated) === null || _a === void 0 ? void 0 : _a.call(on, { title: stream.title, image: stream.cover });
|
|
54
|
+
// start tracking the stream
|
|
55
|
+
currentStreamModel = stream;
|
|
56
|
+
new StreamPlayerBuffer({
|
|
57
|
+
streamId,
|
|
58
|
+
dataProvider: dataProvider,
|
|
59
|
+
on: {
|
|
60
|
+
preloaded: (instance) => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
+
if (instance.loaded.length) {
|
|
62
|
+
const coverUrl = instance.loaded[0].cover;
|
|
63
|
+
if (coverUrl) {
|
|
64
|
+
yield preloadImage(coverUrl);
|
|
65
|
+
}
|
|
66
|
+
contentPlayerConfig.setBackgroundImageUrl(coverUrl);
|
|
67
|
+
}
|
|
68
|
+
buffer = instance;
|
|
69
|
+
contentPlayerConfig.playerBuffer = instance;
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackStreamView(stream.id);
|
|
74
|
+
startActivityTracking();
|
|
75
|
+
});
|
|
76
|
+
const contentPlayerConfig = new ContentPlayerConfig({
|
|
77
|
+
playerBuffer: null,
|
|
78
|
+
mappers: {
|
|
79
|
+
postModelFromCurrentItem: (item) => {
|
|
80
|
+
if (item.type === 'short-video' && item.shortVideo) {
|
|
81
|
+
return mapToPostViewerModel(item.shortVideo);
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
disableBackground: false,
|
|
87
|
+
locale,
|
|
88
|
+
showStreamsCloudWatermark,
|
|
89
|
+
socialInteractionsHandler: postSocialInteractionsHandler,
|
|
90
|
+
mediaCenterData,
|
|
91
|
+
callbacks: {
|
|
92
|
+
close: () => onPlayerClose(),
|
|
93
|
+
videoProgress: (pageId, videoId, progress) => {
|
|
94
|
+
onProgress(pageId, videoId, progress);
|
|
95
|
+
},
|
|
96
|
+
productClick: (id, videoId) => {
|
|
97
|
+
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackShortVideoProductClick(id, videoId);
|
|
98
|
+
onStreamProductClick(id);
|
|
99
|
+
},
|
|
100
|
+
productImpression: (id, videoId) => {
|
|
101
|
+
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackShortVideoProductImpression(id, videoId);
|
|
102
|
+
onStreamProductImpression(id);
|
|
103
|
+
},
|
|
104
|
+
adClick: (id) => {
|
|
105
|
+
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackAdClick(id);
|
|
106
|
+
},
|
|
107
|
+
adImpression: (id) => {
|
|
108
|
+
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackAdImpression(id);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
playerSliderCallbacks: {
|
|
112
|
+
itemActivated: (item) => onPageActivated(item),
|
|
113
|
+
itemDeactivated: (itemId) => analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.reportPageVideoViews(itemId, streamId)
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
const handleChangePage = (index) => {
|
|
117
|
+
if (!buffer) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
buffer.setIndex(index);
|
|
121
|
+
};
|
|
122
|
+
const onPageActivated = (id) => {
|
|
123
|
+
const page = buffer === null || buffer === void 0 ? void 0 : buffer.loaded.find((x) => x.id === id);
|
|
124
|
+
contentPlayerConfig.setBackgroundImageUrl((page === null || page === void 0 ? void 0 : page.cover) || null);
|
|
125
|
+
if (page) {
|
|
126
|
+
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackStreamPageView(id, streamId);
|
|
127
|
+
if (page.type === 'short-video' && page.shortVideo) {
|
|
128
|
+
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackShortVideoView(page.shortVideo.id);
|
|
129
|
+
}
|
|
130
|
+
const currentIndex = buffer === null || buffer === void 0 ? void 0 : buffer.loaded.findIndex((p) => p.id === id);
|
|
131
|
+
if (currentIndex !== undefined && currentIndex > maxPageIndexViewed) {
|
|
132
|
+
maxPageIndexViewed = currentIndex;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const onStreamProductClick = (productId) => {
|
|
137
|
+
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackStreamProductClicked(productId, streamId);
|
|
138
|
+
};
|
|
139
|
+
const onStreamProductImpression = (productId) => {
|
|
140
|
+
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackStreamProductImpression(productId, streamId);
|
|
141
|
+
};
|
|
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
|
+
const onPlayerClose = () => {
|
|
151
|
+
var _a;
|
|
152
|
+
if (currentStreamModel) {
|
|
153
|
+
finalizeStreamTracking(currentStreamModel.id);
|
|
154
|
+
}
|
|
155
|
+
(_a = on === null || on === void 0 ? void 0 : on.playerClosed) === null || _a === void 0 ? void 0 : _a.call(on);
|
|
156
|
+
};
|
|
157
|
+
const onProgress = (pageId, videoId, progress) => {
|
|
158
|
+
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackShortVideoProgress(pageId, videoId, progress, streamId);
|
|
159
|
+
};
|
|
160
|
+
//#region Activity Tracking
|
|
161
|
+
const resetInactivityTimer = () => {
|
|
162
|
+
if (!isActive) {
|
|
163
|
+
isActive = true;
|
|
164
|
+
}
|
|
165
|
+
if (activityTimeout) {
|
|
166
|
+
clearTimeout(activityTimeout);
|
|
167
|
+
}
|
|
168
|
+
activityTimeout = setTimeout(() => {
|
|
169
|
+
isActive = false;
|
|
170
|
+
}, inactiveTimeSeconds * 1000);
|
|
171
|
+
};
|
|
172
|
+
const startActivityTracking = () => {
|
|
173
|
+
totalEngagementTimeSeconds = 0;
|
|
174
|
+
trackingInterval = setInterval(() => {
|
|
175
|
+
if (isActive) {
|
|
176
|
+
totalEngagementTimeSeconds += 1;
|
|
177
|
+
}
|
|
178
|
+
}, 1000);
|
|
179
|
+
window.addEventListener('mousemove', resetInactivityTimer);
|
|
180
|
+
window.addEventListener('mousedown', resetInactivityTimer);
|
|
181
|
+
window.addEventListener('keypress', resetInactivityTimer);
|
|
182
|
+
window.addEventListener('touchstart', resetInactivityTimer);
|
|
183
|
+
window.addEventListener('scroll', resetInactivityTimer);
|
|
184
|
+
resetInactivityTimer();
|
|
185
|
+
};
|
|
186
|
+
const stopActivityTracking = () => {
|
|
187
|
+
window.removeEventListener('mousemove', resetInactivityTimer);
|
|
188
|
+
window.removeEventListener('mousedown', resetInactivityTimer);
|
|
189
|
+
window.removeEventListener('keypress', resetInactivityTimer);
|
|
190
|
+
window.removeEventListener('touchstart', resetInactivityTimer);
|
|
191
|
+
window.removeEventListener('scroll', resetInactivityTimer);
|
|
192
|
+
if (activityTimeout) {
|
|
193
|
+
clearTimeout(activityTimeout);
|
|
194
|
+
activityTimeout = null;
|
|
195
|
+
}
|
|
196
|
+
if (trackingInterval) {
|
|
197
|
+
clearInterval(trackingInterval);
|
|
198
|
+
trackingInterval = null;
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
//#edregion Activity Tracking
|
|
202
|
+
</script>
|
|
203
|
+
|
|
204
|
+
<ContentPlayer config={contentPlayerConfig}>
|
|
205
|
+
{#snippet nonPostItemView({ item })}
|
|
206
|
+
{#if item.type === 'general'}
|
|
207
|
+
<StreamPageViewer
|
|
208
|
+
page={item}
|
|
209
|
+
locale={localization.locale}
|
|
210
|
+
on={{
|
|
211
|
+
progress: (videoId, progress) => onProgress(item.id, videoId, progress),
|
|
212
|
+
productClick: (productId) => onStreamProductClick(productId),
|
|
213
|
+
productImpression: (productId) => onStreamProductImpression(productId)
|
|
214
|
+
}} />
|
|
215
|
+
{/if}
|
|
216
|
+
{/snippet}
|
|
217
|
+
{#snippet overviewPanelContent()}
|
|
218
|
+
{#if contentPlayerConfig.playerBuffer && buffer && currentStreamModel}
|
|
219
|
+
<Overview
|
|
220
|
+
model={currentStreamModel}
|
|
221
|
+
buffer={buffer}
|
|
222
|
+
activePageId={activePageId}
|
|
223
|
+
localization={localization}
|
|
224
|
+
on={{
|
|
225
|
+
setCurrentItem: handleChangePage
|
|
226
|
+
}} />
|
|
227
|
+
{/if}
|
|
228
|
+
{/snippet}
|
|
229
|
+
</ContentPlayer>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MediaCenterData } from '../../media-center/model/types';
|
|
2
|
+
import type { StreamPlayerProps } from './types';
|
|
3
|
+
type $$ComponentProps = StreamPlayerProps & {
|
|
4
|
+
mediaCenterData?: MediaCenterData;
|
|
5
|
+
};
|
|
6
|
+
declare const StreamPlayerView: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type StreamPlayerView = ReturnType<typeof StreamPlayerView>;
|
|
8
|
+
export default StreamPlayerView;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Locale } from '../../core/locale';
|
|
2
|
-
import type { IPostSocialInteractionsHandler } from '../../
|
|
2
|
+
import type { IPostSocialInteractionsHandler } from '../../posts';
|
|
3
3
|
import type { StreamPageViewerModel } from '../stream-page-viewer';
|
|
4
4
|
export type StreamPlayerModel = {
|
|
5
5
|
id: string;
|
|
@@ -15,13 +15,11 @@ export type StreamPlayerModel = {
|
|
|
15
15
|
};
|
|
16
16
|
pagesCount: number;
|
|
17
17
|
};
|
|
18
|
-
export type StreamPlayerProps =
|
|
18
|
+
export type StreamPlayerProps = {
|
|
19
19
|
streamId: string;
|
|
20
20
|
dataProvider: IStreamPlayerDataProvider;
|
|
21
21
|
postSocialInteractionsHandler?: IPostSocialInteractionsHandler;
|
|
22
22
|
analyticsHandler?: IStreamAnalyticsHandler;
|
|
23
|
-
};
|
|
24
|
-
export type PlayerSettings = {
|
|
25
23
|
disableBackground?: boolean;
|
|
26
24
|
locale?: Locale;
|
|
27
25
|
showStreamsCloudWatermark?: boolean;
|
|
@@ -53,4 +51,6 @@ export interface IStreamAnalyticsHandler {
|
|
|
53
51
|
trackShortVideoProductImpression: (productId: string, videoId: string) => void;
|
|
54
52
|
trackShortVideoProductClick: (productId: string, videoId: string) => void;
|
|
55
53
|
trackShortVideoProgress: (pageId: string, videoId: string, progress: number, streamId: string) => void;
|
|
54
|
+
trackAdClick: (adId: string) => void;
|
|
55
|
+
trackAdImpression: (adId: string) => void;
|
|
56
56
|
}
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
import type { IPlayerBuffer } from './types';
|
|
1
|
+
import type { IPlayerBuffer, PlayerSliderCallbacks } from './types';
|
|
2
2
|
import { type Snippet } from 'svelte';
|
|
3
3
|
declare class __sveltets_Render<T extends {
|
|
4
4
|
id: string;
|
|
5
5
|
}> {
|
|
6
6
|
props(): {
|
|
7
7
|
buffer: IPlayerBuffer<T>;
|
|
8
|
-
on?:
|
|
9
|
-
itemPreActivated?: ((e: T) => void) | undefined;
|
|
10
|
-
itemPreDeactivated?: ((e: {
|
|
11
|
-
itemId: string;
|
|
12
|
-
loadingNext: boolean;
|
|
13
|
-
}) => void) | undefined;
|
|
14
|
-
itemActivated?: ((e: string) => void) | undefined;
|
|
15
|
-
itemDeactivated?: ((e: string) => void) | undefined;
|
|
16
|
-
} | undefined;
|
|
8
|
+
on?: PlayerSliderCallbacks<T> | undefined;
|
|
17
9
|
children: Snippet<[{
|
|
18
10
|
item: T;
|
|
19
11
|
active?: boolean;
|
|
@@ -12,3 +12,12 @@ export interface IPlayerBuffer<T extends {
|
|
|
12
12
|
loadPrevious: () => void;
|
|
13
13
|
reset: () => void;
|
|
14
14
|
}
|
|
15
|
+
export type PlayerSliderCallbacks<T> = {
|
|
16
|
+
itemPreActivated?: (e: T) => void;
|
|
17
|
+
itemPreDeactivated?: (e: {
|
|
18
|
+
itemId: string;
|
|
19
|
+
loadingNext: boolean;
|
|
20
|
+
}) => void;
|
|
21
|
+
itemActivated?: (e: string) => void;
|
|
22
|
+
itemDeactivated?: (e: string) => void;
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ShortVideoViewerModel } from './types';
|
|
2
|
-
type Props = {
|
|
3
|
-
model: ShortVideoViewerModel;
|
|
4
|
-
on?: {
|
|
5
|
-
productClick?: (productId: string) => void;
|
|
6
|
-
productImpression?: (productId: string, videoId: string) => void;
|
|
7
|
-
adClick?: (adId: string) => void;
|
|
8
|
-
adImpression?: (adId: string) => void;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
12
|
-
type Cmp = ReturnType<typeof Cmp>;
|
|
13
|
-
export default Cmp;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import { AdCard } from '../../ads/ad-card';
|
|
2
|
-
import { default as ShortVideoProductCard } from './cmp.short-video-product-card.svelte';
|
|
3
|
-
import { ShortVideoAttachmentsLocalization } from './short-video-attachments-localization';
|
|
4
|
-
import {} from './types';
|
|
5
|
-
let { shortVideo, locale = 'en', on } = $props();
|
|
6
|
-
const localization = $derived(new ShortVideoAttachmentsLocalization(locale));
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
{#if shortVideo.hasAttachments}
|
|
10
|
-
<div class="short-video-attachments">
|
|
11
|
-
{#if shortVideo.ad}
|
|
12
|
-
<AdCard
|
|
13
|
-
ad={shortVideo.ad}
|
|
14
|
-
on={{
|
|
15
|
-
adClick: on?.adClick,
|
|
16
|
-
impression: on?.adImpression
|
|
17
|
-
}} />
|
|
18
|
-
{/if}
|
|
19
|
-
|
|
20
|
-
{#if shortVideo.products.length}
|
|
21
|
-
{#each shortVideo.products as product (product.id)}
|
|
22
|
-
<ShortVideoProductCard
|
|
23
|
-
product={product}
|
|
24
|
-
videoId={shortVideo.id}
|
|
25
|
-
locale={localization.productLocale}
|
|
26
|
-
on={{
|
|
27
|
-
productClick: on?.productClick,
|
|
28
|
-
impression: on?.productImpression
|
|
29
|
-
}} />
|
|
30
|
-
{/each}
|
|
31
|
-
{/if}
|
|
32
|
-
</div>
|
|
33
|
-
{/if}
|
|
34
|
-
|
|
35
|
-
<style>@keyframes fadeIn {
|
|
36
|
-
0% {
|
|
37
|
-
opacity: 1;
|
|
38
|
-
}
|
|
39
|
-
50% {
|
|
40
|
-
opacity: 0.4;
|
|
41
|
-
}
|
|
42
|
-
100% {
|
|
43
|
-
opacity: 1;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
.short-video-attachments {
|
|
47
|
-
--_short-video-attachments--gap: var(--short-video-attachments--gap, 2.75rem);
|
|
48
|
-
display: flex;
|
|
49
|
-
flex-direction: column;
|
|
50
|
-
gap: var(--_short-video-attachments--gap);
|
|
51
|
-
padding: 0;
|
|
52
|
-
}</style>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { IPostSocialInteractionsHandler } from './types';
|
|
2
|
-
type Props = {
|
|
3
|
-
model: {
|
|
4
|
-
id: string;
|
|
5
|
-
enableSocialInteractions: boolean;
|
|
6
|
-
products: unknown[];
|
|
7
|
-
ad: unknown | null;
|
|
8
|
-
media: {
|
|
9
|
-
isImage: boolean;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
socialInteractionsHandler?: IPostSocialInteractionsHandler;
|
|
13
|
-
on?: {
|
|
14
|
-
attachmentsClicked?: () => void;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
18
|
-
type Cmp = ReturnType<typeof Cmp>;
|
|
19
|
-
export default Cmp;
|