@streamscloud/embeddable 3.2.4 → 3.2.5

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,51 +1,86 @@
1
- import { StreamElementType, ImagesImagesElementMode } from './enums';
2
- import type { ImageStreamElementStyles, TextStreamElementStyles, ContainerStreamElementStyles, PriceStreamElementStyles } from './styles';
3
- export type StreamElementModel = ContainerStreamElementModel | ImageRefStreamElementModel | ImagesStreamElementModel | PriceStreamElementModel | SpacerStreamElementModel | ShortVideoStreamElementModel | TextStreamElementModel | TextRefStreamElementModel;
1
+ import { StreamElementType, ImagesStreamElementMode, AnnotationStreamElementPlacement, StockStreamElementLevel } from './enums';
2
+ import type { ImageStreamElementStyles, TextStreamElementStyles, ContainerStreamElementStyles, PriceStreamElementStyles, AnnotationStreamElementStyles, StockStreamElementStyles } from './styles';
3
+ export type StreamElementModel = AnnotationStreamElementModel | ContainerStreamElementModel | ImageRefStreamElementModel | ImagesStreamElementModel | PriceStreamElementModel | ShortVideoStreamElementModel | SpacerStreamElementModel | StockStreamElementModel | TextStreamElementModel | TextRefStreamElementModel | WebViewStreamElementModel;
4
+ export type AnnotationStreamElementModel = {
5
+ type: StreamElementType.Annotation;
6
+ $id: string;
7
+ name?: string | null;
8
+ svg: string;
9
+ inactive: boolean;
10
+ placement: AnnotationStreamElementPlacement;
11
+ styles: AnnotationStreamElementStyles;
12
+ };
4
13
  export type ContainerStreamElementModel = {
5
14
  type: StreamElementType.Container;
6
- id?: string;
15
+ $id: string;
16
+ name?: string | null;
7
17
  elements: StreamElementModel[];
8
18
  customizable: boolean | null;
9
19
  styles: ContainerStreamElementStyles | null;
10
20
  };
11
21
  export type ImagesStreamElementModel = {
12
22
  type: StreamElementType.Images;
13
- id?: string;
14
- mode: ImagesImagesElementMode;
23
+ $id: string;
24
+ name?: string | null;
25
+ mode: ImagesStreamElementMode;
15
26
  };
16
27
  export type ImageRefStreamElementModel = {
17
28
  type: StreamElementType.ImageRef;
18
- id?: string;
29
+ $id: string;
30
+ name?: string | null;
19
31
  key: string;
32
+ annotations?: AnnotationStreamElementModel[] | null;
20
33
  styles: ImageStreamElementStyles | null;
21
34
  };
22
35
  export type PriceStreamElementModel = {
23
36
  type: StreamElementType.Price;
24
- id?: string;
37
+ $id: string;
38
+ name?: string | null;
25
39
  excludeBeforePrice: boolean | null;
26
40
  includeCurrency: boolean | null;
41
+ textAfter: string | null;
42
+ stock?: StockStreamElementModel | null;
27
43
  styles: PriceStreamElementStyles | null;
28
44
  };
29
45
  export type ShortVideoStreamElementModel = {
30
46
  type: StreamElementType.ShortVideo;
31
- id?: string;
47
+ $id: string;
48
+ name?: string | null;
32
49
  };
33
50
  export type SpacerStreamElementModel = {
34
51
  type: StreamElementType.Spacer;
35
- id?: string;
52
+ $id: string;
53
+ name?: string | null;
36
54
  value: number | null;
37
55
  };
56
+ export type StockStreamElementModel = {
57
+ type: StreamElementType.Stock;
58
+ $id: string;
59
+ name?: string | null;
60
+ level: StockStreamElementLevel;
61
+ quantity: number;
62
+ textAfter: string | null;
63
+ styles: StockStreamElementStyles | null;
64
+ };
38
65
  export type TextStreamElementModel = {
39
66
  type: StreamElementType.Text;
40
- id?: string;
67
+ $id: string;
68
+ name?: string | null;
41
69
  value: string | null;
42
70
  styles: TextStreamElementStyles | null;
43
71
  };
44
72
  export type TextRefStreamElementModel = {
45
73
  type: StreamElementType.TextRef;
46
- id?: string;
74
+ $id: string;
75
+ name?: string | null;
47
76
  key: string;
48
77
  valueBefore: string | null;
49
78
  valueAfter: string | null;
50
79
  styles: TextStreamElementStyles | null;
51
80
  };
