@streamscloud/embeddable 2.1.0 → 2.1.2

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 (21) hide show
  1. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +2 -2
  2. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte.d.ts +3 -0
  3. package/dist/short-videos/short-video-viewer/cmp.product.svelte +14 -2
  4. package/dist/short-videos/short-video-viewer/cmp.product.svelte.d.ts +3 -0
  5. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte +2 -2
  6. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte.d.ts +3 -0
  7. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +2 -2
  8. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +3 -0
  9. package/dist/streams/layout/cmp.slot-content.svelte +2 -2
  10. package/dist/streams/layout/cmp.slot-content.svelte.d.ts +4 -0
  11. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +2 -2
  12. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte.d.ts +3 -0
  13. package/dist/streams/layout/element-views/cmp.stream-element.svelte +10 -2
  14. package/dist/streams/layout/element-views/cmp.stream-element.svelte.d.ts +4 -0
  15. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte +2 -2
  16. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte.d.ts +4 -0
  17. package/dist/streams/stream-player/cmp.stream-player.svelte +17 -2
  18. package/dist/streams/stream-player/cmp.stream-player.svelte.d.ts +2 -0
  19. package/dist/streams/stream-player/controls.svelte +7 -1
  20. package/dist/streams/stream-player/controls.svelte.d.ts +1 -0
  21. package/package.json +1 -1
@@ -2,7 +2,7 @@
2
2
  import { default as ShortVideoProductViewer } from './cmp.product.svelte';
3
3
  import { ShortVideoAttachmentsLocalizationSvelte } from './short-video-attachments-localization.svelte';
4
4
  import {} from './types';
5
- let { shortVideo, localization: localizationInit } = $props();
5
+ let { shortVideo, localization: localizationInit, on } = $props();
6
6
  const localization = $derived(new ShortVideoAttachmentsLocalizationSvelte(localizationInit));
7
7
  </script>
8
8
 
