@streamscloud/embeddable 9.0.0 → 10.0.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.
Files changed (119) hide show
  1. package/dist/content-player/cmp.content-player.svelte +1 -1
  2. package/dist/content-player/content-player-config.svelte.d.ts +4 -4
  3. package/dist/content-player/controls-and-attachments.svelte +1 -1
  4. package/dist/content-player/header.svelte +1 -1
  5. package/dist/core/document.event-handlers.d.ts +1 -0
  6. package/dist/core/document.event-handlers.js +3 -0
  7. package/dist/media-center/config/internal-media-center-analytics-handler.d.ts +1 -1
  8. package/dist/media-center/config/internal-media-center-config.js +34 -44
  9. package/dist/media-center/config/operations.generated.d.ts +0 -104
  10. package/dist/media-center/config/operations.generated.js +0 -320
  11. package/dist/media-center/config/operations.graphql +0 -24
  12. package/dist/media-center/config/types.d.ts +7 -9
  13. package/dist/media-center/media-center/cmp.media-center.svelte +27 -7
  14. package/dist/media-center/media-center/cmp.media-center.svelte.d.ts +2 -2
  15. package/dist/media-center/media-center/discover-panel-handler.svelte.d.ts +2 -2
  16. package/dist/media-center/media-center/discover-panel.svelte +1 -1
  17. package/dist/media-center/media-center/discover-panel.svelte.d.ts +2 -1
  18. package/dist/media-center/media-center/post-player-provider-generator.d.ts +2 -2
  19. package/dist/media-center/media-center/post-player-provider-generator.js +2 -1
  20. package/dist/media-center/media-center/streams-in-category-panel-handler.svelte.d.ts +5 -2
  21. package/dist/media-center/media-center/streams-in-category-panel-handler.svelte.js +5 -0
  22. package/dist/media-center/media-center/streams-in-category-panel.svelte +2 -2
  23. package/dist/media-center/media-center/streams-in-category-panel.svelte.d.ts +3 -2
  24. package/dist/media-center/media-center/streams-player-provider-generator.d.ts +8 -0
  25. package/dist/media-center/media-center/streams-player-provider-generator.js +36 -0
  26. package/dist/media-center/media-center/types.d.ts +0 -6
  27. package/dist/posts/controls/cmp.controls.svelte +1 -1
  28. package/dist/posts/data-loaders/index.d.ts +1 -0
  29. package/dist/posts/data-loaders/index.js +1 -0
  30. package/dist/posts/{posts-player → data-loaders}/mapper.d.ts +1 -1
  31. package/dist/{short-videos/data-providers → posts/data-loaders}/operations.generated.d.ts +82 -4
  32. package/dist/{short-videos/data-providers → posts/data-loaders}/operations.generated.js +232 -3
  33. package/dist/posts/data-loaders/operations.graphql +17 -0
  34. package/dist/posts/data-loaders/posts-loader.d.ts +19 -0
  35. package/dist/posts/data-loaders/posts-loader.js +28 -0
  36. package/dist/posts/posts-player/index.d.ts +27 -6
  37. package/dist/posts/posts-player/index.js +2 -3
  38. package/dist/posts/posts-player/posts-player-view.svelte +29 -13
  39. package/dist/posts/posts-player/types.d.ts +2 -2
  40. package/dist/short-videos/data-providers/internal-short-video-player-items-provider.d.ts +5 -6
  41. package/dist/short-videos/data-providers/internal-short-video-player-items-provider.js +12 -32
  42. package/dist/short-videos/short-videos-player/index.d.ts +2 -3
  43. package/dist/short-videos/short-videos-player/index.js +1 -1
  44. package/dist/streams/data-loaders/index.d.ts +2 -0
  45. package/dist/streams/data-loaders/index.js +2 -0
  46. package/dist/streams/{stream-player → data-loaders}/mapper.d.ts +1 -1
  47. package/dist/streams/{stream-player → data-loaders}/operations.generated.d.ts +27 -24
  48. package/dist/streams/{stream-player → data-loaders}/operations.generated.js +18 -17
  49. package/dist/streams/{stream-player → data-loaders}/operations.graphql +6 -3
  50. package/dist/streams/data-loaders/stream-pages-loader.d.ts +10 -0
  51. package/dist/streams/data-loaders/stream-pages-loader.js +33 -0
  52. package/dist/streams/data-loaders/streams-loader.d.ts +19 -0
  53. package/dist/streams/data-loaders/streams-loader.js +28 -0
  54. package/dist/streams/{stream-player → streams-player}/index.d.ts +21 -22
  55. package/dist/streams/{stream-player → streams-player}/index.js +9 -7
  56. package/dist/streams/streams-player/internal-streams-player-data-provider.d.ts +16 -0
  57. package/dist/streams/streams-player/internal-streams-player-data-provider.js +55 -0
  58. package/dist/streams/{stream-player → streams-player}/stream-overview.svelte +18 -15
  59. package/dist/streams/{stream-player → streams-player}/stream-overview.svelte.d.ts +2 -2
  60. package/dist/streams/streams-player/streams-player-buffer.svelte.d.ts +8 -0
  61. package/dist/streams/streams-player/streams-player-buffer.svelte.js +15 -0
  62. package/dist/streams/{stream-player/stream-player-view.svelte → streams-player/streams-player-view.svelte} +69 -55
  63. package/dist/streams/streams-player/streams-player-view.svelte.d.ts +8 -0
  64. package/dist/streams/{stream-player → streams-player}/types.d.ts +9 -7
  65. package/dist/ui/{player-button → player/button}/cmp.player-button.svelte +1 -1
  66. package/dist/ui/{player-button → player/button}/cmp.player-button.svelte.d.ts +1 -1
  67. package/dist/ui/{player-button → player/button}/cmp.player-buttons-group.svelte +1 -1
  68. package/dist/ui/{player-button → player/button}/types.d.ts +1 -1
  69. package/dist/ui/player/button/types.js +1 -0
  70. package/dist/ui/player/providers/chunks-player-buffer/index.d.ts +2 -0
  71. package/dist/ui/player/providers/chunks-player-buffer/index.js +2 -0
  72. package/dist/ui/player/providers/chunks-player-buffer/player-chunk-item.svelte.d.ts +11 -0
  73. package/dist/ui/player/providers/chunks-player-buffer/player-chunk-item.svelte.js +11 -0
  74. package/dist/ui/player/providers/chunks-player-buffer/player-chunk.svelte.d.ts +31 -0
  75. package/dist/ui/player/providers/chunks-player-buffer/player-chunk.svelte.js +67 -0
  76. package/dist/ui/player/providers/chunks-player-buffer/player-chunks-manager.svelte.d.ts +23 -0
  77. package/dist/ui/player/providers/chunks-player-buffer/player-chunks-manager.svelte.js +119 -0
  78. package/dist/ui/player/providers/default-chunks-player-buffer.svelte.d.ts +20 -0
  79. package/dist/ui/player/providers/default-chunks-player-buffer.svelte.js +47 -0
  80. package/dist/ui/player/providers/default-feed-player-buffer.svelte.d.ts +27 -0
  81. package/dist/ui/player/providers/default-feed-player-buffer.svelte.js +78 -0
  82. package/dist/ui/player/providers/index.d.ts +3 -0
  83. package/dist/ui/player/providers/index.js +2 -0
  84. package/dist/ui/player/providers/types.d.ts +49 -0
  85. package/dist/ui/{player-slider → player/slider}/cmp.player-slider.svelte +7 -20
  86. package/dist/ui/{player-slider → player/slider}/cmp.player-slider.svelte.d.ts +4 -4
  87. package/dist/ui/{player-slider → player/slider}/index.d.ts +0 -2
  88. package/dist/ui/{player-slider → player/slider}/index.js +0 -1
  89. package/dist/ui/player/slider/types.d.ts +16 -0
  90. package/dist/ui/player/slider/types.js +1 -0
  91. package/package.json +4 -4
  92. package/dist/posts/posts-player/operations.generated.d.ts +0 -80
  93. package/dist/posts/posts-player/operations.generated.js +0 -229
  94. package/dist/posts/posts-player/operations.graphql +0 -7
  95. package/dist/short-videos/data-providers/operations.graphql +0 -9
  96. package/dist/streams/stream-player/internal-stream-player-data-provider.d.ts +0 -12
  97. package/dist/streams/stream-player/internal-stream-player-data-provider.js +0 -48
  98. package/dist/streams/stream-player/stream-player-buffer.svelte.d.ts +0 -28
  99. package/dist/streams/stream-player/stream-player-buffer.svelte.js +0 -79
  100. package/dist/streams/stream-player/stream-player-view.svelte.d.ts +0 -8
  101. package/dist/ui/player-button/types.js +0 -1
  102. package/dist/ui/player-slider/player-buffer.svelte.d.ts +0 -32
  103. package/dist/ui/player-slider/player-buffer.svelte.js +0 -76
  104. package/dist/ui/player-slider/types.d.ts +0 -26
  105. /package/dist/posts/{posts-player → data-loaders}/mapper.js +0 -0
  106. /package/dist/streams/{stream-player → data-loaders}/mapper.js +0 -0
  107. /package/dist/streams/{stream-player → streams-player}/internal-stream-analytics-handler.d.ts +0 -0
  108. /package/dist/streams/{stream-player → streams-player}/internal-stream-analytics-handler.js +0 -0
  109. /package/dist/streams/{stream-player → streams-player}/stream-player-localization.d.ts +0 -0
  110. /package/dist/streams/{stream-player → streams-player}/stream-player-localization.js +0 -0
  111. /package/dist/streams/{stream-player → streams-player}/types.js +0 -0
  112. /package/dist/ui/{player-button → player/button}/cmp.player-buttons-group.svelte.d.ts +0 -0
  113. /package/dist/ui/{player-button → player/button}/index.d.ts +0 -0
  114. /package/dist/ui/{player-button → player/button}/index.js +0 -0
  115. /package/dist/ui/{player-slider → player/providers}/types.js +0 -0
  116. /package/dist/ui/{player-slider → player/slider}/prevent-slider-scroll.d.ts +0 -0
  117. /package/dist/ui/{player-slider → player/slider}/prevent-slider-scroll.js +0 -0
  118. /package/dist/ui/{player-slider → player/slider}/wheel-gestures-adapter.d.ts +0 -0
  119. /package/dist/ui/{player-slider → player/slider}/wheel-gestures-adapter.js +0 -0
