@streamscloud/embeddable 8.2.0 → 9.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 (97) hide show
  1. package/dist/ads/ad-card/cmp.ad-card.svelte +8 -5
  2. package/dist/ads/ad-card/cmp.ad-card.svelte.d.ts +2 -0
  3. package/dist/content-player/cmp.content-player.svelte +1 -0
  4. package/dist/content-player/content-player-config.svelte.d.ts +8 -0
  5. package/dist/content-player/content-player-config.svelte.js +9 -1
  6. package/dist/content-player/controls-and-attachments.svelte +1 -0
  7. package/dist/core/enums.d.ts +5 -1
  8. package/dist/core/enums.js +4 -0
  9. package/dist/marketing-tracking/index.d.ts +2 -0
  10. package/dist/marketing-tracking/index.js +1 -0
  11. package/dist/marketing-tracking/service.d.ts +11 -0
  12. package/dist/marketing-tracking/service.js +35 -0
  13. package/dist/marketing-tracking/types.d.ts +5 -0
  14. package/dist/media-center/config/internal-media-center-analytics-handler.d.ts +3 -2
  15. package/dist/media-center/config/internal-media-center-analytics-handler.js +1 -0
  16. package/dist/media-center/config/internal-media-center-config.d.ts +1 -1
  17. package/dist/media-center/config/internal-media-center-config.js +11 -11
  18. package/dist/media-center/config/operations.generated.d.ts +4 -4
  19. package/dist/media-center/config/operations.generated.js +5 -8
  20. package/dist/media-center/config/operations.graphql +3 -3
  21. package/dist/media-center/config/types.d.ts +7 -5
  22. package/dist/media-center/config/types.js +1 -1
  23. package/dist/media-center/media-center/cmp.media-center.svelte +74 -17
  24. package/dist/media-center/media-center/cmp.media-center.svelte.d.ts +3 -3
  25. package/dist/media-center/media-center/discover-panel-handler.svelte.d.ts +5 -2
  26. package/dist/media-center/media-center/discover-panel-handler.svelte.js +8 -3
  27. package/dist/media-center/media-center/discover-panel.svelte +1 -1
  28. package/dist/media-center/media-center/discover-panel.svelte.d.ts +2 -2
  29. package/dist/media-center/media-center/post-player-provider-generator.d.ts +8 -0
  30. package/dist/media-center/media-center/{short-video-resources-generator.js → post-player-provider-generator.js} +8 -3
  31. package/dist/media-center/media-center/types.d.ts +1 -1
  32. package/dist/posts/attachments/cmp.attachments.svelte +14 -2
  33. package/dist/posts/attachments/cmp.attachments.svelte.d.ts +2 -0
  34. package/dist/posts/handlers/index.d.ts +1 -0
  35. package/dist/posts/handlers/index.js +1 -0
  36. package/dist/{short-videos/short-videos-player/internal-short-video-analytics-handler.d.ts → posts/handlers/internal-post-analytics-handler.d.ts} +3 -2
  37. package/dist/{short-videos/short-videos-player/internal-short-video-analytics-handler.js → posts/handlers/internal-post-analytics-handler.js} +2 -1
  38. package/dist/posts/model/post-model.d.ts +2 -0
  39. package/dist/posts/model/post-model.js +3 -0
  40. package/dist/posts/model/types.d.ts +2 -1
  41. package/dist/posts/model/types.js +1 -1
  42. package/dist/posts/post-viewer/attachments-horizontal.svelte +5 -4
  43. package/dist/posts/post-viewer/attachments-horizontal.svelte.d.ts +2 -0
  44. package/dist/posts/post-viewer/cmp.post-viewer.svelte +13 -2
  45. package/dist/posts/post-viewer/cmp.post-viewer.svelte.d.ts +2 -0
  46. package/dist/posts/post-viewer/mapper.js +18 -1
  47. package/dist/{short-videos/short-videos-player/cmp.short-videos-player.svelte → posts/posts-player/cmp.posts-player.svelte} +3 -3
  48. package/dist/posts/posts-player/cmp.posts-player.svelte.d.ts +4 -0
  49. package/dist/posts/posts-player/index.d.ts +31 -17
  50. package/dist/posts/posts-player/index.js +48 -31
  51. package/dist/posts/posts-player/mapper.d.ts +3 -0
  52. package/dist/{short-videos/short-videos-player → posts/posts-player}/mapper.js +2 -2
  53. package/dist/posts/posts-player/operations.generated.d.ts +80 -0
  54. package/dist/posts/posts-player/operations.generated.js +229 -0
  55. package/dist/posts/posts-player/operations.graphql +7 -0
  56. package/dist/posts/posts-player/posts-player-view.svelte +38 -4
  57. package/dist/posts/posts-player/posts-player-view.svelte.d.ts +5 -1
  58. package/dist/posts/posts-player/types.d.ts +7 -1
  59. package/dist/products/product-card/cmp.product-card.svelte +10 -7
  60. package/dist/products/product-card/cmp.product-card.svelte.d.ts +2 -0
  61. package/dist/products/product-card/mapper.d.ts +3 -1
  62. package/dist/products/product-card/mapper.js +2 -2
  63. package/dist/short-videos/data-providers/index.d.ts +1 -0
  64. package/dist/short-videos/data-providers/index.js +1 -0
  65. package/dist/short-videos/{short-videos-player/internal-short-video-player-provider.d.ts → data-providers/internal-short-video-player-items-provider.d.ts} +4 -4
  66. package/dist/short-videos/{short-videos-player/internal-short-video-player-provider.js → data-providers/internal-short-video-player-items-provider.js} +3 -3
  67. package/dist/short-videos/{short-videos-player → data-providers}/operations.generated.d.ts +0 -78
  68. package/dist/short-videos/{short-videos-player → data-providers}/operations.generated.js +2 -234
  69. package/dist/short-videos/{short-videos-player → data-providers}/operations.graphql +1 -9
  70. package/dist/short-videos/short-videos-player/index.d.ts +13 -62
  71. package/dist/short-videos/short-videos-player/index.js +76 -30
  72. package/dist/streams/layout/cmp.slot-content.svelte +14 -6
  73. package/dist/streams/layout/cmp.slot-content.svelte.d.ts +2 -0
  74. package/dist/streams/layout/element-views/cmp.container-stream-element.svelte +7 -2
  75. package/dist/streams/layout/element-views/cmp.container-stream-element.svelte.d.ts +2 -0
  76. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +8 -2
  77. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte.d.ts +2 -0
  78. package/dist/streams/layout/element-views/cmp.stream-element.svelte +3 -2
  79. package/dist/streams/layout/element-views/cmp.stream-element.svelte.d.ts +2 -0
  80. package/dist/streams/layout/index.d.ts +1 -0
  81. package/dist/streams/layout/models/mapper.js +2 -1
  82. package/dist/streams/layout/serializer.svelte.js +0 -1
  83. package/dist/streams/layout/types.d.ts +4 -0
  84. package/dist/streams/layout/types.js +1 -0
  85. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte +2 -2
  86. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte.d.ts +2 -0
  87. package/dist/streams/stream-player/stream-player-view.svelte +15 -3
  88. package/dist/ui/player-slider/player-buffer.svelte.d.ts +1 -0
  89. package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte +7 -8
  90. package/package.json +1 -1
  91. package/dist/media-center/media-center/short-video-resources-generator.d.ts +0 -8
  92. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +0 -4
  93. package/dist/short-videos/short-videos-player/mapper.d.ts +0 -3
  94. package/dist/short-videos/short-videos-player/short-videos-player-view.svelte +0 -82
  95. package/dist/short-videos/short-videos-player/short-videos-player-view.svelte.d.ts +0 -8
  96. package/dist/short-videos/short-videos-player/types.d.ts +0 -26
  97. /package/dist/{short-videos/short-videos-player → marketing-tracking}/types.js +0 -0
