@streamscloud/embeddable 1.1.11 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/dist/core/enums.d.ts +33 -0
  2. package/dist/core/enums.js +39 -0
  3. package/dist/core/graphql.d.ts +1 -1
  4. package/dist/core/graphql.js +2 -2
  5. package/dist/core/media/images-size-detector.service.d.ts +1 -1
  6. package/dist/core/media/images-size-detector.service.js +1 -1
  7. package/dist/core/media/index.d.ts +1 -1
  8. package/dist/core/media/index.js +1 -1
  9. package/dist/core/media/media-item-url.service.js +2 -1
  10. package/dist/core/media/types.d.ts +1 -16
  11. package/dist/core/media/types.js +1 -19
  12. package/dist/index.d.ts +1 -3
  13. package/dist/index.js +1 -3
  14. package/dist/products/price-helper.d.ts +2 -2
  15. package/dist/products/price-helper.js +20 -9
  16. package/dist/short-videos/short-video-viewer/cmp.ad.svelte +74 -0
  17. package/dist/{advertising/ad-view/cmp.ad-view.svelte.d.ts → short-videos/short-video-viewer/cmp.ad.svelte.d.ts} +2 -3
  18. package/dist/short-videos/short-video-viewer/cmp.attachments-inline.svelte +70 -0
  19. package/dist/{streams/components/images/cmp.images-component.svelte.d.ts → short-videos/short-video-viewer/cmp.attachments-inline.svelte.d.ts} +2 -2
  20. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +45 -48
  21. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte.d.ts +4 -2
  22. package/dist/{streams/components/product/cmp.product-component.svelte → short-videos/short-video-viewer/cmp.product.svelte} +34 -26
  23. package/dist/short-videos/short-video-viewer/cmp.product.svelte.d.ts +10 -0
  24. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte +31 -52
  25. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte.d.ts +1 -1
  26. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +6 -6
  27. package/dist/short-videos/short-video-viewer/index.d.ts +6 -3
  28. package/dist/short-videos/short-video-viewer/index.js +4 -2
  29. package/dist/short-videos/short-video-viewer/mapper.js +35 -7
  30. package/dist/short-videos/short-video-viewer/operations.generated.d.ts +1 -1
  31. package/dist/short-videos/short-video-viewer/operations.generated.js +67 -103
  32. package/dist/short-videos/short-video-viewer/operations.graphql +29 -2
  33. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.svelte.d.ts +12 -0
  34. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.svelte.js +10 -0
  35. package/dist/short-videos/short-video-viewer/short-video-details-localization.svelte.d.ts +3 -4
  36. package/dist/short-videos/short-video-viewer/short-video-details-localization.svelte.js +4 -15
  37. package/dist/short-videos/short-video-viewer/short-video-product-localization.svelte.d.ts +7 -0
  38. package/dist/{products/product-card/product-card-localization.svelte.js → short-videos/short-video-viewer/short-video-product-localization.svelte.js} +1 -1
  39. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.d.ts +3 -0
  40. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.js +4 -7
  41. package/dist/short-videos/short-video-viewer/types.d.ts +29 -6
  42. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +4 -4
  43. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +2 -2
  44. package/dist/short-videos/short-videos-player/controls.svelte +42 -35
  45. package/dist/short-videos/short-videos-player/controls.svelte.d.ts +1 -1
  46. package/dist/short-videos/short-videos-player/index.d.ts +28 -2
  47. package/dist/short-videos/short-videos-player/index.js +40 -1
  48. package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.d.ts +3 -9
  49. package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.js +2 -17
  50. package/dist/streams/layout/cmp.layout.svelte +34 -0
  51. package/dist/streams/{slots/cmp.stream-component-slot.svelte.d.ts → layout/cmp.layout.svelte.d.ts} +2 -2
  52. package/dist/streams/layout/cmp.slot-content.svelte +32 -0
  53. package/dist/streams/layout/cmp.slot-content.svelte.d.ts +9 -0
  54. package/dist/streams/layout/cmp.slot.svelte +26 -0
  55. package/dist/streams/layout/cmp.slot.svelte.d.ts +9 -0
  56. package/dist/streams/layout/component.d.ts +6 -0
  57. package/dist/streams/layout/component.js +1 -0
  58. package/dist/streams/layout/css-values.d.ts +10 -0
  59. package/dist/streams/layout/css-values.js +1 -0
  60. package/dist/streams/layout/element-views/cmp.container-stream-element.svelte +16 -0
  61. package/dist/streams/layout/element-views/cmp.container-stream-element.svelte.d.ts +11 -0
  62. package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte +38 -0
  63. package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte.d.ts +9 -0
  64. package/dist/streams/layout/element-views/cmp.images-stream-element.svelte +30 -0
  65. package/dist/streams/layout/element-views/cmp.images-stream-element.svelte.d.ts +9 -0
  66. package/dist/streams/layout/element-views/cmp.price-stream-element.svelte +97 -0
  67. package/dist/streams/layout/element-views/cmp.price-stream-element.svelte.d.ts +11 -0
  68. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +6 -0
  69. package/dist/streams/{components/product/cmp.product-component.svelte.d.ts → layout/element-views/cmp.short-video-stream-element.svelte.d.ts} +2 -3
  70. package/dist/streams/layout/element-views/cmp.spacer-stream-element.svelte +45 -0
  71. package/dist/streams/layout/element-views/cmp.spacer-stream-element.svelte.d.ts +9 -0
  72. package/dist/streams/layout/element-views/cmp.stream-element.svelte +60 -0
  73. package/dist/streams/layout/element-views/cmp.stream-element.svelte.d.ts +13 -0
  74. package/dist/streams/layout/element-views/cmp.text-ref-stream-element.svelte +23 -0
  75. package/dist/streams/layout/element-views/cmp.text-ref-stream-element.svelte.d.ts +9 -0
  76. package/dist/streams/layout/element-views/cmp.text-stream-element.svelte +8 -0
  77. package/dist/{ui/shadow-dom/cmp.shadow-dom.svelte.d.ts → streams/layout/element-views/cmp.text-stream-element.svelte.d.ts} +2 -2
  78. package/dist/streams/layout/element-views/data-by-key-accessor.d.ts +3 -0
  79. package/dist/streams/layout/element-views/data-by-key-accessor.js +55 -0
  80. package/dist/streams/layout/element-views/index.d.ts +11 -0
  81. package/dist/streams/layout/element-views/index.js +9 -0
  82. package/dist/streams/layout/element-views/price-stream-element-localization.svelte.d.ts +9 -0
  83. package/dist/streams/layout/element-views/price-stream-element-localization.svelte.js +8 -0
  84. package/dist/streams/layout/element-views/stream-element-localization.svelte.d.ts +8 -0
  85. package/dist/streams/layout/element-views/stream-element-localization.svelte.js +6 -0
  86. package/dist/streams/layout/elements.d.ts +51 -0
  87. package/dist/streams/layout/elements.js +1 -0
  88. package/dist/streams/layout/enums.d.ts +45 -0
  89. package/dist/streams/layout/enums.js +54 -0
  90. package/dist/streams/layout/index.d.ts +19 -0
  91. package/dist/streams/layout/index.js +15 -0
  92. package/dist/streams/layout/layout.d.ts +13 -0
  93. package/dist/streams/layout/models/index.d.ts +6 -0
  94. package/dist/streams/layout/models/index.js +1 -0
  95. package/dist/streams/layout/models/mapper.d.ts +3 -0
  96. package/dist/streams/layout/models/mapper.js +62 -0
  97. package/dist/streams/layout/models/stream-layout-blob-model.d.ts +4 -0
  98. package/dist/streams/layout/models/stream-layout-media-item-model.d.ts +6 -0
  99. package/dist/streams/layout/models/stream-layout-media-item-model.js +1 -0
  100. package/dist/streams/layout/models/stream-layout-post-header-model.d.ts +11 -0
  101. package/dist/streams/layout/models/stream-layout-post-header-model.js +1 -0
  102. package/dist/streams/layout/models/stream-layout-product-model.d.ts +19 -0
  103. package/dist/streams/layout/models/stream-layout-product-model.js +1 -0
  104. package/dist/streams/layout/models/stream-layout-short-video-model.d.ts +31 -0
  105. package/dist/streams/layout/models/stream-layout-short-video-model.js +1 -0
  106. package/dist/streams/layout/serializer.d.ts +3 -0
  107. package/dist/streams/layout/serializer.js +6 -0
  108. package/dist/streams/layout/slot-data-input.d.ts +14 -0
  109. package/dist/streams/layout/slot-data-input.js +1 -0
  110. package/dist/streams/layout/slot-data.d.ts +18 -0
  111. package/dist/streams/layout/slot-data.js +1 -0
  112. package/dist/streams/layout/slot.d.ts +16 -0
  113. package/dist/streams/layout/slot.js +1 -0
  114. package/dist/streams/layout/styles-transformer.d.ts +13 -0
  115. package/dist/streams/layout/styles-transformer.js +140 -0
  116. package/dist/streams/layout/styles.d.ts +43 -0
  117. package/dist/streams/layout/styles.js +1 -0
  118. package/dist/streams/layout/type-guards.d.ts +8 -0
  119. package/dist/streams/layout/type-guards.js +21 -0
  120. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte +8 -42
  121. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte.d.ts +0 -2
  122. package/dist/streams/stream-page-viewer/mapper.d.ts +1 -1
  123. package/dist/streams/stream-page-viewer/mapper.js +7 -8
  124. package/dist/streams/stream-page-viewer/operations.generated.d.ts +1 -104
  125. package/dist/streams/stream-page-viewer/operations.generated.js +2 -375
  126. package/dist/streams/stream-page-viewer/operations.graphql +1 -6
  127. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.d.ts +3 -0
  128. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.js +4 -7
  129. package/dist/streams/stream-page-viewer/types.d.ts +5 -5
  130. package/dist/streams/stream-player/cmp.stream-player.svelte +7 -3
  131. package/dist/streams/stream-player/controls.svelte +43 -35
  132. package/dist/streams/stream-player/index.d.ts +29 -2
  133. package/dist/streams/stream-player/index.js +44 -1
  134. package/dist/streams/stream-player/operations.generated.d.ts +1 -103
  135. package/dist/streams/stream-player/operations.generated.js +2 -375
  136. package/dist/streams/stream-player/stream-overview.svelte +2 -2
  137. package/dist/streams/stream-player/stream-player-buffer.svelte.d.ts +1 -1
  138. package/dist/streams/stream-player/stream-player-buffer.svelte.js +1 -1
  139. package/dist/streams/stream-player/stream-player-localization.svelte.d.ts +3 -9
  140. package/dist/streams/stream-player/stream-player-localization.svelte.js +4 -23
  141. package/dist/ui/media-item-view/cmp.media-item-view.svelte +2 -1
  142. package/dist/ui/media-item-view/cmp.media-item-view.svelte.d.ts +2 -1
  143. package/dist/ui/media-items-gallery/cmp.media-items-gallery.svelte +2 -1
  144. package/dist/ui/media-items-gallery/cmp.media-items-gallery.svelte.d.ts +2 -1
  145. package/dist/ui/shadow-dom/_normalize.scss +350 -0
  146. package/dist/ui/shadow-dom/_reset.scss +189 -0
  147. package/dist/ui/shadow-dom/index.d.ts +1 -1
  148. package/dist/ui/shadow-dom/index.js +1 -1
  149. package/dist/ui/shadow-dom/shadow-host.svelte.d.ts +8 -0
  150. package/dist/ui/shadow-dom/shadow-host.svelte.js +39 -0
  151. package/dist/ui/video/cmp.video.svelte +1 -1
  152. package/package.json +68 -26
  153. package/dist/advertising/ad-view/cmp.ad-view.svelte +0 -82
  154. package/dist/advertising/ad-view/index.d.ts +0 -2
  155. package/dist/advertising/ad-view/index.js +0 -1
  156. package/dist/advertising/ad-view/mapper.d.ts +0 -3
  157. package/dist/advertising/ad-view/mapper.js +0 -16
  158. package/dist/advertising/ad-view/operations.generated.d.ts +0 -17
  159. package/dist/advertising/ad-view/operations.generated.js +0 -46
  160. package/dist/advertising/ad-view/operations.graphql +0 -14
  161. package/dist/advertising/ad-view/types.d.ts +0 -10
  162. package/dist/advertising/index.d.ts +0 -1
  163. package/dist/advertising/index.js +0 -1
  164. package/dist/advertising/types.d.ts +0 -5
  165. package/dist/advertising/types.js +0 -6
  166. package/dist/products/index.d.ts +0 -1
  167. package/dist/products/index.js +0 -1
  168. package/dist/products/product-card/cmp.product-card.svelte +0 -121
  169. package/dist/products/product-card/cmp.product-card.svelte.d.ts +0 -10
  170. package/dist/products/product-card/index.d.ts +0 -3
  171. package/dist/products/product-card/index.js +0 -3
  172. package/dist/products/product-card/mapper.d.ts +0 -3
  173. package/dist/products/product-card/mapper.js +0 -14
  174. package/dist/products/product-card/operations.generated.d.ts +0 -22
  175. package/dist/products/product-card/operations.generated.js +0 -65
  176. package/dist/products/product-card/operations.graphql +0 -19
  177. package/dist/products/product-card/product-card-localization.svelte.d.ts +0 -7
  178. package/dist/products/product-card/types.d.ts +0 -10
  179. package/dist/products/product-card/types.js +0 -1
  180. package/dist/products/types.d.ts +0 -5
  181. package/dist/products/types.js +0 -6
  182. package/dist/short-videos/short-videos-player-modal/cmp.short-videos-player-modal.svelte +0 -490
  183. package/dist/short-videos/short-videos-player-modal/cmp.short-videos-player-modal.svelte.d.ts +0 -3
  184. package/dist/short-videos/short-videos-player-modal/index.d.ts +0 -79
  185. package/dist/short-videos/short-videos-player-modal/index.js +0 -78
  186. package/dist/short-videos/short-videos-player-modal/short-videos-player-modal-state.svelte.d.ts +0 -16
  187. package/dist/short-videos/short-videos-player-modal/short-videos-player-modal-state.svelte.js +0 -13
  188. package/dist/streams/components/cmp.stream-page-component.svelte +0 -16
  189. package/dist/streams/components/cmp.stream-page-component.svelte.d.ts +0 -10
  190. package/dist/streams/components/components.factory.d.ts +0 -22
  191. package/dist/streams/components/components.factory.js +0 -34
  192. package/dist/streams/components/images/cmp.images-component.svelte +0 -7
  193. package/dist/streams/components/images/index.d.ts +0 -2
  194. package/dist/streams/components/images/index.js +0 -1
  195. package/dist/streams/components/images/types.d.ts +0 -8
  196. package/dist/streams/components/images/types.js +0 -5
  197. package/dist/streams/components/index.d.ts +0 -7
  198. package/dist/streams/components/index.js +0 -6
  199. package/dist/streams/components/mapper.d.ts +0 -3
  200. package/dist/streams/components/mapper.js +0 -43
  201. package/dist/streams/components/operations.generated.d.ts +0 -178
  202. package/dist/streams/components/operations.generated.js +0 -653
  203. package/dist/streams/components/operations.graphql +0 -35
  204. package/dist/streams/components/product/index.d.ts +0 -3
  205. package/dist/streams/components/product/index.js +0 -2
  206. package/dist/streams/components/product/mapper.d.ts +0 -3
  207. package/dist/streams/components/product/mapper.js +0 -14
  208. package/dist/streams/components/product/operations.generated.d.ts +0 -22
  209. package/dist/streams/components/product/operations.generated.js +0 -53
  210. package/dist/streams/components/product/operations.graphql +0 -19
  211. package/dist/streams/components/product/types.d.ts +0 -10
  212. package/dist/streams/components/product/types.js +0 -1
  213. package/dist/streams/components/short-video/cmp.short-video-component.svelte +0 -9
  214. package/dist/streams/components/short-video/cmp.short-video-component.svelte.d.ts +0 -10
  215. package/dist/streams/components/short-video/index.d.ts +0 -3
  216. package/dist/streams/components/short-video/index.js +0 -2
  217. package/dist/streams/components/short-video/mapper.d.ts +0 -3
  218. package/dist/streams/components/short-video/mapper.js +0 -4
  219. package/dist/streams/components/short-video/operations.generated.d.ts +0 -56
  220. package/dist/streams/components/short-video/operations.generated.js +0 -193
  221. package/dist/streams/components/short-video/operations.graphql +0 -3
  222. package/dist/streams/components/short-video/types.d.ts +0 -2
  223. package/dist/streams/components/stream-components-localization.svelte.d.ts +0 -10
  224. package/dist/streams/components/stream-components-localization.svelte.js +0 -13
  225. package/dist/streams/components/types.d.ts +0 -27
  226. package/dist/streams/components/types.js +0 -6
  227. package/dist/streams/slots/cmp.stream-component-slot.svelte +0 -35
  228. package/dist/streams/slots/index.d.ts +0 -3
  229. package/dist/streams/slots/index.js +0 -2
  230. package/dist/streams/slots/mapper.d.ts +0 -3
  231. package/dist/streams/slots/mapper.js +0 -18
  232. package/dist/streams/slots/operations.generated.d.ts +0 -17
  233. package/dist/streams/slots/operations.generated.js +0 -34
  234. package/dist/streams/slots/operations.graphql +0 -14
  235. package/dist/streams/slots/styles-transformer.d.ts +0 -6
  236. package/dist/streams/slots/styles-transformer.js +0 -12
  237. package/dist/streams/slots/types.d.ts +0 -16
  238. package/dist/streams/slots/types.js +0 -1
  239. package/dist/streams/stream-player-modal/cmp.stream-player-modal.svelte +0 -491
  240. package/dist/streams/stream-player-modal/cmp.stream-player-modal.svelte.d.ts +0 -3
  241. package/dist/streams/stream-player-modal/index.d.ts +0 -79
  242. package/dist/streams/stream-player-modal/index.js +0 -78
  243. package/dist/streams/stream-player-modal/stream-player-modal-state.svelte.d.ts +0 -17
  244. package/dist/streams/stream-player-modal/stream-player-modal-state.svelte.js +0 -14
  245. package/dist/ui/shadow-dom/cmp.shadow-dom.svelte +0 -26
  246. /package/dist/{advertising/ad-view/types.js → streams/layout/layout.js} +0 -0
  247. /package/dist/streams/{components/short-video/types.js → layout/models/stream-layout-blob-model.js} +0 -0