@@ -12,7 +12,7 @@ const localization = $derived(new ShortVideoAttachmentsLocalizationSvelte(locali
12
12
  <div class="short-video-attachments__section-header">{localization.productsSection}</div>
13
13
  <div class="short-video-attachments__products">
14
14
  {#each shortVideo.products as product (product.id)}
15
- <ShortVideoProductViewer product={product} localization={localization.productLocalization} />
15
+ <ShortVideoProductViewer product={product} localization={localization.productLocalization} on={on} />
16
16
  {/each}
17
17
  </div>
18
18
  {/if}
@@ -3,6 +3,9 @@ import { type ShortVideoViewerModel } from './types';
3
3
  type Props = {
4
4
  shortVideo: ShortVideoViewerModel;
5
5
  localization?: IShortVideoAttachmentsLocalization;
6
+ on?: {
7
+ productClick?: (productId: string) => void;
8
+ };
6
9
  };
7
10
  declare const Cmp: import("svelte").Component<Props, {}, "">;
8
11
  type Cmp = ReturnType<typeof Cmp>;
@@ -2,8 +2,19 @@
2
2
  import { ImageRounded } from '../../ui/image';
3
3
  import { ProportionalContainer } from '../../ui/proportional-container';
4
4
  import { ShortVideoProductLocalization } from './short-video-product-localization.svelte';
5
- let { product, fitToContainer = false, localization: localizationInit } = $props();
5
+ let { product, fitToContainer = false, localization: localizationInit, on } = $props();
6
6
  const localization = $derived(new ShortVideoProductLocalization(localizationInit));
7
+ const handleProductClick = (event) => {
8
+ if (!product.link) {
9
+ return;
10
+ }
11
+ event.preventDefault();
12
+ event.stopPropagation();
13
+ if (on === null || on === void 0 ? void 0 : on.productClick) {
14
+ on.productClick(product.id);
15
+ }
16
+ window.open(product.link, '_blank', 'noopener noreferrer');
17
+ };
7
18
  </script>
8
19
 
9
20
  <div class="short-video-product-viewer">
@@ -36,7 +47,8 @@ const localization = $derived(new ShortVideoProductLocalization(localizationInit
36
47
  </div>
37
48
 
38
49
  {#if product.link}
39
- <a href={product.link} target="_blank" rel="noopener noreferrer" class="short-video-product-viewer__link" aria-label="none">&nbsp;</a>
50
+ <a href={product.link} onclick={handleProductClick} target="_blank" rel="noopener noreferrer" class="short-video-product-viewer__link" aria-label="none"
51
+ >&nbsp;</a>
40
52
  {/if}
41
53
  </div>
42
54
 
@@ -4,6 +4,9 @@ type Props = {
4
4
  product: ShortVideoViewerProductModel;
5
5
  fitToContainer?: boolean;
6
6
  localization?: IShortVideoProductLocalization;
7
+ on?: {
8
+ productClick?: (productId: string) => void;
9
+ };
7
10
  };
8
11
  declare const Cmp: import("svelte").Component<Props, {}, "">;
9
12
  type Cmp = ReturnType<typeof Cmp>;
@@ -3,7 +3,7 @@ import { default as ShortVideoAttachments } from './cmp.attachments.svelte';
3
3
  import { default as ShortVideoHeading } from './cmp.short-video-heading.svelte';
4
4
  import { ShortVideoDetailsLocalization } from './short-video-details-localization.svelte';
5
5
  import {} from './types';
6
- let { shortVideo, collapsed, localization: localizationInit } = $props();
6
+ let { shortVideo, collapsed, localization: localizationInit, on } = $props();
7
7
  const localization = $derived(new ShortVideoDetailsLocalization(localizationInit));
8
8
  </script>
9
9
 
@@ -26,7 +26,7 @@ const localization = $derived(new ShortVideoDetailsLocalization(localizationInit
26
26
 
27
27
  <div class="short-video-details__section-splitter"></div>
28
28
 
29
- <ShortVideoAttachments shortVideo={shortVideo} localization={localization.attachmentsLocalization} />
29
+ <ShortVideoAttachments shortVideo={shortVideo} localization={localization.attachmentsLocalization} on={on} />
30
30
  </div>
31
31
  </div>
32
32
  {/if}
@@ -4,6 +4,9 @@ type Props = {
4
4
  shortVideo: ShortVideoViewerModel;
5
5
  collapsed: boolean;
6
6
  localization?: IShortVideoDetailsLocalization;
7
+ on?: {
8
+ productClick?: (productId: string) => void;
9
+ };
7
10
  };
8
11
  declare const Cmp: import("svelte").Component<Props, {}, "">;
9
12
  type Cmp = ReturnType<typeof Cmp>;
@@ -4,7 +4,7 @@ import { default as AttachmentsInline } from './cmp.attachments-inline.svelte';
4
4
  import { default as ShortVideoDescription } from './description.svelte';
5
5
  import { ShortVideoViewerLocalization } from './short-video-viewer-localization.svelte';
6
6
  import { ShortVideoViewerUiManager } from './ui-manager.svelte';
7
- let { model, availableSideSpace = 0, showAttachments = true, autoplay = 'on-appearance', localization: localizationInit } = $props();
7
+ let { model, availableSideSpace = 0, showAttachments = true, autoplay = 'on-appearance', localization: localizationInit, on } = $props();
8
8
  const localization = $derived(new ShortVideoViewerLocalization(localizationInit));
9
9
  let actionsPanelRef = $state.raw(null);
10
10
  const uiManager = new ShortVideoViewerUiManager();
@@ -32,7 +32,7 @@ $effect(() => {
32
32
  <div class="short-video-viewer" style={uiManager.globalCssVariables}>
33
33
  <div class="short-video-viewer__media">
34
34
  {#if !model.media.isImage}
35
- <Video controls={false} autoplay={autoplay} src={model.media.url} loop={true} poster={model.media.thumbnailUrl} id={model.id} />
35
+ <Video controls={false} autoplay={autoplay} src={model.media.url} loop={true} poster={model.media.thumbnailUrl} id={model.id} on={on} />
36
36
  {:else}
37
37
  <Image src={model.media.url} />
38
38
  {/if}
@@ -6,6 +6,9 @@ type Props = {
6
6
  showAttachments?: boolean;
7
7
  autoplay?: true | false | 'on-appearance';
8
8
  localization?: IShortVideoViewerLocalization;
9
+ on?: {
10
+ progress?: (progress: number) => void;
11
+ };
9
12
  };
10
13
  declare const Cmp: import("svelte").Component<Props, {}, "">;
11
14
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">import { Utils } from '../../core/utils';
2
2
  import { StreamElement } from './element-views';
3
3
  import { StreamComponentDataType } from './enums';
4
- let { model, localization } = $props();
4
+ let { model, localization, on } = $props();
5
5
  const component = $derived.by(() => {
6
6
  return model.components.find((c) => { var _a; return c.dataType === ((_a = model.data) === null || _a === void 0 ? void 0 : _a.type); });
7
7
  });
@@ -27,6 +27,6 @@ const dataIsFilled = $derived.by(() => {
27
27
 
28
28
  {#if component && model.data && dataIsFilled}
29
29
  {#each component.elements as element (element)}
30
- <StreamElement model={element} data={model.data} localization={localization} />
30
+ <StreamElement model={element} data={model.data} localization={localization} on={on} />
31
31
  {/each}
32
32
  {/if}
@@ -3,6 +3,10 @@ import type { StreamSlot } from './slot';
3
3
  type Props = {
4
4
  model: StreamSlot;
5
5
  localization?: IStreamElementLocalization;
6
+ on?: {
7
+ productClick: (productId: string) => void;
8
+ progress?: (videoId: string, progress: number) => void;
9
+ };
6
10
  };
7
11
  declare const Cmp: import("svelte").Component<Props, {}, "">;
8
12
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">import { ShortVideoViewer } from '../../../short-videos/short-video-viewer';
2
2
  import { mapToShortVideoViewerModel } from '../models';
3
- let { data } = $props();
3
+ let { data, on } = $props();
4
4
  </script>
5
5
 
6
- <ShortVideoViewer model={mapToShortVideoViewerModel(data)} autoplay={false} />
6
+ <ShortVideoViewer model={mapToShortVideoViewerModel(data)} autoplay={false} on={on} />
@@ -1,6 +1,9 @@
1
1
  import { type StreamLayoutShortVideoModel } from '../models';
2
2
  type Props = {
3
3
  data: StreamLayoutShortVideoModel;
4
+ on?: {
5
+ progress?: (progress: number) => void;
6
+ };
4
7
  };
5
8
  declare const Cmp: import("svelte").Component<Props, {}, "">;
6
9
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">import { ContainerStreamElement, ImageRefStreamElement, ImagesStreamElement, PriceStreamElement, ShortVideoStreamElement, SpacerStreamElement, TextRefStreamElement, TextStreamElement } from '.';
2
2
  import { StreamElementLocalization } from './stream-element-localization.svelte';
3
3
  import { StreamComponentDataType, StreamElementStyleDirection, StreamElementType } from '../enums';
4
- let { model, data, constainerDirection = StreamElementStyleDirection.Vertical, localization: localizatoinInit } = $props();
4
+ let { model, data, constainerDirection = StreamElementStyleDirection.Vertical, localization: localizatoinInit, on } = $props();
5
5
  const localization = $derived(new StreamElementLocalization(localizatoinInit));
6
6
  const shortVideoModel = $derived.by(() => {
7
7
  if (!data) {
@@ -52,7 +52,15 @@ const productModel = $derived.by(() => {
52
52
  {:else if model.type === StreamElementType.Price && productModel}
53
53
  <PriceStreamElement model={model} data={productModel} localization={localization.priceElementLocalization} />
54
54
  {:else if model.type === StreamElementType.ShortVideo && shortVideoModel}
55
- <ShortVideoStreamElement data={shortVideoModel} />
55
+ <ShortVideoStreamElement
56
+ data={shortVideoModel}
57
+ on={on
58
+ ? {
59
+ progress: (progress: number) => {
60
+ on.progress?.(shortVideoModel.id, progress);
61
+ }
62
+ }
63
+ : undefined} />
56
64
  {:else if model.type === StreamElementType.Text}
57
65
  <TextStreamElement model={model} />
58
66
  {:else if model.type === StreamElementType.TextRef}
@@ -7,6 +7,10 @@ type Props = {
7
7
  data: StreamSlotData;
8
8
  constainerDirection?: StreamElementStyleDirection;
9
9
  localization?: IStreamElementLocalization;
10
+ on?: {
11
+ productClick: (productId: string) => void;
12
+ progress?: (videoId: string, progress: number) => void;
13
+ };
10
14
  };
11
15
  declare const Cmp: import("svelte").Component<Props, {}, "">;
12
16
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,12 +1,12 @@
1
1
  <script lang="ts">import { StreamLayoutSlot, StreamPageLayout, StreamLayoutSlotContent } from '../layout';
2
- let { page } = $props();
2
+ let { page, on } = $props();
3
3
  </script>
4
4
 
5
5
  {#if page.type === 'general'}
6
6
  <StreamPageLayout model={page.layout}>
7
7
  {#each page.layout.slots as slot (slot)}
8
8
  <StreamLayoutSlot model={slot}>
9
- <StreamLayoutSlotContent model={slot} />
9
+ <StreamLayoutSlotContent model={slot} on={on} />
10
10
  </StreamLayoutSlot>
11
11
  {/each}
12
12
  </StreamPageLayout>
@@ -1,6 +1,10 @@
1
1
  import type { StreamPageViewerModel } from './types';
2
2
  type Props = {
3
3
  page: StreamPageViewerModel;
4
+ on?: {
5
+ productClick: (productId: string) => void;
6
+ progress?: (videoId: string, progress: number) => void;
7
+ };
4
8
  };
5
9
  declare const Cmp: import("svelte").Component<Props, {}, "">;
6
10
  type Cmp = ReturnType<typeof Cmp>;
@@ -82,10 +82,18 @@ const handleDimensionsChanged = (dimensions) => {
82
82
  <PlayerSlider buffer={buffer}>
83
83
  {#snippet children({ item })}
84
84
  {#if item.type === 'general'}
85
- <StreamPageViewer page={item} />
85
+ <StreamPageViewer
86
+ page={item}
87
+ on={{
88
+ progress: (videoId: string, progress: number) => on?.progress?.(videoId, progress),
89
+ productClick: (productId: string) => on?.productClick?.(productId)
90
+ }} />
86
91
  {:else if item.type === 'short-video'}
87
92
  <ShortVideoViewer
88
93
  model={mapToShortVideoViewerModel(item.shortVideo)}
94
+ on={{
95
+ progress: (progress: number) => on?.progress?.(item.id, progress)
96
+ }}
89
97
  autoplay="on-appearance"
90
98
  showAttachments={uiManager.showShortVideoOverlay} />
91
99
  {/if}
@@ -102,7 +110,14 @@ const handleDimensionsChanged = (dimensions) => {
102
110
  localization={localization}
103
111
  on={{ setCurrentItem: handleChangePage }} />
104
112
  {/if}
105
- <Controls buffer={buffer} uiManager={uiManager} localization={localization} on={{ closePlayer: () => on?.closePlayer?.() }} />
113
+ <Controls
114
+ buffer={buffer}
115
+ uiManager={uiManager}
116
+ localization={localization}
117
+ on={{
118
+ closePlayer: () => on?.closePlayer?.(),
119
+ productClick: (productId: string) => on?.productClick?.(productId)
120
+ }} />
106
121
  {/if}
107
122
  </div>
108
123
  </div>
@@ -10,6 +10,8 @@ type Props = {
10
10
  title: string;
11
11
  image: string | null;
12
12
  }) => void;
13
+ productClick?: (productId: string) => void;
14
+ progress?: (videoId: string, progress: number) => void;
13
15
  };
14
16
  };
15
17
  declare const Cmp: import("svelte").Component<Props, {}, "">;
@@ -63,7 +63,13 @@ const shortVideo = $derived(((_a = buffer.current) === null || _a === void 0 ? v
63
63
  </div>
64
64
 
65
65
  {#if shortVideo && (!uiManager.isMobileView || uiManager.overviewCollapsed)}
66
- <ShortVideoDetails shortVideo={shortVideo} collapsed={uiManager.shortVideoDetailsCollapsed} localization={localization.shortVideoDetailsLocalization} />
66
+ <ShortVideoDetails
67
+ shortVideo={shortVideo}
68
+ collapsed={uiManager.shortVideoDetailsCollapsed}
69
+ localization={localization.shortVideoDetailsLocalization}
70
+ on={{
71
+ productClick: on.productClick
72
+ }} />
67
73
  <div class="toggle-collapsed-button">
68
74
  <ActionButton on={{ click: () => (uiManager.shortVideoDetailsCollapsed = !uiManager.shortVideoDetailsCollapsed) }}>
69
75
  <Icon src={IconPanelRightGallery} />
@@ -7,6 +7,7 @@ type Props = {
7
7
  localization: StreamPlayerLocalization;
8
8
  on: {
9
9
  closePlayer: () => void;
10
+ productClick?: (productId: string) => void;
10
11
  };
11
12
  };
12
13
  declare const Controls: import("svelte").Component<Props, {}, "">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/embeddable",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "author": "StreamsCloud",
5
5
  "repository": "https://github.com/StreamsCloud/streamscloud-frontend-packages.git",
6
6
  "type": "module",