@@ -1,84 +1,101 @@
1
+ import {} from '../../media-center/config/types';
2
+ import { MediaCenter } from '../../media-center/media-center';
1
3
  import { ModalShadowHost } from '../../ui/shadow-dom';
2
- import { default as PostPlayerView } from './posts-player-view.svelte';
4
+ import { default as PostsPlayer } from './cmp.posts-player.svelte';
5
+ import { mapToPostPlayerModel } from './mapper';
3
6
  import { mount, unmount } from 'svelte';
4
- export {};
7
+ export { PostsPlayer };
8
+ export { mapToPostPlayerModel };
5
9
  /**
6
10
  * Opens the posts player modal.
7
11
  *
8
- * This version works only with a posts provider and removes legacy IDs/GraphQL modes.
9
- *
10
12
  * @param init Configuration options.
11
13
  *
12
- * Required
14
+ * Data provider (required)
13
15
  * @param {IPlayerItemsProvider<PostPlayerModel>} init.postsProvider
14
16
  * Provider that supplies post items to the player.
15
17
  *
16
- * Optional
18
+ * Media center (optional)
19
+ * @param {IMediaCenterConfig} [init.mediaCenterConfig]
20
+ * Optional media-center config passed to MediaCenter.
21
+ *
22
+ * Analytics (optional)
17
23
  * @param {IPostAnalyticsHandler} [init.analyticsHandler]
18
- * Analytics events handler.
24
+ * Custom analytics handler for posts player events.
25
+ *
26
+ * Social interactions (optional)
19
27
  * @param {IPostSocialInteractionsHandler} [init.socialInteractionsHandler]
20
28
  * Handler for social interactions (like, share, etc.).
21
- * @param {ContentPlayerSettings} [init.playerSettings]
22
- * Player UI and behavior settings.
23
29
  *
24
- * Fields of ContentPlayerSettings:
30
+ * Player settings
31
+ * @param {PostPlayerSettings} [init.playerSettings]
32
+ * Player UI and behavior settings.
33
+ * Fields of PostPlayerSettings:
25
34
  * - {boolean} [disableBackground]
26
35
  * If true, hides the player's background image.
27
36
  * - {boolean} [hideCloseButton]
28
37
  * If true, hides the close button.
29
- * - {Locale} [locale='en']
30
- * Localization for the player UI. Supported values: 'en' | 'no'.
31
- * If omitted, the default locale 'en' is used.
38
+ * - {'en'|'no'} [locale='en']
39
+ * Localization for the player UI. Default is 'en'; use 'no' for Norwegian.
32
40
  * - {boolean} [showStreamsCloudWatermark]
33
41
  * If true, shows the StreamsCloud watermark.
34
42
  *
35
43
  * Events
36
- * @param {{ playerClosed?: () => void }} [init.on]
44
+ * @param {{ playerClosed?: () => void; postActivated?: (id: string) => void }} [init.on]
37
45
  * Optional event handlers.
38
46
  * @param {() => void} [init.on.playerClosed]
39
47
  * Called after the player is fully closed (after unmount and removal from the DOM).
48
+ * @param {(id: string) => void} [init.on.postActivated]
49
+ * Called when a post becomes active (receives the post's id).
40
50
  *
41
51
  * @returns {void}
42
52
  *
43
53
  * @example
44
54
  * ```ts
45
- * import { openPostsPlayer } from '@streamscloud/embeddable/short-videos-player';
55
+ * import { openPostsPlayer } from '@streamscloud/embeddable/posts-player';
46
56
  *
47
57
  * openPostsPlayer({
48
58
  * postsProvider: myPostsProvider,
59
+ * mediaCenterConfig: myMediaCenterConfig,
49
60
  * analyticsHandler: myAnalyticsHandler,
50
61
  * socialInteractionsHandler: mySocialHandler,
51
62
  * playerSettings: {
63
+ * // Default locale is 'en'; set 'no' to switch to Norwegian:
64
+ * locale: 'no',
52
65
  * disableBackground: false,
53
66
  * hideCloseButton: false,
54
- * // Locale is 'en' by default; set 'no' to switch to Norwegian:
55
- * locale: 'no',
56
67
  * showStreamsCloudWatermark: true,
57
68
  * },
58
69
  * on: {
59
70
  * playerClosed: () => console.log('Player closed'),
71
+ * postActivated: (id) => console.log('Activated post', id),
60
72
  * },
61
73
  * });
62
74
  * ```
63
75
  */
