@streamscloud/embeddable 13.2.0 → 14.0.0-rc.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 (49) hide show
  1. package/dist/content-player/cmp.content-player.svelte.d.ts +15 -6
  2. package/dist/content-player/controls-and-attachments.svelte.d.ts +14 -5
  3. package/dist/content-player/overview-panel.svelte +3 -1
  4. package/dist/content-player/overview-panel.svelte.d.ts +14 -5
  5. package/dist/core/analytics.installation-id.d.ts +5 -0
  6. package/dist/core/{analytics.profile-id.js → analytics.installation-id.js} +20 -10
  7. package/dist/external-api/data-providers/internal-media-center-analytics-handler.d.ts +14 -14
  8. package/dist/external-api/data-providers/internal-media-center-analytics-handler.js +170 -19
  9. package/dist/external-api/data-providers/internal-post-analytics-handler.d.ts +7 -7
  10. package/dist/external-api/data-providers/internal-post-analytics-handler.js +72 -11
  11. package/dist/external-api/data-providers/internal-stream-analytics-handler.d.ts +12 -13
  12. package/dist/external-api/data-providers/internal-stream-analytics-handler.js +162 -18
  13. package/dist/external-api/data-providers/mapper.d.ts +3 -0
  14. package/dist/external-api/data-providers/mapper.js +18 -0
  15. package/dist/external-api/data-providers/post-data-loaders/mapper.js +1 -3
  16. package/dist/media-center/media-center/discover/community-features.svelte +2 -1
  17. package/dist/media-center/media-center/discover/discover-header.svelte +1 -0
  18. package/dist/media-center/media-center/discover/discover-view.svelte +34 -11
  19. package/dist/media-center/media-center/menu/menu.svelte +5 -3
  20. package/dist/media-center/media-center/streams-in-category/streams-in-category-panel.svelte +6 -2
  21. package/dist/posts/post-viewer/attachments-horizontal.svelte +1 -0
  22. package/dist/posts/post-viewer/media/post-media.svelte +3 -3
  23. package/dist/posts/posts-player/posts-player-view.svelte +2 -5
  24. package/dist/posts/posts-player/types.d.ts +3 -5
  25. package/dist/streams/streams-player/streams-player-view.svelte +0 -3
  26. package/dist/streams/streams-player/types.d.ts +0 -1
  27. package/dist/ui/button/resources/button-theme.svelte +4 -2
  28. package/dist/ui/icon/cmp.icon.svelte +1 -1
  29. package/dist/ui/player/button/cmp.player-button.svelte +3 -1
  30. package/dist/ui/player/button/cmp.player-buttons-group.svelte +3 -1
  31. package/dist/ui/player/slider/cmp.player-slider.svelte +22 -15
  32. package/dist/ui/player/slider/cmp.player-slider.svelte.d.ts +14 -5
  33. package/dist/ui/{slider → player/slider-horizontal}/cmp.slider.svelte +57 -30
  34. package/dist/ui/{slider → player/slider-horizontal}/cmp.slider.svelte.d.ts +13 -6
  35. package/dist/ui/player/slider-horizontal/index.d.ts +2 -0
  36. package/dist/ui/player/slider-horizontal/index.js +2 -0
  37. package/dist/ui/{slider → player/slider-horizontal}/slider-localization.d.ts +1 -1
  38. package/dist/ui/{slider → player/slider-horizontal}/slider-localization.js +1 -1
  39. package/dist/ui/player/utils/index.d.ts +1 -0
  40. package/dist/ui/player/utils/index.js +1 -0
  41. package/dist/ui/player/utils/touch-synchronizer.d.ts +7 -0
  42. package/dist/ui/player/utils/touch-synchronizer.js +21 -0
  43. package/dist/ui/shadow-dom/cmp.shadow-root.svelte +2 -2
  44. package/package.json +2 -2
  45. package/dist/core/analytics.profile-id.d.ts +0 -5
  46. package/dist/ui/slider/index.d.ts +0 -2
  47. package/dist/ui/slider/index.js +0 -2
  48. /package/dist/ui/{slider → player/slider-horizontal}/types.d.ts +0 -0
  49. /package/dist/ui/{slider → player/slider-horizontal}/types.js +0 -0
@@ -1,17 +1,26 @@
1
1
  import type { ContentPlayerConfig } from './content-player-config.svelte';
