@streamscloud/embeddable 3.2.2 → 3.2.4

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 (178) hide show
  1. package/dist/core/enums.d.ts +2 -0
  2. package/dist/core/enums.js +2 -0
  3. package/dist/core/graphql.d.ts +1 -3
  4. package/dist/core/graphql.js +3 -12
  5. package/dist/core/utils/html-helper.d.ts +0 -1
  6. package/dist/core/utils/html-helper.js +0 -4
  7. package/dist/products/price-helper.js +1 -1
  8. package/dist/short-videos/short-video-viewer/cmp.attachments-inline.svelte +1 -1
  9. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +2 -2
  10. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte.d.ts +2 -3
  11. package/dist/short-videos/short-video-viewer/cmp.product.svelte +1 -1
  12. package/dist/short-videos/short-video-viewer/cmp.product.svelte.d.ts +2 -3
  13. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte +1 -1
  14. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte.d.ts +2 -3
  15. package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte +2 -6
  16. package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte.d.ts +1 -1
  17. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +1 -1
  18. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +2 -3
  19. package/dist/short-videos/short-video-viewer/description.svelte +0 -5
  20. package/dist/short-videos/short-video-viewer/description.svelte.d.ts +1 -1
  21. package/dist/short-videos/short-video-viewer/index.d.ts +2 -4
  22. package/dist/short-videos/short-video-viewer/index.js +0 -1
  23. package/dist/short-videos/short-video-viewer/mapper.js +1 -2
  24. package/dist/short-videos/short-video-viewer/operations.generated.d.ts +0 -1
  25. package/dist/short-videos/short-video-viewer/operations.generated.js +0 -1
  26. package/dist/short-videos/short-video-viewer/operations.graphql +0 -1
  27. package/dist/short-videos/short-video-viewer/{short-video-attachments-localization.d.ts → short-video-attachments-localization.svelte.d.ts} +4 -5
  28. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.svelte.js +10 -0
  29. package/dist/short-videos/short-video-viewer/{short-video-details-localization.d.ts → short-video-details-localization.svelte.d.ts} +6 -7
  30. package/dist/short-videos/short-video-viewer/short-video-details-localization.svelte.js +10 -0
  31. package/dist/short-videos/short-video-viewer/{short-video-product-localization.d.ts → short-video-product-localization.svelte.d.ts} +1 -2
  32. package/dist/short-videos/short-video-viewer/short-video-product-localization.svelte.js +11 -0
  33. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.d.ts +13 -0
  34. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.js +10 -0
  35. package/dist/short-videos/short-video-viewer/types.d.ts +0 -1
  36. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +11 -88
  37. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +5 -5
  38. package/dist/short-videos/short-videos-player/controls.svelte +2 -2
  39. package/dist/short-videos/short-videos-player/controls.svelte.d.ts +1 -1
  40. package/dist/short-videos/short-videos-player/index.d.ts +14 -51
  41. package/dist/short-videos/short-videos-player/index.js +12 -83
  42. package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.d.ts +8 -0
  43. package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.js +6 -0
  44. package/dist/streams/layout/cmp.layout.svelte.d.ts +2 -4
  45. package/dist/streams/layout/cmp.slot-content.svelte +4 -4
  46. package/dist/streams/layout/cmp.slot-content.svelte.d.ts +1 -2
  47. package/dist/streams/layout/cmp.slot.svelte.d.ts +2 -7
  48. package/dist/streams/layout/component.d.ts +0 -2
  49. package/dist/streams/layout/element-views/cmp.container-stream-element.svelte +1 -1
  50. package/dist/streams/layout/element-views/cmp.container-stream-element.svelte.d.ts +3 -4
  51. package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte +2 -15
  52. package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte.d.ts +3 -7
  53. package/dist/streams/layout/element-views/cmp.images-stream-element.svelte +2 -2
  54. package/dist/streams/layout/element-views/cmp.price-stream-element.svelte +89 -15
  55. package/dist/streams/layout/element-views/cmp.price-stream-element.svelte.d.ts +4 -5
  56. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +2 -4
  57. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte.d.ts +0 -3
  58. package/dist/streams/layout/element-views/cmp.stream-element.svelte +17 -24
  59. package/dist/streams/layout/element-views/cmp.stream-element.svelte.d.ts +3 -4
  60. package/dist/streams/layout/element-views/cmp.text-ref-stream-element.svelte.d.ts +2 -2
  61. package/dist/streams/layout/element-views/cmp.text-stream-element.svelte +2 -6
  62. package/dist/streams/layout/element-views/cmp.text-stream-element.svelte.d.ts +0 -2
  63. package/dist/streams/layout/element-views/data-by-key-accessor.d.ts +3 -3
  64. package/dist/streams/layout/element-views/index.d.ts +11 -16
  65. package/dist/streams/layout/element-views/index.js +9 -12
  66. package/dist/streams/layout/element-views/price-stream-element-localization.svelte.d.ts +9 -0
  67. package/dist/streams/layout/element-views/price-stream-element-localization.svelte.js +8 -0
  68. package/dist/streams/layout/element-views/stream-element-localization.svelte.d.ts +8 -0
  69. package/dist/streams/layout/element-views/stream-element-localization.svelte.js +6 -0
  70. package/dist/streams/layout/elements.d.ts +12 -47
  71. package/dist/streams/layout/elements.js +1 -1
  72. package/dist/streams/layout/enums.d.ts +3 -34
  73. package/dist/streams/layout/enums.js +7 -46
  74. package/dist/streams/layout/index.d.ts +10 -3
  75. package/dist/streams/layout/index.js +2 -3
  76. package/dist/streams/layout/layout.d.ts +1 -2
  77. package/dist/streams/layout/models/index.d.ts +1 -1
  78. package/dist/streams/layout/models/mapper.js +1 -2
  79. package/dist/streams/layout/models/stream-layout-media-item-model.d.ts +1 -1
  80. package/dist/streams/layout/models/stream-layout-media-item-model.js +1 -1
  81. package/dist/streams/layout/models/stream-layout-post-header-model.d.ts +1 -1
  82. package/dist/streams/layout/models/stream-layout-product-model.d.ts +2 -1
  83. package/dist/streams/layout/models/stream-layout-short-video-model.d.ts +0 -4
  84. package/dist/streams/layout/serializer.d.ts +3 -0
  85. package/dist/streams/layout/serializer.js +6 -0
  86. package/dist/streams/layout/slot.d.ts +0 -2
  87. package/dist/streams/layout/styles-transformer.d.ts +2 -3
  88. package/dist/streams/layout/styles-transformer.js +30 -54
  89. package/dist/streams/layout/styles.d.ts +14 -24
  90. package/dist/streams/layout/type-guards.d.ts +0 -31
  91. package/dist/streams/layout/type-guards.js +1 -13
  92. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte +2 -4
  93. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte.d.ts +0 -3
  94. package/dist/streams/stream-page-viewer/index.d.ts +0 -1
  95. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.d.ts +13 -0
  96. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.js +10 -0
  97. package/dist/streams/stream-player/cmp.stream-player.svelte +7 -47
  98. package/dist/streams/stream-player/cmp.stream-player.svelte.d.ts +4 -6
  99. package/dist/streams/stream-player/controls.svelte +3 -46
  100. package/dist/streams/stream-player/controls.svelte.d.ts +1 -1
  101. package/dist/streams/stream-player/index.d.ts +4 -6
  102. package/dist/streams/stream-player/index.js +28 -15
  103. package/dist/streams/stream-player/operations.generated.d.ts +1 -1
  104. package/dist/streams/stream-player/operations.generated.js +3 -5
  105. package/dist/streams/stream-player/operations.graphql +3 -3
  106. package/dist/streams/stream-player/stream-overview.svelte +2 -2
  107. package/dist/streams/stream-player/stream-overview.svelte.d.ts +1 -1
  108. package/dist/streams/stream-player/stream-player-buffer.svelte.js +2 -2
  109. package/dist/streams/stream-player/stream-player-localization.svelte.d.ts +12 -0
  110. package/dist/streams/stream-player/stream-player-localization.svelte.js +10 -0
  111. package/dist/ui/icon/cmp.icon.svelte +26 -13
  112. package/dist/ui/line-clamp/cmp.line-clamp.svelte +2 -2
  113. package/dist/ui/line-clamp/cmp.line-clamp.svelte.d.ts +2 -3
  114. package/dist/ui/line-clamp/index.d.ts +1 -1
  115. package/dist/ui/line-clamp/index.js +1 -1
  116. package/dist/ui/line-clamp/{line-clamp-localization.d.ts → line-clamp-localization.svelte.d.ts} +1 -2
  117. package/dist/ui/line-clamp/line-clamp-localization.svelte.js +15 -0
  118. package/dist/ui/shadow-dom/shadow-host.d.ts +5 -1
  119. package/dist/ui/shadow-dom/shadow-host.js +14 -1
  120. package/dist/ui/time-ago/cmp.time-ago.svelte +1 -1
  121. package/dist/ui/time-ago/cmp.time-ago.svelte.d.ts +2 -3
  122. package/dist/ui/time-ago/index.d.ts +1 -1
  123. package/dist/ui/time-ago/{time-ago-localization.d.ts → time-ago-localization.svelte.d.ts} +1 -2
  124. package/dist/ui/time-ago/time-ago-localization.svelte.js +39 -0
  125. package/dist/ui/video/cmp.video.svelte +18 -42
  126. package/package.json +1 -1
  127. package/dist/core/analytics.profile-id.d.ts +0 -5
  128. package/dist/core/analytics.profile-id.js +0 -17
  129. package/dist/core/document.event-handlers.d.ts +0 -1
  130. package/dist/core/document.event-handlers.js +0 -5
  131. package/dist/core/locale.d.ts +0 -6
  132. package/dist/core/locale.js +0 -24
  133. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.js +0 -21
  134. package/dist/short-videos/short-video-viewer/short-video-details-localization.js +0 -17
  135. package/dist/short-videos/short-video-viewer/short-video-product-localization.js +0 -13
  136. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.d.ts +0 -14
  137. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.js +0 -17
  138. package/dist/short-videos/short-videos-player/operations.generated.d.ts +0 -65
  139. package/dist/short-videos/short-videos-player/operations.generated.js +0 -194
  140. package/dist/short-videos/short-videos-player/operations.graphql +0 -8
  141. package/dist/short-videos/short-videos-player/short-videos-player-localization.d.ts +0 -16
  142. package/dist/short-videos/short-videos-player/short-videos-player-localization.js +0 -13
  143. package/dist/short-videos/short-videos-player/types.d.ts +0 -36
  144. package/dist/short-videos/short-videos-player/types.js +0 -6
  145. package/dist/streams/layout/element-views/cmp.annotation-stream-element.svelte +0 -16
  146. package/dist/streams/layout/element-views/cmp.annotation-stream-element.svelte.d.ts +0 -7
  147. package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte +0 -74
  148. package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte.d.ts +0 -11
  149. package/dist/streams/layout/element-views/cmp.web-view-stream-element.svelte +0 -37
  150. package/dist/streams/layout/element-views/cmp.web-view-stream-element.svelte.d.ts +0 -7
  151. package/dist/streams/layout/element-views/price-element-view.svelte +0 -168
  152. package/dist/streams/layout/element-views/price-element-view.svelte.d.ts +0 -15
  153. package/dist/streams/layout/element-views/price-stream-element-localization.d.ts +0 -13
  154. package/dist/streams/layout/element-views/price-stream-element-localization.js +0 -21
  155. package/dist/streams/layout/element-views/short-video-stream-element-localization.d.ts +0 -9
  156. package/dist/streams/layout/element-views/short-video-stream-element-localization.js +0 -7
  157. package/dist/streams/layout/element-views/stock-stream-element-localization.d.ts +0 -8
  158. package/dist/streams/layout/element-views/stock-stream-element-localization.js +0 -26
  159. package/dist/streams/layout/element-views/stream-element-localization.d.ts +0 -15
  160. package/dist/streams/layout/element-views/stream-element-localization.js +0 -11
  161. package/dist/streams/layout/serializer.svelte.d.ts +0 -29
  162. package/dist/streams/layout/serializer.svelte.js +0 -93
  163. package/dist/streams/layout/slot-data-ref.d.ts +0 -13
  164. package/dist/streams/layout/slot-data-ref.js +0 -1
  165. package/dist/streams/layout/svg-attributes.d.ts +0 -7
  166. package/dist/streams/layout/svg-attributes.js +0 -8
  167. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.d.ts +0 -9
  168. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.js +0 -7
  169. package/dist/streams/stream-player/stream-player-localization.d.ts +0 -26
  170. package/dist/streams/stream-player/stream-player-localization.js +0 -31
  171. package/dist/ui/line-clamp/line-clamp-localization.js +0 -19
  172. package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte +0 -125
  173. package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte.d.ts +0 -9
  174. package/dist/ui/swipe-indicator/index.d.ts +0 -2
  175. package/dist/ui/swipe-indicator/index.js +0 -1
  176. package/dist/ui/swipe-indicator/swipe-indicator-localization.d.ts +0 -8
  177. package/dist/ui/swipe-indicator/swipe-indicator-localization.js +0 -13
  178. package/dist/ui/time-ago/time-ago-localization.js +0 -55
