@streamscloud/embeddable 9.0.0 → 10.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/content-player/cmp.content-player.svelte +1 -1
- package/dist/content-player/content-player-config.svelte.d.ts +4 -4
- package/dist/content-player/controls-and-attachments.svelte +1 -1
- package/dist/content-player/header.svelte +1 -1
- package/dist/core/actions/horizontal-wheel-scroll.d.ts +1 -0
- package/dist/core/actions/horizontal-wheel-scroll.js +9 -8
- package/dist/core/document.event-handlers.d.ts +1 -0
- package/dist/core/document.event-handlers.js +3 -0
- package/dist/media-center/config/internal-media-center-analytics-handler.d.ts +1 -1
- package/dist/media-center/config/internal-media-center-config.js +34 -44
- package/dist/media-center/config/operations.generated.d.ts +0 -104
- package/dist/media-center/config/operations.generated.js +0 -320
- package/dist/media-center/config/operations.graphql +0 -24
- package/dist/media-center/config/types.d.ts +7 -9
- package/dist/media-center/media-center/cmp.media-center.svelte +27 -7
- package/dist/media-center/media-center/cmp.media-center.svelte.d.ts +2 -2
- package/dist/media-center/media-center/discover-panel-handler.svelte.d.ts +2 -2
- package/dist/media-center/media-center/discover-panel.svelte +1 -1
- package/dist/media-center/media-center/discover-panel.svelte.d.ts +2 -1
- package/dist/media-center/media-center/post-player-provider-generator.d.ts +2 -2
- package/dist/media-center/media-center/post-player-provider-generator.js +2 -1
- package/dist/media-center/media-center/streams-in-category-panel-handler.svelte.d.ts +5 -2
- package/dist/media-center/media-center/streams-in-category-panel-handler.svelte.js +5 -0
- package/dist/media-center/media-center/streams-in-category-panel.svelte +2 -2
- package/dist/media-center/media-center/streams-in-category-panel.svelte.d.ts +3 -2
- package/dist/media-center/media-center/streams-player-provider-generator.d.ts +8 -0
- package/dist/media-center/media-center/streams-player-provider-generator.js +36 -0
- package/dist/media-center/media-center/types.d.ts +0 -6
- package/dist/posts/controls/cmp.controls.svelte +1 -1
- package/dist/posts/data-loaders/index.d.ts +1 -0
- package/dist/posts/data-loaders/index.js +1 -0
- package/dist/posts/{posts-player → data-loaders}/mapper.d.ts +1 -1
- package/dist/{short-videos/data-providers → posts/data-loaders}/operations.generated.d.ts +82 -4
- package/dist/{short-videos/data-providers → posts/data-loaders}/operations.generated.js +232 -3
- package/dist/posts/data-loaders/operations.graphql +17 -0
- package/dist/posts/data-loaders/posts-loader.d.ts +19 -0
- package/dist/posts/data-loaders/posts-loader.js +28 -0
- package/dist/posts/posts-player/index.d.ts +27 -6
- package/dist/posts/posts-player/index.js +2 -3
- package/dist/posts/posts-player/posts-player-view.svelte +29 -13
- package/dist/posts/posts-player/types.d.ts +2 -2
- package/dist/short-videos/data-providers/internal-short-video-player-items-provider.d.ts +5 -6
- package/dist/short-videos/data-providers/internal-short-video-player-items-provider.js +12 -32
- package/dist/short-videos/short-videos-player/index.d.ts +2 -3
- package/dist/short-videos/short-videos-player/index.js +1 -1
- package/dist/streams/data-loaders/index.d.ts +2 -0
- package/dist/streams/data-loaders/index.js +2 -0
- package/dist/streams/{stream-player → data-loaders}/mapper.d.ts +1 -1
- package/dist/streams/{stream-player → data-loaders}/operations.generated.d.ts +27 -24
- package/dist/streams/{stream-player → data-loaders}/operations.generated.js +18 -17
- package/dist/streams/{stream-player → data-loaders}/operations.graphql +6 -3
- package/dist/streams/data-loaders/stream-pages-loader.d.ts +10 -0
- package/dist/streams/data-loaders/stream-pages-loader.js +33 -0
- package/dist/streams/data-loaders/streams-loader.d.ts +19 -0
- package/dist/streams/data-loaders/streams-loader.js +28 -0
- package/dist/streams/layout/cmp.slot-content.svelte +18 -13
- package/dist/streams/layout/element-views/cmp.button-stream-element.svelte +26 -0
- package/dist/streams/layout/element-views/cmp.button-stream-element.svelte.d.ts +10 -0
- package/dist/streams/layout/element-views/cmp.products-slider-stream-element.svelte +43 -0
- package/dist/streams/layout/element-views/cmp.products-slider-stream-element.svelte.d.ts +13 -0
- package/dist/streams/layout/element-views/cmp.stream-element.svelte +8 -6
- package/dist/streams/layout/element-views/index.d.ts +2 -0
- package/dist/streams/layout/element-views/index.js +2 -0
- package/dist/streams/layout/element-views/price-element-view.svelte +3 -0
- package/dist/streams/layout/elements.d.ts +20 -2
- package/dist/streams/layout/enums.d.ts +4 -1
- package/dist/streams/layout/enums.js +3 -0
- package/dist/streams/layout/index.d.ts +1 -0
- package/dist/streams/layout/index.js +15 -0
- package/dist/streams/layout/serializer.svelte.js +30 -5
- package/dist/streams/layout/slot-data-input.d.ts +5 -1
- package/dist/streams/layout/slot-data-ref.d.ts +2 -2
- package/dist/streams/layout/slot-data.d.ts +6 -1
- package/dist/streams/layout/styles-transformer.d.ts +3 -1
- package/dist/streams/layout/styles-transformer.js +47 -0
- package/dist/streams/layout/styles.d.ts +25 -0
- package/dist/streams/layout/type-guards.d.ts +11 -4
- package/dist/streams/layout/type-guards.js +17 -3
- package/dist/streams/{stream-player → streams-player}/index.d.ts +21 -22
- package/dist/streams/{stream-player → streams-player}/index.js +9 -7
- package/dist/streams/streams-player/internal-streams-player-data-provider.d.ts +16 -0
- package/dist/streams/streams-player/internal-streams-player-data-provider.js +55 -0
- package/dist/streams/{stream-player → streams-player}/stream-overview.svelte +18 -15
- package/dist/streams/{stream-player → streams-player}/stream-overview.svelte.d.ts +2 -2
- package/dist/streams/streams-player/streams-player-buffer.svelte.d.ts +8 -0
- package/dist/streams/streams-player/streams-player-buffer.svelte.js +15 -0
- package/dist/streams/{stream-player/stream-player-view.svelte → streams-player/streams-player-view.svelte} +69 -55
- package/dist/streams/streams-player/streams-player-view.svelte.d.ts +8 -0
- package/dist/streams/{stream-player → streams-player}/types.d.ts +9 -7
- package/dist/ui/{player-button → player/button}/cmp.player-button.svelte +1 -1
- package/dist/ui/{player-button → player/button}/cmp.player-button.svelte.d.ts +1 -1
- package/dist/ui/{player-button → player/button}/cmp.player-buttons-group.svelte +1 -1
- package/dist/ui/{player-button → player/button}/types.d.ts +1 -1
- package/dist/ui/player/button/types.js +1 -0
- package/dist/ui/player/providers/chunks-player-buffer/index.d.ts +2 -0
- package/dist/ui/player/providers/chunks-player-buffer/index.js +2 -0
- package/dist/ui/player/providers/chunks-player-buffer/player-chunk-item.svelte.d.ts +11 -0
- package/dist/ui/player/providers/chunks-player-buffer/player-chunk-item.svelte.js +11 -0
- package/dist/ui/player/providers/chunks-player-buffer/player-chunk.svelte.d.ts +31 -0
- package/dist/ui/player/providers/chunks-player-buffer/player-chunk.svelte.js +67 -0
- package/dist/ui/player/providers/chunks-player-buffer/player-chunks-manager.svelte.d.ts +23 -0
- package/dist/ui/player/providers/chunks-player-buffer/player-chunks-manager.svelte.js +125 -0
- package/dist/ui/player/providers/default-chunks-player-buffer.svelte.d.ts +20 -0
- package/dist/ui/player/providers/default-chunks-player-buffer.svelte.js +47 -0
- package/dist/ui/player/providers/default-feed-player-buffer.svelte.d.ts +27 -0
- package/dist/ui/player/providers/default-feed-player-buffer.svelte.js +78 -0
- package/dist/ui/player/providers/index.d.ts +3 -0
- package/dist/ui/player/providers/index.js +2 -0
- package/dist/ui/player/providers/types.d.ts +49 -0
- package/dist/ui/{player-slider → player/slider}/cmp.player-slider.svelte +7 -20
- package/dist/ui/{player-slider → player/slider}/cmp.player-slider.svelte.d.ts +4 -4
- package/dist/ui/{player-slider → player/slider}/index.d.ts +0 -2
- package/dist/ui/{player-slider → player/slider}/index.js +0 -1
- package/dist/ui/player/slider/types.d.ts +16 -0
- package/dist/ui/player/slider/types.js +1 -0
- package/package.json +4 -4
- package/dist/posts/posts-player/operations.generated.d.ts +0 -80
- package/dist/posts/posts-player/operations.generated.js +0 -229
- package/dist/posts/posts-player/operations.graphql +0 -7
- package/dist/short-videos/data-providers/operations.graphql +0 -9
- package/dist/streams/layout/element-views/stream-element-localization.d.ts +0 -7
- package/dist/streams/layout/element-views/stream-element-localization.js +0 -11
- package/dist/streams/stream-player/internal-stream-player-data-provider.d.ts +0 -12
- package/dist/streams/stream-player/internal-stream-player-data-provider.js +0 -48
- package/dist/streams/stream-player/stream-player-buffer.svelte.d.ts +0 -28
- package/dist/streams/stream-player/stream-player-buffer.svelte.js +0 -79
- package/dist/streams/stream-player/stream-player-view.svelte.d.ts +0 -8
- package/dist/ui/player-button/types.js +0 -1
- package/dist/ui/player-slider/player-buffer.svelte.d.ts +0 -32
- package/dist/ui/player-slider/player-buffer.svelte.js +0 -76
- package/dist/ui/player-slider/types.d.ts +0 -26
- /package/dist/posts/{posts-player → data-loaders}/mapper.js +0 -0
- /package/dist/streams/{stream-player → data-loaders}/mapper.js +0 -0
- /package/dist/streams/{stream-player → streams-player}/internal-stream-analytics-handler.d.ts +0 -0
- /package/dist/streams/{stream-player → streams-player}/internal-stream-analytics-handler.js +0 -0
- /package/dist/streams/{stream-player → streams-player}/stream-player-localization.d.ts +0 -0
- /package/dist/streams/{stream-player → streams-player}/stream-player-localization.js +0 -0
- /package/dist/streams/{stream-player → streams-player}/types.js +0 -0
- /package/dist/ui/{player-button → player/button}/cmp.player-buttons-group.svelte.d.ts +0 -0
- /package/dist/ui/{player-button → player/button}/index.d.ts +0 -0
- /package/dist/ui/{player-button → player/button}/index.js +0 -0
- /package/dist/ui/{player-slider → player/providers}/types.js +0 -0
- /package/dist/ui/{player-slider → player/slider}/prevent-slider-scroll.d.ts +0 -0
- /package/dist/ui/{player-slider → player/slider}/prevent-slider-scroll.js +0 -0
- /package/dist/ui/{player-slider → player/slider}/wheel-gestures-adapter.d.ts +0 -0
- /package/dist/ui/{player-slider → player/slider}/wheel-gestures-adapter.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StreamComponentDataType } from './enums';
|
|
2
|
-
export type StreamSlotDataInput = ImagesStreamSlotDataInput | ProductStreamSlotDataInput | ShortVideoStreamSlotDataInput;
|
|
2
|
+
export type StreamSlotDataInput = ImagesStreamSlotDataInput | ProductStreamSlotDataInput | ProductsStreamSlotDataInput | ShortVideoStreamSlotDataInput;
|
|
3
3
|
export interface ImagesStreamSlotDataInput {
|
|
4
4
|
type: StreamComponentDataType.Images;
|
|
5
5
|
ids: string[];
|
|
@@ -8,6 +8,10 @@ export interface ProductStreamSlotDataInput {
|
|
|
8
8
|
type: StreamComponentDataType.Product;
|
|
9
9
|
id: string;
|
|
10
10
|
}
|
|
11
|
+
export interface ProductsStreamSlotDataInput {
|
|
12
|
+
type: StreamComponentDataType.Products;
|
|
13
|
+
ids: string[];
|
|
14
|
+
}
|
|
11
15
|
export interface ShortVideoStreamSlotDataInput {
|
|
12
16
|
type: StreamComponentDataType.ShortVideo;
|
|
13
17
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ImagesStreamSlotData, ProductStreamSlotData, ShortVideoStreamSlotData } from './slot-data';
|
|
2
|
-
export type StreamSlotDataRef = Partial<Pick<ImagesStreamSlotData, 'items'>> & Partial<Pick<ProductStreamSlotData, 'product'>> & Partial<Pick<ShortVideoStreamSlotData, 'shortVideo'>>;
|
|
1
|
+
import type { ImagesStreamSlotData, ProductsStreamSlotData, ProductStreamSlotData, ShortVideoStreamSlotData } from './slot-data';
|
|
2
|
+
export type StreamSlotDataRef = Partial<Pick<ImagesStreamSlotData, 'items'>> & Partial<Pick<ProductStreamSlotData, 'product'>> & Partial<Pick<ProductsStreamSlotData, 'products'>> & Partial<Pick<ShortVideoStreamSlotData, 'shortVideo'>>;
|
|
3
3
|
type Prev = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...0[]];
|
|
4
4
|
type Join<K, P> = K extends string | number ? (P extends string | number ? `${K}${'' extends P ? '' : '.'}${P}` : never) : never;
|
|
5
5
|
type IsPrimitive<T> = T extends string | number | boolean | null | undefined ? true : false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StreamComponentDataType } from './enums';
|
|
2
2
|
import type { StreamLayoutBlobModel, StreamLayoutProductModel, StreamLayoutShortVideoModel } from './models';
|
|
3
|
-
export type StreamSlotData = ImagesStreamSlotData | ProductStreamSlotData | ShortVideoStreamSlotData;
|
|
3
|
+
export type StreamSlotData = ImagesStreamSlotData | ProductStreamSlotData | ProductsStreamSlotData | ShortVideoStreamSlotData;
|
|
4
4
|
export type ImagesStreamSlotData = {
|
|
5
5
|
type: StreamComponentDataType.Images;
|
|
6
6
|
ids: string[];
|
|
@@ -11,6 +11,11 @@ export type ProductStreamSlotData = {
|
|
|
11
11
|
id: string;
|
|
12
12
|
product: StreamLayoutProductModel | null;
|
|
13
13
|
};
|
|
14
|
+
export type ProductsStreamSlotData = {
|
|
15
|
+
type: StreamComponentDataType.Products;
|
|
16
|
+
ids: string[];
|
|
17
|
+
products: StreamLayoutProductModel[];
|
|
18
|
+
};
|
|
14
19
|
export type ShortVideoStreamSlotData = {
|
|
15
20
|
type: StreamComponentDataType.ShortVideo;
|
|
16
21
|
id: string;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { StreamElementStyleFontFamily, StreamElementStyleFontWeight, StreamElementStyleHorizontalAlign, AnnotationStreamElementPlacement } from './enums';
|
|
2
|
-
import type { AnnotationStreamElementStyles, ContainerStreamElementStyles, ImageStreamElementStyles, StreamLayoutStyles, TextStreamElementStyles } from './styles';
|
|
2
|
+
import type { AnnotationStreamElementStyles, ButtonStreamElementStyles, ContainerStreamElementStyles, ImageStreamElementStyles, ProductsSliderStreamElementStyles, StreamLayoutStyles, TextStreamElementStyles } from './styles';
|
|
3
3
|
export declare const generateStreamLayoutStyles: (styles: StreamLayoutStyles | null) => string;
|
|
4
4
|
export declare const generateContainerStyles: (styles: Partial<ContainerStreamElementStyles> | null) => string;
|
|
5
|
+
export declare const generateButtonStyles: (styles: Partial<ButtonStreamElementStyles> | null) => string;
|
|
5
6
|
export declare const generateAnnotationStyles: (styles: AnnotationStreamElementStyles, placement: AnnotationStreamElementPlacement) => string;
|
|
7
|
+
export declare const generateProductsSliderStyles: (styles: Partial<ProductsSliderStreamElementStyles> | null) => string;
|
|
6
8
|
export declare const generateTextStyles: (styles: Partial<TextStreamElementStyles> | null) => string;
|
|
7
9
|
export declare const generateImageStyles: (styles: Partial<ImageStreamElementStyles> | null) => string;
|
|
8
10
|
export declare const mapFontFamily: (value: StreamElementStyleFontFamily | null | undefined) => string;
|
|
@@ -32,6 +32,32 @@ export const generateContainerStyles = (styles) => {
|
|
|
32
32
|
}
|
|
33
33
|
return values.join(';');
|
|
34
34
|
};
|
|
35
|
+
export const generateButtonStyles = (styles) => {
|
|
36
|
+
styles = styles || {};
|
|
37
|
+
const values = [
|
|
38
|
+
'display: flex',
|
|
39
|
+
`justify-content: ${mapFlexJustifyContent(styles.textAlign)}`,
|
|
40
|
+
`text-align: ${mapTextAlign(styles.textAlign)}`,
|
|
41
|
+
`align-items: center`,
|
|
42
|
+
`min-width: ${transformNumericValue(styles.minWidth, '0')}`,
|
|
43
|
+
`max-width: ${transformNumericValue(styles.maxWidth, '100%')}`,
|
|
44
|
+
`height: ${transformNumericValue(styles.height, 'fit-content')}`,
|
|
45
|
+
`font-family: ${mapFontFamily(styles.fontFamily)}`,
|
|
46
|
+
`font-size: ${transformFontSizeValue(styles.fontSize)}`,
|
|
47
|
+
`font-weight: ${mapFontWeight(styles.fontWeight)}`,
|
|
48
|
+
`padding-top: ${transformNumericValue(styles.paddingTop)}`,
|
|
49
|
+
`padding-right: ${transformNumericValue(styles.paddingRight)}`,
|
|
50
|
+
`padding-bottom: ${transformNumericValue(styles.paddingBottom)}`,
|
|
51
|
+
`padding-left: ${transformNumericValue(styles.paddingLeft)}`,
|
|
52
|
+
`color: ${transformColorValue(styles.textColor)}`,
|
|
53
|
+
`background-color: ${transformColorValue(styles.backgroundColor)}`,
|
|
54
|
+
`border-width: ${styles.borderColor ? '1px' : '0'}`,
|
|
55
|
+
`border-radius: ${transformNumericValue(styles.borderRadius)}`,
|
|
56
|
+
`border-color: ${transformColorValue(styles.borderColor)}`,
|
|
57
|
+
`overflow: hidden`
|
|
58
|
+
];
|
|
59
|
+
return values.join(';');
|
|
60
|
+
};
|
|
35
61
|
export const generateAnnotationStyles = (styles, placement) => {
|
|
36
62
|
const values = [`height: ${transformNumericValue(styles.height)}`, `aspect-ratio: ${styles.aspectRatio}`, 'position: absolute'];
|
|
37
63
|
switch (placement) {
|
|
@@ -56,6 +82,27 @@ export const generateAnnotationStyles = (styles, placement) => {
|
|
|
56
82
|
}
|
|
57
83
|
return values.join(';');
|
|
58
84
|
};
|
|
85
|
+
export const generateProductsSliderStyles = (styles) => {
|
|
86
|
+
styles = styles || {};
|
|
87
|
+
const values = [
|
|
88
|
+
'display: flex',
|
|
89
|
+
'flex-direction: row',
|
|
90
|
+
`width: 100%`,
|
|
91
|
+
`height: 100%`,
|
|
92
|
+
`gap: ${transformNumericValue(styles.gap)}`,
|
|
93
|
+
`padding-top: ${transformNumericValue(styles.paddingTop)}`,
|
|
94
|
+
`padding-right: ${transformNumericValue(styles.paddingRight)}`,
|
|
95
|
+
`padding-bottom: ${transformNumericValue(styles.paddingBottom)}`,
|
|
96
|
+
`padding-left: ${transformNumericValue(styles.paddingLeft)}`,
|
|
97
|
+
`background-color: ${transformColorValue(styles.backgroundColor)}`,
|
|
98
|
+
`overflow-x: auto`,
|
|
99
|
+
`overflow-y: hidden`,
|
|
100
|
+
`scrollbar-width: none`,
|
|
101
|
+
`scroll-padding-left: ${transformNumericValue(styles.paddingLeft)}`,
|
|
102
|
+
`scroll-padding-right: ${transformNumericValue(styles.paddingRight)}`
|
|
103
|
+
];
|
|
104
|
+
return values.join(';');
|
|
105
|
+
};
|
|
59
106
|
export const generateTextStyles = (styles) => {
|
|
60
107
|
styles = styles || {};
|
|
61
108
|
const values = [
|
|
@@ -10,6 +10,23 @@ export type AnnotationStreamElementStyles = {
|
|
|
10
10
|
offsetX: number;
|
|
11
11
|
offsetY: number;
|
|
12
12
|
};
|
|
13
|
+
export type ButtonStreamElementStyles = {
|
|
14
|
+
minWidth?: number | null;
|
|
15
|
+
maxWidth?: number | null;
|
|
16
|
+
height?: number | null;
|
|
17
|
+
fontSize?: number | null;
|
|
18
|
+
fontWeight?: StreamElementStyleFontWeight | null;
|
|
19
|
+
fontFamily?: StreamElementStyleFontFamily | null;
|
|
20
|
+
textAlign?: StreamElementStyleHorizontalAlign | null;
|
|
21
|
+
paddingTop?: number | null;
|
|
22
|
+
paddingRight?: number | null;
|
|
23
|
+
paddingBottom?: number | null;
|
|
24
|
+
paddingLeft?: number | null;
|
|
25
|
+
textColor?: string | null;
|
|
26
|
+
backgroundColor?: string | null;
|
|
27
|
+
borderRadius?: number | null;
|
|
28
|
+
borderColor?: string | null;
|
|
29
|
+
};
|
|
13
30
|
export type ContainerStreamElementStyles = {
|
|
14
31
|
width?: StreamCssValue | null;
|
|
15
32
|
height?: StreamCssValue | null;
|
|
@@ -38,6 +55,14 @@ export type PriceStreamElementStyles = {
|
|
|
38
55
|
beforeValueColor?: string | null;
|
|
39
56
|
horizontalAlign?: StreamElementStyleHorizontalAlign | null;
|
|
40
57
|
};
|
|
58
|
+
export type ProductsSliderStreamElementStyles = {
|
|
59
|
+
gap?: number;
|
|
60
|
+
paddingTop?: number | null;
|
|
61
|
+
paddingBottom?: number | null;
|
|
62
|
+
paddingLeft?: number | null;
|
|
63
|
+
paddingRight?: number | null;
|
|
64
|
+
backgroundColor?: string | null;
|
|
65
|
+
};
|
|
41
66
|
export type StockStreamElementStyles = {
|
|
42
67
|
height?: number | null;
|
|
43
68
|
horizontalAlign?: StreamElementStyleHorizontalAlign | null;
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import type { AnnotationStreamElementModel, ContainerStreamElementModel, ImageRefStreamElementModel, ImagesStreamElementModel, PriceStreamElementModel, ShortVideoStreamElementModel, SpacerStreamElementModel, StockStreamElementModel, TextRefStreamElementModel, TextStreamElementModel, WebViewStreamElementModel } from './elements';
|
|
1
|
+
import type { AnnotationStreamElementModel, ButtonStreamElementModel, ContainerStreamElementModel, ImageRefStreamElementModel, ImagesStreamElementModel, PriceStreamElementModel, ProductsSliderStreamElementModel, ShortVideoStreamElementModel, SpacerStreamElementModel, StockStreamElementModel, TextRefStreamElementModel, TextStreamElementModel, WebViewStreamElementModel } from './elements';
|
|
2
2
|
import { StreamElementType } from './enums';
|
|
3
|
-
import type { ImagesStreamSlotData, ProductStreamSlotData, ShortVideoStreamSlotData, StreamSlotData } from './slot-data';
|
|
4
|
-
import type { ImagesStreamSlotDataInput, ProductStreamSlotDataInput, ShortVideoStreamSlotDataInput, StreamSlotDataInput } from './slot-data-input';
|
|
5
|
-
import type { AnnotationStreamElementStyles, ContainerStreamElementStyles, ImageStreamElementStyles, PriceStreamElementStyles, StockStreamElementStyles, TextStreamElementStyles } from './styles';
|
|
3
|
+
import type { ImagesStreamSlotData, ProductsStreamSlotData, ProductStreamSlotData, ShortVideoStreamSlotData, StreamSlotData } from './slot-data';
|
|
4
|
+
import type { ImagesStreamSlotDataInput, ProductsStreamSlotDataInput, ProductStreamSlotDataInput, ShortVideoStreamSlotDataInput, StreamSlotDataInput } from './slot-data-input';
|
|
5
|
+
import type { AnnotationStreamElementStyles, ButtonStreamElementStyles, ContainerStreamElementStyles, ImageStreamElementStyles, PriceStreamElementStyles, ProductsSliderStreamElementStyles, StockStreamElementStyles, TextStreamElementStyles } from './styles';
|
|
6
6
|
export declare function isImagesSlotDataInput(data: StreamSlotDataInput | null): data is ImagesStreamSlotDataInput;
|
|
7
7
|
export declare function isProductSlotDataInput(data: StreamSlotDataInput | null): data is ProductStreamSlotDataInput;
|
|
8
|
+
export declare function isProductsSlotDataInput(data: StreamSlotDataInput | null): data is ProductsStreamSlotDataInput;
|
|
8
9
|
export declare function isShortVideoSlotDataInput(data: StreamSlotDataInput | null): data is ShortVideoStreamSlotDataInput;
|
|
9
10
|
export declare function isImagesSlotData(data: StreamSlotData | null): data is ImagesStreamSlotData;
|
|
10
11
|
export declare function isProductSlotData(data: StreamSlotData | null): data is ProductStreamSlotData;
|
|
12
|
+
export declare function isProductsSlotData(data: StreamSlotData | null): data is ProductsStreamSlotData;
|
|
11
13
|
export declare function isShortVideoSlotData(data: StreamSlotData | null): data is ShortVideoStreamSlotData;
|
|
12
14
|
export type ElementTypeToStylesMap = {
|
|
13
15
|
[StreamElementType.Annotation]: AnnotationStreamElementStyles;
|
|
16
|
+
[StreamElementType.Button]: ButtonStreamElementStyles;
|
|
14
17
|
[StreamElementType.Container]: ContainerStreamElementStyles;
|
|
15
18
|
[StreamElementType.Price]: PriceStreamElementStyles;
|
|
19
|
+
[StreamElementType.ProductsSlider]: ProductsSliderStreamElementStyles;
|
|
16
20
|
[StreamElementType.ImageRef]: ImageStreamElementStyles;
|
|
17
21
|
[StreamElementType.Stock]: StockStreamElementStyles;
|
|
18
22
|
[StreamElementType.Text]: TextStreamElementStyles;
|
|
@@ -20,10 +24,12 @@ export type ElementTypeToStylesMap = {
|
|
|
20
24
|
};
|
|
21
25
|
export type ElementTypeToModelMap = {
|
|
22
26
|
[StreamElementType.Annotation]: AnnotationStreamElementModel;
|
|
27
|
+
[StreamElementType.Button]: ButtonStreamElementModel;
|
|
23
28
|
[StreamElementType.Container]: ContainerStreamElementModel;
|
|
24
29
|
[StreamElementType.ImageRef]: ImageRefStreamElementModel;
|
|
25
30
|
[StreamElementType.Images]: ImagesStreamElementModel;
|
|
26
31
|
[StreamElementType.Price]: PriceStreamElementModel;
|
|
32
|
+
[StreamElementType.ProductsSlider]: ProductsSliderStreamElementModel;
|
|
27
33
|
[StreamElementType.ShortVideo]: ShortVideoStreamElementModel;
|
|
28
34
|
[StreamElementType.Spacer]: SpacerStreamElementModel;
|
|
29
35
|
[StreamElementType.Stock]: StockStreamElementModel;
|
|
@@ -34,6 +40,7 @@ export type ElementTypeToModelMap = {
|
|
|
34
40
|
export declare const NotAllowedElementTypesForComponent: {
|
|
35
41
|
IMAGES: StreamElementType[];
|
|
36
42
|
PRODUCT: StreamElementType[];
|
|
43
|
+
PRODUCTS: StreamElementType[];
|
|
37
44
|
SHORT_VIDEO: StreamElementType[];
|
|
38
45
|
NO_DATA: StreamElementType[];
|
|
39
46
|
};
|
|
@@ -6,6 +6,9 @@ export function isImagesSlotDataInput(data) {
|
|
|
6
6
|
export function isProductSlotDataInput(data) {
|
|
7
7
|
return data?.type === StreamComponentDataType.Product;
|
|
8
8
|
}
|
|
9
|
+
export function isProductsSlotDataInput(data) {
|
|
10
|
+
return data?.type === StreamComponentDataType.Products;
|
|
11
|
+
}
|
|
9
12
|
export function isShortVideoSlotDataInput(data) {
|
|
10
13
|
return data?.type === StreamComponentDataType.ShortVideo;
|
|
11
14
|
}
|
|
@@ -16,17 +19,28 @@ export function isImagesSlotData(data) {
|
|
|
16
19
|
export function isProductSlotData(data) {
|
|
17
20
|
return data?.type === StreamComponentDataType.Product;
|
|
18
21
|
}
|
|
22
|
+
export function isProductsSlotData(data) {
|
|
23
|
+
return data?.type === StreamComponentDataType.Products;
|
|
24
|
+
}
|
|
19
25
|
export function isShortVideoSlotData(data) {
|
|
20
26
|
return data?.type === StreamComponentDataType.ShortVideo;
|
|
21
27
|
}
|
|
22
28
|
export const NotAllowedElementTypesForComponent = {
|
|
23
|
-
[StreamComponentDataType.Images]: [
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
[StreamComponentDataType.Images]: [
|
|
30
|
+
StreamElementType.ImageRef,
|
|
31
|
+
StreamElementType.Price,
|
|
32
|
+
StreamElementType.ProductsSlider,
|
|
33
|
+
StreamElementType.ShortVideo,
|
|
34
|
+
StreamElementType.TextRef
|
|
35
|
+
],
|
|
36
|
+
[StreamComponentDataType.Product]: [StreamElementType.Images, StreamElementType.ProductsSlider, StreamElementType.ShortVideo],
|
|
37
|
+
[StreamComponentDataType.Products]: [StreamElementType.Images, StreamElementType.ShortVideo],
|
|
38
|
+
[StreamComponentDataType.ShortVideo]: [StreamElementType.ImageRef, StreamElementType.Price, StreamElementType.ProductsSlider, StreamElementType.TextRef],
|
|
26
39
|
[StreamComponentDataType.NoData]: [
|
|
27
40
|
StreamElementType.ImageRef,
|
|
28
41
|
StreamElementType.Images,
|
|
29
42
|
StreamElementType.Price,
|
|
43
|
+
StreamElementType.ProductsSlider,
|
|
30
44
|
StreamElementType.ShortVideo,
|
|
31
45
|
StreamElementType.TextRef
|
|
32
46
|
]
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import { type IMediaCenterConfig } from '../../media-center/config/types';
|
|
2
2
|
import type { IPostSocialInteractionsHandler } from '../../posts/social-interactions';
|
|
3
3
|
import type { StreamPageViewerModel } from '../stream-page-viewer/types';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export {
|
|
7
|
-
export type {
|
|
4
|
+
import type { IStreamAnalyticsHandler, IStreamsPlayerDataProvider, StreamAmplificationParameters, StreamPlayerModel, StreamsPlayerSettings } from './types';
|
|
5
|
+
export { type StreamPlayerModel, type StreamPageViewerModel };
|
|
6
|
+
export { mapToStreamPlayerModel } from '../data-loaders/mapper';
|
|
7
|
+
export type { IStreamsPlayerDataProvider, IStreamAnalyticsHandler, IMediaCenterConfig };
|
|
8
8
|
/**
|
|
9
|
-
* Opens the
|
|
9
|
+
* Opens the streams player modal.
|
|
10
10
|
*
|
|
11
11
|
* Two overloads (mutually exclusive; enforced by TypeScript):
|
|
12
|
-
* - Provider mode:
|
|
13
|
-
* - Internal provider mode:
|
|
12
|
+
* - Provider mode: openStreamsPlayer({ dataProvider, mediaCenterConfig?, analyticsHandler? })
|
|
13
|
+
* - Internal provider mode: openStreamsPlayer({ ids, initiator, graphqlOrigin?, initialId?, mediaPageId? })
|
|
14
14
|
*
|
|
15
15
|
* @param init Configuration options.
|
|
16
16
|
*
|
|
17
|
-
* Common (required)
|
|
18
|
-
* @param {string} init.streamId
|
|
19
|
-
* The ID of the stream to open.
|
|
20
|
-
*
|
|
21
17
|
* Provider mode (overload 1)
|
|
22
|
-
* @param {
|
|
18
|
+
* @param {IStreamsPlayerDataProvider} init.dataProvider
|
|
23
19
|
* Provider that supplies the stream data to the player.
|
|
24
20
|
* @param {IMediaCenterConfig} [init.mediaCenterConfig]
|
|
25
21
|
* Optional media-center config.
|
|
@@ -28,10 +24,14 @@ export type { IStreamPlayerDataProvider, IStreamAnalyticsHandler, IMediaCenterCo
|
|
|
28
24
|
* If omitted in provider mode, analytics is not auto-initialized.
|
|
29
25
|
*
|
|
30
26
|
* Internal provider mode (overload 2)
|
|
27
|
+
* @param {string[]} init.ids
|
|
28
|
+
* List of stream IDs to display.
|
|
31
29
|
* @param {string} init.initiator
|
|
32
30
|
* Initiator identifier (used for tracking/analytics and GraphQL).
|
|
33
31
|
* @param {string} [init.graphqlOrigin]
|
|
34
32
|
* Optional GraphQL origin (base URL). If omitted, the default origin is determined internally.
|
|
33
|
+
* @param {string} [init.initialId]
|
|
34
|
+
* ID of the stream to open first (optional).
|
|
35
35
|
* @param {string} [init.mediaPageId]
|
|
36
36
|
* Optional media page ID used to construct an internal media-center config.
|
|
37
37
|
*
|
|
@@ -69,7 +69,6 @@ export type { IStreamPlayerDataProvider, IStreamAnalyticsHandler, IMediaCenterCo
|
|
|
69
69
|
* import { openStreamPlayer } from '@streamscloud/embeddable/stream-player';
|
|
70
70
|
*
|
|
71
71
|
* openStreamPlayer({
|
|
72
|
-
* streamId: 'stream_123',
|
|
73
72
|
* dataProvider: myStreamProvider,
|
|
74
73
|
* mediaCenterConfig: myMediaCenterProvider,
|
|
75
74
|
* analyticsHandler: myAnalyticsHandler,
|
|
@@ -91,8 +90,8 @@ export type { IStreamPlayerDataProvider, IStreamAnalyticsHandler, IMediaCenterCo
|
|
|
91
90
|
* ```ts
|
|
92
91
|
* import { openStreamPlayer } from '@streamscloud/embeddable/stream-player';
|
|
93
92
|
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
93
|
+
* openStreamsPlayer({
|
|
94
|
+
* ids: ['stream_123'],
|
|
96
95
|
* initiator: 'marketing-campaign',
|
|
97
96
|
* graphqlOrigin: 'https://api.example.com',
|
|
98
97
|
* mediaPageId: 'media-page-123',
|
|
@@ -109,14 +108,13 @@ export type { IStreamPlayerDataProvider, IStreamAnalyticsHandler, IMediaCenterCo
|
|
|
109
108
|
* });
|
|
110
109
|
* ```
|
|
111
110
|
*/
|
|
112
|
-
export declare function
|
|
113
|
-
|
|
114
|
-
dataProvider: IStreamPlayerDataProvider;
|
|
111
|
+
export declare function openStreamsPlayer(init: {
|
|
112
|
+
dataProvider: IStreamsPlayerDataProvider;
|
|
115
113
|
mediaCenterConfig?: IMediaCenterConfig;
|
|
116
114
|
postSocialInteractionsHandler?: IPostSocialInteractionsHandler;
|
|
117
115
|
analyticsHandler?: IStreamAnalyticsHandler;
|
|
118
116
|
amplificationParameters?: StreamAmplificationParameters;
|
|
119
|
-
playerSettings?:
|
|
117
|
+
playerSettings?: StreamsPlayerSettings;
|
|
120
118
|
on?: {
|
|
121
119
|
streamActivated?: (data: {
|
|
122
120
|
title: string;
|
|
@@ -125,13 +123,14 @@ export declare function openStreamPlayer(init: {
|
|
|
125
123
|
playerClosed?: () => void;
|
|
126
124
|
};
|
|
127
125
|
}): void;
|
|
128
|
-
export declare function
|
|
129
|
-
|
|
126
|
+
export declare function openStreamsPlayer(init: {
|
|
127
|
+
ids: string[];
|
|
130
128
|
initiator: string;
|
|
131
129
|
graphqlOrigin?: string;
|
|
130
|
+
initialId?: string;
|
|
132
131
|
mediaPageId?: string;
|
|
133
132
|
amplificationParameters?: StreamAmplificationParameters;
|
|
134
|
-
playerSettings?:
|
|
133
|
+
playerSettings?: StreamsPlayerSettings;
|
|
135
134
|
on?: {
|
|
136
135
|
streamActivated?: (data: {
|
|
137
136
|
title: string;
|
|
@@ -4,13 +4,16 @@ import {} from '../../media-center/config/types';
|
|
|
4
4
|
import { MediaCenter } from '../../media-center/media-center';
|
|
5
5
|
import { ModalShadowHost } from '../../ui/shadow-dom';
|
|
6
6
|
import { InternalStreamAnalyticsHandler } from './internal-stream-analytics-handler';
|
|
7
|
-
import {
|
|
8
|
-
import { mapToStreamPlayerModel } from './mapper';
|
|
7
|
+
import { InternalStreamsPlayerDataProvider } from './internal-streams-player-data-provider';
|
|
9
8
|
import { mount, unmount } from 'svelte';
|
|
10
|
-
export {
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
const
|
|
9
|
+
export {};
|
|
10
|
+
export { mapToStreamPlayerModel } from '../data-loaders/mapper';
|
|
11
|
+
export function openStreamsPlayer(init) {
|
|
12
|
+
const { ids, initialId, graphqlOrigin, postSocialInteractionsHandler, initiator, amplificationParameters, playerSettings, on } = init;
|
|
13
|
+
let dataProvider = init.dataProvider;
|
|
14
|
+
if (!dataProvider && ids?.length) {
|
|
15
|
+
dataProvider = new InternalStreamsPlayerDataProvider({ ids, initialId, graphqlOrigin, initiator });
|
|
16
|
+
}
|
|
14
17
|
if (!dataProvider) {
|
|
15
18
|
toastrWarning('Data provider is not specified.');
|
|
16
19
|
return;
|
|
@@ -32,7 +35,6 @@ export function openStreamPlayer(init) {
|
|
|
32
35
|
playerProps: {
|
|
33
36
|
mode: 'stream',
|
|
34
37
|
props: {
|
|
35
|
-
streamId,
|
|
36
38
|
dataProvider,
|
|
37
39
|
analyticsHandler,
|
|
38
40
|
amplificationParameters,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IStreamsPlayerDataProvider } from './types';
|
|
2
|
+
export declare class InternalStreamsPlayerDataProvider implements IStreamsPlayerDataProvider {
|
|
3
|
+
initialData: IStreamsPlayerDataProvider['initialData'];
|
|
4
|
+
private ids;
|
|
5
|
+
private idOrder;
|
|
6
|
+
private graphql;
|
|
7
|
+
private dataLoader;
|
|
8
|
+
constructor(input: {
|
|
9
|
+
ids: string[];
|
|
10
|
+
initiator?: string;
|
|
11
|
+
graphqlOrigin?: string;
|
|
12
|
+
initialId?: string;
|
|
13
|
+
});
|
|
14
|
+
loadMoreStreams: IStreamsPlayerDataProvider['loadMoreStreams'];
|
|
15
|
+
getStreamPages: IStreamsPlayerDataProvider['getStreamPages'];
|
|
16
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ContinuationToken } from '../../core/continuation-token';
|
|
2
|
+
import { CursorDataLoader } from '../../core/data-loaders';
|
|
3
|
+
import { createLocalGQLClient } from '../../core/graphql';
|
|
4
|
+
import { getStreamPagesCursor, getStreamsCursor } from '../data-loaders';
|
|
5
|
+
const CHUNK_SIZE = 5;
|
|
6
|
+
export class InternalStreamsPlayerDataProvider {
|
|
7
|
+
initialData;
|
|
8
|
+
ids;
|
|
9
|
+
idOrder = new Map();
|
|
10
|
+
graphql;
|
|
11
|
+
dataLoader = new CursorDataLoader({
|
|
12
|
+
loadPage: async (continuationToken) => {
|
|
13
|
+
const startIdIndex = continuationToken.value ? parseInt(continuationToken.value, 10) : 0;
|
|
14
|
+
const endIdIndex = Math.min(startIdIndex + CHUNK_SIZE, this.ids.length);
|
|
15
|
+
const idsChunk = this.ids.slice(startIdIndex, endIdIndex);
|
|
16
|
+
try {
|
|
17
|
+
const streams = await getStreamsCursor({
|
|
18
|
+
filter: { ids: idsChunk },
|
|
19
|
+
limit: idsChunk.length,
|
|
20
|
+
graphql: this.graphql
|
|
21
|
+
});
|
|
22
|
+
const items = streams.items.sort((a, b) => {
|
|
23
|
+
const ia = this.idOrder.get(a.id) ?? Number.MAX_SAFE_INTEGER;
|
|
24
|
+
const ib = this.idOrder.get(b.id) ?? Number.MAX_SAFE_INTEGER;
|
|
25
|
+
return ia - ib;
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
items,
|
|
29
|
+
continuationToken: ContinuationToken.fromPayload(endIdIndex < this.ids.length ? endIdIndex.toString() : null)
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
constructor(input) {
|
|
38
|
+
const { ids, initialId, graphqlOrigin, initiator } = input;
|
|
39
|
+
this.graphql = createLocalGQLClient(graphqlOrigin, initiator ? { 'x-initiator': initiator } : undefined);
|
|
40
|
+
this.ids = ids;
|
|
41
|
+
if (initialId && this.ids.includes(initialId)) {
|
|
42
|
+
this.ids = [initialId, ...this.ids.filter((id) => id !== initialId)];
|
|
43
|
+
}
|
|
44
|
+
this.ids.forEach((id, index) => this.idOrder.set(id, index));
|
|
45
|
+
this.initialData = { prefetchedStreams: [] };
|
|
46
|
+
}
|
|
47
|
+
loadMoreStreams = () => this.dataLoader.loadMore();
|
|
48
|
+
getStreamPages = async (streamId, continuationToken) => {
|
|
49
|
+
return await getStreamPagesCursor({
|
|
50
|
+
streamId,
|
|
51
|
+
continuationToken,
|
|
52
|
+
graphql: this.graphql
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -41,22 +41,25 @@ let { model, buffer, activePageId, on, localization } = $props();
|
|
|
41
41
|
{localization.pagesCount(model.pagesCount)}
|
|
42
42
|
</div>
|
|
43
43
|
</div>
|
|
44
|
+
|
|
44
45
|
<div class="stream-overview-pages">
|
|
45
|
-
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
{#if buffer.activeChunk}
|
|
47
|
+
<InfiniteScrolling loadMore={buffer.activeChunk.loadMore}>
|
|
48
|
+
<div class="stream-overview-pages__grid">
|
|
49
|
+
{#each buffer.activeChunk.items as item, index (item.id)}
|
|
50
|
+
<button
|
|
51
|
+
type="button"
|
|
52
|
+
class="stream-overview-pages__page"
|
|
53
|
+
class:stream-overview-pages__page--active={activePageId === item.id}
|
|
54
|
+
onclick={() => on.setCurrentItem(index)}>
|
|
55
|
+
<ProportionalContainer ratio={9 / 16}>
|
|
56
|
+
<Image src={item.cover} />
|
|
57
|
+
</ProportionalContainer>
|
|
58
|
+
</button>
|
|
59
|
+
{/each}
|
|
60
|
+
</div>
|
|
61
|
+
</InfiniteScrolling>
|
|
62
|
+
{/if}
|
|
60
63
|
</div>
|
|
61
64
|
|
|
62
65
|
<style>@keyframes fadeIn {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { StreamPlayerBuffer } from './stream-player-buffer.svelte';
|
|
2
1
|
import { StreamPlayerLocalization } from './stream-player-localization';
|
|
2
|
+
import type { StreamsPlayerBuffer } from './streams-player-buffer.svelte';
|
|
3
3
|
import type { StreamPlayerModel } from './types';
|
|
4
4
|
type Props = {
|
|
5
5
|
model: StreamPlayerModel;
|
|
6
|
-
buffer:
|
|
6
|
+
buffer: StreamsPlayerBuffer;
|
|
7
7
|
activePageId: string;
|
|
8
8
|
localization: StreamPlayerLocalization;
|
|
9
9
|
on: {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StreamPageViewerModel } from '../stream-page-viewer';
|
|
2
|
+
import { DefaultChunksPlayerBuffer } from '../../ui/player/providers';
|
|
3
|
+
import type { IStreamsPlayerDataProvider, StreamPlayerModel } from './types';
|
|
4
|
+
export declare class StreamsPlayerBuffer extends DefaultChunksPlayerBuffer<StreamPageViewerModel, StreamPlayerModel> {
|
|
5
|
+
constructor(provider: IStreamsPlayerDataProvider, on?: {
|
|
6
|
+
preloaded?: (self: StreamsPlayerBuffer) => void;
|
|
7
|
+
});
|
|
8
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DefaultChunksPlayerBuffer } from '../../ui/player/providers';
|
|
2
|
+
export class StreamsPlayerBuffer extends DefaultChunksPlayerBuffer {
|
|
3
|
+
constructor(provider, on) {
|
|
4
|
+
super({
|
|
5
|
+
kind: 'chunks',
|
|
6
|
+
initialData: {
|
|
7
|
+
prefetchedChunks: provider.initialData.prefetchedStreams
|
|
8
|
+
},
|
|
9
|
+
loadMoreChunks: async () => {
|
|
10
|
+
return await provider.loadMoreStreams();
|
|
11
|
+
},
|
|
12
|
+
loadChunkItems: provider.getStreamPages
|
|
13
|
+
}, on);
|
|
14
|
+
}
|
|
15
|
+
}
|