@@ -0,0 +1 @@
1
+ export { mapToShortVideoViewerModel } from './mapper';
@@ -0,0 +1,3 @@
1
+ import type { ShortVideoViewerModel } from '../../../short-videos/short-video-viewer';
2
+ import type { StreamLayoutShortVideoModel } from '../models/stream-layout-short-video-model';
3
+ export declare const mapToShortVideoViewerModel: (model: StreamLayoutShortVideoModel) => ShortVideoViewerModel;
@@ -0,0 +1,62 @@
1
+ import { MediaType } from '../../../core/enums';
2
+ export const mapToShortVideoViewerModel = (model) => {
3
+ return {
4
+ id: model.id,
5
+ media: model.media.type === MediaType.Image
6
+ ? { isImage: true, url: model.media.url }
7
+ : {
8
+ isImage: false,
9
+ url: model.media.url,
10
+ thumbnailUrl: model.media.thumbnailUrl
11
+ },
12
+ text: model.text,
13
+ heading: {
14
+ image: model.header.sourceImage,
15
+ name: model.header.sourceName,
16
+ displayDate: model.header.postDisplayDate,
17
+ viewsCount: model.header.postViewsCount
18
+ },
19
+ ad: model.ad ? mapToAdViewModel(model.ad) : null,
20
+ products: model.products.map(mapToProductCardModel)
21
+ // uncomment if you want to test many products behavior
22
+ /*.flatMap((x) => [
23
+ { ...x, id: x.id + '1' },
24
+ { ...x, id: x.id + '2' },
25
+ { ...x, id: x.id + '3' },
26
+ { ...x, id: x.id + '4' },
27
+ { ...x, id: x.id + '5' },
28
+ { ...x, id: x.id + '6' },
29
+ { ...x, id: x.id + '7' },
30
+ { ...x, id: x.id + '8' },
31
+ { ...x, id: x.id + '9' },
32
+ { ...x, id: x.id + '10' },
33
+ { ...x, id: x.id + '11' },
34
+ { ...x, id: x.id + '12' },
35
+ { ...x, id: x.id + '13' },
36
+ { ...x, id: x.id + '14' },
37
+ { ...x, id: x.id + '15' }
38
+ ])*/
39
+ };
40
+ };
41
+ const mapToAdViewModel = (model) => {
42
+ return {
43
+ id: model.id,
44
+ image: model.image,
45
+ title: model.title,
46
+ description: model.description,
47
+ buttonText: model.buttonText,
48
+ buttonUrl: model.buttonUrl,
49
+ openLinkInNewWindow: model.openLinkInNewWindow
50
+ };
51
+ };
52
+ const mapToProductCardModel = (model) => {
53
+ return {
54
+ id: model.id,
55
+ title: model.title,
56
+ image: model.image,
57
+ link: model.link,
58
+ currency: model.currency,
59
+ price: model.price,
60
+ salePrice: model.salePrice
61
+ };
62
+ };
@@ -0,0 +1,4 @@
1
+ export type StreamLayoutBlobModel = {
2
+ id: string;
3
+ url: string;
4
+ };
@@ -0,0 +1,6 @@
1
+ import { MediaType } from '../../..';
2
+ export type StreamLayoutMediaItemModel = {
3
+ url: string;
4
+ thumbnailUrl: string | null;
5
+ type: MediaType;
6
+ };
@@ -0,0 +1 @@
1
+ import { MediaType } from '../../..';
@@ -0,0 +1,11 @@
1
+ import type { PostSourceType } from '$gql/types';
2
+ export type StreamLayoutPostHeaderModel = {
3
+ sourceId: string;
4
+ sourceName: string;
5
+ sourceImage: string;
6
+ sourceHandle: string;
7
+ sourceType: PostSourceType;
8
+ postDisplayDate: string;
9
+ postViewsCount: number;
10
+ sourceIsRemoved: boolean;
11
+ };
@@ -0,0 +1,19 @@
1
+ import type { Currency } from '../../../core/enums';
2
+ export type StreamLayoutProductModel = {
3
+ id: string;
4
+ title: string;
5
+ description: string | null;
6
+ image: string | null;
7
+ link: string | null;
8
+ price: StreamLayoutProductPriceModel;
9
+ };
10
+ type StreamLayoutProductPriceModel = {
11
+ price: number;
12
+ currency: Currency;
13
+ salePrice: number | null;
14
+ currentPriceValue: string;
15
+ beforePriceValue: string | null;
16
+ saveValue: string | null;
17
+ savePercentValue: string | null;
18
+ };
19
+ export {};
@@ -0,0 +1,31 @@
1
+ import type { Currency } from '../../../core/enums';
2
+ import type { StreamLayoutMediaItemModel } from './stream-layout-media-item-model';
3
+ import type { StreamLayoutPostHeaderModel } from './stream-layout-post-header-model';
4
+ export type StreamLayoutShortVideoModel = {
5
+ id: string;
6
+ media: StreamLayoutMediaItemModel;
7
+ text: string | null;
8
+ header: StreamLayoutPostHeaderModel;
9
+ enableSocialInteractions: boolean;
10
+ bookmarksCount: number;
11
+ products: StreamLayoutShortVideoProductModel[];
12
+ ad: StreamLayoutShortVideoAdModel | null;
13
+ };
14
+ export type StreamLayoutShortVideoAdModel = {
15
+ id: string;
16
+ image: string | null;
17
+ title: string;
18
+ description: string | null;
19
+ buttonText: string | null;
20
+ buttonUrl: string | null;
21
+ openLinkInNewWindow: boolean | null;
22
+ };
23
+ export type StreamLayoutShortVideoProductModel = {
24
+ id: string;
25
+ title: string;
26
+ image: string | null;
27
+ link: string | null;
28
+ price: number;
29
+ currency: Currency;
30
+ salePrice: number | null;
31
+ };
@@ -0,0 +1,3 @@
1
+ import type { StreamLayout } from './layout';
2
+ export declare const parseToStreamLayout: (value: string) => StreamLayout;
3
+ export declare const stringifyToStreamLayoutInput: (layout: StreamLayout) => string;
@@ -0,0 +1,6 @@
1
+ export const parseToStreamLayout = (value) => {
2
+ return JSON.parse(value);
3
+ };
4
+ export const stringifyToStreamLayoutInput = (layout) => {
5
+ return JSON.stringify(layout);
6
+ };
@@ -0,0 +1,14 @@
1
+ import { StreamComponentDataType } from './enums';
2
+ export type StreamSlotDataInput = ImagesStreamSlotDataInput | ProductStreamSlotDataInput | ShortVideoStreamSlotDataInput;
3
+ export interface ImagesStreamSlotDataInput {
4
+ type: StreamComponentDataType.Images;
5
+ ids: string[];
6
+ }
7
+ export interface ProductStreamSlotDataInput {
8
+ type: StreamComponentDataType.Product;
9
+ id: string;
10
+ }
11
+ export interface ShortVideoStreamSlotDataInput {
12
+ type: StreamComponentDataType.ShortVideo;
13
+ id: string;
14
+ }
@@ -0,0 +1 @@
1
+ import { StreamComponentDataType } from './enums';
@@ -0,0 +1,18 @@
1
+ import { StreamComponentDataType } from './enums';
2
+ import type { StreamLayoutBlobModel, StreamLayoutProductModel, StreamLayoutShortVideoModel } from './models';
3
+ export type StreamSlotData = ImagesStreamSlotData | ProductStreamSlotData | ShortVideoStreamSlotData;
4
+ export type ImagesStreamSlotData = {
5
+ type: StreamComponentDataType.Images;
6
+ ids: string[];
7
+ items: StreamLayoutBlobModel[];
8
+ };
9
+ export type ProductStreamSlotData = {
10
+ type: StreamComponentDataType.Product;
11
+ id: string;
12
+ product: StreamLayoutProductModel | null;
13
+ };
14
+ export type ShortVideoStreamSlotData = {
15
+ type: StreamComponentDataType.ShortVideo;
16
+ id: string;
17
+ shortVideo: StreamLayoutShortVideoModel | null;
18
+ };
@@ -0,0 +1 @@
1
+ import { StreamComponentDataType } from './enums';
@@ -0,0 +1,16 @@
1
+ import type { StreamComponent } from './component';
2
+ import type { StreamSlotData } from './slot-data';
3
+ import type { StreamSlotDataInput } from './slot-data-input';
4
+ export type StreamSlotTemplate = {
5
+ top: number;
6
+ left: number;
7
+ width: number;
8
+ height: number;
9
+ components: StreamComponent[];
10
+ };
11
+ export type StreamSlotInput = StreamSlotTemplate & {
12
+ data: StreamSlotDataInput | null;
13
+ };
14
+ export type StreamSlot = StreamSlotTemplate & {
15
+ data: StreamSlotData | null;
16
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import { StreamElementStyleFontFamily, StreamElementStyleFontWeight, StreamElementStyleHorizontalAlign } from './enums';
2
+ import type { ContainerStreamElementStyles, ImageStreamElementStyles, StreamLayoutStyles, TextStreamElementStyles } from './styles';
3
+ export declare const generateStreamLayoutStyles: (styles: StreamLayoutStyles | null) => string;
4
+ export declare const generateContainerStyles: (styles: Partial<ContainerStreamElementStyles> | null) => string;
5
+ export declare const generateTextStyles: (styles: Partial<TextStreamElementStyles> | null) => string;
6
+ export declare const generateImageStyles: (styles: Partial<ImageStreamElementStyles> | null) => string;
7
+ export declare const mapFontFamily: (value: StreamElementStyleFontFamily | null | undefined) => string;
8
+ export declare const mapFontWeight: (value: StreamElementStyleFontWeight | null | undefined) => "normal" | "600" | "500";
9
+ export declare const mapTextAlign: (value: StreamElementStyleHorizontalAlign | null | undefined) => "center" | "left" | "right";
10
+ export declare const mapFlexJustifyContent: (value: StreamElementStyleHorizontalAlign | null | undefined) => "center" | "flex-start" | "flex-end";
11
+ export declare const transformFontSizeValue: (value: number | null | undefined) => string;
12
+ export declare const transformNumericValue: (value: number | null | undefined, fallback?: string) => string;
13
+ export declare const transformColorValue: (value: string | null | undefined) => string;
@@ -0,0 +1,140 @@
1
+ import { Utils } from '../../core/utils';
2
+ import { StreamCssValueType, StreamElementStyleDirection, StreamElementStyleFontFamily, StreamElementStyleFontWeight, StreamElementStyleMediaFit, StreamElementStyleHorizontalAlign } from './enums';
3
+ export const generateStreamLayoutStyles = (styles) => {
4
+ if (!styles) {
5
+ return '';
6
+ }
7
+ const values = [`background-color: ${transformColorValue(styles.backgroundColor)};`, `font-family: ${mapFontFamily(styles.fontFamily)};`];
8
+ return values.join('');
9
+ };
10
+ export const generateContainerStyles = (styles) => {
11
+ styles = styles || {};
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'};`
28
+ ];
29
+ if (styles.direction) {
30
+ values.push(`display: flex;`);
31
+ values.push(`flex-direction: ${styles.direction === StreamElementStyleDirection.Horizontal ? 'row' : 'column'};`);
32
+ }
33
+ return values.join('');
34
+ };
35
+ export const generateTextStyles = (styles) => {
36
+ styles = styles || {};
37
+ 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)};`
44
+ ];
45
+ return values.join('');
46
+ };
47
+ export const generateImageStyles = (styles) => {
48
+ styles = styles || {};
49
+ const imageStyles = [`object-fit: ${mapMediaFit(styles.mediaFit)};`];
50
+ return imageStyles.join('');
51
+ };
52
+ export const mapFontFamily = (value) => {
53
+ switch (value) {
54
+ case StreamElementStyleFontFamily.System:
55
+ return 'inherit';
56
+ default: {
57
+ return 'inherit';
58
+ }
59
+ }
60
+ };
61
+ export const mapFontWeight = (value) => {
62
+ switch (value) {
63
+ case StreamElementStyleFontWeight.Bold:
64
+ return '600';
65
+ case StreamElementStyleFontWeight.SemiBold:
66
+ return '500';
67
+ default: {
68
+ return 'normal';
69
+ }
70
+ }
71
+ };
72
+ export const mapTextAlign = (value) => {
73
+ switch (value) {
74
+ case StreamElementStyleHorizontalAlign.Left:
75
+ return 'left';
76
+ case StreamElementStyleHorizontalAlign.Center:
77
+ return 'center';
78
+ case StreamElementStyleHorizontalAlign.Right:
79
+ return 'right';
80
+ default: {
81
+ return 'left';
82
+ }
83
+ }
84
+ };
85
+ export const mapFlexJustifyContent = (value) => {
86
+ switch (value) {
87
+ case StreamElementStyleHorizontalAlign.Left:
88
+ return 'flex-start';
89
+ case StreamElementStyleHorizontalAlign.Center:
90
+ return 'center';
91
+ case StreamElementStyleHorizontalAlign.Right:
92
+ return 'flex-end';
93
+ default: {
94
+ return 'flex-start';
95
+ }
96
+ }
97
+ };
98
+ const mapMediaFit = (value) => {
99
+ switch (value) {
100
+ case StreamElementStyleMediaFit.Cover:
101
+ return 'cover';
102
+ case StreamElementStyleMediaFit.Contain:
103
+ return 'contain';
104
+ default: {
105
+ return 'cover';
106
+ }
107
+ }
108
+ };
109
+ const transformCssValue = (value, fallback = '0') => {
110
+ if (value === null || value === undefined) {
111
+ return fallback;
112
+ }
113
+ switch (value.type) {
114
+ case StreamCssValueType.DDU:
115
+ return transformNumericValue(value.value, fallback);
116
+ case StreamCssValueType.Pct:
117
+ return `${value.value}%`;
118
+ default:
119
+ Utils.assertUnreachable(value);
120
+ }
121
+ };
122
+ export const transformFontSizeValue = (value) => {
123
+ if (value === null || value === undefined) {
124
+ value = 16;
125
+ }
126
+ return transformNumericValue(value);
127
+ };
128
+ const baseContainerWidth = 400;
129
+ export const transformNumericValue = (value, fallback = '0') => {
130
+ if (value === null || value === undefined) {
131
+ return fallback;
132
+ }
133
+ return `${(value / baseContainerWidth) * 100}cqi`;
134
+ };
135
+ export const transformColorValue = (value) => {
136
+ if (value === null || value === undefined) {
137
+ return 'transparent';
138
+ }
139
+ return value;
140
+ };
@@ -0,0 +1,43 @@
1
+ import type { StreamCssValue } from './css-values';
2
+ import { StreamElementStyleDirection, StreamElementStyleFontFamily, StreamElementStyleFontWeight, StreamElementStyleMediaFit, StreamElementStyleHorizontalAlign } from './enums';
3
+ export type StreamLayoutStyles = {
4
+ backgroundColor?: string | null;
5
+ fontFamily?: StreamElementStyleFontFamily | null;
6
+ };
7
+ export type ImageStreamElementStyles = {
8
+ mediaFit?: StreamElementStyleMediaFit | null;
9
+ };
10
+ export type PriceStreamElementStyles = {
11
+ height?: number | null;
12
+ fontWeight?: StreamElementStyleFontWeight | null;
13
+ fontFamily?: StreamElementStyleFontFamily | null;
14
+ regularPriceColor?: string | null;
15
+ salePriceColor?: string | null;
16
+ saveValueColor?: string | null;
17
+ saveValueBackgroundColor?: string | null;
18
+ beforeValueColor?: string | null;
19
+ horizontalAlign?: StreamElementStyleHorizontalAlign | null;
20
+ };
21
+ export type TextStreamElementStyles = {
22
+ fontSize?: number | null;
23
+ fontWeight?: StreamElementStyleFontWeight | null;
24
+ fontFamily?: StreamElementStyleFontFamily | null;
25
+ lineHeight?: number | null;
26
+ textAlign?: StreamElementStyleHorizontalAlign | null;
27
+ color?: string | null;
28
+ maxLines?: number | null;
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
+ };
@@ -0,0 +1 @@
1
+ import { StreamElementStyleDirection, StreamElementStyleFontFamily, StreamElementStyleFontWeight, StreamElementStyleMediaFit, StreamElementStyleHorizontalAlign } from './enums';
@@ -0,0 +1,8 @@
1
+ import type { ImagesStreamSlotData, ProductStreamSlotData, ShortVideoStreamSlotData, StreamSlotData } from './slot-data';
2
+ import type { ImagesStreamSlotDataInput, ProductStreamSlotDataInput, ShortVideoStreamSlotDataInput, StreamSlotDataInput } from './slot-data-input';
3
+ export declare function isImagesSlotDataInput(data: StreamSlotDataInput | null): data is ImagesStreamSlotDataInput;
4
+ export declare function isProductSlotDataInput(data: StreamSlotDataInput | null): data is ProductStreamSlotDataInput;
5
+ export declare function isShortVideoSlotDataInput(data: StreamSlotDataInput | null): data is ShortVideoStreamSlotDataInput;
6
+ export declare function isImagesSlotData(data: StreamSlotData | null): data is ImagesStreamSlotData;
7
+ export declare function isProductSlotData(data: StreamSlotData | null): data is ProductStreamSlotData;
8
+ export declare function isShortVideoSlotData(data: StreamSlotData | null): data is ShortVideoStreamSlotData;
@@ -0,0 +1,21 @@
1
+ import { StreamComponentDataType } from './enums';
2
+ // SlotDataInput guards
3
+ export function isImagesSlotDataInput(data) {
4
+ return data?.type === StreamComponentDataType.Images;
5
+ }
6
+ export function isProductSlotDataInput(data) {
7
+ return data?.type === StreamComponentDataType.Product;
8
+ }
9
+ export function isShortVideoSlotDataInput(data) {
10
+ return data?.type === StreamComponentDataType.ShortVideo;
11
+ }
12
+ // SlotData guards
13
+ export function isImagesSlotData(data) {
14
+ return data?.type === StreamComponentDataType.Images;
15
+ }
16
+ export function isProductSlotData(data) {
17
+ return data?.type === StreamComponentDataType.Product;
18
+ }
19
+ export function isShortVideoSlotData(data) {
20
+ return data?.type === StreamComponentDataType.ShortVideo;
21
+ }
@@ -1,47 +1,13 @@
1
- <script lang="ts">import { StreamPageComponent } from '../components';
2
- import { StreamComponentSlot } from '../slots';
3
- import { StreamPageViewerLocalization } from './stream-page-viewer-localization.svelte';
4
- let { page, localization: localizationInit } = $props();
5
- const localization = $derived(new StreamPageViewerLocalization(localizationInit));
6
- const selectComponentForSlot = (slotId, components) => { var _a; return (_a = components.find((s) => s.slotId === slotId)) !== null && _a !== void 0 ? _a : null; };
1
+ <script lang="ts">import { StreamLayoutSlot, StreamPageLayout, StreamLayoutSlotContent } from '../layout';
2
+ let { page } = $props();
7
3
  </script>
8
4
 
9
5
  {#if page.type === 'general'}
10
- <div class="stream-page-viewer">
11
- {#each page.slots as slot (slot.id)}
12
- {@const component = selectComponentForSlot(slot.id, page.components)}
13
- <StreamComponentSlot model={slot}>
14
- {#if component}
15
- <StreamPageComponent
16
- component={component}
17
- autoplay={false}
18
- localization={{ viewsCount: localization.viewsCount, timeAgoLocalization: localization.timeAgoLocalization }} />
19
- {/if}
20
- </StreamComponentSlot>
6
+ <StreamPageLayout model={page.layout}>
7
+ {#each page.layout.slots as slot (slot)}
8
+ <StreamLayoutSlot model={slot}>
9
+ <StreamLayoutSlotContent model={slot} />
10
+ </StreamLayoutSlot>
21
11
  {/each}
22
- </div>
12
+ </StreamPageLayout>
23
13
  {/if}
24
-
25
- <style>@keyframes fadeIn {
26
- 0% {
27
- opacity: 1;
28
- }
29
- 50% {
30
- opacity: 0.4;
31
- }
32
- 100% {
33
- opacity: 1;
34
- }
35
- }
36
- .stream-page-viewer {
37
- width: 100%;
38
- min-width: 100%;
39
- max-width: 100%;
40
- height: 100%;
41
- min-height: 100%;
42
- max-height: 100%;
43
- position: relative;
44
- background: #ffffff;
45
- border-radius: 0.375rem;
46
- overflow: hidden;
47
- }</style>
@@ -1,8 +1,6 @@
1
- import { type IStreamPageViewerLocalization } from './stream-page-viewer-localization.svelte';
2
1
  import type { StreamPageViewerModel } from './types';
3
2
  type Props = {
4
3
  page: StreamPageViewerModel;
5
- localization?: IStreamPageViewerLocalization;
6
4
  };
7
5
  declare const Cmp: import("svelte").Component<Props, {}, "">;
8
6
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,3 +1,3 @@
1
1
  import type { StreamPageViewerPayloadFragment } from './operations.generated';
2
- import { type StreamPageViewerModel } from './types';
2
+ import type { StreamPageViewerModel } from './types';
3
3
  export declare const mapToStreamPageViewerModel: (payload: StreamPageViewerPayloadFragment) => StreamPageViewerModel;
@@ -1,15 +1,15 @@
1
- import { mapToStreamComponentModel, StreamComponentType } from '../components';
2
- import { mapToStreamComponentSlotModel } from '../slots';
3
- import {} from './types';
1
+ import { getSingleShortVideoFromLayout, parseToStreamLayout } from '../layout';
4
2
  export const mapToStreamPageViewerModel = (payload) => {
5
- const components = payload.components.map(mapToStreamComponentModel).filter((x) => x !== null);
6
- if (components.length === 1 && components[0].type === StreamComponentType.ShortVideo) {
3
+ const layout = parseToStreamLayout(payload.layout);
4
+ const singleShortVideo = getSingleShortVideoFromLayout(layout);
5
+ if (singleShortVideo) {
7
6
  return {
8
7
  type: 'short-video',
9
8
  id: payload.id,
10
9
  cover: payload.cover?.url || null,
11
10
  name: payload.name,
12
- shortVideo: components[0].data
11
+ shortVideo: singleShortVideo,
12
+ layout
13
13
  };
14
14
  }
15
15
  return {
@@ -17,7 +17,6 @@ export const mapToStreamPageViewerModel = (payload) => {
17
17
  id: payload.id,
18
18
  cover: payload.cover?.url || null,
19
19
  name: payload.name,
20
- components,
21
- slots: payload.slots.map(mapToStreamComponentSlotModel)
20
+ layout
22
21
  };
23
22
  };