@streamscloud/embeddable 3.2.4 → 3.2.6

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 (179) hide show
  1. package/dist/core/analytics.profile-id.d.ts +5 -0
  2. package/dist/core/analytics.profile-id.js +17 -0
  3. package/dist/core/document.event-handlers.d.ts +1 -0
  4. package/dist/core/document.event-handlers.js +5 -0
  5. package/dist/core/enums.d.ts +0 -2
  6. package/dist/core/enums.js +0 -2
  7. package/dist/core/graphql.d.ts +3 -1
  8. package/dist/core/graphql.js +12 -3
  9. package/dist/core/locale.d.ts +6 -0
  10. package/dist/core/locale.js +24 -0
  11. package/dist/core/utils/html-helper.d.ts +1 -0
  12. package/dist/core/utils/html-helper.js +4 -0
  13. package/dist/products/price-helper.js +1 -1
  14. package/dist/short-videos/short-video-viewer/cmp.ad.svelte +103 -37
  15. package/dist/short-videos/short-video-viewer/cmp.attachments-inline.svelte +2 -2
  16. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +2 -2
  17. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte.d.ts +3 -2
  18. package/dist/short-videos/short-video-viewer/cmp.product.svelte +1 -1
  19. package/dist/short-videos/short-video-viewer/cmp.product.svelte.d.ts +3 -2
  20. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte +1 -1
  21. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte.d.ts +3 -2
  22. package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte +6 -2
  23. package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte.d.ts +1 -1
  24. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +1 -1
  25. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +3 -2
  26. package/dist/short-videos/short-video-viewer/description.svelte +5 -0
  27. package/dist/short-videos/short-video-viewer/description.svelte.d.ts +1 -1
  28. package/dist/short-videos/short-video-viewer/index.d.ts +4 -2
  29. package/dist/short-videos/short-video-viewer/index.js +1 -0
  30. package/dist/short-videos/short-video-viewer/mapper.js +5 -4
  31. package/dist/short-videos/short-video-viewer/operations.generated.d.ts +10 -3
  32. package/dist/short-videos/short-video-viewer/operations.generated.js +17 -3
  33. package/dist/short-videos/short-video-viewer/operations.graphql +10 -3
  34. package/dist/short-videos/short-video-viewer/{short-video-attachments-localization.svelte.d.ts → short-video-attachments-localization.d.ts} +5 -4
  35. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.js +21 -0
  36. package/dist/short-videos/short-video-viewer/{short-video-details-localization.svelte.d.ts → short-video-details-localization.d.ts} +7 -6
  37. package/dist/short-videos/short-video-viewer/short-video-details-localization.js +17 -0
  38. package/dist/short-videos/short-video-viewer/{short-video-product-localization.svelte.d.ts → short-video-product-localization.d.ts} +2 -1
  39. package/dist/short-videos/short-video-viewer/short-video-product-localization.js +13 -0
  40. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.d.ts +14 -0
  41. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.js +17 -0
  42. package/dist/short-videos/short-video-viewer/types.d.ts +10 -3
  43. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +88 -11
  44. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +5 -5
  45. package/dist/short-videos/short-videos-player/controls.svelte +2 -2
  46. package/dist/short-videos/short-videos-player/controls.svelte.d.ts +1 -1
  47. package/dist/short-videos/short-videos-player/index.d.ts +51 -14
  48. package/dist/short-videos/short-videos-player/index.js +83 -12
  49. package/dist/short-videos/short-videos-player/operations.generated.d.ts +71 -0
  50. package/dist/short-videos/short-videos-player/operations.generated.js +207 -0
  51. package/dist/short-videos/short-videos-player/operations.graphql +8 -0
  52. package/dist/short-videos/short-videos-player/short-videos-player-localization.d.ts +16 -0
  53. package/dist/short-videos/short-videos-player/short-videos-player-localization.js +13 -0
  54. package/dist/short-videos/short-videos-player/types.d.ts +36 -0
  55. package/dist/short-videos/short-videos-player/types.js +6 -0
  56. package/dist/streams/layout/cmp.layout.svelte.d.ts +4 -2
  57. package/dist/streams/layout/cmp.slot-content.svelte +4 -4
  58. package/dist/streams/layout/cmp.slot-content.svelte.d.ts +2 -1
  59. package/dist/streams/layout/cmp.slot.svelte.d.ts +7 -2
  60. package/dist/streams/layout/component.d.ts +2 -0
  61. package/dist/streams/layout/element-views/cmp.annotation-stream-element.svelte +16 -0
  62. package/dist/streams/layout/element-views/cmp.annotation-stream-element.svelte.d.ts +7 -0
  63. package/dist/streams/layout/element-views/cmp.container-stream-element.svelte +1 -1
  64. package/dist/streams/layout/element-views/cmp.container-stream-element.svelte.d.ts +4 -3
  65. package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte +15 -2
  66. package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte.d.ts +7 -3
  67. package/dist/streams/layout/element-views/cmp.images-stream-element.svelte +2 -2
  68. package/dist/streams/layout/element-views/cmp.price-stream-element.svelte +15 -89
  69. package/dist/streams/layout/element-views/cmp.price-stream-element.svelte.d.ts +5 -4
  70. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +4 -2
  71. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte.d.ts +3 -0
  72. package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte +74 -0
  73. package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte.d.ts +11 -0
  74. package/dist/streams/layout/element-views/cmp.stream-element.svelte +24 -17
  75. package/dist/streams/layout/element-views/cmp.stream-element.svelte.d.ts +4 -3
  76. package/dist/streams/layout/element-views/cmp.text-ref-stream-element.svelte.d.ts +2 -2
  77. package/dist/streams/layout/element-views/cmp.text-stream-element.svelte +6 -2
  78. package/dist/streams/layout/element-views/cmp.text-stream-element.svelte.d.ts +2 -0
  79. package/dist/streams/layout/element-views/cmp.web-view-stream-element.svelte +37 -0
  80. package/dist/streams/layout/element-views/cmp.web-view-stream-element.svelte.d.ts +7 -0
  81. package/dist/streams/layout/element-views/data-by-key-accessor.d.ts +3 -3
  82. package/dist/streams/layout/element-views/index.d.ts +16 -11
  83. package/dist/streams/layout/element-views/index.js +12 -9
  84. package/dist/streams/layout/element-views/price-element-view.svelte +168 -0
  85. package/dist/streams/layout/element-views/price-element-view.svelte.d.ts +15 -0
  86. package/dist/streams/layout/element-views/price-stream-element-localization.d.ts +13 -0
  87. package/dist/streams/layout/element-views/price-stream-element-localization.js +21 -0
  88. package/dist/streams/layout/element-views/short-video-stream-element-localization.d.ts +9 -0
  89. package/dist/streams/layout/element-views/short-video-stream-element-localization.js +7 -0
  90. package/dist/streams/layout/element-views/stock-stream-element-localization.d.ts +8 -0
  91. package/dist/streams/layout/element-views/stock-stream-element-localization.js +26 -0
  92. package/dist/streams/layout/element-views/stream-element-localization.d.ts +15 -0
  93. package/dist/streams/layout/element-views/stream-element-localization.js +11 -0
  94. package/dist/streams/layout/elements.d.ts +47 -12
  95. package/dist/streams/layout/elements.js +1 -1
  96. package/dist/streams/layout/enums.d.ts +34 -3
  97. package/dist/streams/layout/enums.js +46 -7
  98. package/dist/streams/layout/index.d.ts +3 -10
  99. package/dist/streams/layout/index.js +3 -2
  100. package/dist/streams/layout/layout.d.ts +2 -1
  101. package/dist/streams/layout/models/index.d.ts +1 -1
  102. package/dist/streams/layout/models/mapper.js +5 -4
  103. package/dist/streams/layout/models/stream-layout-media-item-model.d.ts +1 -1
  104. package/dist/streams/layout/models/stream-layout-media-item-model.js +1 -1
  105. package/dist/streams/layout/models/stream-layout-post-header-model.d.ts +1 -1
  106. package/dist/streams/layout/models/stream-layout-product-model.d.ts +1 -2
  107. package/dist/streams/layout/models/stream-layout-short-video-model.d.ts +13 -3
  108. package/dist/streams/layout/serializer.svelte.d.ts +29 -0
  109. package/dist/streams/layout/serializer.svelte.js +93 -0
  110. package/dist/streams/layout/slot-data-ref.d.ts +13 -0
  111. package/dist/streams/layout/slot-data-ref.js +1 -0
  112. package/dist/streams/layout/slot.d.ts +2 -0
  113. package/dist/streams/layout/styles-transformer.d.ts +3 -2
  114. package/dist/streams/layout/styles-transformer.js +54 -30
  115. package/dist/streams/layout/styles.d.ts +24 -14
  116. package/dist/streams/layout/svg-attributes.d.ts +7 -0
  117. package/dist/streams/layout/svg-attributes.js +8 -0
  118. package/dist/streams/layout/type-guards.d.ts +31 -0
  119. package/dist/streams/layout/type-guards.js +13 -1
  120. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte +4 -2
  121. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte.d.ts +3 -0
  122. package/dist/streams/stream-page-viewer/index.d.ts +1 -0
  123. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.d.ts +9 -0
  124. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.js +7 -0
  125. package/dist/streams/stream-player/cmp.stream-player.svelte +47 -7
  126. package/dist/streams/stream-player/cmp.stream-player.svelte.d.ts +6 -4
  127. package/dist/streams/stream-player/controls.svelte +46 -3
  128. package/dist/streams/stream-player/controls.svelte.d.ts +1 -1
  129. package/dist/streams/stream-player/index.d.ts +6 -4
  130. package/dist/streams/stream-player/index.js +15 -28
  131. package/dist/streams/stream-player/operations.generated.d.ts +1 -1
  132. package/dist/streams/stream-player/operations.generated.js +5 -3
  133. package/dist/streams/stream-player/operations.graphql +3 -3
  134. package/dist/streams/stream-player/stream-overview.svelte +2 -2
  135. package/dist/streams/stream-player/stream-overview.svelte.d.ts +1 -1
  136. package/dist/streams/stream-player/stream-player-buffer.svelte.js +2 -2
  137. package/dist/streams/stream-player/stream-player-localization.d.ts +26 -0
  138. package/dist/streams/stream-player/stream-player-localization.js +31 -0
  139. package/dist/ui/icon/cmp.icon.svelte +13 -26
  140. package/dist/ui/line-clamp/cmp.line-clamp.svelte +2 -2
  141. package/dist/ui/line-clamp/cmp.line-clamp.svelte.d.ts +3 -2
  142. package/dist/ui/line-clamp/index.d.ts +1 -1
  143. package/dist/ui/line-clamp/index.js +1 -1
  144. package/dist/ui/line-clamp/{line-clamp-localization.svelte.d.ts → line-clamp-localization.d.ts} +2 -1
  145. package/dist/ui/line-clamp/line-clamp-localization.js +19 -0
  146. package/dist/ui/shadow-dom/shadow-host.d.ts +1 -5
  147. package/dist/ui/shadow-dom/shadow-host.js +1 -14
  148. package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte +125 -0
  149. package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte.d.ts +9 -0
  150. package/dist/ui/swipe-indicator/index.d.ts +2 -0
  151. package/dist/ui/swipe-indicator/index.js +1 -0
  152. package/dist/ui/swipe-indicator/swipe-indicator-localization.d.ts +8 -0
  153. package/dist/ui/swipe-indicator/swipe-indicator-localization.js +13 -0
  154. package/dist/ui/time-ago/cmp.time-ago.svelte +1 -1
  155. package/dist/ui/time-ago/cmp.time-ago.svelte.d.ts +3 -2
  156. package/dist/ui/time-ago/index.d.ts +1 -1
  157. package/dist/ui/time-ago/{time-ago-localization.svelte.d.ts → time-ago-localization.d.ts} +2 -1
  158. package/dist/ui/time-ago/time-ago-localization.js +55 -0
  159. package/dist/ui/video/cmp.video.svelte +42 -18
  160. package/package.json +1 -1
  161. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.svelte.js +0 -10
  162. package/dist/short-videos/short-video-viewer/short-video-details-localization.svelte.js +0 -10
  163. package/dist/short-videos/short-video-viewer/short-video-product-localization.svelte.js +0 -11
  164. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.d.ts +0 -13
  165. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.js +0 -10
  166. package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.d.ts +0 -8
  167. package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.js +0 -6
  168. package/dist/streams/layout/element-views/price-stream-element-localization.svelte.d.ts +0 -9
  169. package/dist/streams/layout/element-views/price-stream-element-localization.svelte.js +0 -8
  170. package/dist/streams/layout/element-views/stream-element-localization.svelte.d.ts +0 -8
  171. package/dist/streams/layout/element-views/stream-element-localization.svelte.js +0 -6
  172. package/dist/streams/layout/serializer.d.ts +0 -3
  173. package/dist/streams/layout/serializer.js +0 -6
  174. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.d.ts +0 -13
  175. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.js +0 -10
  176. package/dist/streams/stream-player/stream-player-localization.svelte.d.ts +0 -12
  177. package/dist/streams/stream-player/stream-player-localization.svelte.js +0 -10
  178. package/dist/ui/line-clamp/line-clamp-localization.svelte.js +0 -15
  179. package/dist/ui/time-ago/time-ago-localization.svelte.js +0 -39