81
+ export type WebViewStreamElementModel = {
82
+ type: StreamElementType.WebView;
83
+ $id: string;
84
+ name?: string | null;
85
+ url: string | null;
86
+ };
@@ -1 +1 @@
1
- import { StreamElementType, ImagesImagesElementMode } from './enums';
1
+ import { StreamElementType, ImagesStreamElementMode, AnnotationStreamElementPlacement, StockStreamElementLevel } from './enums';
@@ -1,23 +1,39 @@
1
1
  export declare enum StreamComponentDataType {
2
2
  Images = "IMAGES",
3
+ NoData = "NO_DATA",
3
4
  ShortVideo = "SHORT_VIDEO",
4
5
  Product = "PRODUCT"
5
6
  }
6
7
  export declare enum StreamElementType {
8
+ Annotation = "ANNOTATION",
7
9
  Container = "CONTAINER",
8
10
  ImageRef = "IMAGE_REF",
9
11
  Images = "IMAGES",
10
12
  Price = "PRICE",
11
- Spacer = "SPACER",
12
13
  ShortVideo = "SHORT_VIDEO",
14
+ Spacer = "SPACER",
15
+ Stock = "STOCK",
13
16
  Text = "TEXT",
14
- TextRef = "TEXT_REF"
17
+ TextRef = "TEXT_REF",
18
+ WebView = "WEB_VIEW"
19
+ }
20
+ export declare enum AnnotationStreamElementPlacement {
21
+ TopLeft = "TOP_LEFT",
22
+ TopRight = "TOP_RIGHT",
23
+ BottomLeft = "BOTTOM_LEFT",
24
+ BottomRight = "BOTTOM_RIGHT"
15
25
  }