64
76
  export function openPostsPlayer(init) {
65
- const { postsProvider, socialInteractionsHandler, playerSettings, on } = init;
66
- const dataProvider = postsProvider;
67
- const analyticsHandler = init.analyticsHandler;
77
+ const { postsProvider: dataProvider, mediaCenterConfig, analyticsHandler, socialInteractionsHandler, playerSettings, on } = init;
68
78
  const shadowHost = new ModalShadowHost();
69
- const mounted = mount(PostPlayerView, {
79
+ const mounted = mount(MediaCenter, {
70
80
  target: shadowHost.shadowRoot,
71
81
  props: {
72
- dataProvider,
73
- socialInteractionsHandler,
74
- playerSettings,
75
- analyticsHandler,
76
- on: {
77
- playerClosed: async () => {
78
- await unmount(mounted);
79
- shadowHost.remove();
80
- if (on?.playerClosed) {
81
- on.playerClosed();
82
+ config: mediaCenterConfig || null,
83
+ playerProps: {
84
+ mode: 'posts',
85
+ props: {
86
+ dataProvider,
87
+ socialInteractionsHandler,
88
+ analyticsHandler,
89
+ playerSettings,
90
+ on: {
91
+ playerClosed: async () => {
92
+ await unmount(mounted);
93
+ shadowHost.remove();
94
+ if (on?.playerClosed) {
95
+ on.playerClosed();
96
+ }
97
+ },
98
+ postActivated: on?.postActivated
82
99
  }
83
100
  }
84
101
  }
@@ -0,0 +1,3 @@
1
+ import type { PostsPlayerPayloadFragment } from './operations.generated';
2
+ import type { PostPlayerModel } from './types';
3
+ export declare const mapToPostPlayerModel: (payload: PostsPlayerPayloadFragment) => PostPlayerModel;
@@ -1,6 +1,6 @@
1
1
  import { ProfileType } from '../../core/enums';
2
- import { mapToPostModel } from '../../posts/post-viewer';
3
- export const mapToShortVideoPlayerModel = (payload) => {
2
+ import { mapToPostModel } from '../post-viewer';
3
+ export const mapToPostPlayerModel = (payload) => {
4
4
  const viewerModel = mapToPostModel(payload);
5
5
  return {
6
6
  ...viewerModel,
@@ -0,0 +1,80 @@
1
+ import type * as SchemaTypes from '../../../gql/types';
2
+ import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
3
+ export type PostsPlayerPayloadFragment = {
4
+ id: string;
5
+ enableSocialInteractions: boolean;
6
+ ownerProfile: {
7
+ id: string;
8
+ type: SchemaTypes.ProfileType;
9
+ };
10
+ allProducts: Array<{
11
+ id: string;
12
+ title: string;
13
+ shortDescription: string | null;
14
+ link: string | null;
15
+ media: Array<{
16
+ url: string;
17
+ thumbnailUrl: string | null;
18
+ type: SchemaTypes.MediaType;
19
+ }>;
20
+ brand: {
21
+ name: string;
22
+ } | null;
23
+ priceAndAvailability: {
24
+ currency: SchemaTypes.Currency;
25
+ price: number;
26
+ productSalePrices: Array<{
27
+ salePrice: number;
28
+ salePriceEffectiveDateFrom: any | null;
29
+ salePriceEffectiveDateTo: any | null;
30
+ }> | null;
31
+ };
32
+ }>;
33
+ ad: {
34
+ id: string;
35
+ title: string;
36
+ description: string | null;
37
+ price: number | null;
38
+ priceInfo: string | null;
39
+ currency: SchemaTypes.Currency | null;
40
+ type: SchemaTypes.AdType;
41
+ ctaButton: {
42
+ background: string;
43
+ textColor: string;
44
+ text: string;
45
+ url: string;
46
+ border: string;
47
+ } | null;
48
+ media: Array<{
49
+ url: string;
50
+ thumbnailUrl: string | null;
51
+ type: SchemaTypes.MediaType;
52
+ }>;
53
+ } | null;
54
+ postData: {
55
+ media: Array<{
56
+ url: string;
57
+ thumbnailUrl: string | null;
58
+ type: SchemaTypes.MediaType;
59
+ }>;
60
+ articleData: {
61
+ title: string;
62
+ kicker: string | null;
63
+ articleId: string;
64
+ } | null;
65
+ mediaData: {
66
+ text: string | null;
67
+ } | null;
68
+ momentData: {
69
+ text: string | null;
70
+ } | null;
71
+ shortVideoData: {
72
+ text: string | null;
73
+ } | null;
74
+ videoData: {
75
+ title: string | null;
76
+ text: string | null;
77
+ } | null;
78
+ };
79
+ };
80
+ export declare const PostsPlayerPayloadFragmentDoc: DocumentNode<PostsPlayerPayloadFragment, unknown>;
@@ -0,0 +1,229 @@
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
+ };
@@ -0,0 +1,7 @@
1
+ fragment PostsPlayerPayloadFragment on Post {
2
+ ...PostViewerPayloadFragment
3
+ ownerProfile {
4
+ id
5
+ type
6
+ }
7
+ }
@@ -7,13 +7,14 @@
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { PostType } from '../..';
10
11
  import { ContentPlayer, ContentPlayerConfig } from '../../content-player';
11
12
  import { ContentPlayerSettings } from '../../content-player/content-player-settings';
12
13
  import { preloadImage } from '../../core/image-preloader';
13
14
  import { getPostCoverImage } from '../model';
14
15
  import { PlayerBuffer } from '../../ui/player-slider';
15
16
  import { untrack } from 'svelte';
16
- let { dataProvider, socialInteractionsHandler, playerSettings, analyticsHandler, on } = $props();
17
+ let { dataProvider, socialInteractionsHandler, playerSettings, analyticsHandler, on, mediaCenterData } = $props();
17
18
  $effect(() => {
18
19
  void dataProvider;
19
20
  untrack(() => {
@@ -21,7 +22,11 @@ $effect(() => {
21
22
  initBuffer(dataProvider);
22
23
  });
23
24
  });
25
+ $effect(() => contentPlayerConfig.updateMediaCenterData(mediaCenterData));
24
26
  const initBuffer = (dataProvider) => __awaiter(void 0, void 0, void 0, function* () {
27
+ if (dataProvider.prefetch) {
28
+ yield dataProvider.prefetch();
29
+ }
25
30
  new PlayerBuffer(dataProvider, {
26
31
  preloaded: (instance) => __awaiter(void 0, void 0, void 0, function* () {
27
32
  if (instance.loaded.length) {
@@ -33,20 +38,45 @@ const initBuffer = (dataProvider) => __awaiter(void 0, void 0, void 0, function*
33
38
  })
34
39
  });
35
40
  });
41
+ const getLoadedItemById = (id) => {
42
+ if (!contentPlayerConfig.playerBuffer) {
43
+ return null;
44
+ }
45
+ return contentPlayerConfig.playerBuffer.loaded.find((item) => item.id === id) || null;
46
+ };
36
47
  const contentPlayerConfig = new ContentPlayerConfig({
37
48
  playerBuffer: null,
38
49
  mappers: {
39
50
  postModelFromCurrentItem: (item) => item
40
51
  },
41
52
  socialInteractionsHandler,
53
+ mediaCenterData,
42
54
  settings: new ContentPlayerSettings(playerSettings),
43
55
  callbacks: {
44
- close: on === null || on === void 0 ? void 0 : on.playerClosed
56
+ close: on === null || on === void 0 ? void 0 : on.playerClosed,
57
+ productClick: (id, postId) => {
58
+ var _a;
59
+ if (((_a = getLoadedItemById(postId)) === null || _a === void 0 ? void 0 : _a.postType) === PostType.ShortVideo) {
60
+ analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackShortVideoProductClick(id, postId);
61
+ }
62
+ },
63
+ productImpression: (id, postId) => {
64
+ var _a;
65
+ if (((_a = getLoadedItemById(postId)) === null || _a === void 0 ? void 0 : _a.postType) === PostType.ShortVideo) {
66
+ analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackShortVideoProductImpression(id, postId);
67
+ }
68
+ },
69
+ adClick: (id) => {
70
+ analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackAdClick(id);
71
+ },
72
+ adImpression: (id) => {
73
+ analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackAdImpression(id);
74
+ }
45
75
  },
46
76
  playerSliderCallbacks: {
47
77
  itemActivated: (id) => {
48
78
  var _a;
49
- const post = (_a = contentPlayerConfig.playerBuffer) === null || _a === void 0 ? void 0 : _a.loaded.find((x) => x.id === id);
79
+ const post = getLoadedItemById(id);
50
80
  if (!post) {
51
81
  return;
52
82
  }
@@ -54,9 +84,13 @@ const contentPlayerConfig = new ContentPlayerConfig({
54
84
  if (post.analyticsOrganizationId) {
55
85
  analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.setOrganizationId(post.analyticsOrganizationId);
56
86
  }
57
- if (post.analyticsOrganizationId) {
87
+ if (post.postType === PostType.ShortVideo) {
88
+ analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackShortVideoView(id);
89
+ }
90
+ else if (post.analyticsOrganizationId) {
58
91
  analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackPostOpened(id, post.analyticsOrganizationId);
59
92
  }
93
+ (_a = on === null || on === void 0 ? void 0 : on.postActivated) === null || _a === void 0 ? void 0 : _a.call(on, id);
60
94
  }
61
95
  }
62
96
  });
@@ -1,4 +1,8 @@
1
+ import type { MediaCenterData } from '../../media-center/model/types';
1
2
  import type { PostPlayerProps } from './types';
2
- declare const PostsPlayerView: import("svelte").Component<PostPlayerProps, {}, "">;
3
+ type $$ComponentProps = PostPlayerProps & {
4
+ mediaCenterData?: MediaCenterData;
5
+ };
6
+ declare const PostsPlayerView: import("svelte").Component<$$ComponentProps, {}, "">;
3
7
  type PostsPlayerView = ReturnType<typeof PostsPlayerView>;
4
8
  export default PostsPlayerView;
@@ -5,6 +5,11 @@ import type { IPlayerItemsProvider } from '../../ui/player-slider';
5
5
  export interface IPostAnalyticsHandler {
6
6
  setOrganizationId: (organizationId: string) => void;
7
7
  trackPostOpened: (postId: string, ownerId: string) => void;
8
+ trackShortVideoView: (videoId: string) => void;
9
+ trackShortVideoProductImpression: (productId: string, videoId: string) => void;
10
+ trackShortVideoProductClick: (productId: string, videoId: string) => void;
11
+ trackAdClick: (adId: string) => void;
12
+ trackAdImpression: (adId: string) => void;
8
13
  }
9
14
  export type PostPlayerModel = IPostModel & {
10
15
  analyticsOrganizationId: string | null;
@@ -16,6 +21,7 @@ export type PostPlayerProps = {
16
21
  playerSettings?: PostPlayerSettings;
17
22
  on?: {
18
23
  playerClosed?: () => void;
24
+ postActivated?: (id: string) => void;
19
25
  };
20
26
  };
21
- export type PostPlayerSettings = Pick<IContentPlayerSettingsInitializer, 'disableBackground' | 'hideCloseButton' | 'locale' | 'showStreamsCloudWatermark'>;
27
+ export type PostPlayerSettings = IContentPlayerSettingsInitializer;
@@ -1,9 +1,10 @@
1
- <script lang="ts">import { toPriceRepresentation } from '../price-helper';
1
+ <script lang="ts">import { enrichProductLinkWithTracking } from '../../marketing-tracking';
2
+ import { toPriceRepresentation } from '../price-helper';
2
3
  import { Image } from '../../ui/image';
3
4
  import { LineClamp } from '../../ui/line-clamp';
4
5
  import { ProportionalContainer } from '../../ui/proportional-container';
5
6
  import { ProductCardLocalization } from './product-card-localization';
6
- let { product, includeBeforeNowPrefix, inert = false, locale = 'en', on } = $props();
7
+ let { product, includeBeforeNowPrefix, trackingParams, inert = false, locale = 'en', on } = $props();
7
8
  const localization = $derived(new ProductCardLocalization(locale));
8
9
  const shortDescriptionPresented = $derived(product.shortDescription && product.shortDescription.length > 0);
9
10
  const trackImpression = (node) => {
@@ -25,16 +26,16 @@ const trackImpression = (node) => {
25
26
  };
26
27
  }
27
28
  };
29
+ const enrichedLink = $derived(product.link ? enrichProductLinkWithTracking({ link: product.link, productId: product.id, trackingParams }) : null);
28
30
  const onProductClicked = (event) => {
29
31
  event.preventDefault();
30
32
  event.stopPropagation();
31
33
  if (on === null || on === void 0 ? void 0 : on.click) {
32
34
  on.click(product.id);
33
35
  }
34
- if (!product.link) {
35
- return;
36
+ if (enrichedLink) {
37
+ window.open(enrichedLink, '_blank', 'noopener noreferrer');
36
38
  }
37
- window.open(product.link, '_blank', 'noopener noreferrer');
38
39
  };
39
40
  </script>
40
41
 
@@ -68,8 +69,10 @@ const onProductClicked = (event) => {
68
69
  </div>
69
70
  </div>
70
71
 
71
- {#if product.link || on?.click}
72
- <a href={product.link} onclick={onProductClicked} target="_blank" rel="noopener noreferrer" class="product-card__link" aria-label="none">&nbsp;</a>
72
+ {#if enrichedLink}
73
+ <a href={enrichedLink.href} onclick={onProductClicked} target="_blank" rel="noopener noreferrer" class="product-card__link" aria-label="none">&nbsp;</a>
74
+ {:else if on?.click}
75
+ <button type="button" onclick={onProductClicked} class="product-card__link" aria-label="none">&nbsp;</button>
73
76
  {/if}
74
77
  </div>
75
78
 
@@ -1,10 +1,12 @@
1
1
  import type { Locale } from '../../core/locale';
2
+ import { type TrackingParams } from '../../marketing-tracking';
2
3
  import type { ProductCardModel } from './types';
3
4
  type Props = {
4
5
  product: ProductCardModel;
5
6
  locale?: Locale;
6
7
  includeBeforeNowPrefix?: boolean;
7
8
  inert?: boolean;
9
+ trackingParams: TrackingParams;
8
10
  on?: {
9
11
  click?: (id: string) => void;
10
12
  impression?: (id: string) => void;
@@ -1,3 +1,5 @@
1
1
  import type { ProductCardPayloadFragment } from './operations.generated';
2
2
  import type { ProductCardModel } from './types';
3
- export declare const mapToProductCard: (payload: ProductCardPayloadFragment, referenceDate?: string | null) => ProductCardModel;
3
+ export declare const mapToProductCard: (payload: ProductCardPayloadFragment, options?: Partial<{
4
+ referenceDate: string | null;
5
+ }>) => ProductCardModel;