@streamscloud/embeddable 6.5.2 → 7.0.0-1758321891466
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/core/enums.d.ts +3 -0
- package/dist/core/enums.js +4 -0
- package/dist/core/locale.d.ts +0 -4
- package/dist/core/locale.js +1 -12
- package/dist/media-center/config/internal-media-center-config.d.ts +9 -0
- package/dist/media-center/config/internal-media-center-config.js +81 -0
- package/dist/media-center/{data-provider → config}/operations.generated.d.ts +20 -3
- package/dist/media-center/{data-provider → config}/operations.generated.js +53 -2
- package/dist/media-center/{data-provider → config}/operations.graphql +15 -1
- package/dist/media-center/config/types.d.ts +52 -0
- package/dist/media-center/index.d.ts +1 -1
- package/dist/media-center/media-center/cmp.media-center.svelte +106 -66
- package/dist/media-center/media-center/cmp.media-center.svelte.d.ts +11 -11
- package/dist/media-center/media-center/index.d.ts +0 -1
- package/dist/media-center/media-center/media-center-localization.d.ts +3 -8
- package/dist/media-center/media-center/media-center-localization.js +12 -6
- package/dist/media-center/media-center/overview.svelte +14 -1
- package/dist/media-center/media-center/overview.svelte.d.ts +1 -0
- package/dist/media-center/media-center/short-video-resources-generator.d.ts +2 -2
- package/dist/media-center/media-center/short-video-resources-generator.js +2 -2
- package/dist/media-center/media-center/streams-in-category.svelte +100 -0
- package/dist/media-center/media-center/streams-in-category.svelte.d.ts +10 -0
- package/dist/media-center/media-center/types.d.ts +11 -0
- package/dist/products/product-card/cmp.product-card.svelte +2 -2
- package/dist/products/product-card/cmp.product-card.svelte.d.ts +1 -2
- package/dist/products/product-card/product-card-localization.d.ts +1 -4
- package/dist/products/product-card/product-card-localization.js +2 -2
- package/dist/short-videos/short-video-card/cmp.short-video-card.svelte +11 -46
- package/dist/short-videos/short-video-viewer/cmp.attachments-horizontal.svelte +1 -1
- package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +3 -3
- package/dist/short-videos/short-video-viewer/cmp.attachments.svelte.d.ts +1 -2
- package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte +2 -3
- package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte.d.ts +2 -2
- package/dist/short-videos/short-video-viewer/cmp.short-video-product-card.svelte +2 -2
- package/dist/short-videos/short-video-viewer/cmp.short-video-product-card.svelte.d.ts +1 -2
- package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +2 -2
- package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +1 -2
- package/dist/short-videos/short-video-viewer/index.d.ts +0 -2
- package/dist/short-videos/short-video-viewer/short-video-attachments-localization.d.ts +2 -6
- package/dist/short-videos/short-video-viewer/short-video-attachments-localization.js +4 -4
- package/dist/short-videos/short-video-viewer/short-video-viewer-localization.d.ts +3 -10
- package/dist/short-videos/short-video-viewer/short-video-viewer-localization.js +7 -7
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +4 -4
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +2 -2
- package/dist/short-videos/short-videos-player/controls.svelte +1 -1
- package/dist/short-videos/short-videos-player/index.d.ts +12 -10
- package/dist/short-videos/short-videos-player/index.js +9 -8
- package/dist/short-videos/short-videos-player/short-videos-player-localization.d.ts +4 -11
- package/dist/short-videos/short-videos-player/short-videos-player-localization.js +8 -8
- package/dist/short-videos/short-videos-player/short-videos-player-view.svelte +4 -4
- package/dist/short-videos/short-videos-player/types.d.ts +2 -4
- package/dist/streams/cmp.stream-product-card.svelte +2 -2
- package/dist/streams/cmp.stream-product-card.svelte.d.ts +1 -2
- package/dist/streams/layout/cmp.slot-content.svelte +2 -2
- package/dist/streams/layout/cmp.slot-content.svelte.d.ts +1 -2
- package/dist/streams/layout/element-views/cmp.container-stream-element.svelte +3 -8
- package/dist/streams/layout/element-views/cmp.container-stream-element.svelte.d.ts +1 -2
- package/dist/streams/layout/element-views/cmp.price-stream-element.svelte +2 -2
- package/dist/streams/layout/element-views/cmp.price-stream-element.svelte.d.ts +1 -2
- package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +3 -8
- package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte.d.ts +1 -2
- package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte +2 -2
- package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte.d.ts +1 -2
- package/dist/streams/layout/element-views/cmp.stream-element.svelte +6 -6
- package/dist/streams/layout/element-views/cmp.stream-element.svelte.d.ts +1 -2
- package/dist/streams/layout/element-views/index.d.ts +0 -4
- package/dist/streams/layout/element-views/price-element-view.svelte +1 -1
- package/dist/streams/layout/element-views/price-stream-element-localization.d.ts +2 -8
- package/dist/streams/layout/element-views/price-stream-element-localization.js +5 -5
- package/dist/streams/layout/element-views/short-video-stream-element-localization.d.ts +2 -6
- package/dist/streams/layout/element-views/short-video-stream-element-localization.js +4 -4
- package/dist/streams/layout/element-views/stock-stream-element-localization.d.ts +1 -4
- package/dist/streams/layout/element-views/stock-stream-element-localization.js +2 -2
- package/dist/streams/layout/element-views/stream-element-localization.d.ts +4 -12
- package/dist/streams/layout/element-views/stream-element-localization.js +5 -5
- package/dist/streams/stream-card/cmp.stream-card.svelte +89 -0
- package/dist/streams/stream-card/cmp.stream-card.svelte.d.ts +11 -0
- package/dist/streams/stream-card/index.d.ts +2 -0
- package/dist/streams/stream-card/index.js +1 -0
- package/dist/streams/stream-card/types.d.ts +6 -0
- package/dist/streams/stream-card/types.js +1 -0
- package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte +3 -3
- package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte.d.ts +1 -2
- package/dist/streams/stream-page-viewer/index.d.ts +0 -1
- package/dist/streams/stream-page-viewer/stream-page-viewer-localization.d.ts +2 -6
- package/dist/streams/stream-page-viewer/stream-page-viewer-localization.js +3 -3
- package/dist/streams/stream-player/controls.svelte +1 -1
- package/dist/streams/stream-player/index.d.ts +15 -10
- package/dist/streams/stream-player/index.js +11 -8
- package/dist/streams/stream-player/internal-stream-player-data-provider.d.ts +2 -0
- package/dist/streams/stream-player/internal-stream-player-data-provider.js +2 -2
- package/dist/streams/stream-player/stream-overview.svelte +1 -1
- package/dist/streams/stream-player/stream-player-localization.d.ts +6 -19
- package/dist/streams/stream-player/stream-player-localization.js +14 -14
- package/dist/streams/stream-player/stream-player.svelte +6 -6
- package/dist/streams/stream-player/types.d.ts +4 -4
- package/dist/ui/line-clamp/cmp.line-clamp.svelte +2 -2
- package/dist/ui/line-clamp/cmp.line-clamp.svelte.d.ts +1 -2
- package/dist/ui/line-clamp/index.d.ts +0 -1
- package/dist/ui/line-clamp/index.js +0 -1
- package/dist/ui/line-clamp/line-clamp-localization.d.ts +1 -5
- package/dist/ui/line-clamp/line-clamp-localization.js +4 -4
- package/dist/ui/shadow-dom/{reset.scss → reset-shadow.css} +31 -44
- package/dist/ui/shadow-dom/shadow-root-service.js +2 -2
- package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte +2 -2
- package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte.d.ts +1 -2
- package/dist/ui/swipe-indicator/index.d.ts +0 -1
- package/dist/ui/swipe-indicator/swipe-indicator-localization.d.ts +1 -4
- package/dist/ui/swipe-indicator/swipe-indicator-localization.js +3 -3
- package/dist/ui/time-ago/cmp.time-ago.svelte +2 -2
- package/dist/ui/time-ago/cmp.time-ago.svelte.d.ts +1 -2
- package/dist/ui/time-ago/index.d.ts +0 -1
- package/dist/ui/time-ago/time-ago-localization.d.ts +1 -11
- package/dist/ui/time-ago/time-ago-localization.js +10 -10
- package/package.json +1 -1
- package/dist/media-center/data-provider/index.d.ts +0 -2
- package/dist/media-center/data-provider/index.js +0 -1
- package/dist/media-center/data-provider/internal-media-center-data-provider.svelte.d.ts +0 -8
- package/dist/media-center/data-provider/internal-media-center-data-provider.svelte.js +0 -46
- package/dist/media-center/data-provider/types.d.ts +0 -24
- /package/dist/media-center/{data-provider → config}/types.js +0 -0
- /package/dist/ui/shadow-dom/{normalize.scss → normalize-shadow.css} +0 -0
package/dist/core/enums.d.ts
CHANGED
package/dist/core/enums.js
CHANGED
package/dist/core/locale.d.ts
CHANGED
|
@@ -2,7 +2,3 @@ export type Locale = 'en' | 'no';
|
|
|
2
2
|
export type LocalizationSchema = {
|
|
3
3
|
[key: string]: Record<Locale, unknown>;
|
|
4
4
|
};
|
|
5
|
-
export declare const isEn: <T>(input: Locale | T) => input is "en";
|
|
6
|
-
export declare const isNo: <T>(input: Locale | T) => input is "no";
|
|
7
|
-
export declare const isLocale: <T>(input: Locale | T) => input is Locale;
|
|
8
|
-
export declare const isLocalizationInterface: <T>(input: Locale | T) => input is T;
|
package/dist/core/locale.js
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
return input === 'en';
|
|
3
|
-
};
|
|
4
|
-
export const isNo = (input) => {
|
|
5
|
-
return input === 'no';
|
|
6
|
-
};
|
|
7
|
-
export const isLocale = (input) => {
|
|
8
|
-
return input === 'en' || input === 'no';
|
|
9
|
-
};
|
|
10
|
-
export const isLocalizationInterface = (input) => {
|
|
11
|
-
return typeof input === 'object' && input !== null;
|
|
12
|
-
};
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IMediaCenterConfig } from './types';
|
|
2
|
+
export declare class InternalMediaCenterConfig implements IMediaCenterConfig {
|
|
3
|
+
private readonly mediaPageId;
|
|
4
|
+
shortVideosPlayer: IMediaCenterConfig['shortVideosPlayer'];
|
|
5
|
+
streamPlayer: IMediaCenterConfig['streamPlayer'];
|
|
6
|
+
private graphql;
|
|
7
|
+
constructor(mediaPageId: string, graphqlOrigin?: string);
|
|
8
|
+
getSettings: IMediaCenterConfig['getSettings'];
|
|
9
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { PostType, Status, StreamStatus } from '../../core/enums';
|
|
2
|
+
import { createLocalGQLClient } from '../../core/graphql';
|
|
3
|
+
import { InternalShortVideoAnalyticsHandler } from '../../short-videos/short-videos-player/internal-short-video-analytics-handler';
|
|
4
|
+
import { mapToShortVideoPlayerModel } from '../../short-videos/short-videos-player/mapper';
|
|
5
|
+
import { InternalStreamAnalyticsHandler } from '../../streams/stream-player/internal-stream-analytics-handler';
|
|
6
|
+
import { InternalStreamPlayerDataProvider } from '../../streams/stream-player/internal-stream-player-data-provider';
|
|
7
|
+
import { GetMediaPageSettingsDocument, GetShortVideosDocument, GetStreamsDocument } from './operations.generated';
|
|
8
|
+
export class InternalMediaCenterConfig {
|
|
9
|
+
mediaPageId;
|
|
10
|
+
shortVideosPlayer;
|
|
11
|
+
streamPlayer;
|
|
12
|
+
graphql;
|
|
13
|
+
constructor(mediaPageId, graphqlOrigin) {
|
|
14
|
+
this.mediaPageId = mediaPageId;
|
|
15
|
+
this.graphql = createLocalGQLClient(graphqlOrigin);
|
|
16
|
+
this.shortVideosPlayer = {
|
|
17
|
+
getShortVideosCursor: async ({ filter, limit, continuationToken }) => {
|
|
18
|
+
const payload = await this.graphql
|
|
19
|
+
.query(GetShortVideosDocument, {
|
|
20
|
+
input: {
|
|
21
|
+
filter: {
|
|
22
|
+
mediaPageId: this.mediaPageId,
|
|
23
|
+
types: [PostType.ShortVideo],
|
|
24
|
+
statuses: [Status.Published],
|
|
25
|
+
categoryId: filter.categoryId,
|
|
26
|
+
excludeIds: filter.excludeIds
|
|
27
|
+
},
|
|
28
|
+
limit,
|
|
29
|
+
continuationToken
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
.toPromise();
|
|
33
|
+
const posts = payload.data?.shortVideos?.items || [];
|
|
34
|
+
return {
|
|
35
|
+
items: posts.map(mapToShortVideoPlayerModel),
|
|
36
|
+
continuationToken: payload.data?.shortVideos?.continuationToken || null
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
socialInteractionsHandler: undefined,
|
|
40
|
+
analyticsHandler: new InternalShortVideoAnalyticsHandler(graphqlOrigin)
|
|
41
|
+
};
|
|
42
|
+
this.streamPlayer = {
|
|
43
|
+
getStreamsCursor: async ({ filter, limit, continuationToken }) => {
|
|
44
|
+
const payload = await this.graphql
|
|
45
|
+
.query(GetStreamsDocument, {
|
|
46
|
+
input: {
|
|
47
|
+
filter: {
|
|
48
|
+
mediaPageId: this.mediaPageId,
|
|
49
|
+
categoryId: filter.categoryId,
|
|
50
|
+
excludeIds: filter.excludeIds,
|
|
51
|
+
statuses: [StreamStatus.Published]
|
|
52
|
+
},
|
|
53
|
+
limit,
|
|
54
|
+
continuationToken
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
.toPromise();
|
|
58
|
+
const streams = payload.data?.streams.items ?? [];
|
|
59
|
+
return {
|
|
60
|
+
items: streams.map((x) => ({ id: x.id, title: x.title, subTitle: x.subTitle, cover: x.cover?.url ?? null })),
|
|
61
|
+
continuationToken: payload.data?.streams?.continuationToken ?? null
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
streamPlayerDataProvider: new InternalStreamPlayerDataProvider({ graphql: this.graphql }),
|
|
65
|
+
socialInteractionsHandler: undefined,
|
|
66
|
+
analyticsHandler: new InternalStreamAnalyticsHandler(graphqlOrigin)
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
getSettings = async () => {
|
|
70
|
+
const payload = await this.graphql.query(GetMediaPageSettingsDocument, { mediaPageId: this.mediaPageId }).toPromise();
|
|
71
|
+
if (!payload.data?.embedMediaPagePlayerSettings) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
const settings = payload.data.embedMediaPagePlayerSettings;
|
|
75
|
+
return {
|
|
76
|
+
logo: settings.logo?.url || null,
|
|
77
|
+
postCategories: settings.postCategories.map((c) => ({ id: c.id, name: c.name })),
|
|
78
|
+
streamCategories: settings.streamCategories.map((c) => ({ id: c.id, name: c.name }))
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type * as SchemaTypes from '../../../gql/types';
|
|
2
2
|
import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
|
|
3
|
-
export type
|
|
3
|
+
export type GetMediaPageSettingsQueryVariables = SchemaTypes.Exact<{
|
|
4
4
|
mediaPageId: SchemaTypes.Scalars['String']['input'];
|
|
5
5
|
}>;
|
|
6
|
-
export type
|
|
6
|
+
export type GetMediaPageSettingsQuery = {
|
|
7
7
|
embedMediaPagePlayerSettings: {
|
|
8
8
|
logo: {
|
|
9
9
|
url: string;
|
|
@@ -89,5 +89,22 @@ export type GetShortVideosQuery = {
|
|
|
89
89
|
}>;
|
|
90
90
|
};
|
|
91
91
|
};
|
|
92
|
-
export
|
|
92
|
+
export type GetStreamsQueryVariables = SchemaTypes.Exact<{
|
|
93
|
+
input: SchemaTypes.EmbedStreamsInput;
|
|
94
|
+
}>;
|
|
95
|
+
export type GetStreamsQuery = {
|
|
96
|
+
streams: {
|
|
97
|
+
continuationToken: string | null;
|
|
98
|
+
items: Array<{
|
|
99
|
+
id: string;
|
|
100
|
+
title: string;
|
|
101
|
+
subTitle: string | null;
|
|
102
|
+
cover: {
|
|
103
|
+
url: string;
|
|
104
|
+
} | null;
|
|
105
|
+
}>;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
export declare const GetMediaPageSettingsDocument: DocumentNode<GetMediaPageSettingsQuery, GetMediaPageSettingsQueryVariables>;
|
|
93
109
|
export declare const GetShortVideosDocument: DocumentNode<GetShortVideosQuery, GetShortVideosQueryVariables>;
|
|
110
|
+
export declare const GetStreamsDocument: DocumentNode<GetStreamsQuery, GetStreamsQueryVariables>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const GetMediaPageSettingsDocument = {
|
|
2
2
|
kind: 'Document',
|
|
3
3
|
definitions: [
|
|
4
4
|
{
|
|
5
5
|
kind: 'OperationDefinition',
|
|
6
6
|
operation: 'query',
|
|
7
|
-
name: { kind: 'Name', value: '
|
|
7
|
+
name: { kind: 'Name', value: 'GetMediaPageSettings' },
|
|
8
8
|
variableDefinitions: [
|
|
9
9
|
{
|
|
10
10
|
kind: 'VariableDefinition',
|
|
@@ -311,3 +311,54 @@ export const GetShortVideosDocument = {
|
|
|
311
311
|
}
|
|
312
312
|
]
|
|
313
313
|
};
|
|
314
|
+
export const GetStreamsDocument = {
|
|
315
|
+
kind: 'Document',
|
|
316
|
+
definitions: [
|
|
317
|
+
{
|
|
318
|
+
kind: 'OperationDefinition',
|
|
319
|
+
operation: 'query',
|
|
320
|
+
name: { kind: 'Name', value: 'GetStreams' },
|
|
321
|
+
variableDefinitions: [
|
|
322
|
+
{
|
|
323
|
+
kind: 'VariableDefinition',
|
|
324
|
+
variable: { kind: 'Variable', name: { kind: 'Name', value: 'input' } },
|
|
325
|
+
type: { kind: 'NonNullType', type: { kind: 'NamedType', name: { kind: 'Name', value: 'EmbedStreamsInput' } } }
|
|
326
|
+
}
|
|
327
|
+
],
|
|
328
|
+
selectionSet: {
|
|
329
|
+
kind: 'SelectionSet',
|
|
330
|
+
selections: [
|
|
331
|
+
{
|
|
332
|
+
kind: 'Field',
|
|
333
|
+
alias: { kind: 'Name', value: 'streams' },
|
|
334
|
+
name: { kind: 'Name', value: 'embedStreams' },
|
|
335
|
+
arguments: [{ kind: 'Argument', name: { kind: 'Name', value: 'input' }, value: { kind: 'Variable', name: { kind: 'Name', value: 'input' } } }],
|
|
336
|
+
selectionSet: {
|
|
337
|
+
kind: 'SelectionSet',
|
|
338
|
+
selections: [
|
|
339
|
+
{
|
|
340
|
+
kind: 'Field',
|
|
341
|
+
name: { kind: 'Name', value: 'items' },
|
|
342
|
+
selectionSet: {
|
|
343
|
+
kind: 'SelectionSet',
|
|
344
|
+
selections: [
|
|
345
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'id' } },
|
|
346
|
+
{
|
|
347
|
+
kind: 'Field',
|
|
348
|
+
name: { kind: 'Name', value: 'cover' },
|
|
349
|
+
selectionSet: { kind: 'SelectionSet', selections: [{ kind: 'Field', name: { kind: 'Name', value: 'url' } }] }
|
|
350
|
+
},
|
|
351
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'title' } },
|
|
352
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'subTitle' } }
|
|
353
|
+
]
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'continuationToken' } }
|
|
357
|
+
]
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
]
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
]
|
|
364
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
query
|
|
1
|
+
query GetMediaPageSettings($mediaPageId: String!) {
|
|
2
2
|
embedMediaPagePlayerSettings(input: { mediaPageId: $mediaPageId }) {
|
|
3
3
|
logo {
|
|
4
4
|
url
|
|
@@ -23,3 +23,17 @@ query GetShortVideos($input: EmbedPostsInput!, $image_scale: ImageScale = ORIGIN
|
|
|
23
23
|
continuationToken
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
query GetStreams($input: EmbedStreamsInput!) {
|
|
28
|
+
streams: embedStreams(input: $input) {
|
|
29
|
+
items {
|
|
30
|
+
id
|
|
31
|
+
cover {
|
|
32
|
+
url
|
|
33
|
+
}
|
|
34
|
+
title
|
|
35
|
+
subTitle
|
|
36
|
+
}
|
|
37
|
+
continuationToken
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { IPostSocialInteractionsHandler } from '../../short-videos/short-video-viewer';
|
|
2
|
+
import type { IShortVideoAnalyticsHandler, ShortVideoPlayerModel } from '../../short-videos/short-videos-player/types';
|
|
3
|
+
import type { IStreamPlayerDataProvider, IStreamAnalyticsHandler } from '../../streams/stream-player/types';
|
|
4
|
+
export interface IMediaCenterConfig {
|
|
5
|
+
getSettings: () => Promise<MediaCenterSettings | null>;
|
|
6
|
+
shortVideosPlayer: {
|
|
7
|
+
getShortVideosCursor: (input: {
|
|
8
|
+
filter: {
|
|
9
|
+
categoryId?: string;
|
|
10
|
+
excludeIds?: string[];
|
|
11
|
+
};
|
|
12
|
+
limit: number;
|
|
13
|
+
continuationToken?: string | null;
|
|
14
|
+
}) => Promise<{
|
|
15
|
+
items: ShortVideoPlayerModel[];
|
|
16
|
+
continuationToken: string | null;
|
|
17
|
+
}>;
|
|
18
|
+
socialInteractionsHandler?: IPostSocialInteractionsHandler;
|
|
19
|
+
analyticsHandler?: IShortVideoAnalyticsHandler;
|
|
20
|
+
};
|
|
21
|
+
streamPlayer: {
|
|
22
|
+
getStreamsCursor: (input: {
|
|
23
|
+
filter: {
|
|
24
|
+
categoryId?: string;
|
|
25
|
+
excludeIds?: string[];
|
|
26
|
+
};
|
|
27
|
+
limit: number;
|
|
28
|
+
continuationToken?: string | null;
|
|
29
|
+
}) => Promise<{
|
|
30
|
+
items: MediaCenterStreamPreviewModel[];
|
|
31
|
+
continuationToken: string | null;
|
|
32
|
+
}>;
|
|
33
|
+
streamPlayerDataProvider: IStreamPlayerDataProvider;
|
|
34
|
+
socialInteractionsHandler?: IPostSocialInteractionsHandler;
|
|
35
|
+
analyticsHandler?: IStreamAnalyticsHandler;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export type MediaCenterSettings = {
|
|
39
|
+
logo: string | null;
|
|
40
|
+
postCategories: MediaCenterCategoryModel[];
|
|
41
|
+
streamCategories: MediaCenterCategoryModel[];
|
|
42
|
+
};
|
|
43
|
+
export type MediaCenterCategoryModel = {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
};
|
|
47
|
+
export type MediaCenterStreamPreviewModel = {
|
|
48
|
+
id: string;
|
|
49
|
+
title: string;
|
|
50
|
+
subTitle: string | null;
|
|
51
|
+
cover: string | null;
|
|
52
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { IMediaCenterConfig } from './config/types';
|
|
@@ -17,46 +17,45 @@ import { Loading } from '../../ui/loading';
|
|
|
17
17
|
import { MediaCenterLocalization } from './media-center-localization';
|
|
18
18
|
import { default as Overview } from './overview.svelte';
|
|
19
19
|
import { makeShortVideosProvider } from './short-video-resources-generator';
|
|
20
|
+
import { default as StreamsInCategory } from './streams-in-category.svelte';
|
|
20
21
|
import { MediaCenterMode } from './types';
|
|
21
22
|
import IconLineHorizontal3 from '@fluentui/svg-icons/icons/line_horizontal_3_20_regular.svg?raw';
|
|
22
23
|
import IconTextColumnThree from '@fluentui/svg-icons/icons/text_column_three_20_regular.svg?raw';
|
|
23
24
|
import { onDestroy, onMount } from 'svelte';
|
|
24
25
|
import { fade } from 'svelte/transition';
|
|
25
|
-
let {
|
|
26
|
-
const localization = $derived(new MediaCenterLocalization(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
let { config, playerProps, locale = 'en' } = $props();
|
|
27
|
+
const localization = $derived(new MediaCenterLocalization(locale));
|
|
28
|
+
const commonPlayerSettings = {
|
|
29
|
+
disableBackground: playerProps.props.disableBackground,
|
|
30
|
+
locale: playerProps.props.locale,
|
|
31
|
+
showStreamsCloudWatermark: playerProps.props.showStreamsCloudWatermark,
|
|
32
|
+
on: playerProps.props.on
|
|
33
|
+
};
|
|
34
|
+
let mediaDataLoading = $state(!!config);
|
|
35
|
+
let mediaCenterSettings = $state.raw(null);
|
|
36
|
+
let mediaCenterMode = $state(playerProps.mode);
|
|
30
37
|
let selectedCategoryId = $state(null);
|
|
31
|
-
let overviewOpened = $state(false);
|
|
32
38
|
let headerHeight = $state(0);
|
|
33
|
-
let
|
|
34
|
-
let
|
|
39
|
+
let computedPlayerProps = $state.raw(playerProps);
|
|
40
|
+
let overviewOpened = $state(false);
|
|
35
41
|
let overviewData = $state.raw(null);
|
|
42
|
+
let streamsInCategoryOpened = $state(false);
|
|
43
|
+
let streamsInCategoryData = $state.raw(null);
|
|
36
44
|
let scrollResizeObserver = null;
|
|
45
|
+
const overlayActivated = $derived(overviewOpened || streamsInCategoryOpened);
|
|
37
46
|
const categories = $derived.by(() => {
|
|
38
|
-
|
|
39
|
-
return [];
|
|
40
|
-
}
|
|
41
|
-
switch (mediaCenterMode) {
|
|
42
|
-
case MediaCenterMode.ShortVideos:
|
|
43
|
-
return mediaCenterConfig.postCategories;
|
|
44
|
-
case MediaCenterMode.Stream:
|
|
45
|
-
return mediaCenterConfig.streamCategories;
|
|
46
|
-
default:
|
|
47
|
-
Utils.assertUnreachable(mediaCenterMode);
|
|
48
|
-
}
|
|
47
|
+
return (mediaCenterSettings === null || mediaCenterSettings === void 0 ? void 0 : mediaCenterSettings.postCategories) || [];
|
|
49
48
|
});
|
|
50
49
|
const logo = $derived.by(() => {
|
|
51
|
-
if (!
|
|
50
|
+
if (!mediaCenterSettings) {
|
|
52
51
|
return null;
|
|
53
52
|
}
|
|
54
|
-
return
|
|
53
|
+
return mediaCenterSettings.logo;
|
|
55
54
|
});
|
|
56
55
|
onMount(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
-
if (
|
|
56
|
+
if (config) {
|
|
58
57
|
try {
|
|
59
|
-
|
|
58
|
+
mediaCenterSettings = yield config.getSettings();
|
|
60
59
|
}
|
|
61
60
|
finally {
|
|
62
61
|
mediaDataLoading = false;
|
|
@@ -69,76 +68,101 @@ onMount(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
69
68
|
onDestroy(() => {
|
|
70
69
|
scrollResizeObserver === null || scrollResizeObserver === void 0 ? void 0 : scrollResizeObserver.disconnect();
|
|
71
70
|
});
|
|
72
|
-
const selectCategory = (categoryId) => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
if (selectedCategoryId === categoryId) {
|
|
77
|
-
if (overviewOpened) {
|
|
78
|
-
overviewOpened = false;
|
|
79
|
-
}
|
|
71
|
+
const selectCategory = (categoryId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
72
|
+
var _a;
|
|
73
|
+
if (!config) {
|
|
80
74
|
return;
|
|
81
75
|
}
|
|
82
76
|
switch (mediaCenterMode) {
|
|
83
77
|
case MediaCenterMode.ShortVideos:
|
|
84
|
-
if (
|
|
78
|
+
if (selectedCategoryId === categoryId) {
|
|
79
|
+
overviewOpened = false;
|
|
85
80
|
return;
|
|
86
81
|
}
|
|
87
|
-
|
|
82
|
+
selectedCategoryId = categoryId;
|
|
83
|
+
computedPlayerProps = {
|
|
84
|
+
mode: MediaCenterMode.ShortVideos,
|
|
85
|
+
props: Object.assign({ dataProvider: makeShortVideosProvider({ config, categoryId }), socialInteractionsHandler: config.shortVideosPlayer.socialInteractionsHandler, analyticsHandler: config.shortVideosPlayer.analyticsHandler }, commonPlayerSettings)
|
|
86
|
+
};
|
|
87
|
+
overviewOpened = false;
|
|
88
88
|
break;
|
|
89
89
|
case MediaCenterMode.Stream:
|
|
90
|
-
|
|
90
|
+
if (selectedCategoryId === categoryId) {
|
|
91
|
+
overviewOpened = false;
|
|
92
|
+
streamsInCategoryOpened = false;
|
|
93
|
+
selectedCategoryId = null;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
selectedCategoryId = categoryId;
|
|
97
|
+
overviewOpened = false;
|
|
98
|
+
streamsInCategoryOpened = true;
|
|
99
|
+
streamsInCategoryData = { loading: true };
|
|
100
|
+
try {
|
|
101
|
+
const streamsResponse = yield config.streamPlayer.getStreamsCursor({ filter: { categoryId }, limit: 5 });
|
|
102
|
+
streamsInCategoryData = {
|
|
103
|
+
loading: false,
|
|
104
|
+
data: {
|
|
105
|
+
categoryName: ((_a = categories.find((c) => c.id === categoryId)) === null || _a === void 0 ? void 0 : _a.name) || '',
|
|
106
|
+
streams: streamsResponse.items
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
catch (_b) {
|
|
111
|
+
streamsInCategoryData = { loading: false, data: { categoryName: '', streams: [] } };
|
|
112
|
+
}
|
|
91
113
|
break;
|
|
92
114
|
default:
|
|
93
115
|
Utils.assertUnreachable(mediaCenterMode);
|
|
94
116
|
}
|
|
95
|
-
|
|
117
|
+
});
|
|
118
|
+
const activateSelectedShortVideoPlayer = (shortVideo) => {
|
|
119
|
+
if (!config) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
mediaCenterMode = MediaCenterMode.ShortVideos;
|
|
123
|
+
computedPlayerProps = {
|
|
124
|
+
mode: MediaCenterMode.ShortVideos,
|
|
125
|
+
props: Object.assign({ dataProvider: makeShortVideosProvider({ config, prefetchedItems: [shortVideo] }), socialInteractionsHandler: config.shortVideosPlayer.socialInteractionsHandler, analyticsHandler: config.shortVideosPlayer.analyticsHandler }, commonPlayerSettings)
|
|
126
|
+
};
|
|
127
|
+
selectedCategoryId = null;
|
|
96
128
|
overviewOpened = false;
|
|
129
|
+
streamsInCategoryOpened = false;
|
|
97
130
|
};
|
|
98
|
-
const
|
|
99
|
-
if (!
|
|
131
|
+
const activateSelectedStreamPlayer = (id) => {
|
|
132
|
+
if (!config) {
|
|
100
133
|
return;
|
|
101
134
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
case MediaCenterMode.Stream:
|
|
108
|
-
initialProps = {
|
|
109
|
-
dataProvider: null,
|
|
110
|
-
socialInteractionsHandler: playerProps.props.postSocialInteractionsHandler,
|
|
111
|
-
localization: playerProps.props.localization,
|
|
112
|
-
showStreamsCloudWatermark: playerProps.props.showStreamsCloudWatermark,
|
|
113
|
-
on: playerProps.props.on
|
|
114
|
-
};
|
|
115
|
-
break;
|
|
116
|
-
default:
|
|
117
|
-
Utils.assertUnreachable(playerProps);
|
|
118
|
-
}
|
|
135
|
+
mediaCenterMode = MediaCenterMode.Stream;
|
|
136
|
+
computedPlayerProps = {
|
|
137
|
+
mode: MediaCenterMode.Stream,
|
|
138
|
+
props: Object.assign({ streamId: id, dataProvider: config.streamPlayer.streamPlayerDataProvider, analyticsHandler: config.streamPlayer.analyticsHandler, postSocialInteractionsHandler: config.streamPlayer.socialInteractionsHandler }, commonPlayerSettings)
|
|
139
|
+
};
|
|
119
140
|
selectedCategoryId = null;
|
|
120
|
-
shortVideoProps = Object.assign(Object.assign({}, initialProps), { dataProvider: makeShortVideosProvider({ dataProvider, prefetchedItems: [shortVideo] }) });
|
|
121
141
|
overviewOpened = false;
|
|
142
|
+
streamsInCategoryOpened = false;
|
|
122
143
|
};
|
|
123
144
|
const toggleOverview = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
124
|
-
if (!
|
|
145
|
+
if (!config) {
|
|
125
146
|
return;
|
|
126
147
|
}
|
|
127
148
|
overviewOpened = !overviewOpened;
|
|
149
|
+
streamsInCategoryOpened = false;
|
|
128
150
|
if (overviewOpened && !overviewData) {
|
|
129
151
|
overviewData = { loading: true };
|
|
130
152
|
try {
|
|
131
|
-
const
|
|
153
|
+
const shortVideosResponse = yield config.shortVideosPlayer.getShortVideosCursor({ filter: {}, limit: 5 });
|
|
154
|
+
const streamsResponse = yield config.streamPlayer.getStreamsCursor({ filter: {}, limit: 5 });
|
|
132
155
|
overviewData = {
|
|
133
156
|
loading: false,
|
|
134
157
|
data: {
|
|
135
|
-
shortVideos:
|
|
136
|
-
products: uniqueById(
|
|
158
|
+
shortVideos: shortVideosResponse.items,
|
|
159
|
+
products: uniqueById(shortVideosResponse.items.flatMap((i) => i.products)).slice(0, 2),
|
|
160
|
+
streams: streamsResponse.items
|
|
137
161
|
}
|
|
138
162
|
};
|
|
139
163
|
}
|
|
140
164
|
catch (_a) {
|
|
141
|
-
overviewData = { loading: false, data: { shortVideos: [], products: [] } };
|
|
165
|
+
overviewData = { loading: false, data: { shortVideos: [], products: [], streams: [] } };
|
|
142
166
|
}
|
|
143
167
|
}
|
|
144
168
|
});
|
|
@@ -238,14 +262,18 @@ const onScrollMounted = (node) => {
|
|
|
238
262
|
</div>
|
|
239
263
|
</div>
|
|
240
264
|
{/snippet}
|
|
241
|
-
{#if
|
|
265
|
+
{#if computedPlayerProps.mode === MediaCenterMode.ShortVideos}
|
|
242
266
|
<ShortVideosPlayerView
|
|
243
|
-
{...
|
|
267
|
+
{...computedPlayerProps.props}
|
|
244
268
|
categoriesSwitcher={categories.length ? categoriesSwitcher : undefined}
|
|
245
269
|
playerLogo={logo}
|
|
246
|
-
fadeContent={
|
|
247
|
-
{:else if
|
|
248
|
-
<StreamPlayer
|
|
270
|
+
fadeContent={overlayActivated} />
|
|
271
|
+
{:else if computedPlayerProps.mode === MediaCenterMode.Stream}
|
|
272
|
+
<StreamPlayer
|
|
273
|
+
{...computedPlayerProps.props}
|
|
274
|
+
categoriesSwitcher={categories.length ? categoriesSwitcher : undefined}
|
|
275
|
+
playerLogo={logo}
|
|
276
|
+
fadeContent={overlayActivated} />
|
|
249
277
|
{/if}
|
|
250
278
|
{#if overviewOpened && overviewData?.loading}
|
|
251
279
|
<Loading positionFixedCenter={true} timeout={600} />
|
|
@@ -253,7 +281,19 @@ const onScrollMounted = (node) => {
|
|
|
253
281
|
|
|
254
282
|
{#if overviewOpened && overviewData?.loading === false}
|
|
255
283
|
<div class="media-center-overview" style={`top:${headerHeight}px`} transition:fade={{ duration: 300 }}>
|
|
256
|
-
<Overview
|
|
284
|
+
<Overview
|
|
285
|
+
data={overviewData.data}
|
|
286
|
+
localization={localization}
|
|
287
|
+
on={{ shortVideoSelected: (shortVideo) => activateSelectedShortVideoPlayer(shortVideo), streamSelected: (id) => activateSelectedStreamPlayer(id) }} />
|
|
288
|
+
</div>
|
|
289
|
+
{/if}
|
|
290
|
+
{#if streamsInCategoryOpened && streamsInCategoryData?.loading}
|
|
291
|
+
<Loading positionFixedCenter={true} timeout={600} />
|
|
292
|
+
{/if}
|
|
293
|
+
|
|
294
|
+
{#if streamsInCategoryOpened && streamsInCategoryData?.loading === false}
|
|
295
|
+
<div class="media-center-overview" style={`top:${headerHeight}px`} transition:fade={{ duration: 300 }}>
|
|
296
|
+
<StreamsInCategory data={streamsInCategoryData.data} on={{ streamSelected: (id) => activateSelectedStreamPlayer(id) }} />
|
|
257
297
|
</div>
|
|
258
298
|
{/if}
|
|
259
299
|
{/if}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { Locale } from '../../core/locale';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IMediaCenterConfig } from '../config/types';
|
|
3
3
|
import type { ShortVideoPlayerProps } from '../../short-videos/short-videos-player/types';
|
|
4
4
|
import type { StreamPlayerProps } from '../../streams/stream-player/types';
|
|
5
|
-
import { type IMediaCenterLocalization } from './media-center-localization';
|
|
6
5
|
import { MediaCenterMode } from './types';
|
|
6
|
+
type PlayerProps = {
|
|
7
|
+
mode: MediaCenterMode.ShortVideos;
|
|
8
|
+
props: ShortVideoPlayerProps;
|
|
9
|
+
} | {
|
|
10
|
+
mode: MediaCenterMode.Stream;
|
|
11
|
+
props: StreamPlayerProps;
|
|
12
|
+
};
|
|
7
13
|
type Props = {
|
|
8
|
-
|
|
9
|
-
playerProps:
|
|
10
|
-
|
|
11
|
-
props: ShortVideoPlayerProps;
|
|
12
|
-
} | {
|
|
13
|
-
type: MediaCenterMode.Stream;
|
|
14
|
-
props: StreamPlayerProps;
|
|
15
|
-
};
|
|
16
|
-
localization?: IMediaCenterLocalization | Locale;
|
|
14
|
+
config: IMediaCenterConfig | null;
|
|
15
|
+
playerProps: PlayerProps;
|
|
16
|
+
locale?: Locale;
|
|
17
17
|
};
|
|
18
18
|
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
19
19
|
type Cmp = ReturnType<typeof Cmp>;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { type Locale } from '../../core/locale';
|
|
2
|
-
import type { IProductCardLocalization } from '../../products/product-card/product-card-localization';
|
|
3
|
-
export interface IMediaCenterLocalization {
|
|
4
|
-
shortVideosSectionTitle?: string;
|
|
5
|
-
overviewLabel?: string;
|
|
6
|
-
productLocalization?: IProductCardLocalization | Locale;
|
|
7
|
-
}
|
|
8
2
|
export declare class MediaCenterLocalization {
|
|
9
3
|
shortVideosSectionTitle: string;
|
|
4
|
+
streamsSectionTitle: string;
|
|
10
5
|
overviewLabel: string;
|
|
11
|
-
|
|
12
|
-
constructor(
|
|
6
|
+
productLocale: Locale;
|
|
7
|
+
constructor(locale: Locale);
|
|
13
8
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {} from '../../core/locale';
|
|
2
2
|
export class MediaCenterLocalization {
|
|
3
3
|
shortVideosSectionTitle;
|
|
4
|
+
streamsSectionTitle;
|
|
4
5
|
overviewLabel;
|
|
5
|
-
|
|
6
|
-
constructor(
|
|
7
|
-
this.shortVideosSectionTitle =
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
6
|
+
productLocale;
|
|
7
|
+
constructor(locale) {
|
|
8
|
+
this.shortVideosSectionTitle = loc.shortVideosSectionTitle[locale];
|
|
9
|
+
this.streamsSectionTitle = loc.streamsSectionTitle[locale];
|
|
10
|
+
this.overviewLabel = loc.overviewLabel[locale];
|
|
11
|
+
this.productLocale = locale;
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
14
|
const loc = {
|
|
@@ -14,6 +16,10 @@ const loc = {
|
|
|
14
16
|
en: 'Popular Short Videos',
|
|
15
17
|
no: 'Populære korte videoer'
|
|
16
18
|
},
|
|
19
|
+
streamsSectionTitle: {
|
|
20
|
+
en: 'Latest Streams',
|
|
21
|
+
no: 'Siste Streams'
|
|
22
|
+
},
|
|
17
23
|
overviewLabel: {
|
|
18
24
|
en: 'Overview',
|
|
19
25
|
no: 'Oversikt'
|