@@ -1,53 +1,77 @@
1
1
  import { Utils } from '../../core/utils';
2
- import { StreamCssValueType, StreamElementStyleDirection, StreamElementStyleFontFamily, StreamElementStyleFontWeight, StreamElementStyleMediaFit, StreamElementStyleHorizontalAlign } from './enums';
2
+ import { StreamCssValueType, StreamElementStyleDirection, StreamElementStyleFontFamily, StreamElementStyleFontWeight, StreamElementStyleMediaFit, StreamElementStyleHorizontalAlign, AnnotationStreamElementPlacement } from './enums';
3
3
  export const generateStreamLayoutStyles = (styles) => {
4
4
  if (!styles) {
5
5
  return '';
6
6
  }
7
- const values = [`background-color: ${transformColorValue(styles.backgroundColor)};`, `font-family: ${mapFontFamily(styles.fontFamily)};`];
8
- return values.join('');
7
+ const values = [`background-color: ${transformColorValue(styles.backgroundColor)}`, `font-family: ${mapFontFamily(styles.fontFamily)}`];
8
+ return values.join(';');
9
9
  };
10
10
  export const generateContainerStyles = (styles) => {
11
11
  styles = styles || {};
12
12
  const values = [
13
- 'display: flex;',
14
- 'flex-direction: column;',
15
- `width: ${transformCssValue(styles.width, 'auto')};`,
16
- `height: ${transformCssValue(styles.height, 'fit-content')};`,
17
- `aspect-ratio: ${styles.aspectRatio || 'auto'};`,
18
- `gap: ${transformNumericValue(styles.gap)};`,
19
- `padding-top: ${transformNumericValue(styles.paddingTop)};`,
20
- `padding-right: ${transformNumericValue(styles.paddingRight)};`,
21
- `padding-bottom: ${transformNumericValue(styles.paddingBottom)};`,
22
- `padding-left: ${transformNumericValue(styles.paddingLeft)};`,
23
- `background-color: ${transformColorValue(styles.backgroundColor)};`,
24
- `border-width: ${styles.borderColor ? '1px' : '0'};`,
25
- `border-radius: ${transformNumericValue(styles.borderRadius)};`,
26
- `border-color: ${transformColorValue(styles.borderColor)};`,
27
- `overflow: ${styles.borderRadius ? 'hidden' : 'visible'};`
13
+ 'display: flex',
14
+ 'flex-direction: column',
15
+ `width: ${transformCssValue(styles.width, 'auto')}`,
16
+ `height: ${transformCssValue(styles.height, 'fit-content')}`,
17
+ `aspect-ratio: ${styles.aspectRatio || 'auto'}`,
18
+ `gap: ${transformNumericValue(styles.gap)}`,
19
+ `padding-top: ${transformNumericValue(styles.paddingTop)}`,
20
+ `padding-right: ${transformNumericValue(styles.paddingRight)}`,
21
+ `padding-bottom: ${transformNumericValue(styles.paddingBottom)}`,
22
+ `padding-left: ${transformNumericValue(styles.paddingLeft)}`,
23
+ `background-color: ${transformColorValue(styles.backgroundColor)}`,
24
+ `border-width: ${styles.borderColor ? '1px' : '0'}`,
25
+ `border-radius: ${transformNumericValue(styles.borderRadius)}`,
26
+ `border-color: ${transformColorValue(styles.borderColor)}`,
27
+ `overflow: ${styles.borderRadius ? 'hidden' : 'visible'}`
28
28
  ];
29
29
  if (styles.direction) {
30
- values.push(`display: flex;`);
31
- values.push(`flex-direction: ${styles.direction === StreamElementStyleDirection.Horizontal ? 'row' : 'column'};`);
30
+ values.push(`display: flex`);
31
+ values.push(`flex-direction: ${styles.direction === StreamElementStyleDirection.Horizontal ? 'row' : 'column'}`);
32
32
  }
33
- return values.join('');
33
+ return values.join(';');
34
+ };
35
+ export const generateAnnotationStyles = (styles, placement) => {
36
+ const values = [`height: ${transformNumericValue(styles.height)}`, `aspect-ratio: ${styles.aspectRatio}`, 'position: absolute'];
37
+ switch (placement) {
38
+ case AnnotationStreamElementPlacement.TopLeft:
39
+ values.push(`top: ${transformNumericValue(styles.offsetY)}`);
40
+ values.push(`left: ${transformNumericValue(styles.offsetX)}`);
41
+ break;
42
+ case AnnotationStreamElementPlacement.TopRight:
43
+ values.push(`top: ${transformNumericValue(styles.offsetY)}`);
44
+ values.push(`right: ${transformNumericValue(styles.offsetX)}`);
45
+ break;
46
+ case AnnotationStreamElementPlacement.BottomLeft:
47
+ values.push(`bottom: ${transformNumericValue(styles.offsetY)}`);
48
+ values.push(`left: ${transformNumericValue(styles.offsetX)}`);
49
+ break;
50
+ case AnnotationStreamElementPlacement.BottomRight:
51
+ values.push(`bottom: ${transformNumericValue(styles.offsetY)}`);
52
+ values.push(`right: ${transformNumericValue(styles.offsetX)}`);
53
+ break;
54
+ default:
55
+ Utils.assertUnreachable(placement);
56
+ }
57
+ return values.join(';');
34
58
  };
