@streamscloud/embeddable 2.4.2 → 2.6.0
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.
- package/dist/core/enums.d.ts +0 -2
- package/dist/core/enums.js +0 -2
- package/dist/core/locale.d.ts +6 -0
- package/dist/core/locale.js +24 -0
- package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +2 -2
- package/dist/short-videos/short-video-viewer/cmp.attachments.svelte.d.ts +3 -2
- package/dist/short-videos/short-video-viewer/cmp.product.svelte +1 -1
- package/dist/short-videos/short-video-viewer/cmp.product.svelte.d.ts +3 -2
- package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte +1 -1
- package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte.d.ts +3 -2
- package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte +1 -1
- package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte.d.ts +1 -1
- package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +1 -1
- package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +3 -2
- package/dist/short-videos/short-video-viewer/description.svelte.d.ts +1 -1
- package/dist/short-videos/short-video-viewer/index.d.ts +3 -2
- package/dist/short-videos/short-video-viewer/{short-video-attachments-localization.svelte.d.ts → short-video-attachments-localization.d.ts} +5 -4
- package/dist/short-videos/short-video-viewer/short-video-attachments-localization.js +21 -0
- package/dist/short-videos/short-video-viewer/{short-video-details-localization.svelte.d.ts → short-video-details-localization.d.ts} +7 -6
- package/dist/short-videos/short-video-viewer/short-video-details-localization.js +17 -0
- package/dist/short-videos/short-video-viewer/{short-video-product-localization.svelte.d.ts → short-video-product-localization.d.ts} +2 -1
- package/dist/short-videos/short-video-viewer/short-video-product-localization.js +13 -0
- package/dist/short-videos/short-video-viewer/short-video-viewer-localization.d.ts +14 -0
- package/dist/short-videos/short-video-viewer/short-video-viewer-localization.js +17 -0
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +7 -3
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +3 -2
- package/dist/short-videos/short-videos-player/controls.svelte +2 -2
- package/dist/short-videos/short-videos-player/controls.svelte.d.ts +1 -1
- package/dist/short-videos/short-videos-player/index.d.ts +1 -1
- package/dist/short-videos/short-videos-player/index.js +2 -1
- package/dist/short-videos/short-videos-player/short-videos-player-localization.d.ts +16 -0
- package/dist/short-videos/short-videos-player/short-videos-player-localization.js +13 -0
- package/dist/short-videos/short-videos-player/types.d.ts +3 -3
- package/dist/streams/layout/cmp.slot-content.svelte.d.ts +2 -1
- package/dist/streams/layout/element-views/cmp.container-stream-element.svelte +1 -1
- package/dist/streams/layout/element-views/cmp.container-stream-element.svelte.d.ts +3 -2
- package/dist/streams/layout/element-views/cmp.price-stream-element.svelte +50 -29
- package/dist/streams/layout/element-views/cmp.price-stream-element.svelte.d.ts +3 -2
- package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +4 -2
- package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte.d.ts +3 -0
- package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte +74 -0
- package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte.d.ts +11 -0
- package/dist/streams/layout/element-views/cmp.stream-element.svelte +10 -7
- package/dist/streams/layout/element-views/cmp.stream-element.svelte.d.ts +3 -2
- package/dist/streams/layout/element-views/cmp.text-stream-element.svelte +6 -2
- package/dist/streams/layout/element-views/cmp.text-stream-element.svelte.d.ts +2 -0
- package/dist/streams/layout/element-views/index.d.ts +5 -2
- package/dist/streams/layout/element-views/index.js +1 -0
- package/dist/streams/layout/element-views/price-stream-element-localization.d.ts +13 -0
- package/dist/streams/layout/element-views/price-stream-element-localization.js +21 -0
- package/dist/streams/layout/element-views/short-video-stream-element-localization.d.ts +9 -0
- package/dist/streams/layout/element-views/short-video-stream-element-localization.js +7 -0
- package/dist/streams/layout/element-views/stock-stream-element-localization.d.ts +8 -0
- package/dist/streams/layout/element-views/stock-stream-element-localization.js +26 -0
- package/dist/streams/layout/element-views/stream-element-localization.d.ts +15 -0
- package/dist/streams/layout/element-views/stream-element-localization.js +11 -0
- package/dist/streams/layout/elements.d.ts +14 -3
- package/dist/streams/layout/elements.js +1 -1
- package/dist/streams/layout/enums.d.ts +8 -1
- package/dist/streams/layout/enums.js +9 -1
- package/dist/streams/layout/serializer.svelte.js +7 -0
- package/dist/streams/layout/styles.d.ts +4 -0
- package/dist/streams/layout/type-guards.d.ts +4 -2
- package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte +4 -2
- package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte.d.ts +3 -0
- package/dist/streams/stream-page-viewer/index.d.ts +1 -0
- package/dist/streams/stream-page-viewer/stream-page-viewer-localization.d.ts +9 -0
- package/dist/streams/stream-page-viewer/stream-page-viewer-localization.js +7 -0
- package/dist/streams/stream-player/cmp.stream-player.svelte +4 -2
- package/dist/streams/stream-player/cmp.stream-player.svelte.d.ts +3 -2
- package/dist/streams/stream-player/controls.svelte +46 -3
- package/dist/streams/stream-player/controls.svelte.d.ts +1 -1
- package/dist/streams/stream-player/index.d.ts +2 -2
- package/dist/streams/stream-player/index.js +2 -1
- package/dist/streams/stream-player/stream-overview.svelte +2 -2
- package/dist/streams/stream-player/stream-overview.svelte.d.ts +1 -1
- package/dist/streams/stream-player/stream-player-localization.d.ts +26 -0
- package/dist/streams/stream-player/stream-player-localization.js +31 -0
- package/dist/ui/line-clamp/cmp.line-clamp.svelte +2 -2
- package/dist/ui/line-clamp/cmp.line-clamp.svelte.d.ts +3 -2
- package/dist/ui/line-clamp/index.d.ts +1 -1
- package/dist/ui/line-clamp/index.js +1 -1
- package/dist/ui/line-clamp/{line-clamp-localization.svelte.d.ts → line-clamp-localization.d.ts} +2 -1
- package/dist/ui/line-clamp/line-clamp-localization.js +19 -0
- package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte +1 -1
- package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte.d.ts +3 -2
- package/dist/ui/swipe-indicator/index.d.ts +1 -1
- package/dist/ui/swipe-indicator/{swipe-indicator-localization.svelte.d.ts → swipe-indicator-localization.d.ts} +2 -1
- package/dist/ui/swipe-indicator/swipe-indicator-localization.js +13 -0
- package/dist/ui/time-ago/cmp.time-ago.svelte +1 -1
- package/dist/ui/time-ago/cmp.time-ago.svelte.d.ts +3 -2
- package/dist/ui/time-ago/index.d.ts +1 -1
- package/dist/ui/time-ago/{time-ago-localization.svelte.d.ts → time-ago-localization.d.ts} +2 -1
- package/dist/ui/time-ago/time-ago-localization.js +55 -0
- package/package.json +2 -2
- package/dist/short-videos/short-video-viewer/short-video-attachments-localization.svelte.js +0 -10
- package/dist/short-videos/short-video-viewer/short-video-details-localization.svelte.js +0 -10
- package/dist/short-videos/short-video-viewer/short-video-product-localization.svelte.js +0 -11
- package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.d.ts +0 -13
- package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.js +0 -10
- package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.d.ts +0 -8
- package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.js +0 -6
- package/dist/streams/layout/element-views/price-stream-element-localization.svelte.d.ts +0 -9
- package/dist/streams/layout/element-views/price-stream-element-localization.svelte.js +0 -8
- package/dist/streams/layout/element-views/stream-element-localization.svelte.d.ts +0 -8
- package/dist/streams/layout/element-views/stream-element-localization.svelte.js +0 -6
- package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.d.ts +0 -13
- package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.js +0 -10
- package/dist/streams/stream-player/stream-player-localization.svelte.d.ts +0 -12
- package/dist/streams/stream-player/stream-player-localization.svelte.js +0 -10
- package/dist/ui/line-clamp/line-clamp-localization.svelte.js +0 -15
- package/dist/ui/swipe-indicator/swipe-indicator-localization.svelte.js +0 -6
- package/dist/ui/time-ago/time-ago-localization.svelte.js +0 -39
package/dist/core/enums.d.ts
CHANGED
package/dist/core/enums.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export var PostSourceType;
|
|
2
2
|
(function (PostSourceType) {
|
|
3
|
-
PostSourceType["Channel"] = "CHANNEL";
|
|
4
|
-
PostSourceType["Group"] = "GROUP";
|
|
5
3
|
PostSourceType["MediaPage"] = "MEDIA_PAGE";
|
|
6
4
|
PostSourceType["Organization"] = "ORGANIZATION";
|
|
7
5
|
PostSourceType["UserProfile"] = "USER_PROFILE";
|
|
@@ -0,0 +1,6 @@
|
|
|
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;
|
|
@@ -0,0 +1,24 @@
|
|
|
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,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 {
|
|
3
|
+
import { ShortVideoAttachmentsLocalization } from './short-video-attachments-localization';
|
|
4
4
|
import {} from './types';
|
|
5
5
|
let { shortVideo, localization: localizationInit, on } = $props();
|
|
6
|
-
const localization = $derived(new
|
|
6
|
+
const localization = $derived(new ShortVideoAttachmentsLocalization(localizationInit));
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
{#if shortVideo.products.length || shortVideo.ad}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Locale } from '../../core/locale';
|
|
2
|
+
import { type IShortVideoAttachmentsLocalization } from './short-video-attachments-localization';
|
|
2
3
|
import { type ShortVideoViewerModel } from './types';
|
|
3
4
|
type Props = {
|
|
4
5
|
shortVideo: ShortVideoViewerModel;
|
|
5
|
-
localization
|
|
6
|
+
localization: IShortVideoAttachmentsLocalization | Locale;
|
|
6
7
|
on?: {
|
|
7
8
|
productClick?: (productId: string) => void;
|
|
8
9
|
};
|
|
@@ -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';
|
|
5
5
|
let { product, fitToContainer = false, localization: localizationInit, on } = $props();
|
|
6
6
|
const localization = $derived(new ShortVideoProductLocalization(localizationInit));
|
|
7
7
|
const handleProductClick = (event) => {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Locale } from '../../core/locale';
|
|
2
|
+
import { type IShortVideoProductLocalization } from './short-video-product-localization';
|
|
2
3
|
import type { ShortVideoViewerProductModel } from './types';
|
|
3
4
|
type Props = {
|
|
4
5
|
product: ShortVideoViewerProductModel;
|
|
5
6
|
fitToContainer?: boolean;
|
|
6
|
-
localization
|
|
7
|
+
localization: IShortVideoProductLocalization | Locale;
|
|
7
8
|
on?: {
|
|
8
9
|
productClick?: (productId: string) => void;
|
|
9
10
|
};
|
|
@@ -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';
|
|
5
5
|
import {} from './types';
|
|
6
6
|
let { shortVideo, collapsed, localization: localizationInit, on } = $props();
|
|
7
7
|
const localization = $derived(new ShortVideoDetailsLocalization(localizationInit));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Locale } from '../../core/locale';
|
|
2
|
+
import { type IShortVideoDetailsLocalization } from './short-video-details-localization';
|
|
2
3
|
import { type ShortVideoViewerModel } from './types';
|
|
3
4
|
type Props = {
|
|
4
5
|
shortVideo: ShortVideoViewerModel;
|
|
5
6
|
collapsed: boolean;
|
|
6
|
-
localization
|
|
7
|
+
localization: IShortVideoDetailsLocalization | Locale;
|
|
7
8
|
on?: {
|
|
8
9
|
productClick?: (productId: string) => void;
|
|
9
10
|
};
|
|
@@ -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';
|
|
4
4
|
let { model, localization: localizationInit } = $props();
|
|
5
5
|
const localization = $derived(new ShortVideoViewerLocalization(localizationInit));
|
|
6
6
|
</script>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type IShortVideoViewerLocalization } from './short-video-viewer-localization
|
|
1
|
+
import { type IShortVideoViewerLocalization } from './short-video-viewer-localization';
|
|
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';
|
|
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,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Locale } from '../../core/locale';
|
|
2
|
+
import { type IShortVideoViewerLocalization } from './short-video-viewer-localization';
|
|
2
3
|
import type { ShortVideoViewerModel } from './types';
|
|
3
4
|
type Props = {
|
|
4
5
|
model: ShortVideoViewerModel;
|
|
5
6
|
availableSideSpace?: number;
|
|
6
7
|
showAttachments?: boolean;
|
|
7
8
|
autoplay?: true | false | 'on-appearance';
|
|
8
|
-
localization
|
|
9
|
+
localization: IShortVideoViewerLocalization | Locale;
|
|
9
10
|
on?: {
|
|
10
11
|
progress?: (progress: number) => void;
|
|
11
12
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ShortVideoViewerLocalization } from './short-video-viewer-localization
|
|
1
|
+
import type { ShortVideoViewerLocalization } from './short-video-viewer-localization';
|
|
2
2
|
import type { ShortVideoViewerModel } from './types';
|
|
3
3
|
type Props = {
|
|
4
4
|
model: ShortVideoViewerModel;
|
|
@@ -5,6 +5,7 @@ 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
|
|
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';
|
|
10
11
|
export { mapShortVideoViewerModel } from './mapper';
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Locale } from '../../core/locale';
|
|
2
|
+
import type { IShortVideoProductLocalization } from './short-video-product-localization';
|
|
2
3
|
export interface IShortVideoAttachmentsLocalization {
|
|
3
4
|
productsSection?: string;
|
|
4
5
|
offersSection?: string;
|
|
5
6
|
productLocalization?: IShortVideoProductLocalization;
|
|
6
7
|
}
|
|
7
|
-
export declare class
|
|
8
|
+
export declare class ShortVideoAttachmentsLocalization {
|
|
8
9
|
productsSection: string;
|
|
9
10
|
offersSection: string;
|
|
10
|
-
productLocalization: IShortVideoProductLocalization |
|
|
11
|
-
constructor(init
|
|
11
|
+
productLocalization: IShortVideoProductLocalization | Locale;
|
|
12
|
+
constructor(init: IShortVideoAttachmentsLocalization | Locale);
|
|
12
13
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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,13 +1,14 @@
|
|
|
1
|
+
import { type Locale } from '../../core/locale';
|
|
1
2
|
import type { ITimeAgoLocalization } from '../../ui/time-ago';
|
|
2
|
-
import type { IShortVideoAttachmentsLocalization } from './short-video-attachments-localization
|
|
3
|
+
import type { IShortVideoAttachmentsLocalization } from './short-video-attachments-localization';
|
|
3
4
|
export interface IShortVideoDetailsLocalization {
|
|
4
5
|
viewsCount?: (count: number) => string;
|
|
5
|
-
timeAgoLocalization?: ITimeAgoLocalization;
|
|
6
|
-
attachmentsLocalization?: IShortVideoAttachmentsLocalization;
|
|
6
|
+
timeAgoLocalization?: ITimeAgoLocalization | Locale;
|
|
7
|
+
attachmentsLocalization?: IShortVideoAttachmentsLocalization | Locale;
|
|
7
8
|
}
|
|
8
9
|
export declare class ShortVideoDetailsLocalization {
|
|
9
10
|
viewsCount: (count: number) => string;
|
|
10
|
-
timeAgoLocalization: ITimeAgoLocalization |
|
|
11
|
-
attachmentsLocalization: IShortVideoAttachmentsLocalization |
|
|
12
|
-
constructor(init
|
|
11
|
+
timeAgoLocalization: ITimeAgoLocalization | Locale;
|
|
12
|
+
attachmentsLocalization: IShortVideoAttachmentsLocalization | Locale;
|
|
13
|
+
constructor(init: IShortVideoDetailsLocalization | Locale);
|
|
13
14
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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,7 +1,8 @@
|
|
|
1
|
+
import { type Locale } from '../../core/locale';
|
|
1
2
|
export interface IShortVideoProductLocalization {
|
|
2
3
|
beforeNowPrefix?: string | null;
|
|
3
4
|
}
|
|
4
5
|
export declare class ShortVideoProductLocalization {
|
|
5
6
|
beforeNowPrefix: string | null;
|
|
6
|
-
constructor(init
|
|
7
|
+
constructor(init: IShortVideoProductLocalization | Locale);
|
|
7
8
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isLocale } from '../../core/locale';
|
|
2
|
+
export class ShortVideoProductLocalization {
|
|
3
|
+
beforeNowPrefix = $state('Before');
|
|
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
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
};
|
|
@@ -16,7 +16,7 @@ import { SpotlightLayout } from '../../ui/spotlight-layout';
|
|
|
16
16
|
import { SwipeIndicator } from '../../ui/swipe-indicator';
|
|
17
17
|
import { default as Controls } from './controls.svelte';
|
|
18
18
|
import { GetShortVideosDocument } from './operations.generated';
|
|
19
|
-
import { ShortVideosPlayerLocalization } from './short-videos-player-localization
|
|
19
|
+
import { ShortVideosPlayerLocalization } from './short-videos-player-localization';
|
|
20
20
|
import { ShortVideosPlayerUiManager } from './ui-manager.svelte';
|
|
21
21
|
import { onMount, untrack } from 'svelte';
|
|
22
22
|
let { input, localization: localizationInit, on } = $props();
|
|
@@ -107,11 +107,15 @@ const onPlayerClose = () => {
|
|
|
107
107
|
<div class="short-videos-player__content" use:contentMounted>
|
|
108
108
|
<PlayerSlider buffer={buffer}>
|
|
109
109
|
{#snippet children({ item })}
|
|
110
|
-
<ShortVideoViewer
|
|
110
|
+
<ShortVideoViewer
|
|
111
|
+
model={item}
|
|
112
|
+
autoplay="on-appearance"
|
|
113
|
+
showAttachments={uiManager.showShortVideoOverlay}
|
|
114
|
+
localization={localization.shortVideoViewerLocalization} />
|
|
111
115
|
{/snippet}
|
|
112
116
|
</PlayerSlider>
|
|
113
117
|
{#if uiManager.isMobileView && buffer.loaded.length > 1 && !everTouched}
|
|
114
|
-
<SwipeIndicator />
|
|
118
|
+
<SwipeIndicator localization={localization.swipeIndicatorLocalization} />
|
|
115
119
|
{/if}
|
|
116
120
|
</div>
|
|
117
121
|
</SpotlightLayout>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Locale } from '../../core/locale';
|
|
2
|
+
import { type IShortVideosPlayerLocalization } from './short-videos-player-localization';
|
|
2
3
|
import type { PlayerInput } from './types';
|
|
3
4
|
type Props = {
|
|
4
5
|
input: PlayerInput;
|
|
5
|
-
localization
|
|
6
|
+
localization: IShortVideosPlayerLocalization | Locale;
|
|
6
7
|
on?: {
|
|
7
8
|
closePlayer?: () => void;
|
|
8
9
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Icon } from '../../ui/icon';
|
|
3
3
|
import { MediaVolumeManager } from '../../ui/media-playback';
|
|
4
4
|
import { default as ActionButton } from './action-button.svelte';
|
|
5
|
-
import { ShortVideosPlayerLocalization } from './short-videos-player-localization
|
|
5
|
+
import { ShortVideosPlayerLocalization } from './short-videos-player-localization';
|
|
6
6
|
import IconChevronDown from '@fluentui/svg-icons/icons/chevron_down_20_regular.svg?raw';
|
|
7
7
|
import IconChevronUp from '@fluentui/svg-icons/icons/chevron_up_20_regular.svg?raw';
|
|
8
8
|
import IconDismiss from '@fluentui/svg-icons/icons/dismiss_20_regular.svg?raw';
|
|
@@ -37,7 +37,7 @@ const shortVideo = $derived(buffer.current);
|
|
|
37
37
|
<div class="short-videos-player-controls__right">
|
|
38
38
|
{#if shortVideo}
|
|
39
39
|
<div class="short-videos-player-controls__short-video-attachments">
|
|
40
|
-
<ShortVideoViewerAttachments shortVideo={shortVideo} localization={localization.
|
|
40
|
+
<ShortVideoViewerAttachments shortVideo={shortVideo} localization={localization.shortVideoAttachmentsLocalization} />
|
|
41
41
|
</div>
|
|
42
42
|
{/if}
|
|
43
43
|
<div class="short-videos-player-controls__controls">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ShortVideoViewerModel } from '../short-video-viewer';
|
|
2
2
|
import type { IPlayerBuffer } from '../../ui/player';
|
|
3
|
-
import { ShortVideosPlayerLocalization } from './short-videos-player-localization
|
|
3
|
+
import { ShortVideosPlayerLocalization } from './short-videos-player-localization';
|
|
4
4
|
import type { ShortVideosPlayerUiManager } from './ui-manager.svelte';
|
|
5
5
|
type Props = {
|
|
6
6
|
buffer: IPlayerBuffer<ShortVideoViewerModel>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IShortVideosPlayerLocalization } from './short-videos-player-localization
|
|
1
|
+
import type { IShortVideosPlayerLocalization } from './short-videos-player-localization';
|
|
2
2
|
import { type OpenShortVideosPlayerInit } from './types';
|
|
3
3
|
export type { IShortVideosPlayerLocalization };
|
|
4
4
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getLocale } from '../../core/locale';
|
|
1
2
|
import { ShadowHost } from '../../ui/shadow-dom';
|
|
2
3
|
import { default as ShortVideosPlayer } from './cmp.short-videos-player.svelte';
|
|
3
4
|
import { isIdsInit, isShortVideosProviderInit } from './types';
|
|
@@ -93,7 +94,7 @@ export const openShortVideosPlayer = async (init) => {
|
|
|
93
94
|
target: shadowHost.shadowRoot,
|
|
94
95
|
props: {
|
|
95
96
|
input,
|
|
96
|
-
localization: init.localization,
|
|
97
|
+
localization: getLocale(init.localization),
|
|
97
98
|
on: {
|
|
98
99
|
closePlayer: async () => {
|
|
99
100
|
if (init.on?.playerClosed) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Locale } from '../../core/locale';
|
|
2
|
+
import type { IShortVideoAttachmentsLocalization, IShortVideoDetailsLocalization, IShortVideoViewerLocalization } from '../short-video-viewer';
|
|
3
|
+
import type { ISwipeIndicatorLocalization } from '../../ui/swipe-indicator';
|
|
4
|
+
export interface IShortVideosPlayerLocalization {
|
|
5
|
+
shortVideoAttachmentsLocalization?: IShortVideoAttachmentsLocalization | Locale;
|
|
6
|
+
shortVideoDetailsLocalization?: IShortVideoDetailsLocalization | Locale;
|
|
7
|
+
shortVideoViewerLocalization?: IShortVideoViewerLocalization | Locale;
|
|
8
|
+
swipeIndicatorLocalization?: ISwipeIndicatorLocalization | Locale;
|
|
9
|
+
}
|
|
10
|
+
export declare class ShortVideosPlayerLocalization {
|
|
11
|
+
shortVideoAttachmentsLocalization: IShortVideoAttachmentsLocalization | Locale;
|
|
12
|
+
shortVideoDetailsLocalization: IShortVideoDetailsLocalization | Locale;
|
|
13
|
+
shortVideoViewerLocalization: IShortVideoViewerLocalization | Locale;
|
|
14
|
+
swipeIndicatorLocalization: ISwipeIndicatorLocalization | Locale;
|
|
15
|
+
constructor(init: IShortVideosPlayerLocalization | Locale);
|
|
16
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isLocale } from '../../core/locale';
|
|
2
|
+
export class ShortVideosPlayerLocalization {
|
|
3
|
+
shortVideoAttachmentsLocalization;
|
|
4
|
+
shortVideoDetailsLocalization;
|
|
5
|
+
shortVideoViewerLocalization;
|
|
6
|
+
swipeIndicatorLocalization;
|
|
7
|
+
constructor(init) {
|
|
8
|
+
this.shortVideoAttachmentsLocalization = isLocale(init) ? init : init.shortVideoAttachmentsLocalization || 'en';
|
|
9
|
+
this.shortVideoDetailsLocalization = isLocale(init) ? init : init.shortVideoDetailsLocalization || 'en';
|
|
10
|
+
this.shortVideoViewerLocalization = isLocale(init) ? init : init.shortVideoViewerLocalization || 'en';
|
|
11
|
+
this.swipeIndicatorLocalization = isLocale(init) ? init : init.swipeIndicatorLocalization || 'en';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ShortVideoViewerModel } from '../..';
|
|
2
2
|
import type { PlayerItemsProvider } from '../../ui/player';
|
|
3
|
-
import type { IShortVideosPlayerLocalization } from './short-videos-player-localization
|
|
3
|
+
import type { IShortVideosPlayerLocalization } from './short-videos-player-localization';
|
|
4
4
|
export type PlayerInput = ProviderPlayerInput | IdsPlayerInput;
|
|
5
5
|
export type ProviderPlayerInput = {
|
|
6
6
|
type: 'provider';
|
|
@@ -15,7 +15,7 @@ export type IdsPlayerInput = {
|
|
|
15
15
|
export type OpenShortVideosPlayerInit = ProviderInit | IdsInit;
|
|
16
16
|
type ProviderInit = {
|
|
17
17
|
shortVideosProvider: PlayerItemsProvider<ShortVideoViewerModel>;
|
|
18
|
-
localization?: IShortVideosPlayerLocalization;
|
|
18
|
+
localization?: IShortVideosPlayerLocalization | 'en' | 'no';
|
|
19
19
|
on?: {
|
|
20
20
|
playerClosed?: () => void;
|
|
21
21
|
};
|
|
@@ -24,7 +24,7 @@ type IdsInit = {
|
|
|
24
24
|
ids: string[];
|
|
25
25
|
graphqlOrigin?: string;
|
|
26
26
|
initialId?: string;
|
|
27
|
-
localization?: IShortVideosPlayerLocalization;
|
|
27
|
+
localization?: IShortVideosPlayerLocalization | 'en' | 'no';
|
|
28
28
|
on?: {
|
|
29
29
|
playerClosed?: () => void;
|
|
30
30
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { Locale } from '../../core/locale';
|
|
1
2
|
import { type IStreamElementLocalization } from './element-views';
|
|
2
3
|
import type { StreamSlot } from './slot';
|
|
3
4
|
type Props = {
|
|
4
5
|
model: StreamSlot;
|
|
5
|
-
localization
|
|
6
|
+
localization: IStreamElementLocalization | Locale;
|
|
6
7
|
on?: {
|
|
7
8
|
productClick: (productId: string) => void;
|
|
8
9
|
progress?: (videoId: string, progress: number) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script lang="ts">import {} from './stream-element-localization
|
|
1
|
+
<script lang="ts">import {} from './stream-element-localization';
|
|
2
2
|
import { StreamElementStyleDirection } from '../enums';
|
|
3
3
|
import { generateContainerStyles } from '../styles-transformer';
|
|
4
4
|
import { default as StreamElement } from './cmp.stream-element.svelte';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Locale } from '../../../core/locale';
|
|
2
|
+
import { type IStreamElementLocalization } from './stream-element-localization';
|
|
2
3
|
import type { ContainerStreamElementModel } from '../elements';
|
|
3
4
|
import type { StreamSlotData } from '../slot-data';
|
|
4
5
|
type Props = {
|
|
5
6
|
model: ContainerStreamElementModel;
|
|
6
7
|
data: StreamSlotData | null;
|
|
7
|
-
localization
|
|
8
|
+
localization: IStreamElementLocalization | Locale;
|
|
8
9
|
};
|
|
9
10
|
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
10
11
|
type Cmp = ReturnType<typeof Cmp>;
|