@@ -4,26 +4,6 @@ export type StreamLayoutStyles = {
4
4
  backgroundColor?: string | null;
5
5
  fontFamily?: StreamElementStyleFontFamily | null;
6
6
  };
7
- export type AnnotationStreamElementStyles = {
8
- height: number;
9
- aspectRatio: number;
10
- offsetX: number;
11
- offsetY: number;
12
- };
13
- export type ContainerStreamElementStyles = {
14
- width?: StreamCssValue | null;
15
- height?: StreamCssValue | null;
16
- aspectRatio?: number | null;
17
- direction?: StreamElementStyleDirection | null;
18
- gap?: number | null;
19
- paddingTop?: number | null;
20
- paddingRight?: number | null;
21
- paddingBottom?: number | null;
22
- paddingLeft?: number | null;
23
- backgroundColor?: string | null;
24
- borderRadius?: number | null;
25
- borderColor?: string | null;
26
- };
27
7
  export type ImageStreamElementStyles = {
28
8
  mediaFit?: StreamElementStyleMediaFit | null;
29
9
  };
@@ -38,10 +18,6 @@ export type PriceStreamElementStyles = {
38
18
  beforeValueColor?: string | null;
39
19
  horizontalAlign?: StreamElementStyleHorizontalAlign | null;
40
20
  };
