@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
@@ -0,0 +1,74 @@
1
+ <script lang="ts">var _a;
2
+ import { StockStreamElementLocalization } from './stock-stream-element-localization';
3
+ import { StockStreamElementLevel } from '../enums';
4
+ import { mapFlexJustifyContent, transformNumericValue } from '../styles-transformer';
5
+ let { model, heightOverrideDdu, localization: localizationInit } = $props();
6
+ const localization = $derived(new StockStreamElementLocalization(localizationInit));
7
+ const height = $derived(heightOverrideDdu || ((_a = model.styles) === null || _a === void 0 ? void 0 : _a.height) || 16);
8
+ const containerStyles = $derived.by(() => {
9
+ var _a;
10
+ const values = [
11
+ `align-items: center;`,
12
+ `height: ${transformNumericValue(height)}; gap: 1cqi;`,
13
+ `justify-content: ${mapFlexJustifyContent((_a = model.styles) === null || _a === void 0 ? void 0 : _a.horizontalAlign)};`
14
+ ];
15
+ return values.join('');
16
+ });
17
+ const dotCustomStyles = $derived.by(() => {
18
+ const values = [`height: ${transformNumericValue(height)};`, `width: ${transformNumericValue(height)};`];
19
+ return values.join('');
20
+ });
21
+ const quantityCustomStyles = $derived.by(() => {
22
+ const values = [`font-size: ${transformNumericValue(height * 0.75)};`];
23
+ return values.join('');
24
+ });
25
+ </script>
26
+
27
+ <div class="stock-stream-element" style={containerStyles}>
28
+ <div
29
+ class="stock-stream-element__dot"
30
+ style={dotCustomStyles}
31
+ class:stock-stream-element__dot--high={model.level === StockStreamElementLevel.High}
32
+ class:stock-stream-element__dot--medium={model.level === StockStreamElementLevel.Medium}
33
+ class:stock-stream-element__dot--low={model.level === StockStreamElementLevel.Low}
34
+ class:stock-stream-element__dot--out-of-stock={model.level === StockStreamElementLevel.OutOfStock}>
35
+ &nbsp;
36
+ </div>
37
+ <div class="stock-stream-element__quantity" style={quantityCustomStyles}>
38
+ {localization.quantity(model.quantity, [StockStreamElementLevel.Low, StockStreamElementLevel.OutOfStock].includes(model.level))}
39
+ {#if model.textAfter}
40
+ &nbsp;{model.textAfter}
41
+ {/if}
42
+ </div>
43
+ </div>
44
+
45
+ <style>@keyframes fadeIn {
46
+ 0% {
47
+ opacity: 1;
48
+ }
49
+ 50% {
50
+ opacity: 0.4;
51
+ }
52
+ 100% {
53
+ opacity: 1;
54
+ }
55
+ }
56
+ .stock-stream-element {
57
+ display: flex;
58
+ }
59
+ .stock-stream-element__dot {
60
+ border-radius: 50%;
61
+ }
62
+ .stock-stream-element__dot--high {
63
+ background-color: #0cce6b;
64
+ }
65
+ .stock-stream-element__dot--medium {
66
+ background-color: #ffa62b;
67
+ }
68
+ .stock-stream-element__dot--low {
69
+ background-color: #e71d36;
70
+ }
71
+ .stock-stream-element__dot--out-of-stock {
72
+ border: 1px solid #144ab0;
73
+ background-color: #ffffff;
74
+ }</style>
@@ -0,0 +1,11 @@
1
+ import type { Locale } from '../../../core/locale';
2
+ import { type IStockStreamElementLocalization } from './stock-stream-element-localization';
3
+ import type { StockStreamElementModel } from '../elements';
4
+ type Props = {
5
+ model: StockStreamElementModel;
6
+ heightOverrideDdu?: number;
7
+ localization: IStockStreamElementLocalization | Locale;
8
+ };
9
+ declare const Cmp: import("svelte").Component<Props, {}, "">;
10
+ type Cmp = ReturnType<typeof Cmp>;
11
+ export default Cmp;
@@ -1,8 +1,8 @@
1
- <script lang="ts">import { ContainerStreamElement, ImageRefStreamElement, ImagesStreamElement, PriceStreamElement, ShortVideoStreamElement, SpacerStreamElement, TextRefStreamElement, TextStreamElement } from '.';
2
- import { StreamElementLocalization } from './stream-element-localization.svelte';
1
+ <script lang="ts">import { AnnotationStreamElementView, ContainerStreamElementView, ImageRefStreamElementView, ImagesStreamElementView, PriceStreamElementView, ShortVideoStreamElementView, SpacerStreamElementView, StockStreamElementView, TextRefStreamElementView, TextStreamElementView, WebViewStreamElementView } from '.';
2
+ import { StreamElementLocalization } from './stream-element-localization';
3
3
  import { StreamComponentDataType, StreamElementStyleDirection, StreamElementType } from '../enums';
4
- let { model, data, constainerDirection = StreamElementStyleDirection.Vertical, localization: localizatoinInit, on } = $props();
5
- const localization = $derived(new StreamElementLocalization(localizatoinInit));
4
+ let { model, data, constainerDirection = StreamElementStyleDirection.Vertical, localization: localizationInit, on } = $props();
5
+ const localization = $derived(new StreamElementLocalization(localizationInit));
6
6
  const shortVideoModel = $derived.by(() => {
7
7
  if (!data) {
8
8
  return null;
@@ -41,28 +41,35 @@ const productModel = $derived.by(() => {
41
41
  });
42
42
  </script>
43
43
 
44
- {#if model.type === StreamElementType.Container}
45
- <ContainerStreamElement model={model} data={data} localization={localizatoinInit} />
46
- {:else if model.type === StreamElementType.Spacer}
47
- <SpacerStreamElement model={model} parentContainerDirection={constainerDirection} />
48
- {:else if model.type === StreamElementType.ImageRef}
49
- <ImageRefStreamElement model={model} data={data} />
44
+ {#if model.type === StreamElementType.Annotation}
45
+ <AnnotationStreamElementView model={model} />
46
+ {:else if model.type === StreamElementType.Container}
47
+ <ContainerStreamElementView model={model} data={data} localization={localizationInit} />
48
+ {:else if model.type === StreamElementType.ImageRef && data}
49
+ <ImageRefStreamElementView model={model} data={data} />
50
50
  {:else if model.type === StreamElementType.Images && imagesModel?.length}
51
- <ImagesStreamElement model={model} data={imagesModel} />
51
+ <ImagesStreamElementView model={model} data={imagesModel} />
52
52
  {:else if model.type === StreamElementType.Price && productModel}
53
- <PriceStreamElement model={model} data={productModel} localization={localization.priceElementLocalization} />
53
+ <PriceStreamElementView model={model} data={productModel.price} localization={localization.priceElementLocalization} />
54
54
  {:else if model.type === StreamElementType.ShortVideo && shortVideoModel}
55
- <ShortVideoStreamElement
55
+ <ShortVideoStreamElementView
56
56
  data={shortVideoModel}
57
+ localization={localization.shortVideoElementLocalization}
57
58
  on={on
58
59
  ? {
59
- progress: (progress: number) => {
60
+ progress: (progress: Number) => {
60
61
  on.progress?.(shortVideoModel.id, progress);
61
62
  }
62
63
  }
63
64
  : undefined} />
65
+ {:else if model.type === StreamElementType.Spacer}
66
+ <SpacerStreamElementView model={model} parentContainerDirection={constainerDirection} />
67
+ {:else if model.type === StreamElementType.Stock}
68
+ <StockStreamElementView model={model} localization={localization.stockElementLocalization} />
64
69
  {:else if model.type === StreamElementType.Text}
65
- <TextStreamElement model={model} />
66
- {:else if model.type === StreamElementType.TextRef}
67
- <TextRefStreamElement model={model} data={data} />
70
+ <TextStreamElementView model={model} />
71
+ {:else if model.type === StreamElementType.TextRef && data}
72
+ <TextRefStreamElementView model={model} data={data} />
73
+ {:else if model.type === StreamElementType.WebView}
74
+ <WebViewStreamElementView model={model} />
68
75
  {/if}
@@ -1,12 +1,13 @@
1
- import { type IStreamElementLocalization } from './stream-element-localization.svelte';
1
+ import type { Locale } from '../../../core/locale';
2
+ import { type IStreamElementLocalization } from './stream-element-localization';
2
3
  import type { StreamElementModel } from '../elements';
3
4
  import { StreamElementStyleDirection } from '../enums';
4
5
  import type { StreamSlotData } from '../slot-data';
5
6
  type Props = {
6
7
  model: StreamElementModel;
7
- data: StreamSlotData;
8
+ data: StreamSlotData | null;
8
9
  constainerDirection?: StreamElementStyleDirection;
9
- localization?: IStreamElementLocalization;
10
+ localization: IStreamElementLocalization | Locale;
10
11
  on?: {
11
12
  progress?: (videoId: string, progress: number) => void;
12
13
  };
@@ -1,8 +1,8 @@
1
1
  import type { TextRefStreamElementModel } from '../elements';
2
- import type { StreamSlotData } from '../slot-data';
2
+ import type { StreamSlotDataRef } from '../slot-data-ref';
3
3
  type Props = {
4
4
  model: TextRefStreamElementModel;
5
- data: StreamSlotData;
5
+ data: StreamSlotDataRef;
6
6
  };
7
7
  declare const Cmp: import("svelte").Component<Props, {}, "">;
8
8
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,8 +1,12 @@
1
1
  <script lang="ts">import { LineClamp } from '../../../ui/line-clamp';
2
2
  import { generateTextStyles } from '../styles-transformer';
3
- let { model } = $props();
3
+ let { model, placeholder } = $props();
4
4
  </script>
5
5
 
6
6
  <div class="text-stream-element" style={generateTextStyles(model.styles)}>
7
- <LineClamp value={model.value} maxLines={model.styles?.maxLines || 'auto'} />
7
+ {#if model.value}
8
+ <LineClamp value={model.value} maxLines={model.styles?.maxLines || 'auto'} />
9
+ {:else if placeholder}
10
+ {@render placeholder()}
11
+ {/if}
8
12
  </div>
@@ -1,6 +1,8 @@
1
1
  import type { TextStreamElementModel } from '../elements';
2
+ import type { Snippet } from 'svelte';
2
3
  type Props = {
3
4
  model: TextStreamElementModel;
5
+ placeholder?: Snippet;
4
6
  };
5
7
  declare const Cmp: import("svelte").Component<Props, {}, "">;
6
8
  type Cmp = ReturnType<typeof Cmp>;
@@ -0,0 +1,37 @@
1
+ <script lang="ts">let { model } = $props();
2
+ export {};
3
+ </script>
4
+
5
+ <div class="web-view-stream-element">
6
+ {#if model.url}
7
+ <iframe
8
+ title="Web View"
9
+ src={model.url}
10
+ style="width: 100%; height: 100%; border: none;"
11
+ allowfullscreen
12
+ sandbox="allow-scripts allow-forms allow-same-origin"></iframe>
13
+ {:else}
14
+ <p>No URL provided for the web view.</p>
15
+ {/if}
16
+ </div>
17
+
18
+ <style>@keyframes fadeIn {
19
+ 0% {
20
+ opacity: 1;
21
+ }
22
+ 50% {
23
+ opacity: 0.4;
24
+ }
25
+ 100% {
26
+ opacity: 1;
27
+ }
28
+ }
29
+ .web-view-stream-element {
30
+ width: 100%;
31
+ min-width: 100%;
32
+ max-width: 100%;
33
+ height: 100%;
34
+ min-height: 100%;
35
+ max-height: 100%;
36
+ position: relative;
37
+ }</style>
@@ -0,0 +1,7 @@
1
+ import type { WebViewStreamElementModel } from '../elements';
2
+ type Props = {
3
+ model: WebViewStreamElementModel;
4
+ };
5
+ declare const Cmp: import("svelte").Component<Props, {}, "">;
6
+ type Cmp = ReturnType<typeof Cmp>;
7
+ export default Cmp;
@@ -1,3 +1,3 @@
1
- import type { StreamSlotData } from '../slot-data';
2
- export declare const getStringValueByKey: (data: StreamSlotData, key: string) => string;
3
- export declare const getNumberValueByKey: (data: StreamSlotData, key: string) => number;
1
+ import type { StreamSlotDataRef } from '../slot-data-ref';
2
+ export declare const getStringValueByKey: (data: StreamSlotDataRef, key: string) => string;
3
+ export declare const getNumberValueByKey: (data: StreamSlotDataRef, key: string) => number;
@@ -1,11 +1,16 @@
1
- export { default as StreamElement } from './cmp.stream-element.svelte';
2
- export { default as ContainerStreamElement } from './cmp.container-stream-element.svelte';
3
- export { default as ImageRefStreamElement } from './cmp.image-ref-stream-element.svelte';
4
- export { default as ImagesStreamElement } from './cmp.images-stream-element.svelte';
5
- export { default as PriceStreamElement } from './cmp.price-stream-element.svelte';
6
- export { default as ShortVideoStreamElement } from './cmp.short-video-stream-element.svelte';
7
- export { default as SpacerStreamElement } from './cmp.spacer-stream-element.svelte';
8
- export { default as TextRefStreamElement } from './cmp.text-ref-stream-element.svelte';
9
- export { default as TextStreamElement } from './cmp.text-stream-element.svelte';
10
- export type { IStreamElementLocalization } from './stream-element-localization.svelte';
11
- export type { IPriceStreamElementLocalization } from './price-stream-element-localization.svelte';
1
+ export { default as StreamElementView } from './cmp.stream-element.svelte';
2
+ export { default as AnnotationStreamElementView } from './cmp.annotation-stream-element.svelte';
3
+ export { default as ContainerStreamElementView } from './cmp.container-stream-element.svelte';
4
+ export { default as ImageRefStreamElementView } from './cmp.image-ref-stream-element.svelte';
5
+ export { default as ImagesStreamElementView } from './cmp.images-stream-element.svelte';
6
+ export { default as PriceStreamElementView } from './cmp.price-stream-element.svelte';
7
+ export { default as ShortVideoStreamElementView } from './cmp.short-video-stream-element.svelte';
8
+ export { default as SpacerStreamElementView } from './cmp.spacer-stream-element.svelte';
9
+ export { default as StockStreamElementView } from './cmp.stock-stream-element.svelte';
10
+ export { default as TextRefStreamElementView } from './cmp.text-ref-stream-element.svelte';
11
+ export { default as TextStreamElementView } from './cmp.text-stream-element.svelte';
12
+ export { default as WebViewStreamElementView } from './cmp.web-view-stream-element.svelte';
13
+ export type { IStreamElementLocalization } from './stream-element-localization';
14
+ export type { IPriceStreamElementLocalization } from './price-stream-element-localization';
15
+ export type { IStockStreamElementLocalization } from './stock-stream-element-localization';
16
+ export type { IShortVideoStreamElementLocalization } from './short-video-stream-element-localization';
@@ -1,9 +1,12 @@
1
- export { default as StreamElement } from './cmp.stream-element.svelte';
2
- export { default as ContainerStreamElement } from './cmp.container-stream-element.svelte';
3
- export { default as ImageRefStreamElement } from './cmp.image-ref-stream-element.svelte';
4
- export { default as ImagesStreamElement } from './cmp.images-stream-element.svelte';
5
- export { default as PriceStreamElement } from './cmp.price-stream-element.svelte';
6
- export { default as ShortVideoStreamElement } from './cmp.short-video-stream-element.svelte';
7
- export { default as SpacerStreamElement } from './cmp.spacer-stream-element.svelte';
8
- export { default as TextRefStreamElement } from './cmp.text-ref-stream-element.svelte';
9
- export { default as TextStreamElement } from './cmp.text-stream-element.svelte';
1
+ export { default as StreamElementView } from './cmp.stream-element.svelte';
2
+ export { default as AnnotationStreamElementView } from './cmp.annotation-stream-element.svelte';
3
+ export { default as ContainerStreamElementView } from './cmp.container-stream-element.svelte';
4
+ export { default as ImageRefStreamElementView } from './cmp.image-ref-stream-element.svelte';
5
+ export { default as ImagesStreamElementView } from './cmp.images-stream-element.svelte';
6
+ export { default as PriceStreamElementView } from './cmp.price-stream-element.svelte';
7
+ export { default as ShortVideoStreamElementView } from './cmp.short-video-stream-element.svelte';
8
+ export { default as SpacerStreamElementView } from './cmp.spacer-stream-element.svelte';
9
+ export { default as StockStreamElementView } from './cmp.stock-stream-element.svelte';
10
+ export { default as TextRefStreamElementView } from './cmp.text-ref-stream-element.svelte';
11
+ export { default as TextStreamElementView } from './cmp.text-stream-element.svelte';
12
+ export { default as WebViewStreamElementView } from './cmp.web-view-stream-element.svelte';
@@ -0,0 +1,168 @@
1
+ <script lang="ts">var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Utils } from '../../../core/utils';
11
+ import { toPriceRepresentation } from '../../../products/price-helper';
12
+ import { LineClamp } from '../../../ui/line-clamp';
13
+ import { PriceStreamElementLocalization } from './price-stream-element-localization';
14
+ import { default as StockElementView } from './cmp.stock-stream-element.svelte';
15
+ import { mapFlexJustifyContent, mapFontFamily, mapFontWeight, transformColorValue, transformFontSizeValue, transformNumericValue } from '../styles-transformer';
16
+ let { maxElementHeight, model, data, localization, on } = $props();
17
+ let priceElementRef = $state.raw(null);
18
+ let priceContainerRef = $state.raw(null);
19
+ const minElementHeight = 16;
20
+ let adjustedHeight = $derived(maxElementHeight);
21
+ const lineHeight = 1.2;
22
+ const elementHeight = $derived(adjustedHeight);
23
+ const priceHeight = $derived(model.stock ? elementHeight * 0.68 : elementHeight);
24
+ const adjustableHeight = $derived(!!(on === null || on === void 0 ? void 0 : on.heightAdjusted));
25
+ const currentPrice = $derived.by(() => {
26
+ if (data.salePrice) {
27
+ return toPriceRepresentation(data.salePrice, data.currency, model.includeCurrency || false);
28
+ }
29
+ return toPriceRepresentation(data.price, data.currency, model.includeCurrency || false);
30
+ });
31
+ const saveValue = $derived.by(() => {
32
+ if (data.salePrice) {
33
+ return toPriceRepresentation(data.price - data.salePrice, data.currency, model.includeCurrency || false);
34
+ }
35
+ return 0;
36
+ });
37
+ const beforeValue = $derived.by(() => {
38
+ return toPriceRepresentation(data.price, data.currency, model.includeCurrency || false);
39
+ });
40
+ const elementContainerStyles = $derived.by(() => {
41
+ var _a, _b;
42
+ const values = [
43
+ 'display: flex;',
44
+ 'flex-direction: column;',
45
+ 'justify-content: space-between;',
46
+ `align-items: ${mapFlexJustifyContent((_a = model.styles) === null || _a === void 0 ? void 0 : _a.horizontalAlign)};`,
47
+ `font-family: ${mapFontFamily((_b = model.styles) === null || _b === void 0 ? void 0 : _b.fontFamily)};`,
48
+ `height: ${transformNumericValue(elementHeight)};`
49
+ ];
50
+ return values.join('');
51
+ });
52
+ const priceContainerStyles = $derived.by(() => {
53
+ const values = ['display: flex;', `height: ${transformNumericValue(priceHeight)};`, `align-items: center;`, 'gap: 3cqi;'];
54
+ return values.join('');
55
+ });
56
+ const priceCustomStyles = $derived.by(() => {
57
+ var _a, _b, _c;
58
+ const values = [
59
+ `font-size: ${transformFontSizeValue(priceHeight / lineHeight)};`,
60
+ `line-height: ${lineHeight};`,
61
+ `font-weight: ${mapFontWeight((_a = model.styles) === null || _a === void 0 ? void 0 : _a.fontWeight)};`,
62
+ `color: ${transformColorValue(data.salePrice ? (_b = model.styles) === null || _b === void 0 ? void 0 : _b.salePriceColor : (_c = model.styles) === null || _c === void 0 ? void 0 : _c.regularPriceColor)};`
63
+ ];
64
+ return values.join('');
65
+ });
66
+ const saveValueCustomStyles = $derived.by(() => {
67
+ var _a, _b;
68
+ const values = [
69
+ `margin-top: ${transformNumericValue((priceHeight - priceHeight / lineHeight) / 2)};`,
70
+ `font-size: ${transformFontSizeValue(priceHeight / 4)};`,
71
+ `font-weight: 500;`,
72
+ `padding: ${transformNumericValue(priceHeight / 8)} ${transformNumericValue(priceHeight / 4)};`,
73
+ `border-radius: ${transformNumericValue(priceHeight / 8)};`,
74
+ `background-color: ${transformColorValue((_a = model.styles) === null || _a === void 0 ? void 0 : _a.saveValueBackgroundColor)};`,
75
+ `color: ${transformColorValue((_b = model.styles) === null || _b === void 0 ? void 0 : _b.saveValueColor)};`
76
+ ];
77
+ return values.join('');
78
+ });
79
+ const beforeValueCustomStyles = $derived.by(() => {
80
+ var _a;
81
+ const values = [
82
+ `font-size: ${transformFontSizeValue(priceHeight / 5)};`,
83
+ `font-weight: 500;`,
84
+ `color: ${transformColorValue((_a = model.styles) === null || _a === void 0 ? void 0 : _a.beforeValueColor)};`
85
+ ];
86
+ return values.join('');
87
+ });
88
+ const textAfterCustomStyles = $derived.by(() => {
89
+ const values = [`font-size: ${transformFontSizeValue(priceHeight / lineHeight / 2)};`, `font-weight: 500;`, 'align-self: flex-end;'];
90
+ return values.join('');
91
+ });
92
+ const stockElementHeight = $derived(elementHeight * 0.23);
93
+ const adjustHeightToFit = () => __awaiter(void 0, void 0, void 0, function* () {
94
+ if (!priceContainerRef || !priceElementRef || !adjustableHeight) {
95
+ return;
96
+ }
97
+ yield new Promise((resolve) => requestAnimationFrame(resolve));
98
+ let currentHeight = maxElementHeight;
99
+ while (currentHeight > minElementHeight) {
100
+ adjustedHeight = currentHeight;
101
+ yield new Promise((resolve) => requestAnimationFrame(resolve));
102
+ let hasOverflow = priceElementRef.clientWidth < priceContainerRef.clientWidth;
103
+ if (!hasOverflow) {
104
+ break;
105
+ }
106
+ currentHeight -= 1;
107
+ }
108
+ on === null || on === void 0 ? void 0 : on.heightAdjusted(currentHeight);
109
+ });
110
+ const debouncedAdjustHeightToFit = Utils.debounce(adjustHeightToFit, 400);
111
+ $effect(() => {
112
+ const references = [maxElementHeight, currentPrice, saveValue, beforeValue, model.textAfter, model.includeCurrency, model.excludeBeforePrice];
113
+ void references;
114
+ debouncedAdjustHeightToFit();
115
+ });
116
+ </script>
117
+
118
+ <div class="price-stream-element" class:price-stream-element--adjustable={adjustableHeight} style={elementContainerStyles} bind:this={priceElementRef}>
119
+ <div class="price-stream-element__price-container" style={priceContainerStyles} bind:this={priceContainerRef}>
120
+ <div class="price-stream-element__price" style={priceCustomStyles}>
121
+ {currentPrice}
122
+ </div>
123
+ {#if data.salePrice && !model.excludeBeforePrice}
124
+ <div class="price-stream-element__sale-price">
125
+ <div class="price-stream-element__save" style={saveValueCustomStyles}>
126
+ {localization.saveValue(saveValue)}
127
+ </div>
128
+ <div class="price-stream-element__before-price" style={beforeValueCustomStyles}>
129
+ {localization.beforeValue(beforeValue)}
130
+ </div>
131
+ </div>
132
+ {/if}
133
+ {#if model.textAfter}
134
+ <div class="price-stream-element__text-after" style={textAfterCustomStyles}>
135
+ <LineClamp value={model.textAfter} maxLines={1} />
136
+ </div>
137
+ {/if}
138
+ </div>
139
+ {#if model.stock}
140
+ <StockElementView model={model.stock} heightOverrideDdu={stockElementHeight} localization={localization.stockLocalization} />
141
+ {/if}
142
+ </div>
143
+
144
+ <style>@keyframes fadeIn {
145
+ 0% {
146
+ opacity: 1;
147
+ }
148
+ 50% {
149
+ opacity: 0.4;
150
+ }
151
+ 100% {
152
+ opacity: 1;
153
+ }
154
+ }
155
+ .price-stream-element--adjustable {
156
+ position: absolute;
157
+ visibility: hidden;
158
+ width: 100%;
159
+ }
160
+ .price-stream-element__sale-price {
161
+ display: flex;
162
+ height: 100%;
163
+ flex-direction: column;
164
+ justify-content: space-between;
165
+ }
166
+ .price-stream-element__price, .price-stream-element__save, .price-stream-element__before-price {
167
+ white-space: nowrap;
168
+ }</style>
@@ -0,0 +1,15 @@
1
+ import { PriceStreamElementLocalization } from './price-stream-element-localization';
2
+ import type { PriceStreamElementModel } from '../elements';
3
+ import type { StreamLayoutProductPriceModel } from '../models';
4
+ type Props = {
5
+ maxElementHeight: number;
6
+ model: PriceStreamElementModel;
7
+ data: StreamLayoutProductPriceModel;
8
+ localization: PriceStreamElementLocalization;
9
+ on?: {
10
+ heightAdjusted: (height: number) => void;
11
+ };
12
+ };
13
+ declare const PriceElementView: import("svelte").Component<Props, {}, "">;
14
+ type PriceElementView = ReturnType<typeof PriceElementView>;
15
+ export default PriceElementView;
@@ -0,0 +1,13 @@
1
+ import { type Locale } from '../../../core/locale';
2
+ import type { IStockStreamElementLocalization } from './stock-stream-element-localization';
3
+ export interface IPriceStreamElementLocalization {
4
+ saveValue?: (value: string | number) => string;
5
+ beforeValue?: (value: string) => string;
6
+ stockLocalization?: IStockStreamElementLocalization | Locale;
7
+ }
8
+ export declare class PriceStreamElementLocalization {
9
+ saveValue: (value: string | number) => string;
10
+ beforeValue: (value: string) => string;
11
+ stockLocalization: IStockStreamElementLocalization | Locale;
12
+ constructor(init: IPriceStreamElementLocalization | Locale);
13
+ }
@@ -0,0 +1,21 @@
1
+ import { isLocale } from '../../../core/locale';
2
+ export class PriceStreamElementLocalization {
3
+ saveValue;
4
+ beforeValue;
5
+ stockLocalization;
6
+ constructor(init) {
7
+ this.saveValue = isLocale(init) ? loc.saveValue[init] : init.saveValue || loc.saveValue.en;
8
+ this.beforeValue = isLocale(init) ? loc.beforeValue[init] : init.beforeValue || loc.beforeValue.en;
9
+ this.stockLocalization = isLocale(init) ? init : init.stockLocalization || 'en';
10
+ }
11
+ }
12
+ const loc = {
13
+ saveValue: {
14
+ en: (value) => `Save ${value}`,
15
+ no: (value) => `Lagre ${value}`
16
+ },
17
+ beforeValue: {
18
+ en: (value) => `Before ${value}`,
19
+ no: (value) => `Før ${value}`
20
+ }
21
+ };
@@ -0,0 +1,9 @@
1
+ import { type Locale } from '../../../core/locale';
2
+ import type { IShortVideoViewerLocalization } from '../../../short-videos/short-video-viewer';
3
+ export interface IShortVideoStreamElementLocalization {
4
+ shortVideoViewerLocalization?: IShortVideoViewerLocalization | Locale;
5
+ }
6
+ export declare class ShortVideoStreamElementLocalization {
7
+ shortVideoViewerLocalization: IShortVideoViewerLocalization | Locale;
8
+ constructor(init: IShortVideoStreamElementLocalization | Locale);
9
+ }
@@ -0,0 +1,7 @@
1
+ import { isLocale } from '../../../core/locale';
2
+ export class ShortVideoStreamElementLocalization {
3
+ shortVideoViewerLocalization;
4
+ constructor(init) {
5
+ this.shortVideoViewerLocalization = isLocale(init) ? init : init.shortVideoViewerLocalization || 'en';
6
+ }
7
+ }
@@ -0,0 +1,8 @@
1
+ import { type Locale } from '../../../core/locale';
2
+ export interface IStockStreamElementLocalization {
3
+ quantity?: (value: number, low: boolean) => string;
4
+ }
5
+ export declare class StockStreamElementLocalization {
6
+ quantity: (value: number, low: boolean) => string;
7
+ constructor(init: IStockStreamElementLocalization | Locale);
8
+ }
@@ -0,0 +1,26 @@
1
+ import { isLocale } from '../../../core/locale';
2
+ export class StockStreamElementLocalization {
3
+ quantity;
4
+ constructor(init) {
5
+ this.quantity = isLocale(init) ? loc.quantity[init] : init.quantity || loc.quantity.en;
6
+ }
7
+ }
8
+ const loc = {
9
+ quantity: {
10
+ en: (value, low) => {
11
+ if (value === 0) {
12
+ return 'Out of stock';
13
+ }
14
+ const plusMark = low || value < 2 ? '' : '+';
15
+ const unit = value === 1 ? 'pc' : 'pcs';
16
+ return `${value}${plusMark} ${unit} in stock`;
17
+ },
18
+ no: (value, low) => {
19
+ if (value === 0) {
20
+ return 'Ikke på lager';
21
+ }
22
+ const plusMark = low || value < 2 ? '' : '+';
23
+ return `${value}${plusMark} stk. på lager`;
24
+ }
25
+ }
26
+ };
@@ -0,0 +1,15 @@
1
+ import { type Locale } from '../../../core/locale';
2
+ import type { IPriceStreamElementLocalization } from './price-stream-element-localization';
3
+ import type { IShortVideoStreamElementLocalization } from './short-video-stream-element-localization';
4
+ import type { IStockStreamElementLocalization } from './stock-stream-element-localization';
5
+ export interface IStreamElementLocalization {
6
+ priceElementLocalization?: IPriceStreamElementLocalization | Locale;
7
+ stockElementLocalization?: IStockStreamElementLocalization | Locale;
8
+ shortVideoElementLocalization?: IShortVideoStreamElementLocalization | Locale;
9
+ }
10
+ export declare class StreamElementLocalization {
11
+ priceElementLocalization: IPriceStreamElementLocalization | Locale;
12
+ stockElementLocalization: IStockStreamElementLocalization | Locale;
13
+ shortVideoElementLocalization: IShortVideoStreamElementLocalization | Locale;
14
+ constructor(init: IStreamElementLocalization | Locale);
15
+ }
@@ -0,0 +1,11 @@
1
+ import { isLocale } from '../../../core/locale';
2
+ export class StreamElementLocalization {
3
+ priceElementLocalization;
4
+ stockElementLocalization;
5
+ shortVideoElementLocalization;
6
+ constructor(init) {
7
+ this.priceElementLocalization = isLocale(init) ? init : init.priceElementLocalization || 'en';
8
+ this.stockElementLocalization = isLocale(init) ? init : init.stockElementLocalization || 'en';
9
+ this.shortVideoElementLocalization = isLocale(init) ? init : init.shortVideoElementLocalization || 'en';
10
+ }
11
+ }