@streamscloud/embeddable 6.4.3 → 6.5.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.
- package/dist/ads/ad-card/cmp.ad-card.svelte +5 -19
- package/dist/ads/ad-card/cmp.ad-card.svelte.d.ts +0 -3
- package/dist/core/actions/horizontal-wheel-scroll.d.ts +4 -0
- package/dist/core/actions/horizontal-wheel-scroll.js +22 -0
- package/dist/core/actions/index.d.ts +2 -0
- package/dist/core/actions/index.js +2 -0
- package/dist/core/actions/swallow-touch.d.ts +2 -0
- package/dist/core/actions/swallow-touch.js +17 -0
- package/dist/media-center/media-center/cmp.media-center.svelte +10 -5
- package/dist/products/price-helper.d.ts +8 -1
- package/dist/products/price-helper.js +69 -24
- package/dist/products/product-card/cmp.product-card.svelte +2 -2
- package/dist/products/product-card/types.d.ts +1 -1
- package/dist/short-videos/short-video-viewer/cmp.attachments-horizontal.svelte +220 -0
- package/dist/short-videos/short-video-viewer/{cmp.attachments-inline.svelte.d.ts → cmp.attachments-horizontal.svelte.d.ts} +0 -2
- package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +2 -8
- package/dist/short-videos/short-video-viewer/cmp.attachments.svelte.d.ts +0 -2
- package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +63 -67
- package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +0 -2
- package/dist/short-videos/short-video-viewer/index.d.ts +0 -1
- package/dist/short-videos/short-video-viewer/index.js +0 -1
- package/dist/short-videos/short-video-viewer/types.d.ts +1 -1
- package/dist/short-videos/short-video-viewer/ui-manager.svelte.d.ts +2 -1
- package/dist/short-videos/short-video-viewer/ui-manager.svelte.js +5 -2
- package/dist/short-videos/short-videos-player/controls.svelte +85 -93
- package/dist/short-videos/short-videos-player/controls.svelte.d.ts +0 -2
- package/dist/short-videos/short-videos-player/internal-short-video-analytics-handler.d.ts +0 -2
- package/dist/short-videos/short-videos-player/internal-short-video-analytics-handler.js +0 -2
- package/dist/short-videos/short-videos-player/short-videos-player-view.svelte +4 -14
- package/dist/short-videos/short-videos-player/types.d.ts +0 -2
- package/dist/short-videos/short-videos-player/ui-manager.svelte.d.ts +8 -1
- package/dist/short-videos/short-videos-player/ui-manager.svelte.js +15 -6
- package/dist/streams/layout/element-views/price-element-view.svelte +7 -5
- package/dist/streams/layout/models/stream-layout-short-video-model.d.ts +4 -4
- package/dist/streams/stream-player/controls.svelte +131 -103
- package/dist/streams/stream-player/controls.svelte.d.ts +1 -2
- package/dist/streams/stream-player/fade-mixins.scss +12 -0
- package/dist/streams/stream-player/internal-stream-analytics-handler.d.ts +0 -2
- package/dist/streams/stream-player/internal-stream-analytics-handler.js +0 -2
- package/dist/streams/stream-player/stream-overview.svelte +1 -3
- package/dist/streams/stream-player/stream-player.svelte +24 -15
- package/dist/streams/stream-player/stream-player.svelte.d.ts +12 -1
- package/dist/streams/stream-player/types.d.ts +0 -2
- package/dist/streams/stream-player/ui-manager.svelte.d.ts +15 -8
- package/dist/streams/stream-player/ui-manager.svelte.js +40 -19
- package/package.json +1 -1
- package/dist/short-videos/short-video-viewer/cmp.attachments-inline.svelte +0 -144
- package/dist/short-videos/short-video-viewer/cmp.short-video-ad-card.svelte +0 -26
- package/dist/short-videos/short-video-viewer/cmp.short-video-ad-card.svelte.d.ts +0 -13
|
@@ -1,32 +1,53 @@
|
|
|
1
|
+
const CONTROLS_PADDING_HORIZONTAL = 28;
|
|
2
|
+
const CONTROLS_PADDING_VERTICAL = 28;
|
|
3
|
+
const CONTROLS_ATTACHMENTS_MAX_WIDTH = 176;
|
|
4
|
+
const PLAYER_PADDING_VERTICAL = 10;
|
|
1
5
|
export class StreamPlayerUiManager {
|
|
2
6
|
overviewCollapsed = $state(false);
|
|
3
7
|
showShortVideoAttachments = $state(true);
|
|
4
8
|
globalCssVariables = $derived.by(() => {
|
|
5
9
|
const values = [
|
|
6
|
-
`--stream-player--
|
|
7
|
-
`--stream-player--
|
|
8
|
-
`--stream-player--controls--
|
|
9
|
-
`--stream-player--
|
|
10
|
-
`--stream-player--overview--width: ${this.
|
|
11
|
-
`--stream-player--
|
|
10
|
+
`--stream-player--controls--attachments--max-width: ${CONTROLS_ATTACHMENTS_MAX_WIDTH}px`,
|
|
11
|
+
`--stream-player--controls--available-space: ${this._controlsAvailableSpace}px`,
|
|
12
|
+
`--stream-player--controls--padding: ${this._mediaCenterHeaderHeight ? 0 : CONTROLS_PADDING_VERTICAL}px ${CONTROLS_PADDING_HORIZONTAL}px ${CONTROLS_PADDING_VERTICAL}px`,
|
|
13
|
+
`--stream-player--media-center-header--height: ${this._mediaCenterHeaderHeight || 72}px`,
|
|
14
|
+
`--stream-player--overview--width: ${this._overviewWidth}px`,
|
|
15
|
+
`--stream-player--padding: ${this._mediaCenterHeaderHeight ? this._mediaCenterHeaderHeight : PLAYER_PADDING_VERTICAL}px 0 ${PLAYER_PADDING_VERTICAL}px`
|
|
12
16
|
];
|
|
13
17
|
return values.join(';');
|
|
14
18
|
});
|
|
15
|
-
isMobileView = $derived.by(() => this.
|
|
16
|
-
viewInitialized = $derived.by(() => !!this.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
isMobileView = $derived.by(() => this._viewTotalWidth <= 576);
|
|
20
|
+
viewInitialized = $derived.by(() => !!this._viewTotalWidth && !!this._mainViewColumnWidth);
|
|
21
|
+
showShortVideoOverlayAttachments = $derived.by(() => this.viewInitialized && this._controlsAttachmentsPanelWidth < CONTROLS_ATTACHMENTS_MAX_WIDTH + 10);
|
|
22
|
+
showShortVideoOverlayControls = $derived.by(() => this.viewInitialized && this._controlsContentWidth < this._controlsNavitagionButtonsWidth);
|
|
23
|
+
_viewTotalWidth = $state(0);
|
|
24
|
+
_mainViewColumnWidth = $state(0);
|
|
25
|
+
_mediaCenterHeaderHeight = $state(0);
|
|
26
|
+
_overviewWidth = $state(0);
|
|
27
|
+
_controlsAttachmentsPanelWidth = $state(0);
|
|
28
|
+
_controlsNavitagionButtonsWidth = $state(0);
|
|
29
|
+
_controlsAvailableSpace = $derived.by(() => (this._viewTotalWidth - this._mainViewColumnWidth) / 2);
|
|
30
|
+
_controlsContentWidth = $derived.by(() => this._controlsAvailableSpace - CONTROLS_PADDING_HORIZONTAL * 2);
|
|
31
|
+
get viewTotalWidth() {
|
|
32
|
+
return this._viewTotalWidth;
|
|
33
|
+
}
|
|
34
|
+
get mainViewColumnWidth() {
|
|
35
|
+
return this._mainViewColumnWidth;
|
|
36
|
+
}
|
|
25
37
|
updateDimensions = (dimensions) => {
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
38
|
+
this._viewTotalWidth = dimensions.viewTotalWidth;
|
|
39
|
+
this._mainViewColumnWidth = dimensions.mainViewColumnWidth;
|
|
28
40
|
};
|
|
29
41
|
updateOverviewWidth = (width) => {
|
|
30
|
-
this.
|
|
42
|
+
this._overviewWidth = width;
|
|
43
|
+
};
|
|
44
|
+
updateMediaCenterHeaderHeight = (height) => {
|
|
45
|
+
this._mediaCenterHeaderHeight = height;
|
|
46
|
+
};
|
|
47
|
+
setAttachmentsPanelWidth = (width) => {
|
|
48
|
+
this._controlsAttachmentsPanelWidth = width;
|
|
49
|
+
};
|
|
50
|
+
setNavigationButtonsBlockWidth = (width) => {
|
|
51
|
+
this._controlsNavitagionButtonsWidth = width;
|
|
31
52
|
};
|
|
32
53
|
}
|
package/package.json
CHANGED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import { Icon, IconColor } from '../../ui/icon';
|
|
2
|
-
import { ImageRounded } from '../../ui/image';
|
|
3
|
-
import IconTargetArrow from '@fluentui/svg-icons/icons/target_arrow_20_regular.svg?raw';
|
|
4
|
-
let { model, on } = $props();
|
|
5
|
-
const attachmentsToShow = $derived.by(() => {
|
|
6
|
-
const products = model.products
|
|
7
|
-
.filter((p) => !!p.image)
|
|
8
|
-
.map((p) => ({
|
|
9
|
-
isAd: false,
|
|
10
|
-
image: p.image,
|
|
11
|
-
link: p.link,
|
|
12
|
-
productId: p.id,
|
|
13
|
-
adId: null
|
|
14
|
-
}));
|
|
15
|
-
const ads = (model.ad ? [model.ad] : [])
|
|
16
|
-
.filter((a) => !!a.image)
|
|
17
|
-
.map((a) => {
|
|
18
|
-
var _a;
|
|
19
|
-
return ({
|
|
20
|
-
isAd: true,
|
|
21
|
-
image: a.image,
|
|
22
|
-
link: ((_a = a.ctaButton) === null || _a === void 0 ? void 0 : _a.url) || null,
|
|
23
|
-
productId: null,
|
|
24
|
-
adId: a.id
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
const result = [...products, ...ads];
|
|
28
|
-
return result;
|
|
29
|
-
});
|
|
30
|
-
const handleAttachmentClick = (attachment) => {
|
|
31
|
-
if (attachment.productId && (on === null || on === void 0 ? void 0 : on.productClick)) {
|
|
32
|
-
on.productClick(attachment.productId);
|
|
33
|
-
}
|
|
34
|
-
if (attachment.adId && (on === null || on === void 0 ? void 0 : on.adClick)) {
|
|
35
|
-
on.adClick(attachment.adId);
|
|
36
|
-
}
|
|
37
|
-
if (attachment.link) {
|
|
38
|
-
window.open(attachment.link, '_blank');
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
let attachmentElements = $state({});
|
|
42
|
-
let observer = null;
|
|
43
|
-
$effect(() => {
|
|
44
|
-
if (((on === null || on === void 0 ? void 0 : on.productImpression) || (on === null || on === void 0 ? void 0 : on.adImpression)) && Object.keys(attachmentElements).length > 0) {
|
|
45
|
-
if (observer) {
|
|
46
|
-
observer.disconnect();
|
|
47
|
-
}
|
|
48
|
-
observer = new IntersectionObserver((entries) => {
|
|
49
|
-
entries.forEach((entry) => {
|
|
50
|
-
if (entry.isIntersecting && entry.intersectionRatio >= 0.1) {
|
|
51
|
-
const productId = entry.target.getAttribute('data-product-id');
|
|
52
|
-
const adId = entry.target.getAttribute('data-ad-id');
|
|
53
|
-
if (productId && (on === null || on === void 0 ? void 0 : on.productImpression)) {
|
|
54
|
-
on.productImpression(productId, model.id);
|
|
55
|
-
observer === null || observer === void 0 ? void 0 : observer.unobserve(entry.target); // Only track once per session
|
|
56
|
-
}
|
|
57
|
-
else if (adId && (on === null || on === void 0 ? void 0 : on.adImpression)) {
|
|
58
|
-
on.adImpression(adId, model.id);
|
|
59
|
-
observer === null || observer === void 0 ? void 0 : observer.unobserve(entry.target); // Only track once per session
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}, { threshold: 0.1 });
|
|
64
|
-
Object.entries(attachmentElements).forEach(([key, element]) => {
|
|
65
|
-
if (element) {
|
|
66
|
-
observer === null || observer === void 0 ? void 0 : observer.observe(element);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
return () => {
|
|
71
|
-
if (observer) {
|
|
72
|
-
observer.disconnect();
|
|
73
|
-
observer = null;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
});
|
|
77
|
-
</script>
|
|
78
|
-
|
|
79
|
-
<div class="attachments-inline-container">
|
|
80
|
-
<div class="attachments-inline">
|
|
81
|
-
{#each attachmentsToShow as attachment, index (attachment)}
|
|
82
|
-
<div
|
|
83
|
-
class="attachments-inline__item"
|
|
84
|
-
onclick={() => handleAttachmentClick(attachment)}
|
|
85
|
-
onkeydown={() => {}}
|
|
86
|
-
role="none"
|
|
87
|
-
bind:this={attachmentElements[attachment.productId ? `product-${attachment.productId}` : `ad-${attachment.adId}`]}
|
|
88
|
-
data-product-id={attachment.productId || undefined}
|
|
89
|
-
data-ad-id={attachment.adId || undefined}>
|
|
90
|
-
<ImageRounded src={attachment.image} alt="" />
|
|
91
|
-
{#if attachment.isAd}
|
|
92
|
-
<div class="attachments-inline__item-icon">
|
|
93
|
-
<Icon src={IconTargetArrow} color={IconColor.White} />
|
|
94
|
-
</div>
|
|
95
|
-
{/if}
|
|
96
|
-
</div>
|
|
97
|
-
{/each}
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
|
|
101
|
-
<style>@keyframes fadeIn {
|
|
102
|
-
0% {
|
|
103
|
-
opacity: 1;
|
|
104
|
-
}
|
|
105
|
-
50% {
|
|
106
|
-
opacity: 0.4;
|
|
107
|
-
}
|
|
108
|
-
100% {
|
|
109
|
-
opacity: 1;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
.attachments-inline-container {
|
|
113
|
-
flex: 1;
|
|
114
|
-
overflow: hidden;
|
|
115
|
-
min-height: 0;
|
|
116
|
-
display: flex;
|
|
117
|
-
flex-direction: column;
|
|
118
|
-
justify-content: flex-end;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.attachments-inline {
|
|
122
|
-
display: flex;
|
|
123
|
-
flex-direction: column;
|
|
124
|
-
gap: 0.5rem;
|
|
125
|
-
flex-wrap: wrap;
|
|
126
|
-
height: 100%;
|
|
127
|
-
justify-content: flex-end;
|
|
128
|
-
}
|
|
129
|
-
.attachments-inline__item {
|
|
130
|
-
--image--rounded--width: 3.125rem;
|
|
131
|
-
--image--rounded--height: 3.75rem;
|
|
132
|
-
--image--rounded--inner--border-width: 0;
|
|
133
|
-
--image--rounded--outer--border-radius: 0.25rem;
|
|
134
|
-
--image--rounded--outer--border-width: 1px;
|
|
135
|
-
--image--rounded--outer--border-color: #f3f4f6;
|
|
136
|
-
position: relative;
|
|
137
|
-
cursor: pointer;
|
|
138
|
-
}
|
|
139
|
-
.attachments-inline__item-icon {
|
|
140
|
-
position: absolute;
|
|
141
|
-
bottom: 2px;
|
|
142
|
-
right: 2px;
|
|
143
|
-
--icon--size: 1rem;
|
|
144
|
-
}</style>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import { AdCard } from '../../ads/ad-card';
|
|
2
|
-
import { onMount } from 'svelte';
|
|
3
|
-
let { ad, videoId, inert = false, on } = $props();
|
|
4
|
-
let adElement;
|
|
5
|
-
const adData = ad;
|
|
6
|
-
onMount(() => {
|
|
7
|
-
if (adElement && (on === null || on === void 0 ? void 0 : on.impression)) {
|
|
8
|
-
const observer = new IntersectionObserver((entries) => {
|
|
9
|
-
entries.forEach((entry) => {
|
|
10
|
-
if (entry.isIntersecting && entry.intersectionRatio >= 0.5) {
|
|
11
|
-
on.impression(ad.id, videoId);
|
|
12
|
-
observer.unobserve(entry.target);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}, { threshold: 0.5 });
|
|
16
|
-
observer.observe(adElement);
|
|
17
|
-
return () => {
|
|
18
|
-
observer.disconnect();
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<div bind:this={adElement}>
|
|
25
|
-
<AdCard ad={adData} inert={inert} on={{ adClick: on?.adClick }} />
|
|
26
|
-
</div>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ShortVideoAdCardModel } from './types';
|
|
2
|
-
type Props = {
|
|
3
|
-
ad: ShortVideoAdCardModel;
|
|
4
|
-
videoId: string;
|
|
5
|
-
inert?: boolean;
|
|
6
|
-
on?: {
|
|
7
|
-
adClick?: (id: string) => void;
|
|
8
|
-
impression?: (adId: string, videoId: string) => void;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
12
|
-
type Cmp = ReturnType<typeof Cmp>;
|
|
13
|
-
export default Cmp;
|