41
- export type StockStreamElementStyles = {
42
- height?: number | null;
43
- horizontalAlign?: StreamElementStyleHorizontalAlign | null;
44
- };
45
21
  export type TextStreamElementStyles = {
46
22
  fontSize?: number | null;
47
23
  fontWeight?: StreamElementStyleFontWeight | null;
@@ -51,3 +27,17 @@ export type TextStreamElementStyles = {
51
27
  color?: string | null;
52
28
  maxLines?: number | null;
53
29
  };
30
+ export type ContainerStreamElementStyles = {
31
+ width?: StreamCssValue | null;
32
+ height?: StreamCssValue | null;
33
+ aspectRatio?: number | null;
34
+ direction?: StreamElementStyleDirection | null;
35
+ gap?: number | null;
36
+ paddingTop?: number | null;
37
+ paddingRight?: number | null;
38
+ paddingBottom?: number | null;
39
+ paddingLeft?: number | null;
40
+ backgroundColor?: string | null;
41
+ borderRadius?: number | null;
42
+ borderColor?: string | null;
43
+ };
@@ -1,39 +1,8 @@
1
- import type { AnnotationStreamElementModel, ContainerStreamElementModel, ImageRefStreamElementModel, ImagesStreamElementModel, PriceStreamElementModel, ShortVideoStreamElementModel, SpacerStreamElementModel, StockStreamElementModel, TextRefStreamElementModel, TextStreamElementModel, WebViewStreamElementModel } from './elements';
2
- import { StreamElementType } from './enums';
3
1
  import type { ImagesStreamSlotData, ProductStreamSlotData, ShortVideoStreamSlotData, StreamSlotData } from './slot-data';
4
2
  import type { ImagesStreamSlotDataInput, ProductStreamSlotDataInput, ShortVideoStreamSlotDataInput, StreamSlotDataInput } from './slot-data-input';
5
- import type { AnnotationStreamElementStyles, ContainerStreamElementStyles, ImageStreamElementStyles, PriceStreamElementStyles, StockStreamElementStyles, TextStreamElementStyles } from './styles';
6
3
  export declare function isImagesSlotDataInput(data: StreamSlotDataInput | null): data is ImagesStreamSlotDataInput;
7
4
  export declare function isProductSlotDataInput(data: StreamSlotDataInput | null): data is ProductStreamSlotDataInput;
8
5
  export declare function isShortVideoSlotDataInput(data: StreamSlotDataInput | null): data is ShortVideoStreamSlotDataInput;
9
6
  export declare function isImagesSlotData(data: StreamSlotData | null): data is ImagesStreamSlotData;
10
7
  export declare function isProductSlotData(data: StreamSlotData | null): data is ProductStreamSlotData;
11
8
  export declare function isShortVideoSlotData(data: StreamSlotData | null): data is ShortVideoStreamSlotData;
12
- export type ElementTypeToStylesMap = {
13
- [StreamElementType.Annotation]: AnnotationStreamElementStyles;
14
- [StreamElementType.Container]: ContainerStreamElementStyles;
15
- [StreamElementType.Price]: PriceStreamElementStyles;
16
- [StreamElementType.ImageRef]: ImageStreamElementStyles;
17
- [StreamElementType.Stock]: StockStreamElementStyles;
18
- [StreamElementType.Text]: TextStreamElementStyles;
19
- [StreamElementType.TextRef]: TextStreamElementStyles;
20
- };
21
- export type ElementTypeToModelMap = {
22
- [StreamElementType.Annotation]: AnnotationStreamElementModel;
23
- [StreamElementType.Container]: ContainerStreamElementModel;
24
- [StreamElementType.ImageRef]: ImageRefStreamElementModel;
25
- [StreamElementType.Images]: ImagesStreamElementModel;
26
- [StreamElementType.Price]: PriceStreamElementModel;
27
- [StreamElementType.ShortVideo]: ShortVideoStreamElementModel;
28
- [StreamElementType.Spacer]: SpacerStreamElementModel;
29
- [StreamElementType.Stock]: StockStreamElementModel;
30
- [StreamElementType.Text]: TextStreamElementModel;
31
- [StreamElementType.TextRef]: TextRefStreamElementModel;
32
- [StreamElementType.WebView]: WebViewStreamElementModel;
33
- };
34
- export declare const NotAllowedElementTypesForComponent: {
35
- IMAGES: StreamElementType[];
36
- PRODUCT: StreamElementType[];
37
- SHORT_VIDEO: StreamElementType[];
38
- NO_DATA: StreamElementType[];
39
- };
@@ -1,4 +1,4 @@
1
- import { StreamComponentDataType, StreamElementType } from './enums';
1
+ import { StreamComponentDataType } from './enums';
2
2
  // SlotDataInput guards
3
3
  export function isImagesSlotDataInput(data) {
4
4
  return data?.type === StreamComponentDataType.Images;
@@ -19,15 +19,3 @@ export function isProductSlotData(data) {
19
19
  export function isShortVideoSlotData(data) {
20
20
  return data?.type === StreamComponentDataType.ShortVideo;
21
21
  }
22
- export const NotAllowedElementTypesForComponent = {
23
- [StreamComponentDataType.Images]: [StreamElementType.ImageRef, StreamElementType.Price, StreamElementType.ShortVideo, StreamElementType.TextRef],
24
- [StreamComponentDataType.Product]: [StreamElementType.Images, StreamElementType.ShortVideo],
25
- [StreamComponentDataType.ShortVideo]: [StreamElementType.ImageRef, StreamElementType.Price, StreamElementType.TextRef],
26
- [StreamComponentDataType.NoData]: [
27
- StreamElementType.ImageRef,
28
- StreamElementType.Images,
29
- StreamElementType.Price,
30
- StreamElementType.ShortVideo,
31
- StreamElementType.TextRef
32
- ]
33
- };
@@ -1,14 +1,12 @@
1
1
  <script lang="ts">import { StreamLayoutSlot, StreamPageLayout, StreamLayoutSlotContent } from '../layout';
2
- import { StreamPageViewerLocalization } from './stream-page-viewer-localization';
3
- let { page, localization: localizationInit, on } = $props();
4
- const localization = $derived(new StreamPageViewerLocalization(localizationInit));
2
+ let { page, on } = $props();
5
3
  </script>
6
4
 
7
5
  {#if page.type === 'general'}
8
6
  <StreamPageLayout model={page.layout}>
9
7
  {#each page.layout.slots as slot (slot)}
10
8
  <StreamLayoutSlot model={slot}>
11
- <StreamLayoutSlotContent model={slot} on={on} localization={localization.elementsLocalization} />
9
+ <StreamLayoutSlotContent model={slot} on={on} />
12
10
  </StreamLayoutSlot>
13
11
  {/each}
14
12
  </StreamPageLayout>
@@ -1,9 +1,6 @@
1
- import type { Locale } from '../../core/locale';
2
- import { type IStreamPageViewerLocalization } from './stream-page-viewer-localization';
3
1
  import type { StreamPageViewerModel } from './types';
4
2
  type Props = {
5
3
  page: StreamPageViewerModel;
6
- localization: IStreamPageViewerLocalization | Locale;
7
4
  on?: {
8
5
  productClick: (productId: string) => void;
9
6
  progress?: (videoId: string, progress: number) => void;
@@ -1,3 +1,2 @@
1
1
  export { default as StreamPageViewer } from './cmp.stream-page-viewer.svelte';
2
2
  export type { StreamPageViewerModel } from './types';
3
- export type { IStreamPageViewerLocalization } from './stream-page-viewer-localization';
@@ -0,0 +1,13 @@
1
+ import type { IStreamElementLocalization } from '../layout/element-views';
2
+ import type { ITimeAgoLocalization } from '../../ui/time-ago';
3
+ export interface IStreamPageViewerLocalization {
4
+ viewsCount?: (count: number) => string;
5
+ timeAgoLocalization?: ITimeAgoLocalization;
6
+ elementsLocalization?: IStreamElementLocalization;
7
+ }
8
+ export declare class StreamPageViewerLocalization {
9
+ viewsCount: (count: number) => string;
10
+ timeAgoLocalization: ITimeAgoLocalization | undefined;
11
+ elementsLocalization: IStreamElementLocalization | undefined;
12
+ constructor(init?: IStreamPageViewerLocalization);
13
+ }
@@ -0,0 +1,10 @@
1
+ export class StreamPageViewerLocalization {
2
+ viewsCount = $state((count) => (count === 1 ? '1 view' : `${count} views`));
3
+ timeAgoLocalization = $state(undefined);
4
+ elementsLocalization = $state(undefined);
5
+ constructor(init) {
6
+ this.viewsCount = init?.viewsCount ?? this.viewsCount;
7
+ this.timeAgoLocalization = init?.timeAgoLocalization ?? this.timeAgoLocalization;
8
+ this.elementsLocalization = init?.elementsLocalization ?? this.elementsLocalization;
9
+ }
10
+ }
@@ -7,9 +7,6 @@
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { getOrCreateProfileId } from '../../core/analytics.profile-id';
11
- import { handleEsc } from '../../core/document.event-handlers';
12
- import { constructGraphQLUrl, createLocalGQLClient } from '../../core/graphql';
13
10
  import { toastrWarning } from '../../core/toastr';
14
11
  import { ShortVideoViewer } from '../../short-videos/short-video-viewer';
15
12
  import { mapToShortVideoViewerModel } from '../layout/models';
@@ -17,23 +14,21 @@ import { StreamPageViewer } from '../stream-page-viewer';
17
14
  import { Loading } from '../../ui/loading';
18
15
  import { PlayerSlider } from '../../ui/player';
19
16
  import { SpotlightLayout } from '../../ui/spotlight-layout';
20
- import { SwipeIndicator } from '../../ui/swipe-indicator';
21
17
  import { default as Controls } from './controls.svelte';
22
18
  import { mapStreamPlayerModel } from './mapper';
23
19
  import { GetStreamDocument } from './operations.generated';
24
20
  import { default as Overview } from './stream-overview.svelte';
25
21
  import { StreamPlayerBuffer } from './stream-player-buffer.svelte';
26
- import { StreamPlayerLocalization } from './stream-player-localization';
22
+ import { StreamPlayerLocalization } from './stream-player-localization.svelte';
27
23
  import { StreamPlayerUiManager } from './ui-manager.svelte';
28
- import { AppEventsTracker } from '@streamscloud/streams-analytics-collector';
29
24
  import { onMount } from 'svelte';
30
- let { streamId, graphqlOrigin, localization: localizationInit, showStreamsCloudWatermark, initiator, on } = $props();
25
+ import { AppEventsTracker } from '@streamscloud/streams-analytics-collector';
26
+ let { streamId, graphql, localization: localizationInit, on } = $props();
31
27
  const localization = $derived(new StreamPlayerLocalization(localizationInit));
32
28
  let model = $state(null);
33
29
  let buffer = $state.raw(null);
34
30
  let loading = $state(true);
35
31
  let activePageId = $derived.by(() => { var _a, _b; return (_b = (_a = buffer === null || buffer === void 0 ? void 0 : buffer.current) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : ''; });
36
- let everTouched = $state(false);
37
32
  let totalEngagementTimeSeconds = 0;
38
33
  let inactiveTimeSeconds = 10; // // Mark as inactive after 10 seconds of no activity
39
34
  let isActive = true;
@@ -56,15 +51,12 @@ onMount(() => __awaiter(void 0, void 0, void 0, function* () {
56
51
  var _a, _b, _c, _d;
57
52
  uiManager.overviewCollapsed = window && window.innerWidth < window.innerHeight;
58
53
  try {
59
- const graphql = createLocalGQLClient(graphqlOrigin, { 'x-initiator': initiator !== null && initiator !== void 0 ? initiator : 'player/stream' });
60
54
  const streamPayload = yield graphql.query(GetStreamDocument, { id: streamId }).toPromise();
61
55
  if (!((_a = streamPayload.data) === null || _a === void 0 ? void 0 : _a.stream)) {
62
56
  toastrWarning(localization.streamNotFound);
63
57
  (_b = on === null || on === void 0 ? void 0 : on.closePlayer) === null || _b === void 0 ? void 0 : _b.call(on);
64
58
  return;
65
59
  }
66
- AppEventsTracker.setEndpoint(constructGraphQLUrl(graphqlOrigin));
67
- AppEventsTracker.setProfileId(getOrCreateProfileId());
68
60
  (_c = on === null || on === void 0 ? void 0 : on.streamActivated) === null || _c === void 0 ? void 0 : _c.call(on, {
69
61
  ownerId: streamPayload.data.stream.ownerProfile.id,
70
62
  title: streamPayload.data.stream.title,
@@ -123,19 +115,6 @@ const handleDimensionsChanged = (dimensions) => {
123
115
  viewTotalWidth: dimensions.totalWidth
124
116
  });
125
117
  };
126
- const contentMounted = (node) => {
127
- const markAsTouched = () => {
128
- everTouched = true;
129
- node.removeEventListener('touchstart', markAsTouched);
130
- node.removeEventListener('wheel', markAsTouched);
131
- node.removeEventListener('click', markAsTouched);
132
- node.removeEventListener('keypress', markAsTouched);
133
- };
134
- node.addEventListener('touchstart', markAsTouched);
135
- node.addEventListener('wheel', markAsTouched);
136
- node.addEventListener('click', markAsTouched);
137
- node.addEventListener('keypress', markAsTouched);
138
- };
139
118
  const onPageActivated = (id) => {
140
119
  const page = buffer === null || buffer === void 0 ? void 0 : buffer.loaded.find((x) => x.id === id);
141
120
  if (page) {
@@ -167,23 +146,14 @@ const onProgress = (pageId, videoId, progress) => {
167
146
  };
168
147
  </script>
169
148
 
170
- <svelte:document onkeydown={(e) => handleEsc(e, onPlayerClose)} />
171
-
172
149
  <div class="stream-player-container">
173
150
  {#if loading}
174
151
  <Loading positionAbsoluteCenter={true} timeout={600} />
175
152
  {/if}
176
153
  <div class="stream-player" style={uiManager.globalCssVariables}>
177
- {#if showStreamsCloudWatermark}
178
- <div class="stream-player__watermark">
179
- <a href="https://streamscloud.com/" tabindex="-1" aria-label="none">
180
- <img src="https://embedabble-assets.streamscloud-cdn.com/watermark.svg" alt="StreamsCloud" />
181
- </a>
182
- </div>
183
- {/if}
184
154
  {#if buffer && model}
185
155
  <SpotlightLayout ratio={9 / 16} on={{ dimensionsChanged: handleDimensionsChanged }}>
186
- <div class="stream-player__content" use:contentMounted>
156
+ <div class="stream-player__content">
187
157
  <PlayerSlider
188
158
  buffer={buffer}
189
159
  on={{
@@ -194,10 +164,9 @@ const onProgress = (pageId, videoId, progress) => {
194
164
  {#if item.type === 'general'}
195
165
  <StreamPageViewer
196
166
  page={item}
197
- localization={localization.streamPageViewerLocalization}
198
167
  on={{
199
- progress: (videoId: String, progress: Number) => onProgress(item.id, videoId, progress),
200
- productClick: (productId: String) => onProductCardClick(productId)
168
+ progress: (videoId: string, progress: number) => onProgress(item.id, videoId, progress),
169
+ productClick: (productId: string) => onProductCardClick(productId)
201
170
  }} />
202
171
  {:else if item.type === 'short-video'}
203
172
  <ShortVideoViewer
@@ -206,14 +175,10 @@ const onProgress = (pageId, videoId, progress) => {
206
175
  progress: (progress) => onProgress(item.id, item.shortVideo.id, progress)
207
176
  }}
208
177
  autoplay="on-appearance"
209
- localization={localization.shortVideoViewerLocalization}
210
178
  showAttachments={uiManager.showShortVideoOverlay} />
211
179
  {/if}
212
180
  {/snippet}
213
181
  </PlayerSlider>
214
- {#if uiManager.isMobileView && buffer.loaded.length > 1 && !everTouched}
215
- <SwipeIndicator localization={localization.swipeIndicatorLocalization} />
216
- {/if}
217
182
  </div>
218
183
  </SpotlightLayout>
219
184
  {#if model}
@@ -231,7 +196,7 @@ const onProgress = (pageId, videoId, progress) => {
231
196
  localization={localization}
232
197
  on={{
233
198
  closePlayer: () => onPlayerClose(),
234
- productClick: (productId: String) => onProductCardClick(productId)
199
+ productClick: (productId: string) => onProductCardClick(productId)
235
200
  }} />
236
201
  {/if}
237
202
  </div>
@@ -272,11 +237,6 @@ const onProgress = (pageId, videoId, progress) => {
272
237
  padding: 0;
273
238
  }
274
239
  }
275
- .stream-player__watermark {
276
- position: absolute;
277
- bottom: 5rem;
278
- left: 20rem;
279
- }
280
240
  .stream-player__content {
281
241
  width: 100%;
282
242
  height: 100%;
@@ -1,11 +1,9 @@
1
- import type { Locale } from '../../core/locale';
2
- import { type IStreamPlayerLocalization } from './stream-player-localization';
1
+ import { type IStreamPlayerLocalization } from './stream-player-localization.svelte';
2
+ import type { Client } from '@urql/core';
3
3
  type Props = {
4
4
  streamId: string;
5
- localization: IStreamPlayerLocalization | Locale;
6
- graphqlOrigin?: string;
7
- showStreamsCloudWatermark?: boolean;
8
- initiator?: string;
5
+ localization?: IStreamPlayerLocalization;
6
+ graphql: Client;
9
7
  on?: {
10
8
  closePlayer?: () => void;
11
9
  streamActivated?: (data: {
@@ -1,11 +1,10 @@
1
1
  <script lang="ts">var _a, _b;
2
2
  import { ShortVideoDetails, ShortVideoViewerAttachmentsInline, ShortVideoViewerAttachments } from '../../short-videos/short-video-viewer';
3
- import { StreamElementType } from '../layout/enums';
4
3
  import { mapToShortVideoViewerModel } from '../layout/models';
5
4
  import { Icon } from '../../ui/icon';
6
5
  import { MediaVolumeManager } from '../../ui/media-playback';
7
6
  import { default as ActionButton } from './action-button.svelte';
8
- import { StreamPlayerLocalization } from './stream-player-localization';
7
+ import { StreamPlayerLocalization } from './stream-player-localization.svelte';
9
8
  import IconChevronDown from '@fluentui/svg-icons/icons/chevron_down_20_regular.svg?raw';
10
9
  import IconChevronUp from '@fluentui/svg-icons/icons/chevron_up_20_regular.svg?raw';
11
10
  import IconDismiss from '@fluentui/svg-icons/icons/dismiss_20_regular.svg?raw';
@@ -18,36 +17,6 @@ const toggleMuted = () => {
18
17
  MediaVolumeManager.isMuted = !MediaVolumeManager.isMuted;
19
18
  };
20
19
  const shortVideo = $derived(((_a = buffer.current) === null || _a === void 0 ? void 0 : _a.type) === 'short-video' && ((_b = buffer.current) === null || _b === void 0 ? void 0 : _b.shortVideo) ? mapToShortVideoViewerModel(buffer.current.shortVideo) : null);
21
- const singleWebViewPage = $derived.by(() => {
22
- var _a;
23
- if (((_a = buffer.current) === null || _a === void 0 ? void 0 : _a.type) !== 'general') {
24
- return false;
25
- }
26
- const layout = buffer.current.layout;
27
- const collectRenderableElements = (elements) => {
28
- const renderableElements = [];
29
- for (const element of elements) {
30
- if (element.type === StreamElementType.Container) {
31
- if (element.elements) {
32
- renderableElements.push(...collectRenderableElements(element.elements));
33
- }
34
- }
35
- else {
36
- renderableElements.push(element);
37
- }
38
- }
39
- return renderableElements;
40
- };
41
- const allRenderableElements = [];
42
- for (const slot of layout.slots) {
43
- for (const component of slot.components) {
44
- if (component.elements) {
45
- allRenderableElements.push(...collectRenderableElements(component.elements));
46
- }
47
- }
48
- }
49
- return allRenderableElements.length === 1 && allRenderableElements[0].type === StreamElementType.WebView;
50
- });
51
20
  </script>
52
21
 
53
22
  <div class="stream-player-controls">
@@ -59,7 +28,7 @@ const singleWebViewPage = $derived.by(() => {
59
28
  </div>
60
29
  </div>
61
30
  {/if}
62
- <div class="stream-player-controls__navigation-buttons" class:stream-player-controls__navigation-buttons--single-web-view-page={singleWebViewPage}>
31
+ <div class="stream-player-controls__navigation-buttons">
63
32
  <button type="button" class="navigation-button" disabled={!buffer.canLoadPrevious} onclick={buffer.loadPrevious}>
64
33
  <Icon src={IconChevronUp} />
65
34
  </button>
@@ -73,7 +42,7 @@ const singleWebViewPage = $derived.by(() => {
73
42
  <div class="stream-player-controls__short-video-attachments">
74
43
  <ShortVideoViewerAttachments
75
44
  shortVideo={shortVideo}
76
- localization={localization.shortVideoAttachmentsLocalization}
45
+ localization={localization.shortVideoDetailsLocalization?.attachmentsLocalization}
77
46
  on={{
78
47
  productClick: on.productClick
79
48
  }} />
@@ -245,18 +214,6 @@ const singleWebViewPage = $derived.by(() => {
245
214
  visibility: hidden;
246
215
  }
247
216
  }
248
- .stream-player-controls__navigation-buttons--single-web-view-page {
249
- /* Set 'container-type: inline-size;' to reference container*/
250
- }
251
- @container (width < 6.25rem) {
252
- .stream-player-controls__navigation-buttons--single-web-view-page {
253
- visibility: visible;
254
- position: absolute;
255
- bottom: var(--stream-player--controls--offset-vertical);
256
- right: var(--stream-player--controls--offset-horizontal);
257
- z-index: 1;
258
- }
259
- }
260
217
  .stream-player-controls__controls {
261
218
  display: flex;
262
219
  margin-top: auto;
@@ -1,5 +1,5 @@
1
1
  import type { StreamPlayerBuffer } from './stream-player-buffer.svelte';
2
- import { StreamPlayerLocalization } from './stream-player-localization';
2
+ import { StreamPlayerLocalization } from './stream-player-localization.svelte';
3
3
  import type { StreamPlayerUiManager } from './ui-manager.svelte';
4
4
  type Props = {
5
5
  buffer: StreamPlayerBuffer;
@@ -1,4 +1,4 @@
1
- import type { IStreamPlayerLocalization } from './stream-player-localization';
1
+ import type { IStreamPlayerLocalization } from './stream-player-localization.svelte';
2
2
  export type { IStreamPlayerLocalization };
3
3
  /**
4
4
  * Opens the stream player modal with the specified stream details.
@@ -15,7 +15,7 @@ export type { IStreamPlayerLocalization };
15
15
  *
16
16
  * openStreamPlayer({
17
17
  * streamId: '...',
18
- * graphqlOrigin: 'https://api.example.com',
18
+ * graphqlUrl: 'https://api.example.com/graphql',
19
19
  * localization: {
20
20
  * play: 'Play',
21
21
  * pause: 'Pause'
@@ -25,10 +25,8 @@ export type { IStreamPlayerLocalization };
25
25
  */
26
26
  export declare const openStreamPlayer: (init: {
27
27
  streamId: string;
28
- graphqlOrigin?: string;
29
- localization?: IStreamPlayerLocalization | "en" | "no";
30
- showStreamsCloudWatermark?: boolean;
31
- initiator?: string;
28
+ graphqlUrl: string;
29
+ localization?: IStreamPlayerLocalization;
32
30
  on?: {
33
31
  streamActivated?: (data: {
34
32
  title: string;
@@ -1,8 +1,25 @@
1
- import { getLocale } from '../../core/locale';
1
+ import { createLocalGQLClient } from '../../core/graphql';
2
2
  import { ShadowHost } from '../../ui/shadow-dom';
3
3
  import { default as StreamPlayer } from './cmp.stream-player.svelte';
4
4
  import { AppEventsTracker } from '@streamscloud/streams-analytics-collector';
5
- import { mount, unmount } from 'svelte';
5
+ import { mount } from 'svelte';
6
+ /**
7
+ * Key used for storing the profile ID in local storage
8
+ */
9
+ const PROFILE_ID_STORAGE_KEY = 'streamscloud_profile_id';
10
+ /**
11
+ * Retrieves the profile ID from localStorage or generates a new one if it doesn't exist
12
+ * @returns The profile ID to use for analytics tracking
13
+ */
14
+ function getOrCreateProfileId() {
15
+ const storedProfileId = localStorage.getItem(PROFILE_ID_STORAGE_KEY);
16
+ if (!storedProfileId) {
17
+ const newProfileId = crypto.randomUUID();
18
+ localStorage.setItem(PROFILE_ID_STORAGE_KEY, newProfileId);
19
+ return newProfileId;
20
+ }
21
+ return storedProfileId;
22
+ }
6
23
  /**
7
24
  * Opens the stream player modal with the specified stream details.
8
25
  *
@@ -18,7 +35,7 @@ import { mount, unmount } from 'svelte';
18
35
  *
19
36
  * openStreamPlayer({
20
37
  * streamId: '...',
21
- * graphqlOrigin: 'https://api.example.com',
38
+ * graphqlUrl: 'https://api.example.com/graphql',
22
39
  * localization: {
23
40
  * play: 'Play',
24
41
  * pause: 'Pause'
@@ -27,16 +44,16 @@ import { mount, unmount } from 'svelte';
27
44
  * ```
28
45
  */
29
46
  export const openStreamPlayer = (init) => {
30
- const { streamId, graphqlOrigin, localization, showStreamsCloudWatermark, initiator } = init;
31
- const shadowHost = new ShadowHost();
32
- const mounted = mount(StreamPlayer, {
47
+ const { streamId, graphqlUrl, localization } = init;
48
+ const shadowHost = new ShadowHost({ onClosed: () => init.on?.playerClosed?.() });
49
+ AppEventsTracker.setEndpoint(graphqlUrl);
50
+ AppEventsTracker.setProfileId(getOrCreateProfileId());
51
+ mount(StreamPlayer, {
33
52
  target: shadowHost.shadowRoot,
34
53
  props: {
35
54
  streamId,
36
- graphqlOrigin,
37
- localization: getLocale(localization),
38
- showStreamsCloudWatermark,
39
- initiator,
55
+ graphql: createLocalGQLClient(graphqlUrl),
56
+ localization,
40
57
  on: {
41
58
  streamActivated: (data) => {
42
59
  AppEventsTracker.setOrganizationId(data.ownerId);
@@ -44,11 +61,7 @@ export const openStreamPlayer = (init) => {
44
61
  init.on.streamActivated({ title: data.title, image: data.image });
45
62
  }
46
63
  },
47
- closePlayer: async () => {
48
- if (init.on?.playerClosed) {
49
- init.on.playerClosed();
50
- }
51
- await unmount(mounted);
64
+ closePlayer: () => {
52
65
  shadowHost.remove();
53
66
  }
54
67
  }
@@ -27,7 +27,7 @@ export type GetStreamQuery = {
27
27
  } | null;
28
28
  };
29
29
  export type GetStreamPagesQueryVariables = SchemaTypes.Exact<{
30
- input: SchemaTypes.EmbedStreamPagesInput;
30
+ input: SchemaTypes.StreamPagesInput;
31
31
  image_scale: SchemaTypes.ImageScale;
32
32
  }>;
33
33
  export type GetStreamPagesQuery = {
@@ -67,8 +67,7 @@ export const GetStreamDocument = {
67
67
  selections: [
68
68
  {
69
69
  kind: 'Field',
70
- alias: { kind: 'Name', value: 'stream' },
71
- name: { kind: 'Name', value: 'embedStream' },
70
+ name: { kind: 'Name', value: 'stream' },
72
71
  arguments: [
73
72
  {
74
73
  kind: 'Argument',
@@ -142,7 +141,7 @@ export const GetStreamPagesDocument = {
142
141
  {
143
142
  kind: 'VariableDefinition',
144
143
  variable: { kind: 'Variable', name: { kind: 'Name', value: 'input' } },
145
- type: { kind: 'NonNullType', type: { kind: 'NamedType', name: { kind: 'Name', value: 'EmbedStreamPagesInput' } } }
144
+ type: { kind: 'NonNullType', type: { kind: 'NamedType', name: { kind: 'Name', value: 'StreamPagesInput' } } }
146
145
  },
147
146
  {
148
147
  kind: 'VariableDefinition',
@@ -155,8 +154,7 @@ export const GetStreamPagesDocument = {
155
154
  selections: [
156
155
  {
157
156
  kind: 'Field',
158
- alias: { kind: 'Name', value: 'streamPages' },
159
- name: { kind: 'Name', value: 'embedStreamPages' },
157
+ name: { kind: 'Name', value: 'streamPages' },
160
158
  arguments: [{ kind: 'Argument', name: { kind: 'Name', value: 'input' }, value: { kind: 'Variable', name: { kind: 'Name', value: 'input' } } }],
161
159
  selectionSet: {
162
160
  kind: 'SelectionSet',
@@ -1,12 +1,12 @@
1
1
  query GetStream($id: String!) {
2
- stream: embedStream(input: { id: $id }) {
2
+ stream(input: { id: $id }) {
3
3
  ...StreamPlayerPayloadFragment
4
4
  }
5
5
  }
6
6
 
7
7
  # noinspection GraphQLSchemaValidation
8
- query GetStreamPages($input: EmbedStreamPagesInput!, $image_scale: ImageScale!) {
9
- streamPages: embedStreamPages(input: $input) {
8
+ query GetStreamPages($input: StreamPagesInput!, $image_scale: ImageScale!) {
9
+ streamPages(input: $input) {
10
10
  items {
11
11
  ...StreamPageViewerPayloadFragment
12
12
  }
@@ -6,7 +6,7 @@ import { LineClamp } from '../../ui/line-clamp';
6
6
  import { ProportionalContainer } from '../../ui/proportional-container';
7
7
  import { TimeAgo } from '../../ui/time-ago';
8
8
  import { default as ActionButton } from './action-button.svelte';
9
- import { StreamPlayerLocalization } from './stream-player-localization';
9
+ import { StreamPlayerLocalization } from './stream-player-localization.svelte';
10
10
  import IconPanelLeftText from '@fluentui/svg-icons/icons/panel_left_text_20_regular.svg?raw';
11
11
  let { model, buffer, activePageId, on, uiManager, localization } = $props();
12
12
  </script>
@@ -26,7 +26,7 @@ let { model, buffer, activePageId, on, uiManager, localization } = $props();
26
26
  </div>
27
27
  <div class="stream-overview-owner__meta">
28
28
  <LineClamp maxLines={1}>
29
- <TimeAgo date={model.publishedAt || model.createdAt} localization={localization.timeAgoLocalization} />
29
+ <TimeAgo date={model.publishedAt || model.createdAt} />
30
30
  </LineClamp>
31
31
  </div>
32
32
  </div>
@@ -1,5 +1,5 @@
1
1
  import type { StreamPlayerBuffer } from './stream-player-buffer.svelte';
2
- import { StreamPlayerLocalization } from './stream-player-localization';
2
+ import { StreamPlayerLocalization } from './stream-player-localization.svelte';
3
3
  import type { StreamPlayerModel } from './types';
4
4
  import type { StreamPlayerUiManager } from './ui-manager.svelte';
5
5
  type Props = {
@@ -23,7 +23,7 @@ export class StreamPlayerBuffer {
23
23
  const payload = await graphql
24
24
  .query(GetStreamPagesDocument, {
25
25
  input: {
26
- limit: 2,
26
+ limit: 10,
27
27
  continuationToken,
28
28
  filter: {
29
29
  streamId
@@ -70,7 +70,7 @@ export class StreamPlayerBuffer {
70
70
  this._pagesLoader.reset();
71
71
  };
72
72
  warmUpBuffer = async () => {
73
- const bufferSize = 2;
73
+ const bufferSize = 5;
74
74
  if (this.loaded.length >= this.currentIndex + bufferSize) {
75
75
  return;
76
76
  }
@@ -0,0 +1,12 @@
1
+ import type { IShortVideoDetailsLocalization } from '../../short-videos/short-video-viewer';
2
+ export interface IStreamPlayerLocalization {
3
+ streamNotFound?: string;
4
+ pagesCount?: (count: number) => string;
5
+ shortVideoDetailsLocalization?: IShortVideoDetailsLocalization;
6
+ }
7
+ export declare class StreamPlayerLocalization {
8
+ streamNotFound: string;
9
+ pagesCount: (count: number) => string;
10
+ shortVideoDetailsLocalization: IShortVideoDetailsLocalization | undefined;
11
+ constructor(init?: IStreamPlayerLocalization);
12
+ }