35
59
  export const generateTextStyles = (styles) => {
36
60
  styles = styles || {};
37
61
  const values = [
38
- `font-family: ${mapFontFamily(styles.fontFamily)};`,
39
- `font-size: ${transformFontSizeValue(styles.fontSize)};`,
40
- `font-weight: ${mapFontWeight(styles.fontWeight)};`,
41
- `line-height: ${transformNumericValue(styles.lineHeight, '1.2')};`,
42
- `text-align: ${mapTextAlign(styles.textAlign)};`,
43
- `color: ${transformColorValue(styles.color)};`
62
+ `font-family: ${mapFontFamily(styles.fontFamily)}`,
63
+ `font-size: ${transformFontSizeValue(styles.fontSize)}`,
64
+ `font-weight: ${mapFontWeight(styles.fontWeight)}`,
65
+ `line-height: ${transformNumericValue(styles.lineHeight, '1.2')}`,
66
+ `text-align: ${mapTextAlign(styles.textAlign)}`,
67
+ `color: ${transformColorValue(styles.color)}`
44
68
  ];
45
- return values.join('');
69
+ return values.join(';');
46
70
  };
47
71
  export const generateImageStyles = (styles) => {
48
72
  styles = styles || {};
49
- const imageStyles = [`object-fit: ${mapMediaFit(styles.mediaFit)};`];
50
- return imageStyles.join('');
73
+ const imageStyles = [`object-fit: ${mapMediaFit(styles.mediaFit)}`];
74
+ return imageStyles.join(';');
51
75
  };