16
- export declare enum ImagesImagesElementMode {
26
+ export declare enum ImagesStreamElementMode {
17
27
  Single = "SINGLE",
18
28
  Gallery = "GALLERY",
19
29
  Slider = "SLIDER"
20
30
  }
31
+ export declare enum StockStreamElementLevel {
32
+ High = "HIGH",
33
+ Medium = "MEDIUM",
34
+ Low = "LOW",
35
+ OutOfStock = "OUT_OF_STOCK"
36
+ }
21
37
  export declare enum StreamElementStyleMediaFit {
22
38
  Cover = "COVER",
23
39
  Contain = "CONTAIN"
@@ -43,3 +59,18 @@ export declare enum StreamCssValueType {
43
59
  DDU = "DDU",
44
60
  Pct = "PCT"
45
61
  }
62
+ export declare enum StreamSvgTextValueType {
63
+ customText = "STREAM_SVG_CUSTOM_TEXT",
64
+ currency = "STREAM_SVG_CURRENCY",
65
+ currencySymbol = "STREAM_SVG_CURRENCY_SYMBOL",
66
+ price = "STREAM_SVG_PRODUCT_PRICE",
67
+ priceWhole = "STREAM_SVG_PRODUCT_PRICE_WHOLE",
68
+ priceDecimal = "STREAM_SVG_PRODUCT_PRICE_DECIMAL",
69
+ beforePrice = "STREAM_SVG_PRODUCT_BEFORE_PRICE",
70
+ beforePriceWhole = "STREAM_SVG_PRODUCT_BEFORE_PRICE_WHOLE",
71
+ beforePriceDecimal = "STREAM_SVG_PRODUCT_BEFORE_PRICE_DECIMAL",
72
+ saveValue = "STREAM_SVG_PRODUCT_SAVE_VALUE",
73
+ saveValueWhole = "STREAM_SVG_PRODUCT_SAVE_VALUE_WHOLE",
74
+ saveValueDecimal = "STREAM_SVG_PRODUCT_SAVE_VALUE_DECIMAL",
75
+ savePercentValue = "STREAM_SVG_PRODUCT_SAVE_PERCENT_VALUE"
76
+ }
@@ -1,26 +1,44 @@
1
1
  export var StreamComponentDataType;
2
2
  (function (StreamComponentDataType) {
3
3
  StreamComponentDataType["Images"] = "IMAGES";
4
+ StreamComponentDataType["NoData"] = "NO_DATA";
4
5
  StreamComponentDataType["ShortVideo"] = "SHORT_VIDEO";
5
6
  StreamComponentDataType["Product"] = "PRODUCT";
6
7
  })(StreamComponentDataType || (StreamComponentDataType = {}));
7
8
  export var StreamElementType;
8
9
  (function (StreamElementType) {
10
+ StreamElementType["Annotation"] = "ANNOTATION";
9
11
  StreamElementType["Container"] = "CONTAINER";
10
12
  StreamElementType["ImageRef"] = "IMAGE_REF";
11
13
  StreamElementType["Images"] = "IMAGES";
12
14
  StreamElementType["Price"] = "PRICE";
13
- StreamElementType["Spacer"] = "SPACER";
14
15
  StreamElementType["ShortVideo"] = "SHORT_VIDEO";
16
+ StreamElementType["Spacer"] = "SPACER";
17
+ StreamElementType["Stock"] = "STOCK";
15
18
  StreamElementType["Text"] = "TEXT";
16
19
  StreamElementType["TextRef"] = "TEXT_REF";
20
+ StreamElementType["WebView"] = "WEB_VIEW";
17
21
  })(StreamElementType || (StreamElementType = {}));
18
- export var ImagesImagesElementMode;
19
- (function (ImagesImagesElementMode) {
20
- ImagesImagesElementMode["Single"] = "SINGLE";
21
- ImagesImagesElementMode["Gallery"] = "GALLERY";
22
- ImagesImagesElementMode["Slider"] = "SLIDER";
23
- })(ImagesImagesElementMode || (ImagesImagesElementMode = {}));
22
+ export var AnnotationStreamElementPlacement;
23
+ (function (AnnotationStreamElementPlacement) {
24
+ AnnotationStreamElementPlacement["TopLeft"] = "TOP_LEFT";
25
+ AnnotationStreamElementPlacement["TopRight"] = "TOP_RIGHT";
26
+ AnnotationStreamElementPlacement["BottomLeft"] = "BOTTOM_LEFT";
27
+ AnnotationStreamElementPlacement["BottomRight"] = "BOTTOM_RIGHT";
28
+ })(AnnotationStreamElementPlacement || (AnnotationStreamElementPlacement = {}));
29
+ export var ImagesStreamElementMode;
30
+ (function (ImagesStreamElementMode) {
31
+ ImagesStreamElementMode["Single"] = "SINGLE";
32
+ ImagesStreamElementMode["Gallery"] = "GALLERY";
33
+ ImagesStreamElementMode["Slider"] = "SLIDER";
34
+ })(ImagesStreamElementMode || (ImagesStreamElementMode = {}));
35
+ export var StockStreamElementLevel;
36
+ (function (StockStreamElementLevel) {
37
+ StockStreamElementLevel["High"] = "HIGH";
38
+ StockStreamElementLevel["Medium"] = "MEDIUM";
39
+ StockStreamElementLevel["Low"] = "LOW";
40
+ StockStreamElementLevel["OutOfStock"] = "OUT_OF_STOCK";
41
+ })(StockStreamElementLevel || (StockStreamElementLevel = {}));
24
42
  export var StreamElementStyleMediaFit;
25
43
  (function (StreamElementStyleMediaFit) {
26
44
  StreamElementStyleMediaFit["Cover"] = "COVER";
@@ -52,3 +70,24 @@ export var StreamCssValueType;
52
70
  StreamCssValueType["DDU"] = "DDU";
53
71
  StreamCssValueType["Pct"] = "PCT";
54
72
  })(StreamCssValueType || (StreamCssValueType = {}));
73
+ export var StreamSvgTextValueType;
74
+ (function (StreamSvgTextValueType) {
75
+ /* Generic text */
76
+ StreamSvgTextValueType["customText"] = "STREAM_SVG_CUSTOM_TEXT";
77
+ /* Currency info */
78
+ StreamSvgTextValueType["currency"] = "STREAM_SVG_CURRENCY";
79
+ StreamSvgTextValueType["currencySymbol"] = "STREAM_SVG_CURRENCY_SYMBOL";
80
+ /* Product actual price */
81
+ StreamSvgTextValueType["price"] = "STREAM_SVG_PRODUCT_PRICE";
82
+ StreamSvgTextValueType["priceWhole"] = "STREAM_SVG_PRODUCT_PRICE_WHOLE";
83
+ StreamSvgTextValueType["priceDecimal"] = "STREAM_SVG_PRODUCT_PRICE_DECIMAL";
84
+ /* Product price before sales (if applicable) */
85
+ StreamSvgTextValueType["beforePrice"] = "STREAM_SVG_PRODUCT_BEFORE_PRICE";
86
+ StreamSvgTextValueType["beforePriceWhole"] = "STREAM_SVG_PRODUCT_BEFORE_PRICE_WHOLE";
87
+ StreamSvgTextValueType["beforePriceDecimal"] = "STREAM_SVG_PRODUCT_BEFORE_PRICE_DECIMAL";
88
+ /* “Save” / discount values */
89
+ StreamSvgTextValueType["saveValue"] = "STREAM_SVG_PRODUCT_SAVE_VALUE";
90
+ StreamSvgTextValueType["saveValueWhole"] = "STREAM_SVG_PRODUCT_SAVE_VALUE_WHOLE";
91
+ StreamSvgTextValueType["saveValueDecimal"] = "STREAM_SVG_PRODUCT_SAVE_VALUE_DECIMAL";
92
+ StreamSvgTextValueType["savePercentValue"] = "STREAM_SVG_PRODUCT_SAVE_PERCENT_VALUE";
93
+ })(StreamSvgTextValueType || (StreamSvgTextValueType = {}));
@@ -1,19 +1,12 @@
1
- import { StreamComponentDataType, StreamElementType } from './enums';
1
+ import { StreamComponentDataType } from './enums';
2
2
  import type { StreamLayout } from './layout';
3
3
  import type { StreamLayoutShortVideoModel } from './models';
4
4
  import type { StreamSlot } from './slot';
5
- import type { ContainerStreamElementStyles, ImageStreamElementStyles, PriceStreamElementStyles, TextStreamElementStyles } from './styles';
6
5
  export { default as StreamPageLayout } from './cmp.layout.svelte';
7
6
  export { default as StreamLayoutSlot } from './cmp.slot.svelte';
8
7
  export { default as StreamLayoutSlotContent } from './cmp.slot-content.svelte';
9
8
  export * from './layout';
10
- export { parseToStreamLayout, stringifyToStreamLayoutInput } from './serializer';
9
+ export * from './svg-attributes';
10
+ export { parseToStreamLayout, parseToStreamLayoutTemplate, stringifyToStreamLayoutInput, IdPopulator } from './serializer.svelte';
11
11
  export declare const getAllowedDataTypesForSlot: (slot: StreamSlot) => StreamComponentDataType[];
12
12
  export declare const getSingleShortVideoFromLayout: (layout: StreamLayout) => StreamLayoutShortVideoModel | null;
13
- export type ElementTypeToStyles = {
14
- [StreamElementType.Container]: ContainerStreamElementStyles;
15
- [StreamElementType.Price]: PriceStreamElementStyles;
16
- [StreamElementType.ImageRef]: ImageStreamElementStyles;
17
- [StreamElementType.Text]: TextStreamElementStyles;
18
- [StreamElementType.TextRef]: TextStreamElementStyles;
19
- };
@@ -1,9 +1,10 @@
1
- import { StreamComponentDataType, StreamElementType } from './enums';
1
+ import { StreamComponentDataType } from './enums';
2
2
  export { default as StreamPageLayout } from './cmp.layout.svelte';
3
3
  export { default as StreamLayoutSlot } from './cmp.slot.svelte';
4
4
  export { default as StreamLayoutSlotContent } from './cmp.slot-content.svelte';
5
5
  export * from './layout';
6
- export { parseToStreamLayout, stringifyToStreamLayoutInput } from './serializer';
6
+ export * from './svg-attributes';
7
+ export { parseToStreamLayout, parseToStreamLayoutTemplate, stringifyToStreamLayoutInput, IdPopulator } from './serializer.svelte';
7
8
  export const getAllowedDataTypesForSlot = (slot) => {
8
9
  return slot.components.flatMap((c) => c.dataType);
9
10
  };
@@ -1,6 +1,8 @@
1
1
  import type { StreamSlot, StreamSlotInput, StreamSlotTemplate } from './slot';
2
2
  import type { StreamLayoutStyles } from './styles';
3
3
  export type StreamLayoutTemplate = {
4
+ $id: string;
5
+ name?: string | null;
4
6
  styles: StreamLayoutStyles | null;
5
7
  slots: StreamSlotTemplate[];
6
8
  };
@@ -8,6 +10,5 @@ export type StreamLayoutInput = Omit<StreamLayoutTemplate, 'slots'> & {
8
10
  slots: StreamSlotInput[];
9
11
  };
10
12
  export type StreamLayout = Omit<StreamLayoutTemplate, 'slots'> & {
11
- id?: string;
12
13
  slots: StreamSlot[];
13
14
  };
@@ -2,5 +2,5 @@ export { mapToShortVideoViewerModel } from './mapper';
2
2
  export type { StreamLayoutBlobModel } from './stream-layout-blob-model';
3
3
  export type { StreamLayoutMediaItemModel } from './stream-layout-media-item-model';
4
4
  export type { StreamLayoutPostHeaderModel } from './stream-layout-post-header-model';
5
- export type { StreamLayoutProductModel } from './stream-layout-product-model';
5
+ export type { StreamLayoutProductModel, StreamLayoutProductPriceModel } from './stream-layout-product-model';
6
6
  export type { StreamLayoutShortVideoModel, StreamLayoutShortVideoProductModel, StreamLayoutShortVideoAdModel } from './stream-layout-short-video-model';
@@ -44,9 +44,9 @@ const mapToAdViewModel = (model) => {
44
44
  image: model.image,
45
45
  title: model.title,
46
46
  description: model.description,
47
- buttonText: model.buttonText,
48
- buttonUrl: model.buttonUrl,
49
- openLinkInNewWindow: model.openLinkInNewWindow
47
+ price: model.price,
48
+ currency: model.currency,
49
+ ctaButton: model.ctaButton
50
50
  };
51
51
  };
52
52
  const mapToProductCardModel = (model) => {
@@ -57,6 +57,7 @@ const mapToProductCardModel = (model) => {
57
57
  link: model.link,
58
58
  currency: model.currency,
59
59
  price: model.price,
60
- salePrice: model.salePrice
60
+ salePrice: model.salePrice,
61
+ shortDescription: model.shortDescription ?? null
61
62
  };
62
63
  };
@@ -1,4 +1,4 @@
1
- import { MediaType } from '../../..';
1
+ import { MediaType } from '../../../core/enums';
2
2
  export type StreamLayoutMediaItemModel = {
3
3
  url: string;
4
4
  thumbnailUrl: string | null;
@@ -1 +1 @@
1
- import { MediaType } from '../../..';
1
+ import { MediaType } from '../../../core/enums';
@@ -1,4 +1,4 @@
1
- import type { PostSourceType } from '$gql/types';
1
+ import type { PostSourceType } from '../../../core/enums';
2
2
  export type StreamLayoutPostHeaderModel = {
3
3
  sourceId: string;
4
4
  sourceName: string;
@@ -7,7 +7,7 @@ export type StreamLayoutProductModel = {
7
7
  link: string | null;
8
8
  price: StreamLayoutProductPriceModel;
9
9
  };
10
- type StreamLayoutProductPriceModel = {
10
+ export type StreamLayoutProductPriceModel = {
11
11
  price: number;
12
12
  currency: Currency;
13
13
  salePrice: number | null;
@@ -16,4 +16,3 @@ type StreamLayoutProductPriceModel = {
16
16
  saveValue: string | null;
17
17
  savePercentValue: string | null;
18
18
  };
19
- export {};
@@ -16,9 +16,15 @@ export type StreamLayoutShortVideoAdModel = {
16
16
  image: string | null;
17
17
  title: string;
18
18
  description: string | null;
19
- buttonText: string | null;
20
- buttonUrl: string | null;
21
- openLinkInNewWindow: boolean | null;
19
+ price: number | null;
20
+ currency: Currency | null;
21
+ ctaButton: {
22
+ background: string;
23
+ textColor: string;
24
+ text: string;
25
+ url: string;
26
+ border: string;
27
+ } | null;
22
28
  };
23
29
  export type StreamLayoutShortVideoProductModel = {
24
30
  id: string;
@@ -28,4 +34,8 @@ export type StreamLayoutShortVideoProductModel = {
28
34
  price: number;
29
35
  currency: Currency;
30
36
  salePrice: number | null;
37
+ brand?: {
38
+ name?: string | null;
39
+ };
40
+ shortDescription?: string | null;
31
41
  };
@@ -0,0 +1,29 @@
1
+ import type { StreamElementModel } from './elements';
2
+ import type { StreamLayout, StreamLayoutTemplate } from './layout';
3
+ export declare const parseToStreamLayout: (value: string) => StreamLayout;
4
+ export declare const parseToStreamLayoutTemplate: (value: string) => StreamLayoutTemplate;
5
+ export declare const stringifyToStreamLayoutInput: (layout: StreamLayout | StreamLayoutTemplate) => string;
6
+ export declare class IdPopulator {
7
+ static populateLayoutIds(layout: {
8
+ $id: string;
9
+ slots: {
10
+ $id: string;
11
+ components: {
12
+ $id: string;
13
+ elements: StreamElementModel[];
14
+ }[];
15
+ }[];
16
+ }): void;
17
+ static populateSlotIds(slot: {
18
+ $id: string;
19
+ components: {
20
+ $id: string;
21
+ elements: StreamElementModel[];
22
+ }[];
23
+ }): void;
24
+ static populateComponentIds(component: {
25
+ $id: string;
26
+ elements: StreamElementModel[];
27
+ }): void;
28
+ static populateElementId(element: StreamElementModel): void;
29
+ }
@@ -0,0 +1,93 @@
1
+ import { Utils } from '../../core/utils';
2
+ import { StreamComponentDataType, StreamElementType } from './enums';
3
+ import { nanoid } from 'nanoid';
4
+ export const parseToStreamLayout = (value) => {
5
+ const layout = JSON.parse(value);
6
+ IdPopulator.populateLayoutIds(layout);
7
+ return layout;
8
+ };
9
+ export const parseToStreamLayoutTemplate = (value) => {
10
+ const layout = JSON.parse(value);
11
+ IdPopulator.populateLayoutIds(layout);
12
+ return layout;
13
+ };
14
+ export const stringifyToStreamLayoutInput = (layout) => {
15
+ const clone = structuredClone($state.snapshot(layout));
16
+ // @ts-expect-error - clearing local data before sending to the server - clearing local data before sending to the server
17
+ delete clone.$id;
18
+ if (clone.slots) {
19
+ clone.slots.forEach((slot) => {
20
+ // @ts-expect-error - clearing local data before sending to the server
21
+ delete slot.$id;
22
+ slot.components.forEach((component) => {
23
+ // @ts-expect-error - clearing local data before sending to the server
24
+ delete component.$id;
25
+ component.elements.forEach(removeElementIdRecursive);
26
+ });
27
+ if ('data' in slot && slot.data) {
28
+ const data = slot.data;
29
+ switch (data.type) {
30
+ case StreamComponentDataType.Images:
31
+ // @ts-expect-error - clearing local data before sending to the server
32
+ delete data.items;
33
+ break;
34
+ case StreamComponentDataType.ShortVideo:
35
+ // @ts-expect-error - clearing local data before sending to the server
36
+ delete data.shortVideo;
37
+ break;
38
+ case StreamComponentDataType.Product:
39
+ // @ts-expect-error - clearing local data before sending to the server
40
+ delete data.product;
41
+ break;
42
+ default:
43
+ Utils.assertUnreachable(data);
44
+ }
45
+ }
46
+ });
47
+ }
48
+ return JSON.stringify(clone);
49
+ };
50
+ const removeElementIdRecursive = (element) => {
51
+ // @ts-expect-error - clearing local data before sending to the server
52
+ delete element.$id;
53
+ if (element.type === StreamElementType.Container && Array.isArray(element.elements)) {
54
+ element.elements.forEach(removeElementIdRecursive);
55
+ }
56
+ if (element.type === StreamElementType.ImageRef && Array.isArray(element.annotations)) {
57
+ element.annotations.forEach((annotation) => {
58
+ // @ts-expect-error - clearing local data before sending to the server
59
+ delete annotation.$id;
60
+ });
61
+ }
62
+ if (element.type === StreamElementType.Price && element.stock) {
63
+ // @ts-expect-error - clearing local data before sending to the server
64
+ delete element.stock.$id;
65
+ }
66
+ };
67
+ export class IdPopulator {
68
+ static populateLayoutIds(layout) {
69
+ layout.$id = nanoid(10);
70
+ layout.slots.forEach((slot) => IdPopulator.populateSlotIds(slot));
71
+ }
72
+ static populateSlotIds(slot) {
73
+ slot.$id = nanoid(10);
74
+ slot.components.forEach((component) => IdPopulator.populateComponentIds(component));
75
+ }
76
+ static populateComponentIds(component) {
77
+ component.$id = nanoid(10);
78
+ component.elements.forEach((element) => IdPopulator.populateElementId(element));
79
+ }
80
+ static populateElementId(element) {
81
+ element.$id = nanoid(10);
82
+ // Рекурсивно обрабатываем дочерние элементы
83
+ if (element.type === StreamElementType.Container && element.elements) {
84
+ element.elements.forEach((element) => IdPopulator.populateElementId(element));
85
+ }
86
+ if (element.type === StreamElementType.ImageRef && element.annotations) {
87
+ element.annotations.forEach((element) => IdPopulator.populateElementId(element));
88
+ }
89
+ if (element.type === StreamElementType.Price && element.stock) {
90
+ IdPopulator.populateElementId(element.stock);
91
+ }
92
+ }
93
+ }
@@ -0,0 +1,13 @@
1
+ import type { ImagesStreamSlotData, ProductStreamSlotData, ShortVideoStreamSlotData } from './slot-data';
2
+ export type StreamSlotDataRef = Partial<Pick<ImagesStreamSlotData, 'items'>> & Partial<Pick<ProductStreamSlotData, 'product'>> & Partial<Pick<ShortVideoStreamSlotData, 'shortVideo'>>;
3
+ type Prev = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...0[]];
4
+ type Join<K, P> = K extends string | number ? (P extends string | number ? `${K}${'' extends P ? '' : '.'}${P}` : never) : never;
5
+ type IsPrimitive<T> = T extends string | number | boolean | null | undefined ? true : false;
6
+ type ExcludeBuiltins<T> = {
7
+ [K in keyof T as K extends keyof any[] ? never : K extends symbol ? never : T[K] extends (...args: any[]) => any ? never : T[K] extends any[] ? never : K]: T[K];
8
+ };
9
+ type Paths<T, D extends number = 4> = [D] extends [never] ? never : T extends object ? {
10
+ [K in keyof ExcludeBuiltins<T>]: K extends string | number ? IsPrimitive<ExcludeBuiltins<T>[K]> extends true ? `${K}` : ExcludeBuiltins<T>[K] extends object | null ? ExcludeBuiltins<T>[K] extends null ? never : Join<K, Paths<ExcludeBuiltins<NonNullable<T[K]>>, Prev[D]>> : never : never;
11
+ }[keyof ExcludeBuiltins<T>] : '';
12
+ export type StreamSlotDataRefPaths = `#${Paths<Required<StreamSlotDataRef>>}`;
13
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -2,6 +2,8 @@ import type { StreamComponent } from './component';
2
2
  import type { StreamSlotData } from './slot-data';
3
3
  import type { StreamSlotDataInput } from './slot-data-input';
4
4
  export type StreamSlotTemplate = {
5
+ $id: string;
6
+ name?: string | null;
5
7
  top: number;
6
8
  left: number;
7
9
  width: number;
@@ -1,7 +1,8 @@
1
- import { StreamElementStyleFontFamily, StreamElementStyleFontWeight, StreamElementStyleHorizontalAlign } from './enums';
2
- import type { ContainerStreamElementStyles, ImageStreamElementStyles, StreamLayoutStyles, TextStreamElementStyles } from './styles';
1
+ import { StreamElementStyleFontFamily, StreamElementStyleFontWeight, StreamElementStyleHorizontalAlign, AnnotationStreamElementPlacement } from './enums';
2
+ import type { AnnotationStreamElementStyles, ContainerStreamElementStyles, ImageStreamElementStyles, StreamLayoutStyles, TextStreamElementStyles } from './styles';
3
3
  export declare const generateStreamLayoutStyles: (styles: StreamLayoutStyles | null) => string;
4
4
  export declare const generateContainerStyles: (styles: Partial<ContainerStreamElementStyles> | null) => string;
5
+ export declare const generateAnnotationStyles: (styles: AnnotationStreamElementStyles, placement: AnnotationStreamElementPlacement) => string;
5
6
  export declare const generateTextStyles: (styles: Partial<TextStreamElementStyles> | null) => string;
6
7
  export declare const generateImageStyles: (styles: Partial<ImageStreamElementStyles> | null) => string;
7
8
  export declare const mapFontFamily: (value: StreamElementStyleFontFamily | null | undefined) => string;