@streamscloud/embeddable 1.2.0 → 2.0.1
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 +33 -0
- package/dist/core/enums.js +39 -0
- package/dist/core/graphql.d.ts +1 -1
- package/dist/core/graphql.js +2 -2
- package/dist/core/media/images-size-detector.service.d.ts +1 -1
- package/dist/core/media/images-size-detector.service.js +1 -1
- package/dist/core/media/index.d.ts +1 -1
- package/dist/core/media/index.js +1 -1
- package/dist/core/media/media-item-url.service.js +2 -1
- package/dist/core/media/types.d.ts +1 -16
- package/dist/core/media/types.js +1 -19
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -3
- package/dist/products/price-helper.d.ts +2 -2
- package/dist/products/price-helper.js +20 -9
- package/dist/short-videos/short-video-viewer/cmp.ad.svelte +74 -0
- package/dist/{advertising/ad-view/cmp.ad-view.svelte.d.ts → short-videos/short-video-viewer/cmp.ad.svelte.d.ts} +2 -3
- package/dist/short-videos/short-video-viewer/cmp.attachments-inline.svelte +70 -0
- package/dist/{streams/components/images/cmp.images-component.svelte.d.ts → short-videos/short-video-viewer/cmp.attachments-inline.svelte.d.ts} +2 -2
- package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +45 -48
- package/dist/short-videos/short-video-viewer/cmp.attachments.svelte.d.ts +4 -2
- package/dist/{streams/components/product/cmp.product-component.svelte → short-videos/short-video-viewer/cmp.product.svelte} +34 -26
- package/dist/short-videos/short-video-viewer/cmp.product.svelte.d.ts +10 -0
- package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte +31 -52
- package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte.d.ts +1 -1
- package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +6 -6
- package/dist/short-videos/short-video-viewer/index.d.ts +6 -3
- package/dist/short-videos/short-video-viewer/index.js +4 -2
- package/dist/short-videos/short-video-viewer/mapper.js +35 -7
- package/dist/short-videos/short-video-viewer/operations.generated.d.ts +1 -1
- package/dist/short-videos/short-video-viewer/operations.generated.js +67 -103
- package/dist/short-videos/short-video-viewer/operations.graphql +29 -2
- package/dist/short-videos/short-video-viewer/short-video-attachments-localization.svelte.d.ts +12 -0
- package/dist/short-videos/short-video-viewer/short-video-attachments-localization.svelte.js +10 -0
- package/dist/short-videos/short-video-viewer/short-video-details-localization.svelte.d.ts +3 -4
- package/dist/short-videos/short-video-viewer/short-video-details-localization.svelte.js +4 -15
- package/dist/short-videos/short-video-viewer/short-video-product-localization.svelte.d.ts +7 -0
- package/dist/{products/product-card/product-card-localization.svelte.js → short-videos/short-video-viewer/short-video-product-localization.svelte.js} +1 -1
- package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.d.ts +3 -0
- package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.js +4 -7
- package/dist/short-videos/short-video-viewer/types.d.ts +29 -6
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +4 -4
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +2 -2
- package/dist/short-videos/short-videos-player/controls.svelte +42 -35
- package/dist/short-videos/short-videos-player/controls.svelte.d.ts +1 -1
- package/dist/short-videos/short-videos-player/index.d.ts +28 -2
- package/dist/short-videos/short-videos-player/index.js +40 -1
- package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.d.ts +3 -9
- package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.js +2 -17
- package/dist/streams/layout/cmp.layout.svelte +34 -0
- package/dist/streams/{slots/cmp.stream-component-slot.svelte.d.ts → layout/cmp.layout.svelte.d.ts} +2 -2
- package/dist/streams/layout/cmp.slot-content.svelte +32 -0
- package/dist/streams/layout/cmp.slot-content.svelte.d.ts +9 -0
- package/dist/streams/layout/cmp.slot.svelte +26 -0
- package/dist/streams/layout/cmp.slot.svelte.d.ts +9 -0
- package/dist/streams/layout/component.d.ts +6 -0
- package/dist/streams/layout/component.js +1 -0
- package/dist/streams/layout/css-values.d.ts +10 -0
- package/dist/streams/layout/css-values.js +1 -0
- package/dist/streams/layout/element-views/cmp.container-stream-element.svelte +16 -0
- package/dist/streams/layout/element-views/cmp.container-stream-element.svelte.d.ts +11 -0
- package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte +38 -0
- package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte.d.ts +9 -0
- package/dist/streams/layout/element-views/cmp.images-stream-element.svelte +30 -0
- package/dist/streams/layout/element-views/cmp.images-stream-element.svelte.d.ts +9 -0
- package/dist/streams/layout/element-views/cmp.price-stream-element.svelte +97 -0
- package/dist/streams/layout/element-views/cmp.price-stream-element.svelte.d.ts +11 -0
- package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +6 -0
- package/dist/streams/{components/product/cmp.product-component.svelte.d.ts → layout/element-views/cmp.short-video-stream-element.svelte.d.ts} +2 -3
- package/dist/streams/layout/element-views/cmp.spacer-stream-element.svelte +45 -0
- package/dist/streams/layout/element-views/cmp.spacer-stream-element.svelte.d.ts +9 -0
- package/dist/streams/layout/element-views/cmp.stream-element.svelte +60 -0
- package/dist/streams/layout/element-views/cmp.stream-element.svelte.d.ts +13 -0
- package/dist/streams/layout/element-views/cmp.text-ref-stream-element.svelte +23 -0
- package/dist/streams/layout/element-views/cmp.text-ref-stream-element.svelte.d.ts +9 -0
- package/dist/streams/layout/element-views/cmp.text-stream-element.svelte +8 -0
- package/dist/{ui/shadow-dom/cmp.shadow-dom.svelte.d.ts → streams/layout/element-views/cmp.text-stream-element.svelte.d.ts} +2 -2
- package/dist/streams/layout/element-views/data-by-key-accessor.d.ts +3 -0
- package/dist/streams/layout/element-views/data-by-key-accessor.js +55 -0
- package/dist/streams/layout/element-views/index.d.ts +11 -0
- package/dist/streams/layout/element-views/index.js +9 -0
- package/dist/streams/layout/element-views/price-stream-element-localization.svelte.d.ts +9 -0
- package/dist/streams/layout/element-views/price-stream-element-localization.svelte.js +8 -0
- package/dist/streams/layout/element-views/stream-element-localization.svelte.d.ts +8 -0
- package/dist/streams/layout/element-views/stream-element-localization.svelte.js +6 -0
- package/dist/streams/layout/elements.d.ts +51 -0
- package/dist/streams/layout/elements.js +1 -0
- package/dist/streams/layout/enums.d.ts +45 -0
- package/dist/streams/layout/enums.js +54 -0
- package/dist/streams/layout/index.d.ts +19 -0
- package/dist/streams/layout/index.js +15 -0
- package/dist/streams/layout/layout.d.ts +13 -0
- package/dist/streams/layout/models/index.d.ts +6 -0
- package/dist/streams/layout/models/index.js +1 -0
- package/dist/streams/layout/models/mapper.d.ts +3 -0
- package/dist/streams/layout/models/mapper.js +62 -0
- package/dist/streams/layout/models/stream-layout-blob-model.d.ts +4 -0
- package/dist/streams/layout/models/stream-layout-media-item-model.d.ts +6 -0
- package/dist/streams/layout/models/stream-layout-media-item-model.js +1 -0
- package/dist/streams/layout/models/stream-layout-post-header-model.d.ts +11 -0
- package/dist/streams/layout/models/stream-layout-post-header-model.js +1 -0
- package/dist/streams/layout/models/stream-layout-product-model.d.ts +19 -0
- package/dist/streams/layout/models/stream-layout-product-model.js +1 -0
- package/dist/streams/layout/models/stream-layout-short-video-model.d.ts +31 -0
- package/dist/streams/layout/models/stream-layout-short-video-model.js +1 -0
- package/dist/streams/layout/serializer.d.ts +3 -0
- package/dist/streams/layout/serializer.js +6 -0
- package/dist/streams/layout/slot-data-input.d.ts +14 -0
- package/dist/streams/layout/slot-data-input.js +1 -0
- package/dist/streams/layout/slot-data.d.ts +18 -0
- package/dist/streams/layout/slot-data.js +1 -0
- package/dist/streams/layout/slot.d.ts +16 -0
- package/dist/streams/layout/slot.js +1 -0
- package/dist/streams/layout/styles-transformer.d.ts +13 -0
- package/dist/streams/layout/styles-transformer.js +140 -0
- package/dist/streams/layout/styles.d.ts +43 -0
- package/dist/streams/layout/styles.js +1 -0
- package/dist/streams/layout/type-guards.d.ts +8 -0
- package/dist/streams/layout/type-guards.js +21 -0
- package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte +8 -42
- package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte.d.ts +0 -2
- package/dist/streams/stream-page-viewer/mapper.d.ts +1 -1
- package/dist/streams/stream-page-viewer/mapper.js +7 -8
- package/dist/streams/stream-page-viewer/operations.generated.d.ts +1 -104
- package/dist/streams/stream-page-viewer/operations.generated.js +2 -375
- package/dist/streams/stream-page-viewer/operations.graphql +1 -6
- package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.d.ts +3 -0
- package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.js +4 -7
- package/dist/streams/stream-page-viewer/types.d.ts +5 -5
- package/dist/streams/stream-player/cmp.stream-player.svelte +7 -3
- package/dist/streams/stream-player/controls.svelte +43 -35
- package/dist/streams/stream-player/index.d.ts +29 -2
- package/dist/streams/stream-player/index.js +44 -1
- package/dist/streams/stream-player/operations.generated.d.ts +1 -103
- package/dist/streams/stream-player/operations.generated.js +2 -375
- package/dist/streams/stream-player/stream-overview.svelte +2 -2
- package/dist/streams/stream-player/stream-player-buffer.svelte.d.ts +1 -1
- package/dist/streams/stream-player/stream-player-buffer.svelte.js +1 -1
- package/dist/streams/stream-player/stream-player-localization.svelte.d.ts +3 -9
- package/dist/streams/stream-player/stream-player-localization.svelte.js +4 -23
- package/dist/ui/media-item-view/cmp.media-item-view.svelte +2 -1
- package/dist/ui/media-item-view/cmp.media-item-view.svelte.d.ts +2 -1
- package/dist/ui/media-items-gallery/cmp.media-items-gallery.svelte +2 -1
- package/dist/ui/media-items-gallery/cmp.media-items-gallery.svelte.d.ts +2 -1
- package/dist/ui/shadow-dom/_normalize.scss +350 -0
- package/dist/ui/shadow-dom/_reset.scss +189 -0
- package/dist/ui/shadow-dom/index.d.ts +1 -1
- package/dist/ui/shadow-dom/index.js +1 -1
- package/dist/ui/shadow-dom/shadow-host.svelte.d.ts +8 -0
- package/dist/ui/shadow-dom/shadow-host.svelte.js +39 -0
- package/dist/ui/video/cmp.video.svelte +1 -1
- package/package.json +80 -26
- package/dist/advertising/ad-view/cmp.ad-view.svelte +0 -82
- package/dist/advertising/ad-view/index.d.ts +0 -2
- package/dist/advertising/ad-view/index.js +0 -1
- package/dist/advertising/ad-view/mapper.d.ts +0 -3
- package/dist/advertising/ad-view/mapper.js +0 -16
- package/dist/advertising/ad-view/operations.generated.d.ts +0 -17
- package/dist/advertising/ad-view/operations.generated.js +0 -46
- package/dist/advertising/ad-view/operations.graphql +0 -14
- package/dist/advertising/ad-view/types.d.ts +0 -10
- package/dist/advertising/index.d.ts +0 -1
- package/dist/advertising/index.js +0 -1
- package/dist/advertising/types.d.ts +0 -5
- package/dist/advertising/types.js +0 -6
- package/dist/products/index.d.ts +0 -1
- package/dist/products/index.js +0 -1
- package/dist/products/product-card/cmp.product-card.svelte +0 -121
- package/dist/products/product-card/cmp.product-card.svelte.d.ts +0 -10
- package/dist/products/product-card/index.d.ts +0 -3
- package/dist/products/product-card/index.js +0 -3
- package/dist/products/product-card/mapper.d.ts +0 -3
- package/dist/products/product-card/mapper.js +0 -14
- package/dist/products/product-card/operations.generated.d.ts +0 -22
- package/dist/products/product-card/operations.generated.js +0 -65
- package/dist/products/product-card/operations.graphql +0 -19
- package/dist/products/product-card/product-card-localization.svelte.d.ts +0 -7
- package/dist/products/product-card/types.d.ts +0 -10
- package/dist/products/product-card/types.js +0 -1
- package/dist/products/types.d.ts +0 -5
- package/dist/products/types.js +0 -6
- package/dist/short-videos/short-videos-player-modal/cmp.short-videos-player-modal.svelte +0 -486
- package/dist/short-videos/short-videos-player-modal/cmp.short-videos-player-modal.svelte.d.ts +0 -3
- package/dist/short-videos/short-videos-player-modal/index.d.ts +0 -79
- package/dist/short-videos/short-videos-player-modal/index.js +0 -78
- package/dist/short-videos/short-videos-player-modal/short-videos-player-modal-state.svelte.d.ts +0 -16
- package/dist/short-videos/short-videos-player-modal/short-videos-player-modal-state.svelte.js +0 -13
- package/dist/streams/components/cmp.stream-page-component.svelte +0 -16
- package/dist/streams/components/cmp.stream-page-component.svelte.d.ts +0 -10
- package/dist/streams/components/components.factory.d.ts +0 -22
- package/dist/streams/components/components.factory.js +0 -34
- package/dist/streams/components/images/cmp.images-component.svelte +0 -7
- package/dist/streams/components/images/index.d.ts +0 -2
- package/dist/streams/components/images/index.js +0 -1
- package/dist/streams/components/images/types.d.ts +0 -8
- package/dist/streams/components/images/types.js +0 -5
- package/dist/streams/components/index.d.ts +0 -7
- package/dist/streams/components/index.js +0 -6
- package/dist/streams/components/mapper.d.ts +0 -3
- package/dist/streams/components/mapper.js +0 -43
- package/dist/streams/components/operations.generated.d.ts +0 -178
- package/dist/streams/components/operations.generated.js +0 -653
- package/dist/streams/components/operations.graphql +0 -35
- package/dist/streams/components/product/index.d.ts +0 -3
- package/dist/streams/components/product/index.js +0 -2
- package/dist/streams/components/product/mapper.d.ts +0 -3
- package/dist/streams/components/product/mapper.js +0 -14
- package/dist/streams/components/product/operations.generated.d.ts +0 -22
- package/dist/streams/components/product/operations.generated.js +0 -53
- package/dist/streams/components/product/operations.graphql +0 -19
- package/dist/streams/components/product/types.d.ts +0 -10
- package/dist/streams/components/product/types.js +0 -1
- package/dist/streams/components/short-video/cmp.short-video-component.svelte +0 -9
- package/dist/streams/components/short-video/cmp.short-video-component.svelte.d.ts +0 -10
- package/dist/streams/components/short-video/index.d.ts +0 -3
- package/dist/streams/components/short-video/index.js +0 -2
- package/dist/streams/components/short-video/mapper.d.ts +0 -3
- package/dist/streams/components/short-video/mapper.js +0 -4
- package/dist/streams/components/short-video/operations.generated.d.ts +0 -56
- package/dist/streams/components/short-video/operations.generated.js +0 -193
- package/dist/streams/components/short-video/operations.graphql +0 -3
- package/dist/streams/components/short-video/types.d.ts +0 -2
- package/dist/streams/components/stream-components-localization.svelte.d.ts +0 -10
- package/dist/streams/components/stream-components-localization.svelte.js +0 -13
- package/dist/streams/components/types.d.ts +0 -27
- package/dist/streams/components/types.js +0 -6
- package/dist/streams/slots/cmp.stream-component-slot.svelte +0 -35
- package/dist/streams/slots/index.d.ts +0 -3
- package/dist/streams/slots/index.js +0 -2
- package/dist/streams/slots/mapper.d.ts +0 -3
- package/dist/streams/slots/mapper.js +0 -18
- package/dist/streams/slots/operations.generated.d.ts +0 -17
- package/dist/streams/slots/operations.generated.js +0 -34
- package/dist/streams/slots/operations.graphql +0 -14
- package/dist/streams/slots/styles-transformer.d.ts +0 -6
- package/dist/streams/slots/styles-transformer.js +0 -12
- package/dist/streams/slots/types.d.ts +0 -16
- package/dist/streams/slots/types.js +0 -1
- package/dist/streams/stream-player-modal/cmp.stream-player-modal.svelte +0 -487
- package/dist/streams/stream-player-modal/cmp.stream-player-modal.svelte.d.ts +0 -3
- package/dist/streams/stream-player-modal/index.d.ts +0 -79
- package/dist/streams/stream-player-modal/index.js +0 -78
- package/dist/streams/stream-player-modal/stream-player-modal-state.svelte.d.ts +0 -17
- package/dist/streams/stream-player-modal/stream-player-modal-state.svelte.js +0 -14
- package/dist/ui/shadow-dom/cmp.shadow-dom.svelte +0 -26
- /package/dist/{advertising/ad-view/types.js → streams/layout/layout.js} +0 -0
- /package/dist/streams/{components/short-video/types.js → layout/models/stream-layout-blob-model.js} +0 -0
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import { StreamComponentsLocalization } from './stream-components-localization.svelte';
|
|
2
|
-
import { ImagesComponent } from './images';
|
|
3
|
-
import { ProductComponent } from './product';
|
|
4
|
-
import { ShortVideoComponent } from './short-video';
|
|
5
|
-
import { StreamComponentType } from './types';
|
|
6
|
-
let { component, autoplay = true, localization: localizationInit } = $props();
|
|
7
|
-
const localization = $derived(new StreamComponentsLocalization(localizationInit));
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
{#if component.type === StreamComponentType.ShortVideo}
|
|
11
|
-
<ShortVideoComponent model={component.data} autoplay={autoplay} localization={localization} />
|
|
12
|
-
{:else if component.type === StreamComponentType.Product}
|
|
13
|
-
<ProductComponent model={component.data} />
|
|
14
|
-
{:else if component.type === StreamComponentType.Images}
|
|
15
|
-
<ImagesComponent model={component.data} />
|
|
16
|
-
{/if}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type IStreamComponentsLocalization } from './stream-components-localization.svelte';
|
|
2
|
-
import { type StreamComponentModel } from './types';
|
|
3
|
-
type Props = {
|
|
4
|
-
component: StreamComponentModel;
|
|
5
|
-
autoplay?: boolean;
|
|
6
|
-
localization?: IStreamComponentsLocalization;
|
|
7
|
-
};
|
|
8
|
-
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
9
|
-
type Cmp = ReturnType<typeof Cmp>;
|
|
10
|
-
export default Cmp;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { StreamMediaComponentMode } from './images/types';
|
|
2
|
-
import type { ProductComponentData } from './product';
|
|
3
|
-
import type { ShortVideoStreamComponentData } from './short-video';
|
|
4
|
-
import { type ImagesStreamComponentModel, type ProductStreamComponentModel, type ShortVideoStreamComponentModel } from './types';
|
|
5
|
-
export declare class StreamComponentsFactory {
|
|
6
|
-
static images: (init: {
|
|
7
|
-
images: string[];
|
|
8
|
-
mode: StreamMediaComponentMode;
|
|
9
|
-
slotId: string;
|
|
10
|
-
id?: string;
|
|
11
|
-
}) => ImagesStreamComponentModel;
|
|
12
|
-
static shortVideo: (init: {
|
|
13
|
-
data: ShortVideoStreamComponentData;
|
|
14
|
-
slotId: string;
|
|
15
|
-
id?: string;
|
|
16
|
-
}) => ShortVideoStreamComponentModel;
|
|
17
|
-
static product: (init: {
|
|
18
|
-
data: ProductComponentData;
|
|
19
|
-
slotId: string;
|
|
20
|
-
id?: string;
|
|
21
|
-
}) => ProductStreamComponentModel;
|
|
22
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { StreamComponentType } from './types';
|
|
2
|
-
import { nanoid } from 'nanoid';
|
|
3
|
-
export class StreamComponentsFactory {
|
|
4
|
-
static images = (init) => {
|
|
5
|
-
const { images, mode, slotId, id = nanoid(7) } = init;
|
|
6
|
-
return {
|
|
7
|
-
type: StreamComponentType.Images,
|
|
8
|
-
id,
|
|
9
|
-
slotId,
|
|
10
|
-
data: {
|
|
11
|
-
images,
|
|
12
|
-
mode
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
static shortVideo = (init) => {
|
|
17
|
-
const { data, slotId, id = nanoid(7) } = init;
|
|
18
|
-
return {
|
|
19
|
-
type: StreamComponentType.ShortVideo,
|
|
20
|
-
id,
|
|
21
|
-
slotId,
|
|
22
|
-
data
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
static product = (init) => {
|
|
26
|
-
const { data, slotId, id = nanoid(7) } = init;
|
|
27
|
-
return {
|
|
28
|
-
type: StreamComponentType.Product,
|
|
29
|
-
id,
|
|
30
|
-
slotId,
|
|
31
|
-
data
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as ImagesComponent } from './cmp.images-component.svelte';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type { StreamComponentModel, ProductStreamComponentModel, ImagesStreamComponentModel, ShortVideoStreamComponentModel } from './types';
|
|
2
|
-
export { StreamComponentType } from './types';
|
|
3
|
-
export { StreamComponentsFactory } from './components.factory';
|
|
4
|
-
export { default as StreamPageComponent } from './cmp.stream-page-component.svelte';
|
|
5
|
-
export { mapToShortVideoStreamComponentData, type ShortVideoStreamComponentData } from './short-video';
|
|
6
|
-
export { mapToProductComponentData } from './product';
|
|
7
|
-
export { mapToStreamComponentModel } from './mapper';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { StreamComponentType } from './types';
|
|
2
|
-
export { StreamComponentsFactory } from './components.factory';
|
|
3
|
-
export { default as StreamPageComponent } from './cmp.stream-page-component.svelte';
|
|
4
|
-
export { mapToShortVideoStreamComponentData } from './short-video';
|
|
5
|
-
export { mapToProductComponentData } from './product';
|
|
6
|
-
export { mapToStreamComponentModel } from './mapper';
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Utils } from '../../core/utils';
|
|
2
|
-
import { StreamComponentsFactory } from './components.factory';
|
|
3
|
-
import { mapToProductComponentData } from './product';
|
|
4
|
-
import { mapToShortVideoStreamComponentData } from './short-video';
|
|
5
|
-
import { StreamComponentType } from './types';
|
|
6
|
-
export const mapToStreamComponentModel = (payload) => {
|
|
7
|
-
const params = payload.params;
|
|
8
|
-
if (params.shortVideo && !params.shortVideo.data) {
|
|
9
|
-
// short video is missing
|
|
10
|
-
console.error('Short video is missing');
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
if (params.product && !params.product.data) {
|
|
14
|
-
// short video is missing
|
|
15
|
-
console.error('Product is missing');
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
const payloadType = payload.type;
|
|
19
|
-
switch (payloadType) {
|
|
20
|
-
case StreamComponentType.Images: {
|
|
21
|
-
return StreamComponentsFactory.images({
|
|
22
|
-
slotId: payload.slotId,
|
|
23
|
-
mode: params.images.mode,
|
|
24
|
-
images: params.images.images.map((c) => c.url)
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
case StreamComponentType.Product: {
|
|
28
|
-
return StreamComponentsFactory.product({
|
|
29
|
-
slotId: payload.slotId,
|
|
30
|
-
data: mapToProductComponentData(params.product.data)
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
case StreamComponentType.ShortVideo: {
|
|
34
|
-
return StreamComponentsFactory.shortVideo({
|
|
35
|
-
slotId: payload.slotId,
|
|
36
|
-
data: mapToShortVideoStreamComponentData(params.shortVideo.data)
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
default: {
|
|
40
|
-
Utils.assertUnreachable(payloadType);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
@@ -1,178 +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 StreamComponentPayloadFragment = {
|
|
4
|
-
slotId: string;
|
|
5
|
-
type: SchemaTypes.StreamComponentType;
|
|
6
|
-
params: {
|
|
7
|
-
shortVideo: {
|
|
8
|
-
data: {
|
|
9
|
-
id: string;
|
|
10
|
-
enableSocialInteractions: boolean;
|
|
11
|
-
postHeading: {
|
|
12
|
-
sourceImage: string | null;
|
|
13
|
-
sourceName: string;
|
|
14
|
-
postDisplayDate: any;
|
|
15
|
-
postViewsCount: number;
|
|
16
|
-
};
|
|
17
|
-
allProducts: Array<{
|
|
18
|
-
title: string;
|
|
19
|
-
id: string;
|
|
20
|
-
link: string | null;
|
|
21
|
-
media: Array<{
|
|
22
|
-
url: string;
|
|
23
|
-
thumbnailUrl: string | null;
|
|
24
|
-
type: SchemaTypes.MediaType;
|
|
25
|
-
}>;
|
|
26
|
-
priceAndAvailability: {
|
|
27
|
-
currency: SchemaTypes.Currency;
|
|
28
|
-
price: number;
|
|
29
|
-
productSalePrices: Array<{
|
|
30
|
-
salePrice: number;
|
|
31
|
-
salePriceEffectiveDateFrom: any | null;
|
|
32
|
-
salePriceEffectiveDateTo: any | null;
|
|
33
|
-
}> | null;
|
|
34
|
-
};
|
|
35
|
-
}>;
|
|
36
|
-
ad: {
|
|
37
|
-
id: string;
|
|
38
|
-
title: string;
|
|
39
|
-
description: string | null;
|
|
40
|
-
buttonText: string | null;
|
|
41
|
-
buttonUrl: string | null;
|
|
42
|
-
openLinkInNewWindow: boolean | null;
|
|
43
|
-
type: SchemaTypes.AdType;
|
|
44
|
-
media: Array<{
|
|
45
|
-
type: SchemaTypes.MediaType;
|
|
46
|
-
url: string;
|
|
47
|
-
thumbnailUrl: string | null;
|
|
48
|
-
}>;
|
|
49
|
-
} | null;
|
|
50
|
-
postData: {
|
|
51
|
-
media: Array<{
|
|
52
|
-
url: string;
|
|
53
|
-
thumbnailUrl: string | null;
|
|
54
|
-
type: SchemaTypes.MediaType;
|
|
55
|
-
}>;
|
|
56
|
-
shortVideoData: {
|
|
57
|
-
text: string | null;
|
|
58
|
-
} | null;
|
|
59
|
-
};
|
|
60
|
-
} | null;
|
|
61
|
-
} | null;
|
|
62
|
-
images: {
|
|
63
|
-
mode: SchemaTypes.StreamMediaComponentMode;
|
|
64
|
-
images: Array<{
|
|
65
|
-
id: string;
|
|
66
|
-
url: string;
|
|
67
|
-
}>;
|
|
68
|
-
} | null;
|
|
69
|
-
product: {
|
|
70
|
-
data: {
|
|
71
|
-
title: string;
|
|
72
|
-
id: string;
|
|
73
|
-
link: string | null;
|
|
74
|
-
media: Array<{
|
|
75
|
-
url: string;
|
|
76
|
-
thumbnailUrl: string | null;
|
|
77
|
-
type: SchemaTypes.MediaType;
|
|
78
|
-
}>;
|
|
79
|
-
priceAndAvailability: {
|
|
80
|
-
currency: SchemaTypes.Currency;
|
|
81
|
-
price: number;
|
|
82
|
-
productSalePrices: Array<{
|
|
83
|
-
salePrice: number;
|
|
84
|
-
salePriceEffectiveDateFrom: any | null;
|
|
85
|
-
salePriceEffectiveDateTo: any | null;
|
|
86
|
-
}> | null;
|
|
87
|
-
};
|
|
88
|
-
} | null;
|
|
89
|
-
} | null;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
export type ShortVideoStreamComponentParamsFragment = {
|
|
93
|
-
data: {
|
|
94
|
-
id: string;
|
|
95
|
-
enableSocialInteractions: boolean;
|
|
96
|
-
postHeading: {
|
|
97
|
-
sourceImage: string | null;
|
|
98
|
-
sourceName: string;
|
|
99
|
-
postDisplayDate: any;
|
|
100
|
-
postViewsCount: number;
|
|
101
|
-
};
|
|
102
|
-
allProducts: Array<{
|
|
103
|
-
title: string;
|
|
104
|
-
id: string;
|
|
105
|
-
link: string | null;
|
|
106
|
-
media: Array<{
|
|
107
|
-
url: string;
|
|
108
|
-
thumbnailUrl: string | null;
|
|
109
|
-
type: SchemaTypes.MediaType;
|
|
110
|
-
}>;
|
|
111
|
-
priceAndAvailability: {
|
|
112
|
-
currency: SchemaTypes.Currency;
|
|
113
|
-
price: number;
|
|
114
|
-
productSalePrices: Array<{
|
|
115
|
-
salePrice: number;
|
|
116
|
-
salePriceEffectiveDateFrom: any | null;
|
|
117
|
-
salePriceEffectiveDateTo: any | null;
|
|
118
|
-
}> | null;
|
|
119
|
-
};
|
|
120
|
-
}>;
|
|
121
|
-
ad: {
|
|
122
|
-
id: string;
|
|
123
|
-
title: string;
|
|
124
|
-
description: string | null;
|
|
125
|
-
buttonText: string | null;
|
|
126
|
-
buttonUrl: string | null;
|
|
127
|
-
openLinkInNewWindow: boolean | null;
|
|
128
|
-
type: SchemaTypes.AdType;
|
|
129
|
-
media: Array<{
|
|
130
|
-
type: SchemaTypes.MediaType;
|
|
131
|
-
url: string;
|
|
132
|
-
thumbnailUrl: string | null;
|
|
133
|
-
}>;
|
|
134
|
-
} | null;
|
|
135
|
-
postData: {
|
|
136
|
-
media: Array<{
|
|
137
|
-
url: string;
|
|
138
|
-
thumbnailUrl: string | null;
|
|
139
|
-
type: SchemaTypes.MediaType;
|
|
140
|
-
}>;
|
|
141
|
-
shortVideoData: {
|
|
142
|
-
text: string | null;
|
|
143
|
-
} | null;
|
|
144
|
-
};
|
|
145
|
-
} | null;
|
|
146
|
-
};
|
|
147
|
-
export type ImagesStreamComponentParamsFragment = {
|
|
148
|
-
mode: SchemaTypes.StreamMediaComponentMode;
|
|
149
|
-
images: Array<{
|
|
150
|
-
id: string;
|
|
151
|
-
url: string;
|
|
152
|
-
}>;
|
|
153
|
-
};
|
|
154
|
-
export type ProductStreamComponentParamsFragment = {
|
|
155
|
-
data: {
|
|
156
|
-
title: string;
|
|
157
|
-
id: string;
|
|
158
|
-
link: string | null;
|
|
159
|
-
media: Array<{
|
|
160
|
-
url: string;
|
|
161
|
-
thumbnailUrl: string | null;
|
|
162
|
-
type: SchemaTypes.MediaType;
|
|
163
|
-
}>;
|
|
164
|
-
priceAndAvailability: {
|
|
165
|
-
currency: SchemaTypes.Currency;
|
|
166
|
-
price: number;
|
|
167
|
-
productSalePrices: Array<{
|
|
168
|
-
salePrice: number;
|
|
169
|
-
salePriceEffectiveDateFrom: any | null;
|
|
170
|
-
salePriceEffectiveDateTo: any | null;
|
|
171
|
-
}> | null;
|
|
172
|
-
};
|
|
173
|
-
} | null;
|
|
174
|
-
};
|
|
175
|
-
export declare const ShortVideoStreamComponentParamsFragmentDoc: DocumentNode<ShortVideoStreamComponentParamsFragment, unknown>;
|
|
176
|
-
export declare const ImagesStreamComponentParamsFragmentDoc: DocumentNode<ImagesStreamComponentParamsFragment, unknown>;
|
|
177
|
-
export declare const ProductStreamComponentParamsFragmentDoc: DocumentNode<ProductStreamComponentParamsFragment, unknown>;
|
|
178
|
-
export declare const StreamComponentPayloadFragmentDoc: DocumentNode<StreamComponentPayloadFragment, unknown>;
|