52
76
  export const mapFontFamily = (value) => {
53
77
  switch (value) {
@@ -4,6 +4,26 @@ 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
+ };
7
27
  export type ImageStreamElementStyles = {
8
28
  mediaFit?: StreamElementStyleMediaFit | null;
9
29
  };
@@ -18,6 +38,10 @@ export type PriceStreamElementStyles = {
18
38
  beforeValueColor?: string | null;
19
39
  horizontalAlign?: StreamElementStyleHorizontalAlign | null;
20
40
  };
41
+ export type StockStreamElementStyles = {
42
+ height?: number | null;
43
+ horizontalAlign?: StreamElementStyleHorizontalAlign | null;
44
+ };
21
45
  export type TextStreamElementStyles = {
22
46
  fontSize?: number | null;
23
47
  fontWeight?: StreamElementStyleFontWeight | null;
@@ -27,17 +51,3 @@ export type TextStreamElementStyles = {
27
51
  color?: string | null;
28
52
  maxLines?: number | null;
29
53
  };
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
- };
@@ -0,0 +1,7 @@
1
+ export declare enum SvgAttributes {
2
+ customizableElement = "data-streams--customizable",
3
+ textElementValueType = "data-streams--text--value-type",
4
+ textElementCustomValue = "data-streams--text--custom-value",
5
+ textElementValueBefore = "data-streams--text--value-before",
6
+ textElementValueAfter = "data-streams--text--value-after"
7
+ }
@@ -0,0 +1,8 @@
1
+ export var SvgAttributes;
2
+ (function (SvgAttributes) {
3
+ SvgAttributes["customizableElement"] = "data-streams--customizable";
4
+ SvgAttributes["textElementValueType"] = "data-streams--text--value-type";
5
+ SvgAttributes["textElementCustomValue"] = "data-streams--text--custom-value";
6
+ SvgAttributes["textElementValueBefore"] = "data-streams--text--value-before";
7
+ SvgAttributes["textElementValueAfter"] = "data-streams--text--value-after";
8
+ })(SvgAttributes || (SvgAttributes = {}));
@@ -1,8 +1,39 @@
1
+ import type { AnnotationStreamElementModel, ContainerStreamElementModel, ImageRefStreamElementModel, ImagesStreamElementModel, PriceStreamElementModel, ShortVideoStreamElementModel, SpacerStreamElementModel, StockStreamElementModel, TextRefStreamElementModel, TextStreamElementModel, WebViewStreamElementModel } from './elements';
2
+ import { StreamElementType } from './enums';
1
3
  import type { ImagesStreamSlotData, ProductStreamSlotData, ShortVideoStreamSlotData, StreamSlotData } from './slot-data';
2
4
  import type { ImagesStreamSlotDataInput, ProductStreamSlotDataInput, ShortVideoStreamSlotDataInput, StreamSlotDataInput } from './slot-data-input';
5
+ import type { AnnotationStreamElementStyles, ContainerStreamElementStyles, ImageStreamElementStyles, PriceStreamElementStyles, StockStreamElementStyles, TextStreamElementStyles } from './styles';
3
6
  export declare function isImagesSlotDataInput(data: StreamSlotDataInput | null): data is ImagesStreamSlotDataInput;
4
7
  export declare function isProductSlotDataInput(data: StreamSlotDataInput | null): data is ProductStreamSlotDataInput;
5
8
  export declare function isShortVideoSlotDataInput(data: StreamSlotDataInput | null): data is ShortVideoStreamSlotDataInput;
6
9
  export declare function isImagesSlotData(data: StreamSlotData | null): data is ImagesStreamSlotData;
7
10
  export declare function isProductSlotData(data: StreamSlotData | null): data is ProductStreamSlotData;
8
11
  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 } from './enums';
