@streamscloud/embeddable 3.2.1 → 3.2.3

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 -5
  24. package/dist/short-videos/short-video-viewer/operations.generated.d.ts +0 -4
  25. package/dist/short-videos/short-video-viewer/operations.generated.js +0 -6
  26. package/dist/short-videos/short-video-viewer/operations.graphql +0 -4
  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 -4
  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 -5
  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 -68
  139. package/dist/short-videos/short-videos-player/operations.generated.js +0 -199
  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
@@ -1,4 +1,6 @@
1
1
  export declare enum PostSourceType {
2
+ Channel = "CHANNEL",
3
+ Group = "GROUP",
2
4
  MediaPage = "MEDIA_PAGE",
3
5
  Organization = "ORGANIZATION",
4
6
  UserProfile = "USER_PROFILE"
@@ -1,5 +1,7 @@
1
1
  export var PostSourceType;
2
2
  (function (PostSourceType) {
3
+ PostSourceType["Channel"] = "CHANNEL";
4
+ PostSourceType["Group"] = "GROUP";
3
5
  PostSourceType["MediaPage"] = "MEDIA_PAGE";
4
6
  PostSourceType["Organization"] = "ORGANIZATION";
5
7
  PostSourceType["UserProfile"] = "USER_PROFILE";
@@ -1,3 +1 @@
1
- export declare const createLocalGQLClient: (graphqlOrigin?: string, headers?: HeadersInit, customFetch?: typeof fetch) => import("@urql/core").Client;
2
- export declare const resolveGraphQLOrigin: (origin?: string) => string;
3
- export declare const constructGraphQLUrl: (graphqlOrigin?: string) => string;
1
+ export declare const createLocalGQLClient: (graphqlUrl: string, customFetch?: typeof fetch) => import("@urql/core").Client;
@@ -1,19 +1,10 @@
1
1
  import { createClient, fetchExchange } from '@urql/core';
2
- export const createLocalGQLClient = (graphqlOrigin, headers, customFetch) => createClient({
3
- url: constructGraphQLUrl(resolveGraphQLOrigin(graphqlOrigin)),
2
+ export const createLocalGQLClient = (graphqlUrl, customFetch) => createClient({
3
+ url: graphqlUrl,
4
4
  requestPolicy: 'network-only',
5
5
  fetchOptions: {
6
- credentials: 'include',
7
- headers: headers
6
+ credentials: 'include'
8
7
  },
9
8
  fetch: customFetch || fetch,
10
9
  exchanges: [fetchExchange]
11
10
  });
12
- export const resolveGraphQLOrigin = (origin) => {
13
- return origin || 'https://api.streamscloud.com';
14
- };
15
- export const constructGraphQLUrl = (graphqlOrigin) => {
16
- let baseUrl = resolveGraphQLOrigin(graphqlOrigin);
17
- baseUrl = baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`;
18
- return `${baseUrl}external/graphql`;
19
- };
@@ -36,6 +36,5 @@ export declare class HtmlHelper {
36
36
  * DomHelper.insert(siblingElement, newContentField, false);
37
37
  */
38
38
  static insert(newElement: Element, siblingElement: Element, insertBefore?: boolean): void;
39
- static sanitizeSvg(svg: string): string;
40
39
  static pasteIntoInput(value: string, element: HTMLInputElement | HTMLTextAreaElement): void;
41
40
  }
@@ -1,4 +1,3 @@
1
- import dp from 'dompurify';
2
1
  export class HtmlHelper {
3
2
  static clearSelection() {
4
3
  if (window.getSelection) {
@@ -71,9 +70,6 @@ export class HtmlHelper {
71
70
  HtmlHelper.insertAfter(newElement, siblingElement);
72
71
  }
73
72
  }
74
- static sanitizeSvg(svg) {
75
- return dp.sanitize(svg, { USE_PROFILES: { svg: true, svgFilters: true }, ADD_ATTR: ['dominant-baseline'] });
76
- }
77
73
  static pasteIntoInput(value, element) {
78
74
  if (element.selectionStart || element.selectionStart === 0) {
79
75
  const startPos = element.selectionStart;
@@ -20,7 +20,7 @@ export const toPriceRepresentation = (amount, currency, includeCurrency = true)
20
20
  }
21
21
  case Currency.Usd: {
22
22
  const value = formatNumber(amount);
23
- return includeCurrency ? `$ ${value}` : value;
23
+ return includeCurrency ? `€ ${value}` : value;
24
24
  }
25
25
  default: {
26
26
  Utils.assertUnreachable(currency);
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">import { Icon, IconColor } from '../../ui/icon';
2
2
  import { ImageRounded } from '../../ui/image';
3
- import IconTargetArrow from '@fluentui/svg-icons/icons/target_arrow_20_regular.svg?raw';
3
+ import IconTargetArrow from '@fluentui/svg-icons/icons/target_arrow_20_regular.svg';
4
4
  let { model } = $props();
5
5
  const attachmentsToShow = $derived.by(() => {
6
6
  const products = model.products.filter((p) => !!p.image).map((p) => ({ isAd: false, image: p.image, link: p.link }));
@@ -1,9 +1,9 @@
1
1
  <script lang="ts">import { default as ShortVideoAdViewer } from './cmp.ad.svelte';
2
2
  import { default as ShortVideoProductViewer } from './cmp.product.svelte';
3
- import { ShortVideoAttachmentsLocalization } from './short-video-attachments-localization';
3
+ import { ShortVideoAttachmentsLocalizationSvelte } from './short-video-attachments-localization.svelte';
4
4
  import {} from './types';
5
5
  let { shortVideo, localization: localizationInit, on } = $props();
6
- const localization = $derived(new ShortVideoAttachmentsLocalization(localizationInit));
6
+ const localization = $derived(new ShortVideoAttachmentsLocalizationSvelte(localizationInit));
7
7
  </script>
8
8
 
9
9
  {#if shortVideo.products.length || shortVideo.ad}
@@ -1,9 +1,8 @@
1
- import type { Locale } from '../../core/locale';
2
- import { type IShortVideoAttachmentsLocalization } from './short-video-attachments-localization';
1
+ import { type IShortVideoAttachmentsLocalization } from './short-video-attachments-localization.svelte';
3
2
  import { type ShortVideoViewerModel } from './types';
4
3
  type Props = {
5
4
  shortVideo: ShortVideoViewerModel;
6
- localization: IShortVideoAttachmentsLocalization | Locale;
5
+ localization?: IShortVideoAttachmentsLocalization;
7
6
  on?: {
8
7
  productClick?: (productId: string) => void;
9
8
  };
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">import { toPriceRepresentation } from '../../products/price-helper';
2
2
  import { ImageRounded } from '../../ui/image';
3
3
  import { ProportionalContainer } from '../../ui/proportional-container';
4
- import { ShortVideoProductLocalization } from './short-video-product-localization';
4
+ import { ShortVideoProductLocalization } from './short-video-product-localization.svelte';
5
5
  let { product, fitToContainer = false, localization: localizationInit, on } = $props();
6
6
  const localization = $derived(new ShortVideoProductLocalization(localizationInit));
7
7
  const handleProductClick = (event) => {
@@ -1,10 +1,9 @@
1
- import type { Locale } from '../../core/locale';
2
- import { type IShortVideoProductLocalization } from './short-video-product-localization';
1
+ import { type IShortVideoProductLocalization } from './short-video-product-localization.svelte';
3
2
  import type { ShortVideoViewerProductModel } from './types';
4
3
  type Props = {
5
4
  product: ShortVideoViewerProductModel;
6
5
  fitToContainer?: boolean;
7
- localization: IShortVideoProductLocalization | Locale;
6
+ localization?: IShortVideoProductLocalization;
8
7
  on?: {
9
8
  productClick?: (productId: string) => void;
10
9
  };
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">import { slideHorizontally } from '../../core/transitions';
2
2
  import { default as ShortVideoAttachments } from './cmp.attachments.svelte';
3
3
  import { default as ShortVideoHeading } from './cmp.short-video-heading.svelte';
4
- import { ShortVideoDetailsLocalization } from './short-video-details-localization';
4
+ import { ShortVideoDetailsLocalization } from './short-video-details-localization.svelte';
5
5
  import {} from './types';
6
6
  let { shortVideo, collapsed, localization: localizationInit, on } = $props();
7
7
  const localization = $derived(new ShortVideoDetailsLocalization(localizationInit));
@@ -1,10 +1,9 @@
1
- import type { Locale } from '../../core/locale';
2
- import { type IShortVideoDetailsLocalization } from './short-video-details-localization';
1
+ import { type IShortVideoDetailsLocalization } from './short-video-details-localization.svelte';
3
2
  import { type ShortVideoViewerModel } from './types';
4
3
  type Props = {
5
4
  shortVideo: ShortVideoViewerModel;
6
5
  collapsed: boolean;
7
- localization: IShortVideoDetailsLocalization | Locale;
6
+ localization?: IShortVideoDetailsLocalization;
8
7
  on?: {
9
8
  productClick?: (productId: string) => void;
10
9
  };
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">import { ImageRound } from '../../ui/image';
2
2
  import { TimeAgo } from '../../ui/time-ago';
3
- import { ShortVideoViewerLocalization } from './short-video-viewer-localization';
3
+ import { ShortVideoViewerLocalization } from './short-video-viewer-localization.svelte';
4
4
  let { model, localization: localizationInit } = $props();
5
5
  const localization = $derived(new ShortVideoViewerLocalization(localizationInit));
6
6
  </script>
@@ -14,7 +14,7 @@ const localization = $derived(new ShortVideoViewerLocalization(localizationInit)
14
14
  <div class="short-video-heading__source-name">{model.name}</div>
15
15
  <p class="short-video-heading__metadata">
16
16
  <TimeAgo date={model.displayDate} localization={localization.timeAgoLocalization} />
17
- {#if Number.isInteger(model.viewsCount) && model.viewsCount}
17
+ {#if Number.isInteger(model.viewsCount)}
18
18
  <span>&middot;</span>
19
19
  {localization.viewsCount(model.viewsCount)}
20
20
  {/if}
@@ -36,9 +36,7 @@ const localization = $derived(new ShortVideoViewerLocalization(localizationInit)
36
36
  .short-video-heading {
37
37
  --_short-video-heading--container--font-size: var(--short-video-heading--container--font-size, 1em);
38
38
  --_short-video-heading--text--color: var(--short-video-heading--text--color, #374151);
39
- --_short-video-heading--text--shadow: var(--short-video-heading--text--shadow, 1px 1px hsl(0, 0%, 10%));
40
39
  --_short-video-heading--meta--color: var(--short-video-heading--meta--color, #6b7280);
41
- --_short-video-heading--meta--shadow: var(--short-video-heading--meta--shadow, 1px 1px hsl(0, 0%, 10%));
42
40
  --_short-video-heading--padding: var(--short-video-heading--padding, 0);
43
41
  display: flex;
44
42
  align-items: center;
@@ -68,7 +66,6 @@ const localization = $derived(new ShortVideoViewerLocalization(localizationInit)
68
66
  line-height: 1.25em;
69
67
  font-weight: 500;
70
68
  color: var(--_short-video-heading--text--color);
71
- text-shadow: var(--_short-video-heading--text--shadow);
72
69
  text-overflow: ellipsis;
73
70
  width: 100%;
74
71
  white-space: nowrap;
@@ -83,7 +80,6 @@ const localization = $derived(new ShortVideoViewerLocalization(localizationInit)
83
80
  line-height: 1.2em;
84
81
  font-weight: 400;
85
82
  color: var(--_short-video-heading--meta--color);
86
- text-shadow: var(--_short-video-heading--meta--shadow);
87
83
  }
88
84
  :global([data-theme="dark"]) .short-video-heading__metadata {
89
85
  --_short-video-heading--meta--color: var(--short-video-heading--meta--color, #d1d5db);
@@ -1,4 +1,4 @@
1
- import { type IShortVideoViewerLocalization } from './short-video-viewer-localization';
1
+ import { type IShortVideoViewerLocalization } from './short-video-viewer-localization.svelte';
2
2
  import type { ShortVideoViewerHeadingModel } from './types';
3
3
  type Props = {
4
4
  model: ShortVideoViewerHeadingModel;
@@ -2,7 +2,7 @@
2
2
  import { Video } from '../../ui/video';
3
3
  import { default as AttachmentsInline } from './cmp.attachments-inline.svelte';
4
4
  import { default as ShortVideoDescription } from './description.svelte';
5
- import { ShortVideoViewerLocalization } from './short-video-viewer-localization';
5
+ import { ShortVideoViewerLocalization } from './short-video-viewer-localization.svelte';
6
6
  import { ShortVideoViewerUiManager } from './ui-manager.svelte';
7
7
  let { model, availableSideSpace = 0, showAttachments = true, autoplay = 'on-appearance', localization: localizationInit, on } = $props();
8
8
  const localization = $derived(new ShortVideoViewerLocalization(localizationInit));
@@ -1,12 +1,11 @@
1
- import type { Locale } from '../../core/locale';
2
- import { type IShortVideoViewerLocalization } from './short-video-viewer-localization';
1
+ import { type IShortVideoViewerLocalization } from './short-video-viewer-localization.svelte';
3
2
  import type { ShortVideoViewerModel } from './types';
4
3
  type Props = {
5
4
  model: ShortVideoViewerModel;
6
5
  availableSideSpace?: number;
7
6
  showAttachments?: boolean;
8
7
  autoplay?: true | false | 'on-appearance';
9
- localization: IShortVideoViewerLocalization | Locale;
8
+ localization?: IShortVideoViewerLocalization;
10
9
  on?: {
11
10
  progress?: (progress: number) => void;
12
11
  };
@@ -27,9 +27,7 @@ let { model, localization } = $props();
27
27
  }
28
28
  .short-video-description {
29
29
  --_short-video-viewer--description--font--primary-color: var(--short-video-viewer--description--font--primary-color);
30
- --_short-video-viewer--description--font--primary-shadow: var(--short-video-viewer--description--font--primary-shadow, 1px 1px hsl(0, 0%, 10%));
31
30
  --_short-video-viewer--description--font--secondary-color: var(--short-video-viewer--description--font--secondary-color);
32
- --_short-video-viewer--description--font--secondary-shadow: var(--short-video-viewer--description--font--secondary-shadow, 1px 1px hsl(0, 0%, 10%));
33
31
  display: flex;
34
32
  flex-direction: column;
35
33
  padding-top: 0.75rem;
@@ -37,13 +35,10 @@ let { model, localization } = $props();
37
35
  .short-video-description__heading {
38
36
  --short-video-heading--padding: 0 0 0.875rem 0;
39
37
  --short-video-heading--text--color: var(--_short-video-viewer--description--font--primary-color);
40
- --short-video-heading--text--shadow: var(--_short-video-viewer--description--font--primary-shadow);
41
38
  --short-video-heading--meta--color: var(--_short-video-viewer--description--font--secondary-color);
42
- --short-video-heading--meta--shadow: var(--_short-video-viewer--description--font--secondary-shadow);
43
39
  }
44
40
  .short-video-description__text {
45
41
  color: var(--_short-video-viewer--description--font--primary-color);
46
- text-shadow: var(--_short-video-viewer--description--font--primary-shadow);
47
42
  font-size: 0.9375rem;
48
43
  line-height: 1.25rem;
49
44
  font-weight: 400;
@@ -1,4 +1,4 @@
1
- import type { ShortVideoViewerLocalization } from './short-video-viewer-localization';
1
+ import type { ShortVideoViewerLocalization } from './short-video-viewer-localization.svelte';
2
2
  import type { ShortVideoViewerModel } from './types';
3
3
  type Props = {
4
4
  model: ShortVideoViewerModel;
@@ -5,7 +5,5 @@ export { default as ShortVideoViewerAttachments } from './cmp.attachments.svelte
5
5
  export { default as ShortVideoViewerAttachmentsInline } from './cmp.attachments-inline.svelte';
6
6
  export { default as ShortVideoDetails } from './cmp.short-video-details.svelte';
7
7
  export type { ShortVideoViewerModel, ShortVideoViewerAdModel, ShortVideoViewerProductModel } from './types';
8
- export type { IShortVideoViewerLocalization } from './short-video-viewer-localization';
9
- export type { IShortVideoDetailsLocalization } from './short-video-details-localization';
10
- export type { IShortVideoAttachmentsLocalization } from './short-video-attachments-localization';
11
- export { mapShortVideoViewerModel } from './mapper';
8
+ export type { IShortVideoViewerLocalization } from './short-video-viewer-localization.svelte';
9
+ export type { IShortVideoDetailsLocalization } from './short-video-details-localization.svelte';
@@ -4,4 +4,3 @@ export { default as ShortVideoProductViewer } from './cmp.product.svelte';
4
4
  export { default as ShortVideoViewerAttachments } from './cmp.attachments.svelte';
5
5
  export { default as ShortVideoViewerAttachmentsInline } from './cmp.attachments-inline.svelte';
6
6
  export { default as ShortVideoDetails } from './cmp.short-video-details.svelte';
7
- export { mapShortVideoViewerModel } from './mapper';
@@ -51,10 +51,6 @@ const mapToShortVideoViewerProductModel = (payload) => {
51
51
  link: payload.link,
52
52
  currency: payload.priceAndAvailability.currency,
53
53
  price: payload.priceAndAvailability.price,
54
- salePrice: effectiveSalePrice?.salePrice ?? null,
55
- brand: {
56
- name: payload.brand?.name ?? null
57
- },
58
- shortDescription: payload.shortDescription ?? null
54
+ salePrice: effectiveSalePrice?.salePrice ?? null
59
55
  };
60
56
  };
@@ -13,15 +13,11 @@ export type ShortVideoViewerPayloadFragment = {
13
13
  title: string;
14
14
  id: string;
15
15
  link: string | null;
16
- shortDescription: string | null;
17
16
  media: Array<{
18
17
  url: string;
19
18
  thumbnailUrl: string | null;
20
19
  type: SchemaTypes.MediaType;
21
20
  }>;
22
- brand: {
23
- name: string;
24
- } | null;
25
21
  priceAndAvailability: {
26
22
  currency: SchemaTypes.Currency;
27
23
  price: number;
@@ -44,12 +44,6 @@ export const ShortVideoViewerPayloadFragmentDoc = {
44
44
  { kind: 'Field', name: { kind: 'Name', value: 'title' } },
45
45
  { kind: 'Field', name: { kind: 'Name', value: 'id' } },
46
46
  { kind: 'Field', name: { kind: 'Name', value: 'link' } },
47
- { kind: 'Field', name: { kind: 'Name', value: 'shortDescription' } },
48
- {
49
- kind: 'Field',
50
- name: { kind: 'Name', value: 'brand' },
51
- selectionSet: { kind: 'SelectionSet', selections: [{ kind: 'Field', name: { kind: 'Name', value: 'name' } }] }
52
- },
53
47
  {
54
48
  kind: 'Field',
55
49
  name: { kind: 'Name', value: 'priceAndAvailability' },
@@ -16,10 +16,6 @@ fragment ShortVideoViewerPayloadFragment on Post {
16
16
  title
17
17
  id
18
18
  link
19
- shortDescription
20
- brand {
21
- name
22
- }
23
19
  priceAndAvailability {
24
20
  currency
25
21
  price
@@ -1,13 +1,12 @@
1
- import { type Locale } from '../../core/locale';
2
- import type { IShortVideoProductLocalization } from './short-video-product-localization';
1
+ import type { IShortVideoProductLocalization } from './short-video-product-localization.svelte';
3
2
  export interface IShortVideoAttachmentsLocalization {
4
3
  productsSection?: string;
5
4
  offersSection?: string;
6
5
  productLocalization?: IShortVideoProductLocalization;
7
6
  }
8
- export declare class ShortVideoAttachmentsLocalization {
7
+ export declare class ShortVideoAttachmentsLocalizationSvelte {
9
8
  productsSection: string;
10
9
  offersSection: string;
11
- productLocalization: IShortVideoProductLocalization | Locale;
12
- constructor(init: IShortVideoAttachmentsLocalization | Locale);
10
+ productLocalization: IShortVideoProductLocalization | undefined;
11
+ constructor(init?: IShortVideoAttachmentsLocalization);
13
12
  }
@@ -0,0 +1,10 @@
1
+ export class ShortVideoAttachmentsLocalizationSvelte {
2
+ productsSection = $state('Products');
3
+ offersSection = $state('Offers');
4
+ productLocalization = $state(undefined);
5
+ constructor(init) {
6
+ this.productsSection = init?.productsSection || this.productsSection;
7
+ this.offersSection = init?.offersSection || this.offersSection;
8
+ this.productLocalization = init?.productLocalization;
9
+ }
10
+ }
@@ -1,14 +1,13 @@
1
- import { type Locale } from '../../core/locale';
2
1
  import type { ITimeAgoLocalization } from '../../ui/time-ago';
3
- import type { IShortVideoAttachmentsLocalization } from './short-video-attachments-localization';
2
+ import type { IShortVideoAttachmentsLocalization } from './short-video-attachments-localization.svelte';
4
3
  export interface IShortVideoDetailsLocalization {
5
4
  viewsCount?: (count: number) => string;
6
- timeAgoLocalization?: ITimeAgoLocalization | Locale;
7
- attachmentsLocalization?: IShortVideoAttachmentsLocalization | Locale;
5
+ timeAgoLocalization?: ITimeAgoLocalization;
6
+ attachmentsLocalization?: IShortVideoAttachmentsLocalization;
8
7
  }
9
8
  export declare class ShortVideoDetailsLocalization {
10
9
  viewsCount: (count: number) => string;
11
- timeAgoLocalization: ITimeAgoLocalization | Locale;
12
- attachmentsLocalization: IShortVideoAttachmentsLocalization | Locale;
13
- constructor(init: IShortVideoDetailsLocalization | Locale);
10
+ timeAgoLocalization: ITimeAgoLocalization | undefined;
11
+ attachmentsLocalization: IShortVideoAttachmentsLocalization | undefined;
12
+ constructor(init?: IShortVideoDetailsLocalization);
14
13
  }
@@ -0,0 +1,10 @@
1
+ export class ShortVideoDetailsLocalization {
2
+ viewsCount = $state((count) => (count === 1 ? '1 view' : `${count} views`));
3
+ timeAgoLocalization = $state(undefined);
4
+ attachmentsLocalization = $state(undefined);
5
+ constructor(init) {
6
+ this.viewsCount = init?.viewsCount ? init.viewsCount : this.viewsCount;
7
+ this.timeAgoLocalization = init?.timeAgoLocalization;
8
+ this.attachmentsLocalization = init?.attachmentsLocalization;
9
+ }
10
+ }
@@ -1,8 +1,7 @@
1
- import { type Locale } from '../../core/locale';
2
1
  export interface IShortVideoProductLocalization {
3
2
  beforeNowPrefix?: string | null;
4
3
  }
5
4
  export declare class ShortVideoProductLocalization {
6
5
  beforeNowPrefix: string | null;
7
- constructor(init: IShortVideoProductLocalization | Locale);
6
+ constructor(init?: IShortVideoProductLocalization);
8
7
  }
@@ -0,0 +1,11 @@
1
+ export class ShortVideoProductLocalization {
2
+ beforeNowPrefix = $state('Before');
3
+ constructor(init) {
4
+ if (!init) {
5
+ return;
6
+ }
7
+ if (init.beforeNowPrefix !== undefined) {
8
+ this.beforeNowPrefix = init.beforeNowPrefix;
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,13 @@
1
+ import type { ITimeAgoLocalization } from '../../ui/time-ago';
2
+ import type { IShortVideoProductLocalization } from './short-video-product-localization.svelte';
3
+ export interface IShortVideoViewerLocalization {
4
+ viewsCount?: (count: number) => string;
5
+ timeAgoLocalization?: ITimeAgoLocalization;
6
+ productLocalization?: IShortVideoProductLocalization;
7
+ }
8
+ export declare class ShortVideoViewerLocalization {
9
+ viewsCount: (count: number) => string;
10
+ timeAgoLocalization: ITimeAgoLocalization | undefined;
11
+ productLocalization: IShortVideoProductLocalization | undefined;
12
+ constructor(init?: IShortVideoViewerLocalization);
13
+ }
@@ -0,0 +1,10 @@
1
+ export class ShortVideoViewerLocalization {
2
+ viewsCount = $state((count) => (count === 1 ? '1 view' : `${count} views`));
3
+ timeAgoLocalization = $state(undefined);
4
+ productLocalization = $state(undefined);
5
+ constructor(init) {
6
+ this.viewsCount = init?.viewsCount ? init.viewsCount : this.viewsCount;
7
+ this.timeAgoLocalization = init?.timeAgoLocalization;
8
+ this.productLocalization = init?.productLocalization;
9
+ }
10
+ }
@@ -37,8 +37,4 @@ export type ShortVideoViewerProductModel = {
37
37
  price: number;
38
38
  currency: Currency;
39
39
  salePrice: number | null;
40
- brand?: {
41
- name?: string | null;
42
- };
43
- shortDescription?: string | null;
44
40
  };
@@ -7,121 +7,44 @@
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { handleEsc } from '../../core/document.event-handlers';
11
- import { createLocalGQLClient } from '../../core/graphql';
12
- import { mapShortVideoViewerModel, ShortVideoViewer } from '../short-video-viewer';
13
- import { Loading } from '../../ui/loading';
10
+ import { ShortVideoViewer } from '../short-video-viewer';
14
11
  import { PlayerBuffer, PlayerSlider } from '../../ui/player';
15
12
  import { SpotlightLayout } from '../../ui/spotlight-layout';
16
- import { SwipeIndicator } from '../../ui/swipe-indicator';
17
13
  import { default as Controls } from './controls.svelte';
18
- import { GetShortVideosDocument } from './operations.generated';
19
- import { ShortVideosPlayerLocalization } from './short-videos-player-localization';
14
+ import { ShortVideosPlayerLocalization } from './short-videos-player-localization.svelte';
20
15
  import { ShortVideosPlayerUiManager } from './ui-manager.svelte';
21
- import { onMount, untrack } from 'svelte';
22
- let { input, localization: localizationInit, on } = $props();
16
+ import { onDestroy, onMount } from 'svelte';
17
+ let { shortVideosProvider, localization: localizationInit, on } = $props();
23
18
  const localization = $derived(new ShortVideosPlayerLocalization(localizationInit));
24
- let everTouched = $state(false);
25
- let buffer = $state(input.type === 'provider' ? new PlayerBuffer(input.provider) : null);
26
- $effect(() => {
27
- if (input.type !== 'ids') {
28
- return;
29
- }
30
- untrack(() => {
31
- initBuffer(input);
32
- });
33
- });
34
- const initBuffer = (input) => __awaiter(void 0, void 0, void 0, function* () {
35
- var _a, _b;
36
- try {
37
- const { graphqlOrigin, ids, initialId } = input;
38
- const graphql = createLocalGQLClient(graphqlOrigin, { 'x-initiator': input.initiator || 'player/short-videos' });
39
- const payload = yield graphql
40
- .query(GetShortVideosDocument, {
41
- input: {
42
- filter: {
43
- ids
44
- }
45
- }
46
- })
47
- .toPromise();
48
- const posts = ((_b = (_a = payload.data) === null || _a === void 0 ? void 0 : _a.shortVideos) === null || _b === void 0 ? void 0 : _b.items) || [];
49
- const idOrder = new Map(ids.map((id, index) => [id, index]));
50
- posts.sort((a, b) => {
51
- var _a, _b;
52
- return ((_a = idOrder.get(a.id)) !== null && _a !== void 0 ? _a : Infinity) - ((_b = idOrder.get(b.id)) !== null && _b !== void 0 ? _b : Infinity);
53
- });
54
- const index = initialId ? posts.findIndex((p) => p.id === initialId) : 0;
55
- const provider = {
56
- initialData: {
57
- prefetchedItems: posts.map(mapShortVideoViewerModel),
58
- startIndex: index
59
- },
60
- loadMore: () => __awaiter(void 0, void 0, void 0, function* () {
61
- // No more items to load, as all are already prefetched
62
- return [];
63
- })
64
- };
65
- buffer = new PlayerBuffer(provider);
66
- }
67
- catch (_c) {
68
- console.error('Failed to load short videos by IDs:', input.ids);
69
- buffer = null; // Reset buffer on error
70
- }
71
- });
19
+ const buffer = $derived(new PlayerBuffer(shortVideosProvider));
72
20
  const uiManager = new ShortVideosPlayerUiManager();
73
21
  onMount(() => __awaiter(void 0, void 0, void 0, function* () {
74
22
  uiManager.detailsCollapsed = window && window.innerWidth < window.innerHeight;
75
23
  }));
76
- const contentMounted = (node) => {
77
- const markAsTouched = () => {
78
- everTouched = true;
79
- node.removeEventListener('touchstart', markAsTouched);
80
- node.removeEventListener('wheel', markAsTouched);
81
- node.removeEventListener('click', markAsTouched);
82
- node.removeEventListener('keypress', markAsTouched);
83
- };
84
- node.addEventListener('touchstart', markAsTouched);
85
- node.addEventListener('wheel', markAsTouched);
86
- node.addEventListener('click', markAsTouched);
87
- node.addEventListener('keypress', markAsTouched);
88
- };
24
+ onDestroy(() => {
25
+ // end tracking the short video
26
+ });
89
27
  const handleDimensionsChanged = (dimensions) => {
90
28
  uiManager.updateDimensions({
91
29
  mainViewColumnWidth: dimensions.mainSceneWidth,
92
30
  viewTotalWidth: dimensions.totalWidth
93
31
  });
94
32
  };
95
- const onPlayerClose = () => {
96
- var _a;
97
- (_a = on === null || on === void 0 ? void 0 : on.closePlayer) === null || _a === void 0 ? void 0 : _a.call(on);
98
- };
99
33
  </script>
100
34
 
101
- <svelte:document onkeydown={(e) => handleEsc(e, onPlayerClose)} />
102
-
103
35
  <div class="short-videos-player-container">
104
36
  <div class="short-videos-player" style={uiManager.globalCssVariables}>
105
37
  {#if buffer}
106
38
  <SpotlightLayout ratio={9 / 16} on={{ dimensionsChanged: handleDimensionsChanged }}>
107
- <div class="short-videos-player__content" use:contentMounted>
39
+ <div class="short-videos-player__content">
108
40
  <PlayerSlider buffer={buffer}>
109
41
  {#snippet children({ item })}
110
- <ShortVideoViewer
111
- model={item}
112
- autoplay="on-appearance"
113
- showAttachments={uiManager.showShortVideoOverlay}
114
- localization={localization.shortVideoViewerLocalization} />
42
+ <ShortVideoViewer model={item} autoplay="on-appearance" showAttachments={uiManager.showShortVideoOverlay} />
115
43
  {/snippet}
116
44
  </PlayerSlider>
117
- {#if uiManager.isMobileView && buffer.loaded.length > 1 && !everTouched}
118
- <SwipeIndicator localization={localization.swipeIndicatorLocalization} />
119
- {/if}
120
45
  </div>
121
46
  </SpotlightLayout>
122
- <Controls buffer={buffer} uiManager={uiManager} localization={localization} on={{ closePlayer: () => onPlayerClose() }} />
123
- {:else}
124
- <Loading positionFixedCenter={true} timeout={1000} />
47
+ <Controls buffer={buffer} uiManager={uiManager} localization={localization} on={{ closePlayer: () => on?.closePlayer?.() }} />
125
48
  {/if}
126
49
  </div>
127
50
  </div>
@@ -1,9 +1,9 @@
1
- import type { Locale } from '../../core/locale';
2
- import { type IShortVideosPlayerLocalization } from './short-videos-player-localization';
3
- import type { PlayerInput } from './types';
1
+ import { type ShortVideoViewerModel } from '../short-video-viewer';
2
+ import { type PlayerItemsProvider } from '../../ui/player';
3
+ import { type IShortVideosPlayerLocalization } from './short-videos-player-localization.svelte';
4
4
  type Props = {
5
- input: PlayerInput;
6
- localization: IShortVideosPlayerLocalization | Locale;
5
+ shortVideosProvider: PlayerItemsProvider<ShortVideoViewerModel>;
6
+ localization?: IShortVideosPlayerLocalization;
7
7
  on?: {
8
8
  closePlayer?: () => void;
9
9
  };