@streamscloud/embeddable 4.0.0 → 5.1.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 +34 -7
- package/dist/ads/ad-card/cmp.ad-card.svelte.d.ts +1 -1
- package/dist/ads/ad-card/mapper.js +1 -0
- package/dist/ads/ad-card/operations.generated.d.ts +1 -0
- package/dist/ads/ad-card/operations.generated.js +1 -0
- package/dist/ads/ad-card/operations.graphql +1 -0
- package/dist/ads/ad-card/types.d.ts +1 -0
- package/dist/products/product-card/cmp.product-card.svelte +3 -2
- package/dist/short-videos/short-video-viewer/cmp.short-video-controls.svelte +24 -13
- package/dist/short-videos/short-video-viewer/cmp.short-video-controls.svelte.d.ts +2 -2
- package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +4 -3
- package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +3 -2
- package/dist/short-videos/short-video-viewer/index.d.ts +2 -2
- package/dist/short-videos/short-video-viewer/index.js +1 -1
- package/dist/short-videos/short-video-viewer/mapper.d.ts +1 -1
- package/dist/short-videos/short-video-viewer/mapper.js +38 -5
- package/dist/short-videos/short-video-viewer/operations.generated.d.ts +1 -0
- package/dist/short-videos/short-video-viewer/operations.generated.js +87 -98
- package/dist/short-videos/short-video-viewer/operations.graphql +40 -2
- package/dist/short-videos/short-video-viewer/types.d.ts +35 -6
- package/dist/short-videos/short-video-viewer/types.js +1 -1
- package/dist/short-videos/short-video-viewer/ui-manager.svelte.js +2 -2
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +3 -1
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +4 -0
- package/dist/short-videos/short-videos-player/controls.svelte +37 -20
- package/dist/short-videos/short-videos-player/controls.svelte.d.ts +2 -1
- package/dist/short-videos/short-videos-player/index.js +6 -0
- package/dist/short-videos/short-videos-player/operations.generated.d.ts +1 -0
- package/dist/short-videos/short-videos-player/operations.generated.js +73 -84
- package/dist/short-videos/short-videos-player/short-videos-player-view.svelte +19 -6
- package/dist/short-videos/short-videos-player/short-videos-player-view.svelte.d.ts +4 -0
- package/dist/short-videos/short-videos-player/types.d.ts +9 -9
- package/dist/short-videos/short-videos-player/ui-manager.svelte.d.ts +1 -0
- package/dist/short-videos/short-videos-player/ui-manager.svelte.js +2 -1
- package/dist/streams/layout/models/mapper.js +2 -1
- package/dist/streams/layout/models/stream-layout-short-video-model.d.ts +1 -0
- package/dist/streams/stream-player/cmp.stream-player.svelte +6 -4
- package/dist/streams/stream-player/cmp.stream-player.svelte.d.ts +2 -0
- package/dist/streams/stream-player/controls.svelte +25 -5
- package/dist/streams/stream-player/controls.svelte.d.ts +2 -0
- package/dist/streams/stream-player/index.d.ts +2 -0
- package/dist/streams/stream-player/index.js +2 -1
- package/dist/streams/stream-player/mapper.d.ts +1 -1
- package/dist/streams/stream-player/mapper.js +1 -1
- package/dist/streams/stream-player/ui-manager.svelte.d.ts +1 -0
- package/dist/streams/stream-player/ui-manager.svelte.js +2 -1
- package/dist/ui/line-clamp/cmp.line-clamp.svelte +35 -13
- package/dist/ui/player/cmp.player-slider.svelte +75 -9
- package/dist/ui/progress/cmp.progress.svelte +4 -1
- package/dist/ui/seek-bar/cmp.seek-bar.svelte +134 -28
- package/dist/ui/seek-bar/cmp.seek-bar.svelte.d.ts +3 -0
- package/dist/ui/video/cmp.video.svelte +40 -42
- package/dist/ui/video/cmp.video.svelte.d.ts +2 -0
- package/dist/ui/video/index.d.ts +1 -0
- package/dist/ui/video/index.js +1 -0
- package/dist/ui/video/types.d.ts +4 -0
- package/dist/ui/video/types.js +5 -0
- package/package.json +5 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { ProductCardModel } from '../../products/product-card';
|
|
1
|
+
import { AdType, type Currency } from '../../core/enums';
|
|
3
2
|
export type ShortVideoViewerModel = {
|
|
4
3
|
id: string;
|
|
5
4
|
media: {
|
|
@@ -13,8 +12,8 @@ export type ShortVideoViewerModel = {
|
|
|
13
12
|
text?: string | null;
|
|
14
13
|
heading: ShortVideoViewerHeadingModel | null;
|
|
15
14
|
enableSocialInteractions: boolean;
|
|
16
|
-
products:
|
|
17
|
-
ad:
|
|
15
|
+
products: ShortVideoProductCardModel[];
|
|
16
|
+
ad: ShortVideoAdCardModel | null;
|
|
18
17
|
};
|
|
19
18
|
export type ShortVideoViewerHeadingModel = {
|
|
20
19
|
image: string | null;
|
|
@@ -22,8 +21,38 @@ export type ShortVideoViewerHeadingModel = {
|
|
|
22
21
|
displayDate: string;
|
|
23
22
|
viewsCount: number;
|
|
24
23
|
};
|
|
25
|
-
export type
|
|
26
|
-
isLiked: (shortVideoId: string) =>
|
|
24
|
+
export type ShortVideoSocialInteractionsHandler = {
|
|
25
|
+
isLiked: (shortVideoId: string) => Promise<{
|
|
26
|
+
readonly isLiked: boolean;
|
|
27
|
+
}>;
|
|
27
28
|
onToggleLike: (shortVideoId: string) => void;
|
|
28
29
|
onShare: (shortVideoId: string) => void;
|
|
29
30
|
};
|
|
31
|
+
export type ShortVideoProductCardModel = {
|
|
32
|
+
id: string;
|
|
33
|
+
title: string;
|
|
34
|
+
shortDescription?: string | null;
|
|
35
|
+
link: string | null;
|
|
36
|
+
image: string | null;
|
|
37
|
+
brandName: string | null;
|
|
38
|
+
price: number;
|
|
39
|
+
currency: Currency;
|
|
40
|
+
salePrice: number | null;
|
|
41
|
+
};
|
|
42
|
+
export type ShortVideoAdCardModel = {
|
|
43
|
+
id: string;
|
|
44
|
+
type: AdType;
|
|
45
|
+
image: string | null;
|
|
46
|
+
title: string;
|
|
47
|
+
description: string | null;
|
|
48
|
+
price: number | null;
|
|
49
|
+
priceInfoLabel: string | null;
|
|
50
|
+
currency: Currency | null;
|
|
51
|
+
ctaButton: {
|
|
52
|
+
background: string;
|
|
53
|
+
textColor: string;
|
|
54
|
+
text: string;
|
|
55
|
+
url: string;
|
|
56
|
+
border: string;
|
|
57
|
+
} | null;
|
|
58
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import { AdType } from '../../core/enums';
|
|
@@ -16,9 +16,9 @@ export class ShortVideoViewerUiManager {
|
|
|
16
16
|
actionsPanelWidth = $state(0);
|
|
17
17
|
availableSideSpace = $state(0);
|
|
18
18
|
// is provided from the calling side
|
|
19
|
-
canShowControls = $state(
|
|
19
|
+
canShowControls = $state(false);
|
|
20
20
|
// is provided from the calling side
|
|
21
|
-
canShowAttachments = $state(
|
|
21
|
+
canShowAttachments = $state(false);
|
|
22
22
|
// managed internally by component
|
|
23
23
|
enableAttachments = $state(true);
|
|
24
24
|
updateActionsPanelWidth = (value) => {
|
|
@@ -3,15 +3,17 @@ import { createShadowRoot } from '../../ui/shadow-dom';
|
|
|
3
3
|
import {} from './short-videos-player-localization';
|
|
4
4
|
import { default as ShortVideosPlayerView } from './short-videos-player-view.svelte';
|
|
5
5
|
import { mount, unmount } from 'svelte';
|
|
6
|
-
let { input, localization, showStreamsCloudWatermark, on } = $props();
|
|
6
|
+
let { input, socialInteractionsHandler, localization, showStreamsCloudWatermark, disableBackground, on } = $props();
|
|
7
7
|
const initHost = (node) => {
|
|
8
8
|
const shadowRoot = createShadowRoot(node);
|
|
9
9
|
const mounted = mount(ShortVideosPlayerView, {
|
|
10
10
|
target: shadowRoot,
|
|
11
11
|
props: {
|
|
12
12
|
input,
|
|
13
|
+
socialInteractionsHandler,
|
|
13
14
|
localization,
|
|
14
15
|
showStreamsCloudWatermark,
|
|
16
|
+
disableBackground,
|
|
15
17
|
on
|
|
16
18
|
}
|
|
17
19
|
});
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { type Locale } from '../../core/locale';
|
|
2
|
+
import type { ShortVideoSocialInteractionsHandler } from '../short-video-viewer';
|
|
2
3
|
import { type IShortVideosPlayerLocalization } from './short-videos-player-localization';
|
|
3
4
|
import type { PlayerInput } from './types';
|
|
4
5
|
type Props = {
|
|
5
6
|
input: PlayerInput;
|
|
7
|
+
socialInteractionsHandler?: ShortVideoSocialInteractionsHandler;
|
|
6
8
|
localization?: IShortVideosPlayerLocalization | Locale;
|
|
7
9
|
showStreamsCloudWatermark?: boolean;
|
|
10
|
+
disableBackground?: boolean;
|
|
8
11
|
on?: {
|
|
9
12
|
closePlayer?: () => void;
|
|
13
|
+
videoActivated?: (id: string) => void;
|
|
10
14
|
};
|
|
11
15
|
};
|
|
12
16
|
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
@@ -5,14 +5,14 @@ import { ShortVideosPlayerLocalization } from './short-videos-player-localizatio
|
|
|
5
5
|
import IconChevronDown from '@fluentui/svg-icons/icons/chevron_down_20_regular.svg?raw';
|
|
6
6
|
import IconChevronUp from '@fluentui/svg-icons/icons/chevron_up_20_regular.svg?raw';
|
|
7
7
|
import IconDismiss from '@fluentui/svg-icons/icons/dismiss_20_regular.svg?raw';
|
|
8
|
-
let { buffer, uiManager, localization, on } = $props();
|
|
8
|
+
let { buffer, uiManager, localization, socialInteractionsHandler, on } = $props();
|
|
9
9
|
const shortVideo = $derived(buffer.current);
|
|
10
10
|
const changeShowAttachments = () => {
|
|
11
11
|
uiManager.showAttachments = !uiManager.showAttachments;
|
|
12
12
|
};
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
|
-
{#if !uiManager.showShortVideoOverlay}
|
|
15
|
+
{#if uiManager.viewInitialized && !uiManager.showShortVideoOverlay}
|
|
16
16
|
<div class="short-videos-player-controls">
|
|
17
17
|
<div class="short-videos-player-controls__left">
|
|
18
18
|
{#if shortVideo}
|
|
@@ -22,15 +22,19 @@ const changeShowAttachments = () => {
|
|
|
22
22
|
<ShortVideoViewerAttachmentsInline model={shortVideo} />
|
|
23
23
|
</div>
|
|
24
24
|
{/if}
|
|
25
|
-
<ShortVideoControls model={shortVideo} on={{ attachmentsClicked: changeShowAttachments }} />
|
|
25
|
+
<ShortVideoControls model={shortVideo} socialInteractionsHandler={socialInteractionsHandler} on={{ attachmentsClicked: changeShowAttachments }} />
|
|
26
26
|
</div>
|
|
27
27
|
{/if}
|
|
28
28
|
<div class="short-videos-player-controls__navigation-buttons">
|
|
29
29
|
<button type="button" class="navigation-button" disabled={!buffer.canLoadPrevious} onclick={buffer.loadPrevious}>
|
|
30
|
-
<
|
|
30
|
+
<span class="navigation-button__icon">
|
|
31
|
+
<Icon src={IconChevronUp} />
|
|
32
|
+
</span>
|
|
31
33
|
</button>
|
|
32
34
|
<button type="button" class="navigation-button" disabled={!buffer.canLoadNext} onclick={buffer.loadNext}>
|
|
33
|
-
<
|
|
35
|
+
<span class="navigation-button__icon">
|
|
36
|
+
<Icon src={IconChevronDown} />
|
|
37
|
+
</span>
|
|
34
38
|
</button>
|
|
35
39
|
</div>
|
|
36
40
|
</div>
|
|
@@ -50,7 +54,7 @@ const changeShowAttachments = () => {
|
|
|
50
54
|
{/if}
|
|
51
55
|
|
|
52
56
|
{#if on.closePlayer}
|
|
53
|
-
<button type="button" class="close-button
|
|
57
|
+
<button type="button" class="close-button" onclick={on.closePlayer}>
|
|
54
58
|
<Icon src={IconDismiss} />
|
|
55
59
|
</button>
|
|
56
60
|
{/if}
|
|
@@ -155,7 +159,7 @@ const changeShowAttachments = () => {
|
|
|
155
159
|
z-index: 1;
|
|
156
160
|
}
|
|
157
161
|
|
|
158
|
-
.
|
|
162
|
+
.close-button {
|
|
159
163
|
width: var(--short-videos-player--button--size);
|
|
160
164
|
min-width: var(--short-videos-player--button--size);
|
|
161
165
|
max-width: var(--short-videos-player--button--size);
|
|
@@ -168,13 +172,29 @@ const changeShowAttachments = () => {
|
|
|
168
172
|
text-align: center;
|
|
169
173
|
--icon--color: #ffffff;
|
|
170
174
|
--icon--size: var(--short-videos-player--icon--size);
|
|
175
|
+
position: absolute;
|
|
176
|
+
top: 0.9375rem;
|
|
177
|
+
left: 0.625rem;
|
|
178
|
+
z-index: 1;
|
|
179
|
+
/* Set 'container-type: inline-size;' to reference container*/
|
|
171
180
|
}
|
|
172
|
-
.
|
|
181
|
+
.close-button:disabled {
|
|
173
182
|
opacity: 0.5;
|
|
174
183
|
cursor: default;
|
|
175
184
|
}
|
|
185
|
+
.close-button:hover {
|
|
186
|
+
background-color: rgba(0, 0, 0, 0.9);
|
|
187
|
+
transition: background-color 0.5s;
|
|
188
|
+
}
|
|
189
|
+
@container (width < 576px) {
|
|
190
|
+
.close-button {
|
|
191
|
+
left: unset;
|
|
192
|
+
right: 0.625rem;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
176
195
|
|
|
177
|
-
.
|
|
196
|
+
.navigation-button {
|
|
197
|
+
--_icon-scale: 1;
|
|
178
198
|
width: var(--short-videos-player--button--size);
|
|
179
199
|
min-width: var(--short-videos-player--button--size);
|
|
180
200
|
max-width: var(--short-videos-player--button--size);
|
|
@@ -187,19 +207,16 @@ const changeShowAttachments = () => {
|
|
|
187
207
|
text-align: center;
|
|
188
208
|
--icon--color: #ffffff;
|
|
189
209
|
--icon--size: var(--short-videos-player--icon--size);
|
|
190
|
-
position: absolute;
|
|
191
|
-
top: 0.9375rem;
|
|
192
|
-
left: 0.625rem;
|
|
193
|
-
z-index: 1;
|
|
194
|
-
/* Set 'container-type: inline-size;' to reference container*/
|
|
195
210
|
}
|
|
196
|
-
.
|
|
211
|
+
.navigation-button:disabled {
|
|
197
212
|
opacity: 0.5;
|
|
198
213
|
cursor: default;
|
|
199
214
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
215
|
+
.navigation-button:hover:not(:disabled) {
|
|
216
|
+
--_icon-scale: 1.2;
|
|
217
|
+
}
|
|
218
|
+
.navigation-button__icon {
|
|
219
|
+
display: block;
|
|
220
|
+
transform: scale(var(--_icon-scale));
|
|
221
|
+
transition: 0.3s;
|
|
205
222
|
}</style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ShortVideoViewerModel } from '../short-video-viewer';
|
|
1
|
+
import { type ShortVideoSocialInteractionsHandler, type ShortVideoViewerModel } from '../short-video-viewer';
|
|
2
2
|
import type { IPlayerBuffer } from '../../ui/player';
|
|
3
3
|
import { ShortVideosPlayerLocalization } from './short-videos-player-localization';
|
|
4
4
|
import type { ShortVideosPlayerUiManager } from './ui-manager.svelte';
|
|
@@ -6,6 +6,7 @@ type Props = {
|
|
|
6
6
|
buffer: IPlayerBuffer<ShortVideoViewerModel>;
|
|
7
7
|
uiManager: ShortVideosPlayerUiManager;
|
|
8
8
|
localization: ShortVideosPlayerLocalization;
|
|
9
|
+
socialInteractionsHandler?: ShortVideoSocialInteractionsHandler;
|
|
9
10
|
on: {
|
|
10
11
|
closePlayer?: () => void;
|
|
11
12
|
productClick?: (productId: string) => void;
|
|
@@ -97,6 +97,7 @@ export const openShortVideosPlayer = async (init) => {
|
|
|
97
97
|
target: shadowHost.shadowRoot,
|
|
98
98
|
props: {
|
|
99
99
|
input,
|
|
100
|
+
socialInteractionsHandler: init.socialInteractionsHandler,
|
|
100
101
|
localization: getLocale(init.localization),
|
|
101
102
|
showStreamsCloudWatermark: init.showStreamsCloudWatermark,
|
|
102
103
|
on: {
|
|
@@ -106,6 +107,11 @@ export const openShortVideosPlayer = async (init) => {
|
|
|
106
107
|
}
|
|
107
108
|
await unmount(mounted);
|
|
108
109
|
shadowHost.remove();
|
|
110
|
+
},
|
|
111
|
+
videoActivated: (id) => {
|
|
112
|
+
if (init.on?.videoActivated) {
|
|
113
|
+
init.on.videoActivated(id);
|
|
114
|
+
}
|
|
109
115
|
}
|
|
110
116
|
}
|
|
111
117
|
}
|
|
@@ -45,118 +45,107 @@ export const GetShortVideosDocument = {
|
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
kind: 'FragmentDefinition',
|
|
48
|
-
name: { kind: 'Name', value: '
|
|
49
|
-
typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: '
|
|
48
|
+
name: { kind: 'Name', value: 'ShortVideoViewerPayloadFragment' },
|
|
49
|
+
typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Post' } },
|
|
50
50
|
selectionSet: {
|
|
51
51
|
kind: 'SelectionSet',
|
|
52
52
|
selections: [
|
|
53
53
|
{ kind: 'Field', name: { kind: 'Name', value: 'id' } },
|
|
54
|
-
{ kind: 'Field', name: { kind: 'Name', value: '
|
|
55
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'shortDescription' } },
|
|
56
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'link' } },
|
|
54
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'enableSocialInteractions' } },
|
|
57
55
|
{
|
|
58
56
|
kind: 'Field',
|
|
59
|
-
name: { kind: 'Name', value: '
|
|
57
|
+
name: { kind: 'Name', value: 'allProducts' },
|
|
60
58
|
selectionSet: {
|
|
61
59
|
kind: 'SelectionSet',
|
|
62
60
|
selections: [
|
|
63
|
-
{ kind: 'Field', name: { kind: 'Name', value: '
|
|
64
|
-
{ kind: 'Field', name: { kind: 'Name', value: '
|
|
65
|
-
{ kind: 'Field', name: { kind: 'Name', value: '
|
|
61
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'id' } },
|
|
62
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'title' } },
|
|
63
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'shortDescription' } },
|
|
64
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'link' } },
|
|
65
|
+
{
|
|
66
|
+
kind: 'Field',
|
|
67
|
+
name: { kind: 'Name', value: 'media' },
|
|
68
|
+
selectionSet: {
|
|
69
|
+
kind: 'SelectionSet',
|
|
70
|
+
selections: [
|
|
71
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'url' } },
|
|
72
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'thumbnailUrl' } },
|
|
73
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'type' } }
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
kind: 'Field',
|
|
79
|
+
name: { kind: 'Name', value: 'brand' },
|
|
80
|
+
selectionSet: { kind: 'SelectionSet', selections: [{ kind: 'Field', name: { kind: 'Name', value: 'name' } }] }
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
kind: 'Field',
|
|
84
|
+
name: { kind: 'Name', value: 'priceAndAvailability' },
|
|
85
|
+
selectionSet: {
|
|
86
|
+
kind: 'SelectionSet',
|
|
87
|
+
selections: [
|
|
88
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'currency' } },
|
|
89
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'price' } },
|
|
90
|
+
{
|
|
91
|
+
kind: 'Field',
|
|
92
|
+
name: { kind: 'Name', value: 'productSalePrices' },
|
|
93
|
+
selectionSet: {
|
|
94
|
+
kind: 'SelectionSet',
|
|
95
|
+
selections: [
|
|
96
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'salePrice' } },
|
|
97
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'salePriceEffectiveDateFrom' } },
|
|
98
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'salePriceEffectiveDateTo' } }
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
}
|
|
66
105
|
]
|
|
67
106
|
}
|
|
68
107
|
},
|
|
69
108
|
{
|
|
70
109
|
kind: 'Field',
|
|
71
|
-
name: { kind: 'Name', value: '
|
|
72
|
-
selectionSet: { kind: 'SelectionSet', selections: [{ kind: 'Field', name: { kind: 'Name', value: 'name' } }] }
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
kind: 'Field',
|
|
76
|
-
name: { kind: 'Name', value: 'priceAndAvailability' },
|
|
110
|
+
name: { kind: 'Name', value: 'ad' },
|
|
77
111
|
selectionSet: {
|
|
78
112
|
kind: 'SelectionSet',
|
|
79
113
|
selections: [
|
|
80
|
-
{ kind: 'Field', name: { kind: 'Name', value: '
|
|
114
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'id' } },
|
|
115
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'title' } },
|
|
116
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'description' } },
|
|
81
117
|
{ kind: 'Field', name: { kind: 'Name', value: 'price' } },
|
|
118
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'priceInfo' } },
|
|
119
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'currency' } },
|
|
82
120
|
{
|
|
83
121
|
kind: 'Field',
|
|
84
|
-
name: { kind: 'Name', value: '
|
|
122
|
+
name: { kind: 'Name', value: 'ctaButton' },
|
|
85
123
|
selectionSet: {
|
|
86
124
|
kind: 'SelectionSet',
|
|
87
125
|
selections: [
|
|
88
|
-
{ kind: 'Field', name: { kind: 'Name', value: '
|
|
89
|
-
{ kind: 'Field', name: { kind: 'Name', value: '
|
|
90
|
-
{ kind: 'Field', name: { kind: 'Name', value: '
|
|
126
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'background' } },
|
|
127
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'textColor' } },
|
|
128
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'text' } },
|
|
129
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'url' } },
|
|
130
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'border' } }
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'type' } },
|
|
135
|
+
{
|
|
136
|
+
kind: 'Field',
|
|
137
|
+
name: { kind: 'Name', value: 'media' },
|
|
138
|
+
selectionSet: {
|
|
139
|
+
kind: 'SelectionSet',
|
|
140
|
+
selections: [
|
|
141
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'url' } },
|
|
142
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'thumbnailUrl' } },
|
|
143
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'type' } }
|
|
91
144
|
]
|
|
92
145
|
}
|
|
93
146
|
}
|
|
94
147
|
]
|
|
95
148
|
}
|
|
96
|
-
}
|
|
97
|
-
]
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
kind: 'FragmentDefinition',
|
|
102
|
-
name: { kind: 'Name', value: 'AdCardPayloadFragment' },
|
|
103
|
-
typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Ad' } },
|
|
104
|
-
selectionSet: {
|
|
105
|
-
kind: 'SelectionSet',
|
|
106
|
-
selections: [
|
|
107
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'id' } },
|
|
108
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'title' } },
|
|
109
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'description' } },
|
|
110
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'price' } },
|
|
111
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'currency' } },
|
|
112
|
-
{
|
|
113
|
-
kind: 'Field',
|
|
114
|
-
name: { kind: 'Name', value: 'ctaButton' },
|
|
115
|
-
selectionSet: {
|
|
116
|
-
kind: 'SelectionSet',
|
|
117
|
-
selections: [
|
|
118
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'background' } },
|
|
119
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'textColor' } },
|
|
120
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'text' } },
|
|
121
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'url' } },
|
|
122
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'border' } }
|
|
123
|
-
]
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'type' } },
|
|
127
|
-
{
|
|
128
|
-
kind: 'Field',
|
|
129
|
-
name: { kind: 'Name', value: 'media' },
|
|
130
|
-
selectionSet: {
|
|
131
|
-
kind: 'SelectionSet',
|
|
132
|
-
selections: [
|
|
133
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'url' } },
|
|
134
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'thumbnailUrl' } },
|
|
135
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'type' } }
|
|
136
|
-
]
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
]
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
kind: 'FragmentDefinition',
|
|
144
|
-
name: { kind: 'Name', value: 'ShortVideoViewerPayloadFragment' },
|
|
145
|
-
typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Post' } },
|
|
146
|
-
selectionSet: {
|
|
147
|
-
kind: 'SelectionSet',
|
|
148
|
-
selections: [
|
|
149
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'id' } },
|
|
150
|
-
{ kind: 'Field', name: { kind: 'Name', value: 'enableSocialInteractions' } },
|
|
151
|
-
{
|
|
152
|
-
kind: 'Field',
|
|
153
|
-
name: { kind: 'Name', value: 'allProducts' },
|
|
154
|
-
selectionSet: { kind: 'SelectionSet', selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'ProductCardPayloadFragment' } }] }
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
kind: 'Field',
|
|
158
|
-
name: { kind: 'Name', value: 'ad' },
|
|
159
|
-
selectionSet: { kind: 'SelectionSet', selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'AdCardPayloadFragment' } }] }
|
|
160
149
|
},
|
|
161
150
|
{
|
|
162
151
|
kind: 'Field',
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
};
|
|
10
10
|
import { handleEsc } from '../../core/document.event-handlers';
|
|
11
11
|
import { createLocalGQLClient } from '../../core/graphql';
|
|
12
|
-
import {
|
|
12
|
+
import { mapToShortVideoViewerModel, ShortVideoViewer } from '../short-video-viewer';
|
|
13
13
|
import { Loading } from '../../ui/loading';
|
|
14
14
|
import { PlayerBuffer, PlayerSlider } from '../../ui/player';
|
|
15
15
|
import { SpotlightLayout } from '../../ui/spotlight-layout';
|
|
@@ -19,7 +19,7 @@ import { GetShortVideosDocument } from './operations.generated';
|
|
|
19
19
|
import { ShortVideosPlayerLocalization } from './short-videos-player-localization';
|
|
20
20
|
import { ShortVideosPlayerUiManager } from './ui-manager.svelte';
|
|
21
21
|
import { onMount } from 'svelte';
|
|
22
|
-
let { input, localization: localizationInit = 'en', showStreamsCloudWatermark, on } = $props();
|
|
22
|
+
let { input, socialInteractionsHandler, localization: localizationInit = 'en', showStreamsCloudWatermark, disableBackground, on } = $props();
|
|
23
23
|
const localization = $derived(new ShortVideosPlayerLocalization(localizationInit));
|
|
24
24
|
let everTouched = $state(false);
|
|
25
25
|
let background = $state(null);
|
|
@@ -47,7 +47,7 @@ const initBuffer = (input) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
47
47
|
const index = initialId ? posts.findIndex((p) => p.id === initialId) : 0;
|
|
48
48
|
const provider = {
|
|
49
49
|
initialData: {
|
|
50
|
-
prefetchedItems: posts.map(
|
|
50
|
+
prefetchedItems: posts.map(mapToShortVideoViewerModel),
|
|
51
51
|
startIndex: index
|
|
52
52
|
},
|
|
53
53
|
loadMore: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -69,11 +69,13 @@ onMount(() => {
|
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
const onItemActivated = (id) => {
|
|
72
|
+
var _a;
|
|
72
73
|
const shortVideo = buffer === null || buffer === void 0 ? void 0 : buffer.loaded.find((x) => x.id === id);
|
|
73
74
|
if (!shortVideo) {
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
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);
|
|
77
79
|
};
|
|
78
80
|
const contentMounted = (node) => {
|
|
79
81
|
const markAsTouched = () => {
|
|
@@ -102,7 +104,10 @@ const onPlayerClose = () => {
|
|
|
102
104
|
|
|
103
105
|
<svelte:document onkeydown={(e) => handleEsc(e, onPlayerClose)} />
|
|
104
106
|
|
|
105
|
-
<div
|
|
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}>
|
|
106
111
|
<div class="short-videos-player" style={uiManager.globalCssVariables}>
|
|
107
112
|
{#if showStreamsCloudWatermark}
|
|
108
113
|
<div class="short-videos-player__watermark">
|
|
@@ -122,6 +127,7 @@ const onPlayerClose = () => {
|
|
|
122
127
|
{#snippet children({ item })}
|
|
123
128
|
<ShortVideoViewer
|
|
124
129
|
model={item}
|
|
130
|
+
socialInteractionsHandler={socialInteractionsHandler}
|
|
125
131
|
autoplay="on-appearance"
|
|
126
132
|
showAttachments={uiManager.showShortVideoOverlay}
|
|
127
133
|
showControls={uiManager.showShortVideoOverlay}
|
|
@@ -133,7 +139,12 @@ const onPlayerClose = () => {
|
|
|
133
139
|
{/if}
|
|
134
140
|
</div>
|
|
135
141
|
</SpotlightLayout>
|
|
136
|
-
<Controls
|
|
142
|
+
<Controls
|
|
143
|
+
buffer={buffer}
|
|
144
|
+
uiManager={uiManager}
|
|
145
|
+
localization={localization}
|
|
146
|
+
socialInteractionsHandler={socialInteractionsHandler}
|
|
147
|
+
on={{ closePlayer: on?.closePlayer }} />
|
|
137
148
|
{:else}
|
|
138
149
|
<Loading positionFixedCenter={true} timeout={1000} />
|
|
139
150
|
{/if}
|
|
@@ -161,7 +172,9 @@ const onPlayerClose = () => {
|
|
|
161
172
|
container-type: inline-size;
|
|
162
173
|
display: flex;
|
|
163
174
|
position: relative;
|
|
164
|
-
|
|
175
|
+
}
|
|
176
|
+
.short-videos-player-container--background-enabled {
|
|
177
|
+
background-color: #c1c1c1;
|
|
165
178
|
background-image: var(--background-image);
|
|
166
179
|
background-size: cover;
|
|
167
180
|
background-blend-mode: multiply;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { Locale } from '../../core/locale';
|
|
2
|
+
import { type ShortVideoSocialInteractionsHandler } from '../short-video-viewer';
|
|
2
3
|
import { type IShortVideosPlayerLocalization } from './short-videos-player-localization';
|
|
3
4
|
import type { PlayerInput } from './types';
|
|
4
5
|
type Props = {
|
|
5
6
|
input: PlayerInput;
|
|
7
|
+
socialInteractionsHandler?: ShortVideoSocialInteractionsHandler;
|
|
6
8
|
localization?: IShortVideosPlayerLocalization | Locale;
|
|
7
9
|
showStreamsCloudWatermark?: boolean;
|
|
10
|
+
disableBackground?: boolean;
|
|
8
11
|
on?: {
|
|
9
12
|
closePlayer?: () => void;
|
|
13
|
+
videoActivated?: (id: string) => void;
|
|
10
14
|
};
|
|
11
15
|
};
|
|
12
16
|
declare const ShortVideosPlayerView: import("svelte").Component<Props, {}, "">;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ShortVideoViewerModel } from '
|
|
1
|
+
import type { ShortVideoViewerModel, ShortVideoSocialInteractionsHandler } 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,23 +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
|
-
showStreamsCloudWatermark?: boolean;
|
|
21
|
-
on?: {
|
|
22
|
-
playerClosed?: () => void;
|
|
23
|
-
};
|
|
24
19
|
};
|
|
25
|
-
type IdsInit = {
|
|
20
|
+
type IdsInit = PlayerSettings & {
|
|
26
21
|
ids: string[];
|
|
27
22
|
graphqlOrigin?: string;
|
|
28
23
|
initialId?: string;
|
|
29
|
-
localization?: IShortVideosPlayerLocalization | 'en' | 'no';
|
|
30
24
|
initiator?: string;
|
|
25
|
+
};
|
|
26
|
+
type PlayerSettings = {
|
|
27
|
+
socialInteractionsHandler?: ShortVideoSocialInteractionsHandler;
|
|
28
|
+
disableBackground?: boolean;
|
|
29
|
+
localization?: IShortVideosPlayerLocalization | 'en' | 'no';
|
|
31
30
|
showStreamsCloudWatermark?: boolean;
|
|
32
31
|
on?: {
|
|
33
32
|
playerClosed?: () => void;
|
|
33
|
+
videoActivated?: (id: string) => void;
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
export declare const isShortVideosProviderInit: (init: unknown) => init is ProviderInit;
|
|
@@ -11,7 +11,8 @@ export class ShortVideosPlayerUiManager {
|
|
|
11
11
|
return values.join(';');
|
|
12
12
|
});
|
|
13
13
|
isMobileView = $derived.by(() => this.viewTotalWidth <= 576);
|
|
14
|
-
|
|
14
|
+
viewInitialized = $derived.by(() => !!this.viewTotalWidth && !!this.mainViewColumnWidth);
|
|
15
|
+
showShortVideoOverlay = $derived.by(() => this.viewInitialized && (this.viewTotalWidth - this.mainViewColumnWidth) / 2 <= 85);
|
|
15
16
|
buttonSize = 48;
|
|
16
17
|
iconSize = 28;
|
|
17
18
|
controlsOffsetHorizontal = 28;
|
|
@@ -37,7 +37,8 @@ const mapToAdViewModel = (model) => {
|
|
|
37
37
|
description: model.description,
|
|
38
38
|
price: model.price,
|
|
39
39
|
currency: model.currency,
|
|
40
|
-
ctaButton: model.ctaButton
|
|
40
|
+
ctaButton: model.ctaButton,
|
|
41
|
+
priceInfoLabel: model.priceInfo
|
|
41
42
|
};
|
|
42
43
|
};
|
|
43
44
|
const mapToProductCardModel = (model) => {
|