@streamscloud/embeddable 3.2.2 → 3.2.4

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 (178) hide show
  1. package/dist/core/enums.d.ts +2 -0
  2. package/dist/core/enums.js +2 -0
  3. package/dist/core/graphql.d.ts +1 -3
  4. package/dist/core/graphql.js +3 -12
  5. package/dist/core/utils/html-helper.d.ts +0 -1
  6. package/dist/core/utils/html-helper.js +0 -4
  7. package/dist/products/price-helper.js +1 -1
  8. package/dist/short-videos/short-video-viewer/cmp.attachments-inline.svelte +1 -1
  9. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +2 -2
  10. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte.d.ts +2 -3
  11. package/dist/short-videos/short-video-viewer/cmp.product.svelte +1 -1
  12. package/dist/short-videos/short-video-viewer/cmp.product.svelte.d.ts +2 -3
  13. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte +1 -1
  14. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte.d.ts +2 -3
  15. package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte +2 -6
  16. package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte.d.ts +1 -1
  17. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +1 -1
  18. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +2 -3
  19. package/dist/short-videos/short-video-viewer/description.svelte +0 -5
  20. package/dist/short-videos/short-video-viewer/description.svelte.d.ts +1 -1
  21. package/dist/short-videos/short-video-viewer/index.d.ts +2 -4
  22. package/dist/short-videos/short-video-viewer/index.js +0 -1
  23. package/dist/short-videos/short-video-viewer/mapper.js +1 -2
  24. package/dist/short-videos/short-video-viewer/operations.generated.d.ts +0 -1
  25. package/dist/short-videos/short-video-viewer/operations.generated.js +0 -1
  26. package/dist/short-videos/short-video-viewer/operations.graphql +0 -1
  27. package/dist/short-videos/short-video-viewer/{short-video-attachments-localization.d.ts → short-video-attachments-localization.svelte.d.ts} +4 -5
  28. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.svelte.js +10 -0
  29. package/dist/short-videos/short-video-viewer/{short-video-details-localization.d.ts → short-video-details-localization.svelte.d.ts} +6 -7
  30. package/dist/short-videos/short-video-viewer/short-video-details-localization.svelte.js +10 -0
  31. package/dist/short-videos/short-video-viewer/{short-video-product-localization.d.ts → short-video-product-localization.svelte.d.ts} +1 -2
  32. package/dist/short-videos/short-video-viewer/short-video-product-localization.svelte.js +11 -0
  33. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.d.ts +13 -0
  34. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.js +10 -0
  35. package/dist/short-videos/short-video-viewer/types.d.ts +0 -1
  36. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +11 -88
  37. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +5 -5
  38. package/dist/short-videos/short-videos-player/controls.svelte +2 -2
  39. package/dist/short-videos/short-videos-player/controls.svelte.d.ts +1 -1
  40. package/dist/short-videos/short-videos-player/index.d.ts +14 -51
  41. package/dist/short-videos/short-videos-player/index.js +12 -83
  42. package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.d.ts +8 -0
  43. package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.js +6 -0
  44. package/dist/streams/layout/cmp.layout.svelte.d.ts +2 -4
  45. package/dist/streams/layout/cmp.slot-content.svelte +4 -4
  46. package/dist/streams/layout/cmp.slot-content.svelte.d.ts +1 -2
  47. package/dist/streams/layout/cmp.slot.svelte.d.ts +2 -7
  48. package/dist/streams/layout/component.d.ts +0 -2
  49. package/dist/streams/layout/element-views/cmp.container-stream-element.svelte +1 -1
  50. package/dist/streams/layout/element-views/cmp.container-stream-element.svelte.d.ts +3 -4
  51. package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte +2 -15
  52. package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte.d.ts +3 -7
  53. package/dist/streams/layout/element-views/cmp.images-stream-element.svelte +2 -2
  54. package/dist/streams/layout/element-views/cmp.price-stream-element.svelte +89 -15
  55. package/dist/streams/layout/element-views/cmp.price-stream-element.svelte.d.ts +4 -5
  56. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +2 -4
  57. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte.d.ts +0 -3
  58. package/dist/streams/layout/element-views/cmp.stream-element.svelte +17 -24
  59. package/dist/streams/layout/element-views/cmp.stream-element.svelte.d.ts +3 -4
  60. package/dist/streams/layout/element-views/cmp.text-ref-stream-element.svelte.d.ts +2 -2
  61. package/dist/streams/layout/element-views/cmp.text-stream-element.svelte +2 -6
  62. package/dist/streams/layout/element-views/cmp.text-stream-element.svelte.d.ts +0 -2
  63. package/dist/streams/layout/element-views/data-by-key-accessor.d.ts +3 -3
  64. package/dist/streams/layout/element-views/index.d.ts +11 -16
  65. package/dist/streams/layout/element-views/index.js +9 -12
  66. package/dist/streams/layout/element-views/price-stream-element-localization.svelte.d.ts +9 -0
  67. package/dist/streams/layout/element-views/price-stream-element-localization.svelte.js +8 -0
  68. package/dist/streams/layout/element-views/stream-element-localization.svelte.d.ts +8 -0
  69. package/dist/streams/layout/element-views/stream-element-localization.svelte.js +6 -0
  70. package/dist/streams/layout/elements.d.ts +12 -47
  71. package/dist/streams/layout/elements.js +1 -1
  72. package/dist/streams/layout/enums.d.ts +3 -34
  73. package/dist/streams/layout/enums.js +7 -46
  74. package/dist/streams/layout/index.d.ts +10 -3
  75. package/dist/streams/layout/index.js +2 -3
  76. package/dist/streams/layout/layout.d.ts +1 -2
  77. package/dist/streams/layout/models/index.d.ts +1 -1
  78. package/dist/streams/layout/models/mapper.js +1 -2
  79. package/dist/streams/layout/models/stream-layout-media-item-model.d.ts +1 -1
  80. package/dist/streams/layout/models/stream-layout-media-item-model.js +1 -1
  81. package/dist/streams/layout/models/stream-layout-post-header-model.d.ts +1 -1
  82. package/dist/streams/layout/models/stream-layout-product-model.d.ts +2 -1
  83. package/dist/streams/layout/models/stream-layout-short-video-model.d.ts +0 -4
  84. package/dist/streams/layout/serializer.d.ts +3 -0
  85. package/dist/streams/layout/serializer.js +6 -0
  86. package/dist/streams/layout/slot.d.ts +0 -2
  87. package/dist/streams/layout/styles-transformer.d.ts +2 -3
  88. package/dist/streams/layout/styles-transformer.js +30 -54
  89. package/dist/streams/layout/styles.d.ts +14 -24
  90. package/dist/streams/layout/type-guards.d.ts +0 -31
  91. package/dist/streams/layout/type-guards.js +1 -13
  92. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte +2 -4
  93. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte.d.ts +0 -3
  94. package/dist/streams/stream-page-viewer/index.d.ts +0 -1
  95. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.d.ts +13 -0
  96. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.js +10 -0
  97. package/dist/streams/stream-player/cmp.stream-player.svelte +7 -47
  98. package/dist/streams/stream-player/cmp.stream-player.svelte.d.ts +4 -6
  99. package/dist/streams/stream-player/controls.svelte +3 -46
  100. package/dist/streams/stream-player/controls.svelte.d.ts +1 -1
  101. package/dist/streams/stream-player/index.d.ts +4 -6
  102. package/dist/streams/stream-player/index.js +28 -15
  103. package/dist/streams/stream-player/operations.generated.d.ts +1 -1
  104. package/dist/streams/stream-player/operations.generated.js +3 -5
  105. package/dist/streams/stream-player/operations.graphql +3 -3
  106. package/dist/streams/stream-player/stream-overview.svelte +2 -2
  107. package/dist/streams/stream-player/stream-overview.svelte.d.ts +1 -1
  108. package/dist/streams/stream-player/stream-player-buffer.svelte.js +2 -2
  109. package/dist/streams/stream-player/stream-player-localization.svelte.d.ts +12 -0
  110. package/dist/streams/stream-player/stream-player-localization.svelte.js +10 -0
  111. package/dist/ui/icon/cmp.icon.svelte +26 -13
  112. package/dist/ui/line-clamp/cmp.line-clamp.svelte +2 -2
  113. package/dist/ui/line-clamp/cmp.line-clamp.svelte.d.ts +2 -3
  114. package/dist/ui/line-clamp/index.d.ts +1 -1
  115. package/dist/ui/line-clamp/index.js +1 -1
  116. package/dist/ui/line-clamp/{line-clamp-localization.d.ts → line-clamp-localization.svelte.d.ts} +1 -2
  117. package/dist/ui/line-clamp/line-clamp-localization.svelte.js +15 -0
  118. package/dist/ui/shadow-dom/shadow-host.d.ts +5 -1
  119. package/dist/ui/shadow-dom/shadow-host.js +14 -1
  120. package/dist/ui/time-ago/cmp.time-ago.svelte +1 -1
  121. package/dist/ui/time-ago/cmp.time-ago.svelte.d.ts +2 -3
  122. package/dist/ui/time-ago/index.d.ts +1 -1
  123. package/dist/ui/time-ago/{time-ago-localization.d.ts → time-ago-localization.svelte.d.ts} +1 -2
  124. package/dist/ui/time-ago/time-ago-localization.svelte.js +39 -0
  125. package/dist/ui/video/cmp.video.svelte +18 -42
  126. package/package.json +1 -1
  127. package/dist/core/analytics.profile-id.d.ts +0 -5
  128. package/dist/core/analytics.profile-id.js +0 -17
  129. package/dist/core/document.event-handlers.d.ts +0 -1
  130. package/dist/core/document.event-handlers.js +0 -5
  131. package/dist/core/locale.d.ts +0 -6
  132. package/dist/core/locale.js +0 -24
  133. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.js +0 -21
  134. package/dist/short-videos/short-video-viewer/short-video-details-localization.js +0 -17
  135. package/dist/short-videos/short-video-viewer/short-video-product-localization.js +0 -13
  136. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.d.ts +0 -14
  137. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.js +0 -17
  138. package/dist/short-videos/short-videos-player/operations.generated.d.ts +0 -65
  139. package/dist/short-videos/short-videos-player/operations.generated.js +0 -194
  140. package/dist/short-videos/short-videos-player/operations.graphql +0 -8
  141. package/dist/short-videos/short-videos-player/short-videos-player-localization.d.ts +0 -16
  142. package/dist/short-videos/short-videos-player/short-videos-player-localization.js +0 -13
  143. package/dist/short-videos/short-videos-player/types.d.ts +0 -36
  144. package/dist/short-videos/short-videos-player/types.js +0 -6
  145. package/dist/streams/layout/element-views/cmp.annotation-stream-element.svelte +0 -16
  146. package/dist/streams/layout/element-views/cmp.annotation-stream-element.svelte.d.ts +0 -7
  147. package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte +0 -74
  148. package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte.d.ts +0 -11
  149. package/dist/streams/layout/element-views/cmp.web-view-stream-element.svelte +0 -37
  150. package/dist/streams/layout/element-views/cmp.web-view-stream-element.svelte.d.ts +0 -7
  151. package/dist/streams/layout/element-views/price-element-view.svelte +0 -168
  152. package/dist/streams/layout/element-views/price-element-view.svelte.d.ts +0 -15
  153. package/dist/streams/layout/element-views/price-stream-element-localization.d.ts +0 -13
  154. package/dist/streams/layout/element-views/price-stream-element-localization.js +0 -21
  155. package/dist/streams/layout/element-views/short-video-stream-element-localization.d.ts +0 -9
  156. package/dist/streams/layout/element-views/short-video-stream-element-localization.js +0 -7
  157. package/dist/streams/layout/element-views/stock-stream-element-localization.d.ts +0 -8
  158. package/dist/streams/layout/element-views/stock-stream-element-localization.js +0 -26
  159. package/dist/streams/layout/element-views/stream-element-localization.d.ts +0 -15
  160. package/dist/streams/layout/element-views/stream-element-localization.js +0 -11
  161. package/dist/streams/layout/serializer.svelte.d.ts +0 -29
  162. package/dist/streams/layout/serializer.svelte.js +0 -93
  163. package/dist/streams/layout/slot-data-ref.d.ts +0 -13
  164. package/dist/streams/layout/slot-data-ref.js +0 -1
  165. package/dist/streams/layout/svg-attributes.d.ts +0 -7
  166. package/dist/streams/layout/svg-attributes.js +0 -8
  167. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.d.ts +0 -9
  168. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.js +0 -7
  169. package/dist/streams/stream-player/stream-player-localization.d.ts +0 -26
  170. package/dist/streams/stream-player/stream-player-localization.js +0 -31
  171. package/dist/ui/line-clamp/line-clamp-localization.js +0 -19
  172. package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte +0 -125
  173. package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte.d.ts +0 -9
  174. package/dist/ui/swipe-indicator/index.d.ts +0 -2
  175. package/dist/ui/swipe-indicator/index.js +0 -1
  176. package/dist/ui/swipe-indicator/swipe-indicator-localization.d.ts +0 -8
  177. package/dist/ui/swipe-indicator/swipe-indicator-localization.js +0 -13
  178. package/dist/ui/time-ago/time-ago-localization.js +0 -55