@@ -1,10 +1,239 @@
1
- export const GetShortVideosDocument = {
1
+ export const PostsPlayerPayloadFragmentDoc = {
2
+ kind: 'Document',
3
+ definitions: [
4
+ {
5
+ kind: 'FragmentDefinition',
6
+ name: { kind: 'Name', value: 'PostsPlayerPayloadFragment' },
7
+ typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Post' } },
8
+ selectionSet: {
9
+ kind: 'SelectionSet',
10
+ selections: [
11
+ { kind: 'FragmentSpread', name: { kind: 'Name', value: 'PostViewerPayloadFragment' } },
12
+ {
13
+ kind: 'Field',
14
+ name: { kind: 'Name', value: 'ownerProfile' },
15
+ selectionSet: {
16
+ kind: 'SelectionSet',
17
+ selections: [
18
+ { kind: 'Field', name: { kind: 'Name', value: 'id' } },
19
+ { kind: 'Field', name: { kind: 'Name', value: 'type' } }
20
+ ]
21
+ }
22
+ }
23
+ ]
24
+ }
25
+ },
26
+ {
27
+ kind: 'FragmentDefinition',
28
+ name: { kind: 'Name', value: 'PostViewerPayloadFragment' },
29
+ typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Post' } },
30
+ selectionSet: {
31
+ kind: 'SelectionSet',
32
+ selections: [
33
+ { kind: 'Field', name: { kind: 'Name', value: 'id' } },
34
+ { kind: 'Field', name: { kind: 'Name', value: 'enableSocialInteractions' } },
35
+ {
36
+ kind: 'Field',
37
+ name: { kind: 'Name', value: 'allProducts' },
38
+ selectionSet: {
39
+ kind: 'SelectionSet',
40
+ selections: [
41
+ { kind: 'Field', name: { kind: 'Name', value: 'id' } },
42
+ { kind: 'Field', name: { kind: 'Name', value: 'title' } },
43
+ { kind: 'Field', name: { kind: 'Name', value: 'shortDescription' } },
44
+ { kind: 'Field', name: { kind: 'Name', value: 'link' } },
45
+ {
46
+ kind: 'Field',
47
+ name: { kind: 'Name', value: 'media' },
48
+ selectionSet: {
49
+ kind: 'SelectionSet',
50
+ selections: [
51
+ {
52
+ kind: 'Field',
53
+ name: { kind: 'Name', value: 'url' },
54
+ arguments: [{ kind: 'Argument', name: { kind: 'Name', value: 'scale' }, value: { kind: 'EnumValue', value: 'SMALL' } }]
55
+ },
56
+ {
57
+ kind: 'Field',
58
+ name: { kind: 'Name', value: 'thumbnailUrl' },
59
+ arguments: [{ kind: 'Argument', name: { kind: 'Name', value: 'scale' }, value: { kind: 'EnumValue', value: 'SMALL' } }]
60
+ },
61
+ { kind: 'Field', name: { kind: 'Name', value: 'type' } }
62
+ ]
63
+ }
64
+ },
65
+ {
66
+ kind: 'Field',
67
+ name: { kind: 'Name', value: 'brand' },
68
+ selectionSet: { kind: 'SelectionSet', selections: [{ kind: 'Field', name: { kind: 'Name', value: 'name' } }] }
69
+ },
70
+ {
71
+ kind: 'Field',
72
+ name: { kind: 'Name', value: 'priceAndAvailability' },
73
+ selectionSet: {
74
+ kind: 'SelectionSet',
75
+ selections: [
76
+ { kind: 'Field', name: { kind: 'Name', value: 'currency' } },
77
+ { kind: 'Field', name: { kind: 'Name', value: 'price' } },
78
+ {
79
+ kind: 'Field',
80
+ name: { kind: 'Name', value: 'productSalePrices' },
81
+ selectionSet: {
82
+ kind: 'SelectionSet',
83
+ selections: [
84
+ { kind: 'Field', name: { kind: 'Name', value: 'salePrice' } },
85
+ { kind: 'Field', name: { kind: 'Name', value: 'salePriceEffectiveDateFrom' } },
86
+ { kind: 'Field', name: { kind: 'Name', value: 'salePriceEffectiveDateTo' } }
87
+ ]
88
+ }
89
+ }
90
+ ]
91
+ }
92
+ }
93
+ ]
94
+ }
95
+ },
96
+ {
97
+ kind: 'Field',
98
+ name: { kind: 'Name', value: 'ad' },
99
+ selectionSet: {
100
+ kind: 'SelectionSet',
101
+ selections: [
102
+ { kind: 'Field', name: { kind: 'Name', value: 'id' } },
103
+ { kind: 'Field', name: { kind: 'Name', value: 'title' } },
104
+ { kind: 'Field', name: { kind: 'Name', value: 'description' } },
105
+ { kind: 'Field', name: { kind: 'Name', value: 'price' } },
106
+ { kind: 'Field', name: { kind: 'Name', value: 'priceInfo' } },
107
+ { kind: 'Field', name: { kind: 'Name', value: 'currency' } },
108
+ {
109
+ kind: 'Field',
110
+ name: { kind: 'Name', value: 'ctaButton' },
111
+ selectionSet: {
112
+ kind: 'SelectionSet',
113
+ selections: [
114
+ { kind: 'Field', name: { kind: 'Name', value: 'background' } },
115
+ { kind: 'Field', name: { kind: 'Name', value: 'textColor' } },
116
+ { kind: 'Field', name: { kind: 'Name', value: 'text' } },
117
+ { kind: 'Field', name: { kind: 'Name', value: 'url' } },
118
+ { kind: 'Field', name: { kind: 'Name', value: 'border' } }
119
+ ]
120
+ }
121
+ },
122
+ { kind: 'Field', name: { kind: 'Name', value: 'type' } },
123
+ {
124
+ kind: 'Field',
125
+ name: { kind: 'Name', value: 'media' },
126
+ selectionSet: {
127
+ kind: 'SelectionSet',
128
+ selections: [
129
+ {
130
+ kind: 'Field',
131
+ name: { kind: 'Name', value: 'url' },
132
+ arguments: [{ kind: 'Argument', name: { kind: 'Name', value: 'scale' }, value: { kind: 'EnumValue', value: 'SMALL' } }]
133
+ },
134
+ {
135
+ kind: 'Field',
136
+ name: { kind: 'Name', value: 'thumbnailUrl' },
137
+ arguments: [{ kind: 'Argument', name: { kind: 'Name', value: 'scale' }, value: { kind: 'EnumValue', value: 'SMALL' } }]
138
+ },
139
+ { kind: 'Field', name: { kind: 'Name', value: 'type' } }
140
+ ]
141
+ }
142
+ }
143
+ ]
144
+ }
145
+ },
146
+ {
147
+ kind: 'Field',
148
+ name: { kind: 'Name', value: 'postData' },
149
+ selectionSet: {
150
+ kind: 'SelectionSet',
151
+ selections: [
152
+ {
153
+ kind: 'Field',
154
+ name: { kind: 'Name', value: 'media' },
155
+ selectionSet: {
156
+ kind: 'SelectionSet',
157
+ selections: [
158
+ {
159
+ kind: 'Field',
160
+ name: { kind: 'Name', value: 'url' },
161
+ arguments: [
162
+ {
163
+ kind: 'Argument',
164
+ name: { kind: 'Name', value: 'scale' },
165
+ value: { kind: 'Variable', name: { kind: 'Name', value: 'image_scale' } }
166
+ }
167
+ ]
168
+ },
169
+ {
170
+ kind: 'Field',
171
+ name: { kind: 'Name', value: 'thumbnailUrl' },
172
+ arguments: [
173
+ {
174
+ kind: 'Argument',
175
+ name: { kind: 'Name', value: 'scale' },
176
+ value: { kind: 'Variable', name: { kind: 'Name', value: 'image_scale' } }
177
+ }
178
+ ]
179
+ },
180
+ { kind: 'Field', name: { kind: 'Name', value: 'type' } }
181
+ ]
182
+ }
183
+ },
184
+ {
185
+ kind: 'Field',
186
+ name: { kind: 'Name', value: 'articleData' },
187
+ selectionSet: {
188
+ kind: 'SelectionSet',
189
+ selections: [
190
+ { kind: 'Field', name: { kind: 'Name', value: 'title' } },
191
+ { kind: 'Field', name: { kind: 'Name', value: 'kicker' } },
192
+ { kind: 'Field', name: { kind: 'Name', value: 'articleId' } }
193
+ ]
194
+ }
195
+ },
196
+ {
197
+ kind: 'Field',
198
+ name: { kind: 'Name', value: 'mediaData' },
199
+ selectionSet: { kind: 'SelectionSet', selections: [{ kind: 'Field', name: { kind: 'Name', value: 'text' } }] }
200
+ },
201
+ {
202
+ kind: 'Field',
203
+ name: { kind: 'Name', value: 'momentData' },
204
+ selectionSet: { kind: 'SelectionSet', selections: [{ kind: 'Field', name: { kind: 'Name', value: 'text' } }] }
205
+ },
206
+ {
207
+ kind: 'Field',
208
+ name: { kind: 'Name', value: 'shortVideoData' },
209
+ selectionSet: { kind: 'SelectionSet', selections: [{ kind: 'Field', name: { kind: 'Name', value: 'text' } }] }
210
+ },
211
+ {
212
+ kind: 'Field',
213
+ name: { kind: 'Name', value: 'videoData' },
214
+ selectionSet: {
215
+ kind: 'SelectionSet',
216
+ selections: [
217
+ { kind: 'Field', name: { kind: 'Name', value: 'title' } },
218
+ { kind: 'Field', name: { kind: 'Name', value: 'text' } }
219
+ ]
220
+ }
221
+ }
222
+ ]
223
+ }
224
+ }
225
+ ]
226
+ }
227
+ }
228
+ ]
229
+ };
230
+ export const GetPostsDocument = {
2
231
  kind: 'Document',
3
232
  definitions: [
4
233
  {
5
234
  kind: 'OperationDefinition',
6
235
  operation: 'query',
7
- name: { kind: 'Name', value: 'GetShortVideos' },
236
+ name: { kind: 'Name', value: 'GetPosts' },
8
237
  variableDefinitions: [
9
238
  {
10
239
  kind: 'VariableDefinition',
@@ -23,7 +252,7 @@ export const GetShortVideosDocument = {
23
252
  selections: [
24
253
  {
25
254
  kind: 'Field',
26
- alias: { kind: 'Name', value: 'shortVideos' },
255
+ alias: { kind: 'Name', value: 'posts' },
27
256
  name: { kind: 'Name', value: 'embedPosts' },
28
257
  arguments: [{ kind: 'Argument', name: { kind: 'Name', value: 'input' }, value: { kind: 'Variable', name: { kind: 'Name', value: 'input' } } }],
29
258
  selectionSet: {
@@ -0,0 +1,17 @@
1
+ # noinspection GraphQLSchemaValidation
2
+ query GetPosts($input: EmbedPostsInput!, $image_scale: ImageScale = ORIGINAL_ENCODED) {
3
+ posts: embedPosts(input: $input) {
4
+ items {
5
+ ...PostsPlayerPayloadFragment
6
+ }
7
+ continuationToken
8
+ }
9
+ }
10
+
11
+ fragment PostsPlayerPayloadFragment on Post {
12
+ ...PostViewerPayloadFragment
13
+ ownerProfile {
14
+ id
15
+ type
16
+ }
17
+ }
@@ -0,0 +1,19 @@
1
+ import { PostType, Status } from '../../core/enums';
2
+ import type { PostPlayerModel } from '../posts-player/types';
3
+ import type { Client } from '@urql/core';
4
+ export declare const getPostsCursor: (input: {
5
+ filter: {
6
+ types: PostType[];
7
+ ids?: string[];
8
+ categoryId?: string;
9
+ excludeIds?: string[];
10
+ mediaPageId?: string;
11
+ statuses?: Status[];
12
+ };
13
+ limit: number;
14
+ continuationToken?: string | null;
15
+ graphql: Client;
16
+ }) => Promise<{
17
+ items: PostPlayerModel[];
18
+ continuationToken: string | null;
19
+ }>;
@@ -0,0 +1,28 @@
1
+ import { PostType, Status } from '../../core/enums';
2
+ import { mapToPostPlayerModel } from './mapper';
3
+ import { GetPostsDocument } from './operations.generated';
4
+ export const getPostsCursor = async (input) => {
5
+ const { filter, limit, continuationToken, graphql } = input;
6
+ const { ids, mediaPageId, categoryId, excludeIds, types, statuses } = filter;
7
+ const payload = await graphql
8
+ .query(GetPostsDocument, {
9
+ input: {
10
+ filter: {
11
+ ids,
12
+ mediaPageId,
13
+ types,
14
+ statuses,
15
+ categoryId,
16
+ excludeIds
17
+ },
18
+ limit,
19
+ continuationToken
20
+ }
21
+ })
22
+ .toPromise();
23
+ const posts = payload.data?.posts?.items || [];
24
+ return {
25
+ items: posts.map(mapToPostPlayerModel),
26
+ continuationToken: payload.data?.posts?.continuationToken || null
27
+ };
28
+ };
@@ -1,19 +1,17 @@
1
1
  import { type IMediaCenterConfig } from '../../media-center/config/types';
2
2
  import type { IPostSocialInteractionsHandler } from '../social-interactions';
3
- import type { IPlayerItemsProvider } from '../../ui/player-slider';
4
3
  import { default as PostsPlayer } from './cmp.posts-player.svelte';
5
- import { mapToPostPlayerModel } from './mapper';
6
4
  import type { IPostAnalyticsHandler, PostPlayerModel, PostPlayerSettings } from './types';
7
5
  export { PostsPlayer, type PostPlayerModel };
8
- export type { IMediaCenterConfig, IPlayerItemsProvider, IPostAnalyticsHandler };
9
- export { mapToPostPlayerModel };
6
+ export type { IMediaCenterConfig, IPostAnalyticsHandler };
7
+ export { mapToPostPlayerModel } from '../data-loaders/mapper';
10
8
  /**
11
9
  * Opens the posts player modal.
12
10
  *
13
11
  * @param init Configuration options.
14
12
  *
15
13
  * Data provider (required)
16
- * @param {IPlayerItemsProvider<PostPlayerModel>} init.postsProvider
14
+ * @param init.postsProvider
17
15
  * Provider that supplies post items to the player.
18
16
  *
19
17
  * Media center (optional)
@@ -75,7 +73,7 @@ export { mapToPostPlayerModel };
75
73
  * ```
76
74
  */
77
75
  export declare function openPostsPlayer(init: {
78
- postsProvider: IPlayerItemsProvider<PostPlayerModel>;
76
+ postsProvider: IPostsPlayerDataProvider;
79
77
  mediaCenterConfig?: IMediaCenterConfig;
80
78
  analyticsHandler?: IPostAnalyticsHandler;
81
79
  socialInteractionsHandler?: IPostSocialInteractionsHandler;
@@ -85,3 +83,26 @@ export declare function openPostsPlayer(init: {
85
83
  postActivated?: (id: string) => void;
86
84
  };
87
85
  }): void;
86
+ export type IPostsPlayerDataProvider<TChunk extends WithId = WithId> = {
87
+ kind: 'feed';
88
+ initialData: {
89
+ prefetchedItems: PostPlayerModel[];
90
+ startIndex: number;
91
+ startMediaIndex?: number;
92
+ };
93
+ loadMore(): Promise<PostPlayerModel[]>;
94
+ } | {
95
+ kind: 'chunks';
96
+ initialData: {
97
+ prefetchedChunks: TChunk[];
98
+ startItemIndex?: number;
99
+ };
100
+ loadMoreChunks: () => Promise<TChunk[]>;
101
+ loadChunkItems: (chunkId: string, continuationToken: string | null | undefined) => Promise<{
102
+ items: PostPlayerModel[];
103
+ continuationToken: string | null;
104
+ }>;
105
+ };
106
+ type WithId = {
107
+ id: string;
108
+ };
@@ -2,17 +2,16 @@ import {} from '../../media-center/config/types';
2
2
  import { MediaCenter } from '../../media-center/media-center';
3
3
  import { ModalShadowHost } from '../../ui/shadow-dom';
4
4
  import { default as PostsPlayer } from './cmp.posts-player.svelte';
5
- import { mapToPostPlayerModel } from './mapper';
6
5
  import { mount, unmount } from 'svelte';
7
6
  export { PostsPlayer };
8
- export { mapToPostPlayerModel };
7
+ export { mapToPostPlayerModel } from '../data-loaders/mapper';
9
8
  /**
10
9
  * Opens the posts player modal.
11
10
  *
12
11
  * @param init Configuration options.
13
12
  *
14
13
  * Data provider (required)
15
- * @param {IPlayerItemsProvider<PostPlayerModel>} init.postsProvider
14
+ * @param init.postsProvider
16
15
  * Provider that supplies post items to the player.
17
16
  *
18
17
  * Media center (optional)
@@ -11,8 +11,9 @@ import { PostType } from '../..';
11
11
  import { ContentPlayer, ContentPlayerConfig } from '../../content-player';
12
12
  import { ContentPlayerSettings } from '../../content-player/content-player-settings';
13
13
  import { preloadImage } from '../../core/image-preloader';
14
+ import { Utils } from '../../core/utils';
14
15
  import { getPostCoverImage } from '../model';
15
- import { PlayerBuffer } from '../../ui/player-slider';
16
+ import { DefaultChunksPlayerBuffer, DefaultFeedPlayerBuffer } from '../../ui/player/providers';
16
17
  import { untrack } from 'svelte';
17
18
  let { dataProvider, socialInteractionsHandler, playerSettings, analyticsHandler, on, mediaCenterData } = $props();
18
19
  $effect(() => {
@@ -24,19 +25,34 @@ $effect(() => {
24
25
  });
25
26
  $effect(() => contentPlayerConfig.updateMediaCenterData(mediaCenterData));
26
27
  const initBuffer = (dataProvider) => __awaiter(void 0, void 0, void 0, function* () {
27
- if (dataProvider.prefetch) {
28
- yield dataProvider.prefetch();
28
+ switch (dataProvider.kind) {
29
+ case 'feed':
30
+ new DefaultFeedPlayerBuffer(dataProvider, {
31
+ preloaded: (instance) => __awaiter(void 0, void 0, void 0, function* () {
32
+ if (instance.loaded.length) {
33
+ const coverUrl = getPostCoverImage(instance.loaded[0]);
34
+ yield preloadImage(coverUrl);
35
+ contentPlayerConfig.setBackgroundImageUrl(coverUrl);
36
+ }
37
+ contentPlayerConfig.playerBuffer = instance;
38
+ })
39
+ });
40
+ break;
41
+ case 'chunks':
42
+ new DefaultChunksPlayerBuffer(dataProvider, {
43
+ preloaded: (instance) => __awaiter(void 0, void 0, void 0, function* () {
44
+ if (instance.loaded.length) {
45
+ const coverUrl = getPostCoverImage(instance.loaded[0]);
46
+ yield preloadImage(coverUrl);
47
+ contentPlayerConfig.setBackgroundImageUrl(coverUrl);
48
+ }
49
+ contentPlayerConfig.playerBuffer = instance;
50
+ })
51
+ });
52
+ break;
53
+ default:
54
+ Utils.assertUnreachable(dataProvider);
29
55
  }
30
- new PlayerBuffer(dataProvider, {
31
- preloaded: (instance) => __awaiter(void 0, void 0, void 0, function* () {
32
- if (instance.loaded.length) {
33
- const coverUrl = getPostCoverImage(instance.loaded[0]);
34
- yield preloadImage(coverUrl);
35
- contentPlayerConfig.setBackgroundImageUrl(coverUrl);
36
- }
37
- contentPlayerConfig.playerBuffer = instance;
38
- })
39
- });
40
56
  });
41
57
  const getLoadedItemById = (id) => {
42
58
  if (!contentPlayerConfig.playerBuffer) {
@@ -1,7 +1,7 @@
1
1
  import type { IContentPlayerSettingsInitializer } from '../../content-player/content-player-settings';
2
2
  import type { IPostModel } from '..';
3
3
  import type { IPostSocialInteractionsHandler } from '../social-interactions';
4
- import type { IPlayerItemsProvider } from '../../ui/player-slider';
4
+ import type { IPlayerDataProvider } from '../../ui/player/providers';
5
5
  export interface IPostAnalyticsHandler {
6
6
  setOrganizationId: (organizationId: string) => void;
7
7
  trackPostOpened: (postId: string, ownerId: string) => void;
@@ -15,7 +15,7 @@ export type PostPlayerModel = IPostModel & {
15
15
  analyticsOrganizationId: string | null;
16
16
  };
17
17
  export type PostPlayerProps = {
18
- dataProvider: IPlayerItemsProvider<PostPlayerModel>;
18
+ dataProvider: IPlayerDataProvider<PostPlayerModel>;
19
19
  socialInteractionsHandler?: IPostSocialInteractionsHandler;
20
20
  analyticsHandler?: IPostAnalyticsHandler;
21
21
  playerSettings?: PostPlayerSettings;
@@ -1,10 +1,10 @@
1
1
  import { type PostPlayerModel } from '../../posts/posts-player';
2
- import type { IPlayerItemsProvider } from '../../ui/player-slider';
3
- export declare class InternalShortVideoPlayerItemsProvider implements IPlayerItemsProvider<PostPlayerModel> {
4
- initialData: IPlayerItemsProvider<PostPlayerModel>['initialData'];
2
+ import type { IFeedPlayerDataProvider } from '../../ui/player/providers';
3
+ export declare class InternalShortVideoPlayerItemsProvider implements IFeedPlayerDataProvider<PostPlayerModel> {
4
+ readonly kind = "feed";
5
+ readonly initialData: IFeedPlayerDataProvider<PostPlayerModel>['initialData'];
5
6
  private ids;
6
7
  private idOrder;
7
- private initialId?;
8
8
  private graphql;
9
9
  private dataLoader;
10
10
  constructor(input: {
@@ -13,6 +13,5 @@ export declare class InternalShortVideoPlayerItemsProvider implements IPlayerIte
13
13
  graphqlOrigin?: string;
14
14
  initialId?: string;
15
15
  });
16
- loadMore: () => Promise<PostPlayerModel[]>;
17
- prefetch: () => Promise<void>;
16
+ loadMore: IFeedPlayerDataProvider<PostPlayerModel>['loadMore'];
18
17
  }
@@ -1,15 +1,15 @@
1
- import { ImageScale } from '../..';
1
+ import { PostType } from '../..';
2
2
  import { ContinuationToken } from '../../core/continuation-token';
3
3
  import { CursorDataLoader } from '../../core/data-loaders';
4
4
  import { createLocalGQLClient } from '../../core/graphql';
5
- import { mapToPostPlayerModel } from '../../posts/posts-player';
6
- import { GetShortVideosDocument } from './operations.generated';
5
+ import { getPostsCursor } from '../../posts/data-loaders';
6
+ import {} from '../../posts/posts-player';
7
7
  const CHUNK_SIZE = 20;
8
8
  export class InternalShortVideoPlayerItemsProvider {
9
+ kind = 'feed';
9
10
  initialData;
10
11
  ids;
11
12
  idOrder = new Map();
12
- initialId;
13
13
  graphql;
14
14
  dataLoader = new CursorDataLoader({
15
15
  loadPage: async (continuationToken) => {
@@ -17,22 +17,12 @@ export class InternalShortVideoPlayerItemsProvider {
17
17
  const endIdIndex = Math.min(startIdIndex + CHUNK_SIZE, this.ids.length);
18
18
  const idsChunk = this.ids.slice(startIdIndex, endIdIndex);
19
19
  try {
20
- const payload = await this.graphql
21
- .query(GetShortVideosDocument, {
22
- input: {
23
- limit: idsChunk.length,
24
- filter: {
25
- ids: idsChunk
26
- }
27
- },
28
- image_scale: ImageScale.OriginalEncoded
29
- })
30
- .toPromise();
31
- const data = payload.data?.shortVideos;
32
- if (!data) {
33
- return null;
34
- }
35
- const items = data.items.map(mapToPostPlayerModel).sort((a, b) => {
20
+ const posts = await getPostsCursor({
21
+ filter: { ids: idsChunk, types: [PostType.ShortVideo] },
22
+ limit: idsChunk.length,
23
+ graphql: this.graphql
24
+ });
25
+ const items = posts.items.sort((a, b) => {
36
26
  const ia = this.idOrder.get(a.id) ?? Number.MAX_SAFE_INTEGER;
37
27
  const ib = this.idOrder.get(b.id) ?? Number.MAX_SAFE_INTEGER;
38
28
  return ia - ib;
@@ -52,18 +42,8 @@ export class InternalShortVideoPlayerItemsProvider {
52
42
  this.graphql = createLocalGQLClient(graphqlOrigin, initiator ? { 'x-initiator': initiator } : undefined);
53
43
  this.ids = ids;
54
44
  ids.forEach((id, idx) => this.idOrder.set(id, idx));
55
- this.initialId = initialId;
56
- this.initialData = { prefetchedItems: [], startIndex: 0 };
45
+ const startIndex = initialId ? ids.indexOf(initialId) : 0;
46
+ this.initialData = { prefetchedItems: [], startIndex };
57
47
  }
58
48
  loadMore = () => this.dataLoader.loadMore();
59
- prefetch = async () => {
60
- const items = await this.loadMore();
61
- if (this.initialId && items.length) {
62
- const initialIndex = items.findIndex((i) => i.id === this.initialId);
63
- this.initialData = { prefetchedItems: items, startIndex: initialIndex >= 0 ? initialIndex : 0 };
64
- }
65
- else {
66
- this.initialData = { prefetchedItems: items, startIndex: 0 };
67
- }
68
- };
69
49
  }
@@ -1,7 +1,6 @@
1
1
  import type { Locale } from '../../core/locale';
2
2
  import { type IMediaCenterConfig } from '../../media-center/config/types';
3
- import type { IPlayerItemsProvider } from '../../ui/player-slider';
4
- export type { IMediaCenterConfig, IPlayerItemsProvider };
3
+ export type { IMediaCenterConfig };
5
4
  /**
6
5
  * Opens the short videos player modal.
7
6
  *
@@ -78,4 +77,4 @@ export declare function openShortVideosPlayer(init: {
78
77
  on?: {
79
78
  playerClosed?: () => void;
80
79
  };
81
- }): void;
80
+ }): Promise<void>;
@@ -68,7 +68,7 @@ import { mount, unmount } from 'svelte';
68
68
  * });
69
69
  * ```
70
70
  */
71
- export function openShortVideosPlayer(init) {
71
+ export async function openShortVideosPlayer(init) {
72
72
  const { ids, graphqlOrigin, initialId, initiator, playerSettings, on } = init;
73
73
  const dataProvider = new InternalShortVideoPlayerItemsProvider({ ids, graphqlOrigin, initialId, initiator });
74
74
  const mediaCenterConfig = init.mediaPageId ? new InternalMediaCenterConfig(init.mediaPageId, graphqlOrigin) : undefined;
@@ -0,0 +1,2 @@
1
+ export { getStreamsCursor } from './streams-loader';
2
+ export { getStreamPagesCursor } from './stream-pages-loader';
@@ -0,0 +1,2 @@
1
+ export { getStreamsCursor } from './streams-loader';
2
+ export { getStreamPagesCursor } from './stream-pages-loader';
@@ -1,3 +1,3 @@
1
+ import type { StreamPlayerModel } from '../streams-player/types';
1
2
  import type { StreamPlayerPayloadFragment } from './operations.generated';
2
- import type { StreamPlayerModel } from './types';
3
3
  export declare const mapToStreamPlayerModel: (payload: StreamPlayerPayloadFragment) => StreamPlayerModel;