1
+ import { StreamComponentDataType, StreamElementType } from './enums';
2
2
  // SlotDataInput guards
3
3
  export function isImagesSlotDataInput(data) {
4
4
  return data?.type === StreamComponentDataType.Images;
@@ -19,3 +19,15 @@ 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,12 +1,14 @@
1
1
  <script lang="ts">import { StreamLayoutSlot, StreamPageLayout, StreamLayoutSlotContent } from '../layout';
2
- let { page, on } = $props();
2
+ import { StreamPageViewerLocalization } from './stream-page-viewer-localization';
3
+ let { page, localization: localizationInit, on } = $props();
4
+ const localization = $derived(new StreamPageViewerLocalization(localizationInit));
3
5
  </script>
4
6
 
5
7
  {#if page.type === 'general'}
6
8
  <StreamPageLayout model={page.layout}>
7
9
  {#each page.layout.slots as slot (slot)}
8
10
  <StreamLayoutSlot model={slot}>
9
- <StreamLayoutSlotContent model={slot} on={on} />
11
+ <StreamLayoutSlotContent model={slot} on={on} localization={localization.elementsLocalization} />
10
12
  </StreamLayoutSlot>
11
13
  {/each}
12
14
  </StreamPageLayout>
@@ -1,6 +1,9 @@
1
+ import type { Locale } from '../../core/locale';
2
+ import { type IStreamPageViewerLocalization } from './stream-page-viewer-localization';
1
3
  import type { StreamPageViewerModel } from './types';
2
4
  type Props = {
3
5
  page: StreamPageViewerModel;
6
+ localization: IStreamPageViewerLocalization | Locale;
4
7
  on?: {
5
8
  productClick: (productId: string) => void;
6
9
  progress?: (videoId: string, progress: number) => void;
@@ -1,2 +1,3 @@
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,9 @@
1
+ import { type Locale } from '../../core/locale';
2
+ import type { IStreamElementLocalization } from '../layout/element-views';
3
+ export interface IStreamPageViewerLocalization {
4
+ elementsLocalization?: IStreamElementLocalization | Locale;
5
+ }
6
+ export declare class StreamPageViewerLocalization {
7
+ elementsLocalization: IStreamElementLocalization | Locale;
8
+ constructor(init: IStreamPageViewerLocalization | Locale);
9
+ }
@@ -0,0 +1,7 @@
1
+ import { isLocale } from '../../core/locale';
2
+ export class StreamPageViewerLocalization {
3
+ elementsLocalization;
4
+ constructor(init) {
5
+ this.elementsLocalization = isLocale(init) ? init : init?.elementsLocalization || 'en';
6
+ }
7
+ }
@@ -7,6 +7,9 @@
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';
10
13
  import { toastrWarning } from '../../core/toastr';
11
14
  import { ShortVideoViewer } from '../../short-videos/short-video-viewer';
12
15
  import { mapToShortVideoViewerModel } from '../layout/models';
@@ -14,21 +17,23 @@ import { StreamPageViewer } from '../stream-page-viewer';
14
17
  import { Loading } from '../../ui/loading';
15
18
  import { PlayerSlider } from '../../ui/player';
16
19
  import { SpotlightLayout } from '../../ui/spotlight-layout';
20
+ import { SwipeIndicator } from '../../ui/swipe-indicator';
17
21
  import { default as Controls } from './controls.svelte';
18
22
  import { mapStreamPlayerModel } from './mapper';
19
23
  import { GetStreamDocument } from './operations.generated';
20
24
  import { default as Overview } from './stream-overview.svelte';
21
25
  import { StreamPlayerBuffer } from './stream-player-buffer.svelte';
22
- import { StreamPlayerLocalization } from './stream-player-localization.svelte';
26
+ import { StreamPlayerLocalization } from './stream-player-localization';
23
27
  import { StreamPlayerUiManager } from './ui-manager.svelte';
24
- import { onMount } from 'svelte';
25
28
  import { AppEventsTracker } from '@streamscloud/streams-analytics-collector';
26
- let { streamId, graphql, localization: localizationInit, on } = $props();
29
+ import { onMount } from 'svelte';
30
+ let { streamId, graphqlOrigin, localization: localizationInit, showStreamsCloudWatermark, initiator, on } = $props();
27
31
  const localization = $derived(new StreamPlayerLocalization(localizationInit));
28
32
  let model = $state(null);
29
33
  let buffer = $state.raw(null);
30
34
  let loading = $state(true);
31
35
  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);
32
37
  let totalEngagementTimeSeconds = 0;
33
38
  let inactiveTimeSeconds = 10; // // Mark as inactive after 10 seconds of no activity
34
39
  let isActive = true;
@@ -51,12 +56,15 @@ onMount(() => __awaiter(void 0, void 0, void 0, function* () {
51
56
  var _a, _b, _c, _d;
52
57
  uiManager.overviewCollapsed = window && window.innerWidth < window.innerHeight;
53
58
  try {
59
+ const graphql = createLocalGQLClient(graphqlOrigin, { 'x-initiator': initiator !== null && initiator !== void 0 ? initiator : 'player/stream' });
54
60
  const streamPayload = yield graphql.query(GetStreamDocument, { id: streamId }).toPromise();
55
61
  if (!((_a = streamPayload.data) === null || _a === void 0 ? void 0 : _a.stream)) {
56
62
  toastrWarning(localization.streamNotFound);
57
63
  (_b = on === null || on === void 0 ? void 0 : on.closePlayer) === null || _b === void 0 ? void 0 : _b.call(on);
58
64
  return;
59
65
  }
66
+ AppEventsTracker.setEndpoint(constructGraphQLUrl(graphqlOrigin));
67
+ AppEventsTracker.setProfileId(getOrCreateProfileId());
60
68
  (_c = on === null || on === void 0 ? void 0 : on.streamActivated) === null || _c === void 0 ? void 0 : _c.call(on, {
61
69
  ownerId: streamPayload.data.stream.ownerProfile.id,
62
70
  title: streamPayload.data.stream.title,
@@ -115,6 +123,19 @@ const handleDimensionsChanged = (dimensions) => {
115
123
  viewTotalWidth: dimensions.totalWidth
116
124
  });
117
125
  };
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
+ };
118
139
  const onPageActivated = (id) => {
119
140
  const page = buffer === null || buffer === void 0 ? void 0 : buffer.loaded.find((x) => x.id === id);
120
141
  if (page) {
@@ -146,14 +167,23 @@ const onProgress = (pageId, videoId, progress) => {
146
167
  };
147
168
  </script>
148
169
 
170
+ <svelte:document onkeydown={(e) => handleEsc(e, onPlayerClose)} />
171
+
149
172
  <div class="stream-player-container">
150
173
  {#if loading}
151
174
  <Loading positionAbsoluteCenter={true} timeout={600} />
152
175
  {/if}
153
176
  <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}
154
184
  {#if buffer && model}
155
185
  <SpotlightLayout ratio={9 / 16} on={{ dimensionsChanged: handleDimensionsChanged }}>
156
- <div class="stream-player__content">
186
+ <div class="stream-player__content" use:contentMounted>
157
187
  <PlayerSlider
158
188
  buffer={buffer}
159
189
  on={{
@@ -164,9 +194,10 @@ const onProgress = (pageId, videoId, progress) => {
164
194
  {#if item.type === 'general'}
165
195
  <StreamPageViewer
166
196
  page={item}
197
+ localization={localization.streamPageViewerLocalization}
167
198
  on={{
168
- progress: (videoId: string, progress: number) => onProgress(item.id, videoId, progress),
169
- productClick: (productId: string) => onProductCardClick(productId)
199
+ progress: (videoId: String, progress: Number) => onProgress(item.id, videoId, progress),
200
+ productClick: (productId: String) => onProductCardClick(productId)
170
201
  }} />
171
202
  {:else if item.type === 'short-video'}
172
203
  <ShortVideoViewer
@@ -175,10 +206,14 @@ const onProgress = (pageId, videoId, progress) => {
175
206
  progress: (progress) => onProgress(item.id, item.shortVideo.id, progress)
176
207
  }}
177
208
  autoplay="on-appearance"
209
+ localization={localization.shortVideoViewerLocalization}
178
210
  showAttachments={uiManager.showShortVideoOverlay} />
179
211
  {/if}
180
212
  {/snippet}
181
213
  </PlayerSlider>
214
+ {#if uiManager.isMobileView && buffer.loaded.length > 1 && !everTouched}
215
+ <SwipeIndicator localization={localization.swipeIndicatorLocalization} />
216
+ {/if}
182
217
  </div>
183
218
  </SpotlightLayout>
184
219
  {#if model}
@@ -196,7 +231,7 @@ const onProgress = (pageId, videoId, progress) => {
196
231
  localization={localization}
197
232
  on={{
198
233
  closePlayer: () => onPlayerClose(),
199
- productClick: (productId: string) => onProductCardClick(productId)
234
+ productClick: (productId: String) => onProductCardClick(productId)
200
235
  }} />
201
236
  {/if}
202
237
  </div>
@@ -237,6 +272,11 @@ const onProgress = (pageId, videoId, progress) => {
237
272
  padding: 0;
238
273
  }
239
274
  }
275
+ .stream-player__watermark {
276
+ position: absolute;
277
+ bottom: 5rem;
278
+ left: 20rem;
279
+ }
240
280
  .stream-player__content {
241
281
  width: 100%;
242
282
  height: 100%;
@@ -1,9 +1,11 @@
1
- import { type IStreamPlayerLocalization } from './stream-player-localization.svelte';
2
- import type { Client } from '@urql/core';
1
+ import type { Locale } from '../../core/locale';
2
+ import { type IStreamPlayerLocalization } from './stream-player-localization';
3
3
  type Props = {
4
4
  streamId: string;
5
- localization?: IStreamPlayerLocalization;
6
- graphql: Client;
5
+ localization: IStreamPlayerLocalization | Locale;
6
+ graphqlOrigin?: string;
7
+ showStreamsCloudWatermark?: boolean;
8
+ initiator?: string;
7
9
  on?: {
8
10
  closePlayer?: () => void;
9
11
  streamActivated?: (data: {
@@ -1,10 +1,11 @@
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';
3
4
  import { mapToShortVideoViewerModel } from '../layout/models';
4
5
  import { Icon } from '../../ui/icon';
5
6
  import { MediaVolumeManager } from '../../ui/media-playback';
6
7
  import { default as ActionButton } from './action-button.svelte';
7
- import { StreamPlayerLocalization } from './stream-player-localization.svelte';
8
+ import { StreamPlayerLocalization } from './stream-player-localization';
8
9
  import IconChevronDown from '@fluentui/svg-icons/icons/chevron_down_20_regular.svg?raw';
9
10
  import IconChevronUp from '@fluentui/svg-icons/icons/chevron_up_20_regular.svg?raw';
10
11
  import IconDismiss from '@fluentui/svg-icons/icons/dismiss_20_regular.svg?raw';
@@ -17,6 +18,36 @@ const toggleMuted = () => {
17
18
  MediaVolumeManager.isMuted = !MediaVolumeManager.isMuted;
18
19
  };
19
20
  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
+ });
20
51
  </script>
21
52
 
22
53
  <div class="stream-player-controls">
@@ -28,7 +59,7 @@ const shortVideo = $derived(((_a = buffer.current) === null || _a === void 0 ? v
28
59
  </div>
29
60
  </div>
30
61
  {/if}
31
- <div class="stream-player-controls__navigation-buttons">
62
+ <div class="stream-player-controls__navigation-buttons" class:stream-player-controls__navigation-buttons--single-web-view-page={singleWebViewPage}>
32
63
  <button type="button" class="navigation-button" disabled={!buffer.canLoadPrevious} onclick={buffer.loadPrevious}>
33
64
  <Icon src={IconChevronUp} />
34
65
  </button>
@@ -42,7 +73,7 @@ const shortVideo = $derived(((_a = buffer.current) === null || _a === void 0 ? v
42
73
  <div class="stream-player-controls__short-video-attachments">
43
74
  <ShortVideoViewerAttachments
44
75
  shortVideo={shortVideo}
45
- localization={localization.shortVideoDetailsLocalization?.attachmentsLocalization}
76
+ localization={localization.shortVideoAttachmentsLocalization}
46
77
  on={{
47
78
  productClick: on.productClick
48
79
  }} />
@@ -214,6 +245,18 @@ const shortVideo = $derived(((_a = buffer.current) === null || _a === void 0 ? v
214
245
  visibility: hidden;
215
246
  }
216
247
  }
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
+ }
217
260
  .stream-player-controls__controls {
218
261
  display: flex;
219
262
  margin-top: auto;
@@ -1,5 +1,5 @@
1
1
  import type { StreamPlayerBuffer } from './stream-player-buffer.svelte';
2
- import { StreamPlayerLocalization } from './stream-player-localization.svelte';
2
+ import { StreamPlayerLocalization } from './stream-player-localization';
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.svelte';
1
+ import type { IStreamPlayerLocalization } from './stream-player-localization';
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
- * graphqlUrl: 'https://api.example.com/graphql',
18
+ * graphqlOrigin: 'https://api.example.com',
19
19
  * localization: {
20
20
  * play: 'Play',
21
21
  * pause: 'Pause'
@@ -25,8 +25,10 @@ export type { IStreamPlayerLocalization };
25
25
  */
26
26
  export declare const openStreamPlayer: (init: {
27
27
  streamId: string;
28
- graphqlUrl: string;
29
- localization?: IStreamPlayerLocalization;
28
+ graphqlOrigin?: string;
29
+ localization?: IStreamPlayerLocalization | "en" | "no";
30
+ showStreamsCloudWatermark?: boolean;
31
+ initiator?: string;
30
32
  on?: {
31
33
  streamActivated?: (data: {
32
34
  title: string;