2
2
  import { type Snippet } from 'svelte';
3
- declare class __sveltets_Render<T extends {
3
+ declare function $$render<T extends {
4
4
  id: string;
5
- }> {
6
- props(): {
5
+ }>(): {
6
+ props: {
7
7
  config: ContentPlayerConfig<T>;
8
8
  nonPostItemView?: Snippet<[{
9
9
  item: T;
10
- }]> | undefined;
10
+ }]>;
11
11
  overviewPanelContent?: Snippet;
12
12
  };
13
- events(): {};
14
- slots(): {};
13
+ exports: {};
14
+ bindings: "";
15
+ slots: {};
16
+ events: {};
17
+ };
18
+ declare class __sveltets_Render<T extends {
19
+ id: string;
20
+ }> {
21
+ props(): ReturnType<typeof $$render<T>>['props'];
22
+ events(): ReturnType<typeof $$render<T>>['events'];
23
+ slots(): ReturnType<typeof $$render<T>>['slots'];
15
24
  bindings(): "";
16
25
  exports(): {};
17
26
  }
@@ -1,13 +1,22 @@
1
1
  import { ContentPlayerConfig } from './content-player-config.svelte';
2
- declare class __sveltets_Render<T extends {
2
+ declare function $$render<T extends {
3
3
  id: string;
4
- }> {
5
- props(): {
4
+ }>(): {
5
+ props: {
6
6
  config: ContentPlayerConfig<T>;
7
7
  hasOverview: boolean;
8
8
  };
9
- events(): {};
10
- slots(): {};
9
+ exports: {};
10
+ bindings: "";
11
+ slots: {};
12
+ events: {};
13
+ };
14
+ declare class __sveltets_Render<T extends {
15
+ id: string;
16
+ }> {
17
+ props(): ReturnType<typeof $$render<T>>['props'];
18
+ events(): ReturnType<typeof $$render<T>>['events'];
19
+ slots(): ReturnType<typeof $$render<T>>['slots'];
11
20
  bindings(): "";
12
21
  exports(): {};
13
22
  }
@@ -59,7 +59,6 @@ const styles = $derived.by(() => {
59
59
  z-index: 0;
60
60
  border-radius: 0.5rem 0 0 0.5rem;
61
61
  background: var(--_overview-panel--background);
62
- /* Set 'container-type: inline-size;' to reference container*/
63
62
  }
64
63
  .overview-panel__content {
65
64
  width: 100%;
@@ -71,6 +70,9 @@ const styles = $derived.by(() => {
71
70
  overflow: hidden;
72
71
  container-type: inline-size;
73
72
  }
73
+ .overview-panel {
74
+ /* Set 'container-type: inline-size;' to reference container*/
75
+ }
74
76
  @container (width < 576px) {
75
77
  .overview-panel {
76
78
  width: 100%;
@@ -1,10 +1,10 @@
1
1
  import type { ContentPlayerConfig } from './content-player-config.svelte';
2
2
  import type { ContentPlayerUIManager } from './ui-manager.svelte';
3
3
  import type { Snippet } from 'svelte';
4
- declare class __sveltets_Render<T extends {
4
+ declare function $$render<T extends {
5
5
  id: string;
6
- }> {
7
- props(): {
6
+ }>(): {
7
+ props: {
8
8
  config: ContentPlayerConfig<T>;
9
9
  uiManager: ContentPlayerUIManager;
10
10
  position: {
@@ -14,8 +14,17 @@ declare class __sveltets_Render<T extends {
14
14
  };
15
15
  children: Snippet;
16
16
  };
17
- events(): {};
18
- slots(): {};
17
+ exports: {};
18
+ bindings: "";
19
+ slots: {};
20
+ events: {};
21
+ };
22
+ declare class __sveltets_Render<T extends {
23
+ id: string;
24
+ }> {
25
+ props(): ReturnType<typeof $$render<T>>['props'];
26
+ events(): ReturnType<typeof $$render<T>>['events'];
27
+ slots(): ReturnType<typeof $$render<T>>['slots'];
19
28
  bindings(): "";
20
29
  exports(): {};
21
30
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Retrieves the installation ID from localStorage or generates a new one if it doesn't exist
3
+ * @returns The installation ID to use for analytics tracking
4
+ */
5
+ export declare const getOrCreateInstallationId: () => string;
@@ -1,19 +1,29 @@
1
1
  /**
2
- * Key used for storing the profile ID in local storage
2
+ * Key used for storing the installation ID in local storage (new)
3
+ */
4
+ const INSTALLATION_ID_STORAGE_KEY = 'streamscloud_installation_id';
5
+ /**
6
+ * Legacy key used for storing the profile ID in local storage (to be migrated)
3
7
  */
4
8
  const PROFILE_ID_STORAGE_KEY = 'streamscloud_profile_id';
5
9
  /**
6
- * Retrieves the profile ID from localStorage or generates a new one if it doesn't exist
7
- * @returns The profile ID to use for analytics tracking
10
+ * Retrieves the installation ID from localStorage or generates a new one if it doesn't exist
11
+ * @returns The installation ID to use for analytics tracking
8
12
  */
9
- export const getOrCreateProfileId = () => {
10
- const storedProfileId = localStorage.getItem(PROFILE_ID_STORAGE_KEY);
11
- if (!storedProfileId) {
12
- const newProfileId = safeRandomUUID();
13
- localStorage.setItem(PROFILE_ID_STORAGE_KEY, newProfileId);
14
- return newProfileId;
13
+ export const getOrCreateInstallationId = () => {
14
+ const currentId = localStorage.getItem(INSTALLATION_ID_STORAGE_KEY);
15
+ if (currentId) {
16
+ return currentId;
17
+ }
18
+ const legacyId = localStorage.getItem(PROFILE_ID_STORAGE_KEY);
19
+ if (legacyId) {
20
+ localStorage.setItem(INSTALLATION_ID_STORAGE_KEY, legacyId);
21
+ localStorage.removeItem(PROFILE_ID_STORAGE_KEY);
22
+ return legacyId;
15
23
  }
16
- return storedProfileId;
24
+ const newInstallationId = safeRandomUUID();
25
+ localStorage.setItem(INSTALLATION_ID_STORAGE_KEY, newInstallationId);
26
+ return newInstallationId;
17
27
  };
18
28
  function safeRandomUUID() {
19
29
  // 1) Native support
@@ -1,20 +1,20 @@
1
+ import type { PostType } from '../..';
1
2
  import type { IPostAnalyticsHandler } from '../../posts/posts-player/types';
2
3
  import type { IStreamAnalyticsHandler } from '../../streams/streams-player/types';
3
4
  export declare class InternalMediaCenterAnalyticsHandler implements IPostAnalyticsHandler, IStreamAnalyticsHandler {
4
5
  constructor(graphqlOrigin: string | undefined);
5
- setOrganizationId: (organizationId: string) => void;
6
- trackPostOpened: (postId: string, ownerId: string) => void;
7
- trackStreamView: (streamId: string) => void;
8
- trackStreamPageView: (pageId: string, streamId: string) => void;
9
- trackStreamEngagementTime: (streamId: string, engagementTime: number) => void;
10
- trackStreamScrollDepth: (streamId: string, scrollDepth: number) => void;
11
- trackStreamProductImpression: (productId: string, streamId: string) => void;
12
- trackStreamProductClicked: (productId: string, streamId: string) => void;
13
- reportPageVideoViews: (videoId: string, streamId: string) => void;
14
- trackShortVideoView: (videoId: string) => void;
15
- trackShortVideoProductImpression: (productId: string, videoId: string) => void;
16
- trackShortVideoProductClick: (productId: string, videoId: string) => void;
6
+ trackPostOpened: (postType: PostType, postId: string) => Promise<void>;
7
+ trackStreamView: (streamId: string) => Promise<void>;
8
+ trackStreamPageView: (pageId: string, streamId: string) => Promise<void>;
9
+ trackStreamEngagementTime: (streamId: string, engagementTime: number) => Promise<void>;
10
+ trackStreamScrollDepth: (streamId: string, scrollDepth: number) => Promise<void>;
11
+ trackStreamProductImpression: (productId: string, streamId: string) => Promise<void>;
12
+ trackStreamProductClicked: (productId: string, streamId: string) => Promise<void>;
13
+ reportPageVideoViews: (pageId: string, streamId: string) => Promise<import("@streamscloud/streams-analytics-collector").MeasurementsBatchReportResult>;
14
+ trackShortVideoView: (videoId: string) => Promise<void>;
15
+ trackShortVideoProductImpression: (productId: string, videoId: string) => Promise<void>;
16
+ trackShortVideoProductClick: (productId: string, videoId: string) => Promise<void>;
17
17
  trackShortVideoProgress: (pageId: string, videoId: string, progress: number, streamId: string) => void;
18
- trackAdClick: (adId: string) => void;
19
- trackAdImpression: (adId: string) => void;
18
+ trackAdClick: (adId: string) => Promise<void>;
19
+ trackAdImpression: (adId: string) => Promise<void>;
20
20
  }
@@ -1,24 +1,175 @@
1
- import { getOrCreateProfileId } from '../../core/analytics.profile-id';
1
+ import { getOrCreateInstallationId } from '../../core/analytics.installation-id';
2
2
  import { constructGraphQLUrl } from '../../core/graphql';
3
- import { AppEventsTracker } from '@streamscloud/streams-analytics-collector';
3
+ import { mapPostTypeToEntityType } from './mapper';
4
+ import { AnalyticsCollector, EntityRelationType, EntityType, EventType, MeasurementType, Schemas } from '@streamscloud/streams-analytics-collector';
4
5
  export class InternalMediaCenterAnalyticsHandler {
5
6
  constructor(graphqlOrigin) {
6
- AppEventsTracker.setEndpoint(constructGraphQLUrl(graphqlOrigin));
7
- AppEventsTracker.setProfileId(getOrCreateProfileId());
7
+ AnalyticsCollector.initialize({
8
+ gqlDataSenderOptions: {
9
+ endpoint: constructGraphQLUrl(graphqlOrigin)
10
+ },
11
+ schema: Schemas.external,
12
+ metadata: {
13
+ installationId: getOrCreateInstallationId()
14
+ }
15
+ });
8
16
  }
9
- setOrganizationId = (organizationId) => AppEventsTracker.setOrganizationId(organizationId);
10
- trackPostOpened = (postId, ownerId) => AppEventsTracker.trackPostOpened(postId, ownerId);
11
- trackStreamView = (streamId) => AppEventsTracker.trackStreamView(streamId);
12
- trackStreamPageView = (pageId, streamId) => AppEventsTracker.trackStreamPageView(pageId, streamId);
13
- trackStreamEngagementTime = (streamId, engagementTime) => AppEventsTracker.trackStreamEngagementTime(streamId, engagementTime);
14
- trackStreamScrollDepth = (streamId, scrollDepth) => AppEventsTracker.trackStreamScrollDepth(streamId, scrollDepth);
15
- trackStreamProductImpression = (productId, streamId) => AppEventsTracker.trackStreamProductImpression(productId, streamId);
16
- trackStreamProductClicked = (productId, streamId) => AppEventsTracker.trackStreamProductClicked(productId, streamId);
17
- reportPageVideoViews = (videoId, streamId) => AppEventsTracker.reportPageVideoViews(videoId, streamId);
18
- trackShortVideoView = (videoId) => AppEventsTracker.trackShortVideoView(videoId);
19
- trackShortVideoProductImpression = (productId, videoId) => AppEventsTracker.trackShortVideoProductImpression(productId, videoId);
20
- trackShortVideoProductClick = (productId, videoId) => AppEventsTracker.trackShortVideoProductClick(productId, videoId);
21
- trackShortVideoProgress = (pageId, videoId, progress, streamId) => AppEventsTracker.trackShortVideoProgress(pageId, videoId, progress, streamId);
22
- trackAdClick = (adId) => AppEventsTracker.trackAdClick(adId);
23
- trackAdImpression = (adId) => AppEventsTracker.trackAdImpression(adId);
17
+ trackPostOpened = (postType, postId) => AnalyticsCollector.eventsReporter.reportEvent({
18
+ entity: {
19
+ type: mapPostTypeToEntityType(postType),
20
+ id: postId
21
+ },
22
+ eventType: EventType.Viewed
23
+ });
24
+ trackStreamView = (streamId) => AnalyticsCollector.eventsReporter.reportEvent({
25
+ entity: {
26
+ type: EntityType.Stream,
27
+ id: streamId
28
+ },
29
+ eventType: EventType.Viewed
30
+ });
31
+ trackStreamPageView = (pageId, streamId) => AnalyticsCollector.eventsReporter.reportEvent({
32
+ entity: {
33
+ type: EntityType.StreamPage,
34
+ id: pageId
35
+ },
36
+ eventType: EventType.Viewed,
37
+ relatedEntities: [
38
+ {
39
+ relationType: EntityRelationType.PlacedIn,
40
+ entity: {
41
+ type: EntityType.Stream,
42
+ id: streamId
43
+ }
44
+ }
45
+ ]
46
+ });
47
+ trackStreamEngagementTime = (streamId, engagementTime) => AnalyticsCollector.measurementsReporter.reportMeasurement({
48
+ entity: {
49
+ type: EntityType.Stream,
50
+ id: streamId
51
+ },
52
+ measurementType: MeasurementType.EngagementTime,
53
+ value: engagementTime
54
+ });
55
+ trackStreamScrollDepth = (streamId, scrollDepth) => AnalyticsCollector.measurementsReporter.reportMeasurement({
56
+ entity: {
57
+ type: EntityType.Stream,
58
+ id: streamId
59
+ },
60
+ measurementType: MeasurementType.ScrollDepth,
61
+ value: scrollDepth
62
+ });
63
+ trackStreamProductImpression = (productId, streamId) => AnalyticsCollector.eventsReporter.reportEvent({
64
+ entity: {
65
+ type: EntityType.Product,
66
+ id: productId
67
+ },
68
+ eventType: EventType.Appeared,
69
+ relatedEntities: [
70
+ {
71
+ relationType: EntityRelationType.PlacedIn,
72
+ entity: {
73
+ type: EntityType.Stream,
74
+ id: streamId
75
+ }
76
+ }
77
+ ]
78
+ });
79
+ trackStreamProductClicked = (productId, streamId) => AnalyticsCollector.eventsReporter.reportEvent({
80
+ entity: {
81
+ type: EntityType.Product,
82
+ id: productId
83
+ },
84
+ eventType: EventType.Clicked,
85
+ relatedEntities: [
86
+ {
87
+ relationType: EntityRelationType.PlacedIn,
88
+ entity: {
89
+ type: EntityType.Stream,
90
+ id: streamId
91
+ }
92
+ }
93
+ ]
94
+ });
95
+ reportPageVideoViews = (pageId, streamId) => AnalyticsCollector.measurementsBatcher.reportBatch([
96
+ {
97
+ type: EntityType.StreamPage,
98
+ id: pageId
99
+ },
100
+ {
101
+ type: EntityType.Stream,
102
+ id: streamId
103
+ }
104
+ ]);
105
+ trackShortVideoView = (videoId) => AnalyticsCollector.eventsReporter.reportEvent({
106
+ entity: {
107
+ type: EntityType.ShortVideo,
108
+ id: videoId
109
+ },
110
+ eventType: EventType.Viewed
111
+ });
112
+ trackShortVideoProductImpression = (productId, videoId) => AnalyticsCollector.eventsReporter.reportEvent({
113
+ entity: {
114
+ type: EntityType.Product,
115
+ id: productId
116
+ },
117
+ eventType: EventType.Appeared,
118
+ relatedEntities: [
119
+ {
120
+ relationType: EntityRelationType.PlacedIn,
121
+ entity: {
122
+ type: EntityType.ShortVideo,
123
+ id: videoId
124
+ }
125
+ }
126
+ ]
127
+ });
128
+ trackShortVideoProductClick = (productId, videoId) => AnalyticsCollector.eventsReporter.reportEvent({
129
+ entity: {
130
+ type: EntityType.Product,
131
+ id: productId
132
+ },
133
+ eventType: EventType.Clicked,
134
+ relatedEntities: [
135
+ {
136
+ relationType: EntityRelationType.PlacedIn,
137
+ entity: {
138
+ type: EntityType.ShortVideo,
139
+ id: videoId
140
+ }
141
+ }
142
+ ]
143
+ });
144
+ trackShortVideoProgress = (pageId, videoId, progress, streamId) => AnalyticsCollector.measurementsBatcher.collect([
145
+ {
146
+ type: EntityType.StreamPage,
147
+ id: pageId
148
+ },
149
+ {
150
+ type: EntityType.Stream,
151
+ id: streamId
152
+ }
153
+ ], {
154
+ entity: {
155
+ type: EntityType.ShortVideo,
156
+ id: videoId
157
+ },
158
+ measurementType: MeasurementType.Progress,
159
+ value: progress
160
+ });
161
+ trackAdClick = (adId) => AnalyticsCollector.eventsReporter.reportEvent({
162
+ entity: {
163
+ type: EntityType.Ad,
164
+ id: adId
165
+ },
166
+ eventType: EventType.Clicked
167
+ });
168
+ trackAdImpression = (adId) => AnalyticsCollector.eventsReporter.reportEvent({
169
+ entity: {
170
+ type: EntityType.Ad,
171
+ id: adId
172
+ },
173
+ eventType: EventType.Appeared
174
+ });
24
175
  }
@@ -1,11 +1,11 @@
1
+ import type { PostType } from '../../core/enums';
1
2
  import type { IPostAnalyticsHandler } from '../../posts/posts-player';
2
3
  export declare class InternalPostAnalyticsHandler implements IPostAnalyticsHandler {
3
4
  constructor(graphqlOrigin: string | undefined);
4
- setOrganizationId: (organizationId: string) => void;
5
- trackPostOpened: (postId: string, ownerId: string) => void;
6
- trackShortVideoView: (videoId: string) => void;
7
- trackShortVideoProductImpression: (productId: string, videoId: string) => void;
8
- trackShortVideoProductClick: (productId: string, videoId: string) => void;
9
- trackAdClick: (adId: string) => void;
10
- trackAdImpression: (adId: string) => void;
5
+ trackPostOpened: (postType: PostType, postId: string) => Promise<void>;
6
+ trackShortVideoView: (videoId: string) => Promise<void>;
7
+ trackShortVideoProductImpression: (productId: string, videoId: string) => Promise<void>;
8
+ trackShortVideoProductClick: (productId: string, videoId: string) => Promise<void>;
9
+ trackAdClick: (adId: string) => Promise<void>;
10
+ trackAdImpression: (adId: string) => Promise<void>;
11
11
  }
@@ -1,16 +1,77 @@
1
- import { getOrCreateProfileId } from '../../core/analytics.profile-id';
1
+ import { getOrCreateInstallationId } from '../../core/analytics.installation-id';
2
2
  import { constructGraphQLUrl } from '../../core/graphql';
3
- import { AppEventsTracker } from '@streamscloud/streams-analytics-collector';
3
+ import { mapPostTypeToEntityType } from './mapper';
4
+ import { AnalyticsCollector, EntityRelationType, EntityType, EventType, Schemas } from '@streamscloud/streams-analytics-collector';
4
5
  export class InternalPostAnalyticsHandler {
5
6
  constructor(graphqlOrigin) {
6
- AppEventsTracker.setEndpoint(constructGraphQLUrl(graphqlOrigin));
7
- AppEventsTracker.setProfileId(getOrCreateProfileId());
7
+ AnalyticsCollector.initialize({
8
+ gqlDataSenderOptions: {
9
+ endpoint: constructGraphQLUrl(graphqlOrigin)
10
+ },
11
+ schema: Schemas.external,
12
+ metadata: {
13
+ installationId: getOrCreateInstallationId()
14
+ }
15
+ });
8
16
  }
9
- setOrganizationId = (organizationId) => AppEventsTracker.setOrganizationId(organizationId);
10
- trackPostOpened = (postId, ownerId) => AppEventsTracker.trackPostOpened(postId, ownerId);
11
- trackShortVideoView = (videoId) => AppEventsTracker.trackShortVideoView(videoId);
12
- trackShortVideoProductImpression = (productId, videoId) => AppEventsTracker.trackShortVideoProductImpression(productId, videoId);
13
- trackShortVideoProductClick = (productId, videoId) => AppEventsTracker.trackShortVideoProductClick(productId, videoId);
14
- trackAdClick = (adId) => AppEventsTracker.trackAdClick(adId);
15
- trackAdImpression = (adId) => AppEventsTracker.trackAdImpression(adId);
17
+ trackPostOpened = (postType, postId) => AnalyticsCollector.eventsReporter.reportEvent({
18
+ entity: {
19
+ type: mapPostTypeToEntityType(postType),
20
+ id: postId
21
+ },
22
+ eventType: EventType.Viewed
23
+ });
24
+ trackShortVideoView = (videoId) => AnalyticsCollector.eventsReporter.reportEvent({
25
+ entity: {
26
+ type: EntityType.ShortVideo,
27
+ id: videoId
28
+ },
29
+ eventType: EventType.Viewed
30
+ });
31
+ trackShortVideoProductImpression = (productId, videoId) => AnalyticsCollector.eventsReporter.reportEvent({
32
+ entity: {
33
+ type: EntityType.Product,
34
+ id: productId
35
+ },
36
+ eventType: EventType.Appeared,
37
+ relatedEntities: [
38
+ {
39
+ relationType: EntityRelationType.PlacedIn,
40
+ entity: {
41
+ type: EntityType.ShortVideo,
42
+ id: videoId
43
+ }
44
+ }
45
+ ]
46
+ });
47
+ trackShortVideoProductClick = (productId, videoId) => AnalyticsCollector.eventsReporter.reportEvent({
48
+ entity: {
49
+ type: EntityType.Product,
50
+ id: productId
51
+ },
52
+ eventType: EventType.Clicked,
53
+ relatedEntities: [
54
+ {
55
+ relationType: EntityRelationType.PlacedIn,
56
+ entity: {
57
+ type: EntityType.ShortVideo,
58
+ id: videoId
59
+ }
60
+ }
61
+ ]
62
+ });
63
+ trackAdClick = (adId) => AnalyticsCollector.eventsReporter.reportEvent({
64
+ entity: {
65
+ type: EntityType.Ad,
66
+ id: adId
67
+ },
68
+ eventType: EventType.Clicked
69
+ });
70
+ trackAdImpression = (adId) => AnalyticsCollector.eventsReporter.reportEvent({
71
+ entity: {
72
+ type: EntityType.Ad,
73
+ id: adId
74
+ },
75
+ eventType: EventType.Appeared
76
+ });
16
77
  }
@@ -1,18 +1,17 @@
1
1
  import type { IStreamAnalyticsHandler } from '../../streams/streams-player/types';
2
2
  export declare class InternalStreamAnalyticsHandler implements IStreamAnalyticsHandler {
3
3
  constructor(graphqlOrigin: string | undefined);
4
- setOrganizationId: (organizationId: string) => void;
5
- trackStreamView: (streamId: string) => void;
6
- trackStreamPageView: (pageId: string, streamId: string) => void;
7
- trackStreamEngagementTime: (streamId: string, engagementTime: number) => void;
8
- trackStreamScrollDepth: (streamId: string, scrollDepth: number) => void;
9
- trackStreamProductImpression: (productId: string, streamId: string) => void;
10
- trackStreamProductClicked: (productId: string, streamId: string) => void;
11
- reportPageVideoViews: (videoId: string, streamId: string) => void;
12
- trackShortVideoView: (videoId: string) => void;
13
- trackShortVideoProductImpression: (productId: string, videoId: string) => void;
14
- trackShortVideoProductClick: (productId: string, videoId: string) => void;
4
+ trackStreamView: (streamId: string) => Promise<void>;
5
+ trackStreamPageView: (pageId: string, streamId: string) => Promise<void>;
6
+ trackStreamEngagementTime: (streamId: string, engagementTime: number) => Promise<void>;
7
+ trackStreamScrollDepth: (streamId: string, scrollDepth: number) => Promise<void>;
8
+ trackStreamProductImpression: (productId: string, streamId: string) => Promise<void>;
9
+ trackStreamProductClicked: (productId: string, streamId: string) => Promise<void>;
10
+ reportPageVideoViews: (pageId: string, streamId: string) => Promise<import("@streamscloud/streams-analytics-collector").MeasurementsBatchReportResult>;
11
+ trackShortVideoView: (videoId: string) => Promise<void>;
12
+ trackShortVideoProductImpression: (productId: string, videoId: string) => Promise<void>;
13
+ trackShortVideoProductClick: (productId: string, videoId: string) => Promise<void>;
15
14
  trackShortVideoProgress: (pageId: string, videoId: string, progress: number, streamId: string) => void;
16
- trackAdClick: (adId: string) => void;
17
- trackAdImpression: (adId: string) => void;
15
+ trackAdClick: (adId: string) => Promise<void>;
16
+ trackAdImpression: (adId: string) => Promise<void>;
18
17
  }