@@ -0,0 +1,10 @@
1
+ export class StreamPlayerLocalization {
2
+ streamNotFound = $state('Stream not found');
3
+ pagesCount = $state((count) => (count === 1 ? '1 page' : `${count} pages`));
4
+ shortVideoDetailsLocalization = $state(undefined);
5
+ constructor(init) {
6
+ this.streamNotFound = init?.streamNotFound || this.streamNotFound;
7
+ this.pagesCount = init?.pagesCount || this.pagesCount;
8
+ this.shortVideoDetailsLocalization = init?.shortVideoDetailsLocalization || this.shortVideoDetailsLocalization;
9
+ }
10
+ }
@@ -1,20 +1,34 @@
1
1
  <script lang="ts">import { IconColor } from './types';
2
+ import { inlineSvg } from '@svelte-put/inline-svg';
2
3
  let { src, color = null } = $props();
4
+ let svgRef;
5
+ $effect(() => {
6
+ if (svgRef && src) {
7
+ inlineSvg(svgRef, src);
8
+ }
9
+ });
10
+ const fillSvg = (node) => {
11
+ svgRef = node;
12
+ return inlineSvg(node, src);
13
+ };
3
14
  </script>
4
15
 
5
- {#if src?.startsWith('<svg')}
6
- <div
7
- class="icon"
8
- class:icon--white={color === IconColor.White}
9
- class:icon--text={color === IconColor.Text}
10
- class:icon--gray={color === IconColor.Gray}
11
- class:icon--green={color === IconColor.Green}
12
- class:icon--red={color === IconColor.Red}
13
- class:icon--orange={color === IconColor.Orange}
14
- class:icon--blue={color === IconColor.Blue}>
16
+ <div
17
+ class="icon"
18
+ style="display: contents"
19
+ class:icon--white={color === IconColor.White}
20
+ class:icon--text={color === IconColor.Text}
21
+ class:icon--gray={color === IconColor.Gray}
22
+ class:icon--green={color === IconColor.Green}
23
+ class:icon--red={color === IconColor.Red}
24
+ class:icon--orange={color === IconColor.Orange}
25
+ class:icon--blue={color === IconColor.Blue}>
26
+ {#if src.startsWith('<svg')}
15
27
  {@html src}
16
- </div>
17
- {/if}
28
+ {:else}
29
+ <svg use:fillSvg></svg>
30
+ {/if}
31
+ </div>
18
32
 
19
33
  <style>@keyframes fadeIn {
20
34
  0% {
@@ -31,7 +45,6 @@ let { src, color = null } = $props();
31
45
  --_icon--color: var(--icon--color);
32
46
  --_icon--size: var(--icon--size, 1.25em);
33
47
  --_icon--stroke-width: var(--icon--stroke-width, 0);
34
- display: contents;
35
48
  }
36
49
  .icon--white {
37
50
  --_icon--color: #ffffff;
@@ -1,8 +1,8 @@
1
- <script lang="ts">import { LineClampLocalization } from './line-clamp-localization';
1
+ <script lang="ts">import { LineClampLocalization } from './line-clamp-localization.svelte';
2
2
  import { LineClampUtils } from './line-clamp-utils';
3
3
  import { onDestroy, onMount } from 'svelte';
4
4
  let { value = undefined, maxLines = 3, localization: localizationInit, enableShowMore = false, children } = $props();
5
- const localization = $derived(new LineClampLocalization(localizationInit !== null && localizationInit !== void 0 ? localizationInit : 'en'));
5
+ const localization = $derived(new LineClampLocalization(localizationInit));
6
6
  let parent;
7
7
  let element;
8
8
  let clampWrapperRef;
@@ -1,11 +1,10 @@
1
- import type { Locale } from '../../core/locale';
2
- import { type ILineClampLocalization } from './line-clamp-localization';
1
+ import { type ILineClampLocalization } from './line-clamp-localization.svelte';
3
2
  import { type Snippet } from 'svelte';
4
3
  type Props = {
5
4
  value?: string | null;
6
5
  maxLines?: number | 'auto';
7
6
  enableShowMore?: boolean;
8
- localization?: ILineClampLocalization | Locale;
7
+ localization?: ILineClampLocalization;
9
8
  children?: Snippet;
10
9
  };
11
10
  declare const Cmp: import("svelte").Component<Props, {}, "">;
@@ -1,2 +1,2 @@
1
1
  export { default as LineClamp } from './cmp.line-clamp.svelte';
2
- export { type ILineClampLocalization } from './line-clamp-localization';
2
+ export { type ILineClampLocalization } from './line-clamp-localization.svelte';
@@ -1,2 +1,2 @@
1
1
  export { default as LineClamp } from './cmp.line-clamp.svelte';
2
- export {} from './line-clamp-localization';
2
+ export {} from './line-clamp-localization.svelte';
@@ -1,4 +1,3 @@
1
- import { type Locale } from '../../core/locale';
2
1
  export interface ILineClampLocalization {
3
2
  showLess?: string;
4
3
  showMore?: string;
@@ -6,5 +5,5 @@ export interface ILineClampLocalization {
6
5
  export declare class LineClampLocalization {
7
6
  showLess: string;
8
7
  showMore: string;
9
- constructor(init: ILineClampLocalization | Locale);
8
+ constructor(init?: ILineClampLocalization);
10
9
  }
@@ -0,0 +1,15 @@
1
+ export class LineClampLocalization {
2
+ showLess = $state('Show less');
3
+ showMore = $state('Show more');
4
+ constructor(init) {
5
+ if (!init) {
6
+ return;
7
+ }
8
+ if (init.showLess !== undefined) {
9
+ this.showLess = init.showLess;
10
+ }
11
+ if (init.showMore !== undefined) {
12
+ this.showMore = init.showMore;
13
+ }
14
+ }
15
+ }
@@ -1,7 +1,11 @@
1
1
  export declare class ShadowHost {
2
2
  shadowRoot: ShadowRoot;
3
3
  private host;
4
- constructor();
4
+ private callbacks;
5
+ constructor(init: {
6
+ onClosed: () => void;
7
+ });
5
8
  attachToBody(): void;
6
9
  remove(): void;
10
+ private handleEsc;
7
11
  }
@@ -3,7 +3,11 @@ import reset from './_reset.scss?raw';
3
3
  export class ShadowHost {
4
4
  shadowRoot;
5
5
  host;
6
- constructor() {
6
+ callbacks;
7
+ constructor(init) {
8
+ this.callbacks = {
9
+ onClosed: init.onClosed
10
+ };
7
11
  const host = document.createElement('div');
8
12
  host.style.all = 'unset';
9
13
  host.style.position = 'fixed';
@@ -15,6 +19,7 @@ export class ShadowHost {
15
19
  host.style.margin = '0';
16
20
  host.style.boxSizing = 'border-box';
17
21
  host.style.textAlign = 'initial';
22
+ document.addEventListener('keydown', this.handleEsc);
18
23
  this.host = host;
19
24
  this.shadowRoot = host.attachShadow({ mode: 'open' });
20
25
  const styleElement = document.createElement('style');
@@ -28,5 +33,13 @@ export class ShadowHost {
28
33
  remove() {
29
34
  this.host.remove();
30
35
  document.getElementsByTagName('html')[0].style.overflow = '';
36
+ document.removeEventListener('keydown', this.handleEsc);
37
+ this.callbacks.onClosed();
31
38
  }
39
+ handleEsc = (event) => {
40
+ if (event.key === 'Escape' || event.key === 'Esc') {
41
+ // Remove the modal from the DOM, for example:
42
+ this.remove();
43
+ }
44
+ };
32
45
  }
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">import { DateFormatOptions, DateHelper } from '../../core/utils/date-helper';
2
- import { TimeAgoLocalization } from './time-ago-localization';
2
+ import { TimeAgoLocalization } from './time-ago-localization.svelte';
3
3
  import { onDestroy } from 'svelte';
4
4
  let { date = null, thresholdMinutes = 60 * 24 * 2 /* 2 days */, localization: localizationInit } = $props();
5
5
  const localization = $derived(new TimeAgoLocalization(localizationInit));
@@ -1,9 +1,8 @@
1
- import type { Locale } from '../../core/locale';
2
- import { type ITimeAgoLocalization } from './time-ago-localization';
1
+ import { type ITimeAgoLocalization } from './time-ago-localization.svelte';
3
2
  type Props = {
4
3
  date: Date | string | null;
5
4
  thresholdMinutes?: number;
6
- localization: ITimeAgoLocalization | Locale;
5
+ localization?: ITimeAgoLocalization;
7
6
  };
8
7
  declare const Cmp: import("svelte").Component<Props, {}, "">;
9
8
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,2 +1,2 @@
1
1
  export { default as TimeAgo } from './cmp.time-ago.svelte';
2
- export type { ITimeAgoLocalization } from './time-ago-localization';
2
+ export type { ITimeAgoLocalization } from './time-ago-localization.svelte';
@@ -1,4 +1,3 @@
1
- import { type Locale } from '../../core/locale';
2
1
  export interface ITimeAgoLocalization {
3
2
  locale?: string;
4
3
  aMinuteAgo?: string;
@@ -18,5 +17,5 @@ export declare class TimeAgoLocalization {
18
17
  hoursAgo: (hours: number) => string;
19
18
  minutesAgo: (minutes: number) => string;
20
19
  yesterday: (time: string) => string;
21
- constructor(init: ITimeAgoLocalization | Locale);
20
+ constructor(init?: ITimeAgoLocalization);
22
21
  }
@@ -0,0 +1,39 @@
1
+ export class TimeAgoLocalization {
2
+ locale = $state('en-US');
3
+ aMinuteAgo = $state('a minute ago');
4
+ anHourAgo = $state('an hour ago');
5
+ justNow = $state('just now');
6
+ at = $state((date, time) => `${date} at ${time}`);
7
+ hoursAgo = $state((hours) => `${hours} hours ago`);
8
+ minutesAgo = $state((minutes) => `${minutes} minutes ago`);
9
+ yesterday = $state((time) => `esterday at ${time}`);
10
+ constructor(init) {
11
+ if (!init) {
12
+ return;
13
+ }
14
+ if (init.locale !== undefined) {
15
+ this.locale = init.locale;
16
+ }
17
+ if (init.aMinuteAgo !== undefined) {
18
+ this.aMinuteAgo = init.aMinuteAgo;
19
+ }
20
+ if (init.anHourAgo !== undefined) {
21
+ this.anHourAgo = init.anHourAgo;
22
+ }
23
+ if (init.justNow !== undefined) {
24
+ this.justNow = init.justNow;
25
+ }
26
+ if (init.at !== undefined) {
27
+ this.at = init.at;
28
+ }
29
+ if (init.hoursAgo !== undefined) {
30
+ this.hoursAgo = init.hoursAgo;
31
+ }
32
+ if (init.minutesAgo !== undefined) {
33
+ this.minutesAgo = init.minutesAgo;
34
+ }
35
+ if (init.yesterday !== undefined) {
36
+ this.yesterday = init.yesterday;
37
+ }
38
+ }
39
+ }
@@ -55,13 +55,8 @@ onMount(() => {
55
55
  }
56
56
  });
57
57
  onDestroy(() => {
58
- try {
59
- PlaybackManager.unregisterPlayer(id);
60
- intersectionObserver.disconnect();
61
- }
62
- catch (_a) {
63
- // ignore
64
- }
58
+ PlaybackManager.unregisterPlayer(id);
59
+ intersectionObserver.disconnect();
65
60
  });
66
61
  let video = $state.raw(undefined);
67
62
  let showControlsOnHover = $state(false);
@@ -159,7 +154,6 @@ const stop = () => {
159
154
  video.pause();
160
155
  video.currentTime = 0;
161
156
  video.load();
162
- onPause();
163
157
  };
164
158
  const togglePlay = (e) => {
165
159
  e === null || e === void 0 ? void 0 : e.stopPropagation();
@@ -240,7 +234,7 @@ const handleSeek = (percent) => {
240
234
  <div class="video" onmouseenter={() => setShowControlsOnHover(true)} onmouseleave={() => setShowControlsOnHover(false)} role="none" inert={inert}>
241
235
  <video
242
236
  class="video__video"
243
- class:video__video--not-activated={!everActivated}
237
+ style={everActivated ? `--_video--media-fit: contain;` : ''}
244
238
  width="100%"
245
239
  controls={controls && everActivated}
246
240
  poster={poster}
@@ -256,11 +250,8 @@ const handleSeek = (percent) => {
256
250
  bind:this={video}>
257
251
  <track src="" kind="captions" />
258
252
  </video>
259
- {#if !everActivated}
260
- <img class="video__poster" src={poster} alt="" />
261
- {/if}
262
253
  {#if !controls || !everActivated}
263
- <div class="video__overlay" onclick={togglePlay} onkeydown={() => ({})} role="none">
254
+ <div class="video__cover" onclick={togglePlay} onkeydown={() => ({})} role="none">
264
255
  {#if isVideoPaused}
265
256
  <button type="button" aria-label="play" class="video__playback-button" onclick={togglePlay} onkeydown={() => ({})}>
266
257
  <Icon src={IconPlay} color={IconColor.White} />
@@ -280,22 +271,20 @@ const handleSeek = (percent) => {
280
271
  </button>
281
272
  {/if}
282
273
 
283
- {#if everActivated}
284
- <div class="video__progress-container">
285
- {#if needShowProgress}
286
- {#if showControlsOnHover}
287
- <div class="video__seek-bar" onclick={(e) => e.stopPropagation()} onkeydown={() => ({})} role="none" transition:slide>
288
- <SeekBar value={percentageCompleted} on={{ seek: handleSeek }} />
289
- </div>
290
- {/if}
291
- {#if !showControlsOnHover}
292
- <div class="video__progress" in:slide>
293
- <Progress value={percentageCompleted} />
294
- </div>
295
- {/if}
274
+ <div class="video__progress-container">
275
+ {#if needShowProgress}
276
+ {#if showControlsOnHover}
277
+ <div class="video__seek-bar" onclick={(e) => e.stopPropagation()} onkeydown={() => ({})} role="none" transition:slide>
278
+ <SeekBar value={percentageCompleted} on={{ seek: handleSeek }} />
279
+ </div>
296
280
  {/if}
297
- </div>
298
- {/if}
281
+ {#if !showControlsOnHover}
282
+ <div class="video__progress" in:slide>
283
+ <Progress value={percentageCompleted} />
284
+ </div>
285
+ {/if}
286
+ {/if}
287
+ </div>
299
288
  </div>
300
289
  {/if}
301
290
  </div>
@@ -315,7 +304,6 @@ const handleSeek = (percent) => {
315
304
  --_video--background-color: var(--video--background-color, #000000);
316
305
  --_video--border-radius: var(--video--border-radius, 0);
317
306
  --_video--media-fit: var(--video--media-fit, contain);
318
- --_video--poster--media-fit: var(--video--poster--media-fit, cover);
319
307
  --_video--progress--background-color: var(--video--progress--background-color, hsla(0, 0%, 0%, 0.5));
320
308
  --_video--progress--back-color: var(--video--progress--back-color);
321
309
  --_video--progress--front-color: var(--video--progress--front-color);
@@ -353,13 +341,6 @@ const handleSeek = (percent) => {
353
341
  font-size: 1em;
354
342
  z-index: 1;
355
343
  }
356
- .video__poster {
357
- object-fit: var(--_video--poster--media-fit);
358
- min-width: 100%;
359
- min-height: 100%;
360
- max-width: 100%;
361
- max-height: 100%;
362
- }
363
344
  .video__video {
364
345
  object-fit: var(--_video--media-fit);
365
346
  min-width: 100%;
@@ -367,12 +348,7 @@ const handleSeek = (percent) => {
367
348
  max-width: 100%;
368
349
  max-height: 100%;
369
350
  }
370
- .video__video--not-activated {
371
- visibility: hidden;
372
- height: 0;
373
- min-height: 0;
374
- }
375
- .video__overlay {
351
+ .video__cover {
376
352
  position: absolute;
377
353
  left: 0;
378
354
  top: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/embeddable",
3
- "version": "3.2.2",
3
+ "version": "3.2.4",
4
4
  "author": "StreamsCloud",
5
5
  "repository": "https://github.com/StreamsCloud/streamscloud-frontend-packages.git",
6
6
  "type": "module",
@@ -1,5 +0,0 @@
1
- /**
2
- * Retrieves the profile ID from localStorage or generates a new one if it doesn't exist
3
- * @returns The profile ID to use for analytics tracking
4
- */
5
- export declare const getOrCreateProfileId: () => string;
@@ -1,17 +0,0 @@
1
- /**
2
- * Key used for storing the profile ID in local storage
3
- */
4
- const PROFILE_ID_STORAGE_KEY = 'streamscloud_profile_id';
5
- /**
6
- * Retrieves the profile ID from localStorage or generates a new one if it doesn't exist
7
- * @returns The profile ID to use for analytics tracking
8
- */
9
- export const getOrCreateProfileId = () => {
10
- const storedProfileId = localStorage.getItem(PROFILE_ID_STORAGE_KEY);
11
- if (!storedProfileId) {
12
- const newProfileId = crypto.randomUUID();
13
- localStorage.setItem(PROFILE_ID_STORAGE_KEY, newProfileId);
14
- return newProfileId;
15
- }
16
- return storedProfileId;
17
- };
@@ -1 +0,0 @@
1
- export declare const handleEsc: (event: KeyboardEvent, callback: () => void) => void;
@@ -1,5 +0,0 @@
1
- export const handleEsc = (event, callback) => {
2
- if (event.key === 'Escape' || event.key === 'Esc') {
3
- callback();
4
- }
5
- };
@@ -1,6 +0,0 @@
1
- export type Locale = 'en' | 'no';
2
- export declare const getLocale: <T>(input?: Locale | T) => Locale | T;
3
- export declare const isEn: <T>(input: Locale | T) => input is "en";
4
- export declare const isNo: <T>(input: Locale | T) => input is "no";
5
- export declare const isLocale: <T>(input: Locale | T) => input is Locale;
6
- export declare const isLocalizationInterface: <T>(input: Locale | T) => input is T;
@@ -1,24 +0,0 @@
1
- export const getLocale = (input) => {
2
- if (input === undefined || input === null) {
3
- return 'en';
4
- }
5
- switch (input) {
6
- case 'en':
7
- case 'no':
8
- return input;
9
- default:
10
- return input;
11
- }
12
- };
13
- export const isEn = (input) => {
14
- return input === 'en';
15
- };
16
- export const isNo = (input) => {
17
- return input === 'no';
18
- };
19
- export const isLocale = (input) => {
20
- return input === 'en' || input === 'no';
21
- };
22
- export const isLocalizationInterface = (input) => {
23
- return typeof input === 'object' && input !== null;
24
- };
@@ -1,21 +0,0 @@
1
- import { isLocale } from '../../core/locale';
2
- export class ShortVideoAttachmentsLocalization {
3
- productsSection;
4
- offersSection;
5
- productLocalization;
6
- constructor(init) {
7
- this.productsSection = isLocale(init) ? loc.productsSection[init] : init.productsSection || loc.productsSection.en;
8
- this.offersSection = isLocale(init) ? loc.offersSection[init] : init.offersSection || loc.offersSection.en;
9
- this.productLocalization = isLocale(init) ? init : init.productLocalization || 'en';
10
- }
11
- }
12
- const loc = {
13
- productsSection: {
14
- en: 'Products',
15
- no: 'Produkter'
16
- },
17
- offersSection: {
18
- en: 'Offers',
19
- no: 'Tilbud'
20
- }
21
- };
@@ -1,17 +0,0 @@
1
- import { isLocale } from '../../core/locale';
2
- export class ShortVideoDetailsLocalization {
3
- viewsCount;
4
- timeAgoLocalization;
5
- attachmentsLocalization;
6
- constructor(init) {
7
- this.viewsCount = isLocale(init) ? loc.viewsCount[init] : init.viewsCount || loc.viewsCount.en;
8
- this.timeAgoLocalization = isLocale(init) ? init : init.timeAgoLocalization || 'en';
9
- this.attachmentsLocalization = isLocale(init) ? init : init.attachmentsLocalization || 'en';
10
- }
11
- }
12
- const loc = {
13
- viewsCount: {
14
- en: (count) => (count === 1 ? '1 view' : `${count} views`),
15
- no: (count) => (count === 1 ? '1 visning' : `${count} visninger`)
16
- }
17
- };
@@ -1,13 +0,0 @@
1
- import { isLocale } from '../../core/locale';
2
- export class ShortVideoProductLocalization {
3
- beforeNowPrefix;
4
- constructor(init) {
5
- this.beforeNowPrefix = isLocale(init) ? loc.beforeNowPrefix[init] : init?.beforeNowPrefix || loc.beforeNowPrefix.en;
6
- }
7
- }
8
- const loc = {
9
- beforeNowPrefix: {
10
- en: 'Before',
11
- no: 'Før'
12
- }
13
- };
@@ -1,14 +0,0 @@
1
- import { type Locale } from '../../core/locale';
2
- import type { ITimeAgoLocalization } from '../../ui/time-ago';
3
- import type { IShortVideoProductLocalization } from './short-video-product-localization';
4
- export interface IShortVideoViewerLocalization {
5
- viewsCount?: (count: number) => string;
6
- timeAgoLocalization?: ITimeAgoLocalization | Locale;
7
- productLocalization?: IShortVideoProductLocalization | Locale;
8
- }
9
- export declare class ShortVideoViewerLocalization {
10
- viewsCount: (count: number) => string;
11
- timeAgoLocalization: ITimeAgoLocalization | Locale;
12
- productLocalization: IShortVideoProductLocalization | Locale;
13
- constructor(init: IShortVideoViewerLocalization | Locale);
14
- }
@@ -1,17 +0,0 @@
1
- import { isLocale } from '../../core/locale';
2
- export class ShortVideoViewerLocalization {
3
- viewsCount;
4
- timeAgoLocalization;
5
- productLocalization;
6
- constructor(init) {
7
- this.viewsCount = isLocale(init) ? loc.viewsCount[init] : init.viewsCount || loc.viewsCount.en;
8
- this.timeAgoLocalization = isLocale(init) ? init : init.timeAgoLocalization || 'en';
9
- this.productLocalization = isLocale(init) ? init : init.productLocalization || 'en';
10
- }
11
- }
12
- const loc = {
13
- viewsCount: {
14
- en: (count) => (count === 1 ? '1 view' : `${count} views`),
15
- no: (count) => (count === 1 ? '1 visning' : `${count} visninger`)
16
- }
17
- };
@@ -1,65 +0,0 @@
1
- import type * as SchemaTypes from '../../../gql/types';
2
- import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
3
- export type GetShortVideosQueryVariables = SchemaTypes.Exact<{
4
- input: SchemaTypes.EmbedPostsInput;
5
- image_scale?: SchemaTypes.InputMaybe<SchemaTypes.ImageScale>;
6
- }>;
7
- export type GetShortVideosQuery = {
8
- shortVideos: {
9
- items: Array<{
10
- id: string;
11
- enableSocialInteractions: boolean;
12
- postHeading: {
13
- sourceImage: string | null;
14
- sourceName: string;
15
- postDisplayDate: any;
16
- postViewsCount: number;
17
- };
18
- allProducts: Array<{
19
- title: string;
20
- id: string;
21
- link: string | null;
22
- shortDescription: string | null;
23
- media: Array<{
24
- url: string;
25
- thumbnailUrl: string | null;
26
- type: SchemaTypes.MediaType;
27
- }>;
28
- priceAndAvailability: {
29
- currency: SchemaTypes.Currency;
30
- price: number;
31
- productSalePrices: Array<{
32
- salePrice: number;
33
- salePriceEffectiveDateFrom: any | null;
34
- salePriceEffectiveDateTo: any | null;
35
- }> | null;
36
- };
37
- }>;
38
- ad: {
39
- id: string;
40
- title: string;
41
- description: string | null;
42
- buttonText: string | null;
43
- buttonUrl: string | null;
44
- openLinkInNewWindow: boolean | null;
45
- type: SchemaTypes.AdType;
46
- media: Array<{
47
- url: string;
48
- thumbnailUrl: string | null;
49
- type: SchemaTypes.MediaType;
50
- }>;
51
- } | null;
52
- postData: {
53
- media: Array<{
54
- url: string;
55
- thumbnailUrl: string | null;
56
- type: SchemaTypes.MediaType;
57
- }>;
58
- shortVideoData: {
59
- text: string | null;
60
- } | null;
61
- };
62
- }>;
63
- };
64
- };
65
- export declare const GetShortVideosDocument: DocumentNode<GetShortVideosQuery, GetShortVideosQueryVariables>;