@streamscloud/embeddable 15.0.1 → 15.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ads/ad-card/cmp.ad-card.svelte +7 -9
- package/dist/external-api/data-providers/internal-media-center-analytics-handler.d.ts +14 -14
- package/dist/external-api/data-providers/internal-post-analytics-handler.d.ts +6 -6
- package/dist/external-api/data-providers/internal-stream-analytics-handler.d.ts +13 -13
- package/dist/media-center/media-center/cmp.media-center-proxy.svelte +4 -5
- package/dist/media-center/media-center/discover/community-features.svelte +12 -21
- package/dist/media-center/media-center/discover/discover-view.svelte +44 -35
- package/dist/media-center/media-center/handlers/categories-handler.svelte.js +2 -1
- package/dist/media-center/media-center/header/media-center-header-mobile.svelte +2 -4
- package/dist/media-center/media-center/header/media-center-header.svelte +4 -6
- package/dist/media-center/media-center/media-center-context.svelte.js +2 -1
- package/dist/media-center/media-center/media-center-view.svelte +5 -14
- package/dist/media-center/media-center/menu/category-following-wrapper.svelte +7 -16
- package/dist/media-center/media-center/menu/menu.svelte +5 -3
- package/dist/media-center/media-center/moments/cmp.moments-circle.svelte +1 -1
- package/dist/media-center/media-center/moments/moments-state.svelte.js +2 -1
- package/dist/media-center/media-center/streams-in-category/streams-in-category-panel.svelte +6 -2
- package/dist/media-page/cmp.media-page.svelte +6 -15
- package/dist/posts/controls/post-actions-generator.svelte.js +2 -1
- package/dist/posts/post-viewer/attachments-horizontal.svelte +23 -26
- package/dist/posts/post-viewer/media/post-media.svelte +5 -3
- package/dist/posts/posts-player/cmp.posts-player.svelte +4 -13
- package/dist/posts/posts-player/posts-player-proxy.svelte +2 -3
- package/dist/posts/posts-player/posts-player-view.svelte +36 -47
- package/dist/products/product-card/cmp.product-card.svelte +6 -7
- package/dist/short-videos/short-video-card/cmp.short-video-card.svelte +1 -1
- package/dist/streams/controls/stream-actions-generator.svelte.js +2 -1
- package/dist/streams/layout/cmp.slot-content.svelte +5 -6
- package/dist/streams/layout/element-views/cmp.price-stream-element.svelte +2 -3
- package/dist/streams/layout/element-views/cmp.products-slider-stream-element.svelte +1 -1
- package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte +4 -7
- package/dist/streams/layout/element-views/price-element-view.svelte +14 -27
- package/dist/streams/streams-player/cmp.streams-player.svelte +4 -13
- package/dist/streams/streams-player/streams-player-proxy.svelte +2 -3
- package/dist/streams/streams-player/streams-player-view.svelte +44 -57
- package/dist/ui/button/resources/button-theme.svelte +4 -2
- package/dist/ui/dropdown/cmp.dropdown.svelte +4 -6
- package/dist/ui/icon/cmp.icon.svelte +1 -1
- package/dist/ui/image/cmp.image.svelte +2 -2
- package/dist/ui/infinite-scrolling/cmp.infinite-scrolling.svelte +6 -15
- package/dist/ui/line-clamp/cmp.line-clamp-auto.svelte +2 -2
- package/dist/ui/media-item-view/cmp.media-item-view.svelte +1 -1
- package/dist/ui/media-items-gallery/cmp.media-items-gallery.svelte +6 -15
- package/dist/ui/player/button/cmp.player-button.svelte +3 -1
- package/dist/ui/player/button/cmp.player-buttons-group.svelte +3 -1
- package/dist/ui/player/close-orchestrator/close-orchestrator.svelte.js +2 -1
- package/dist/ui/player/player/cmp.player.svelte +2 -3
- package/dist/ui/player/player/cmp.player.svelte.d.ts +1 -1
- package/dist/ui/player/player/controls-and-attachments.svelte +2 -2
- package/dist/ui/player/player/overview-panel.svelte +3 -1
- package/dist/ui/player/slider/cmp.player-slider.svelte +6 -7
- package/dist/ui/player/slider-horizontal/cmp.slider.svelte +14 -11
- package/dist/ui/seek-bar/cmp.seek-bar.svelte +7 -9
- package/dist/ui/shadow-dom/cmp.shadow-root.svelte +2 -2
- package/dist/ui/video/cmp.video.svelte +17 -29
- package/package.json +41 -39
|
@@ -80,19 +80,23 @@ let { handler, on } = $props();
|
|
|
80
80
|
gap: 2rem 1.25rem;
|
|
81
81
|
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
82
82
|
/* Set 'container-type: inline-size;' to reference container*/
|
|
83
|
-
/* Set 'container-type: inline-size;' to reference container*/
|
|
84
|
-
/* Set 'container-type: inline-size;' to reference container*/
|
|
85
83
|
}
|
|
86
84
|
@container (width < 992px) {
|
|
87
85
|
.streams-in-category__section-content {
|
|
88
86
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
89
87
|
}
|
|
90
88
|
}
|
|
89
|
+
.streams-in-category__section-content {
|
|
90
|
+
/* Set 'container-type: inline-size;' to reference container*/
|
|
91
|
+
}
|
|
91
92
|
@container (width < 768px) {
|
|
92
93
|
.streams-in-category__section-content {
|
|
93
94
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
94
95
|
}
|
|
95
96
|
}
|
|
97
|
+
.streams-in-category__section-content {
|
|
98
|
+
/* Set 'container-type: inline-size;' to reference container*/
|
|
99
|
+
}
|
|
96
100
|
@container (width < 576px) {
|
|
97
101
|
.streams-in-category__section-content {
|
|
98
102
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { MediaCenterProxy } from '../media-center/media-center';
|
|
1
|
+
<script lang="ts">import { MediaCenterProxy } from '../media-center/media-center';
|
|
11
2
|
import { MediaCenterSettings } from '../media-center/media-center/media-center-settings.svelte';
|
|
12
3
|
import { CloseOrchestrator } from '../ui/player/close-orchestrator';
|
|
13
4
|
import { createShadowRoot } from '../ui/shadow-dom';
|
|
14
|
-
import { mount, unmount } from 'svelte';
|
|
5
|
+
import { mount, unmount, untrack } from 'svelte';
|
|
15
6
|
let { dataProvider, settings, dynamicActions } = $props();
|
|
16
|
-
const settingsHolder = new MediaCenterSettings(settings);
|
|
7
|
+
const settingsHolder = untrack(() => new MediaCenterSettings(settings));
|
|
17
8
|
$effect(() => {
|
|
18
9
|
settingsHolder.update(settings);
|
|
19
10
|
});
|
|
@@ -27,9 +18,9 @@ const initHost = (node) => {
|
|
|
27
18
|
modeProps: { mode: 'default' },
|
|
28
19
|
dynamicActions,
|
|
29
20
|
closeOrchestrator: new CloseOrchestrator({
|
|
30
|
-
closeFn: () =>
|
|
31
|
-
|
|
32
|
-
}
|
|
21
|
+
closeFn: async () => {
|
|
22
|
+
await unmount(mounted);
|
|
23
|
+
},
|
|
33
24
|
canClose: false
|
|
34
25
|
})
|
|
35
26
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { PostActionsHandler } from './post-actions-handler.svelte';
|
|
2
|
+
import { SvelteMap } from 'svelte/reactivity';
|
|
2
3
|
export class PostActionsGenerator {
|
|
3
4
|
socialInteractionsHandler;
|
|
4
5
|
sharingHandler;
|
|
5
6
|
callbacks;
|
|
6
|
-
handlers = new
|
|
7
|
+
handlers = new SvelteMap();
|
|
7
8
|
constructor(init) {
|
|
8
9
|
this.socialInteractionsHandler = init.socialInteractionsHandler ?? null;
|
|
9
10
|
this.sharingHandler = init.sharingHandler ?? null;
|
|
@@ -29,33 +29,30 @@ const attachmentsToShow = $derived.by(() => {
|
|
|
29
29
|
}));
|
|
30
30
|
const ads = model.attachments.ads
|
|
31
31
|
.filter((a) => !!a.image)
|
|
32
|
-
.map((a) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
description: a.description
|
|
49
|
-
});
|
|
50
|
-
});
|
|
32
|
+
.map((a) => ({
|
|
33
|
+
isAd: true,
|
|
34
|
+
image: a.image,
|
|
35
|
+
link: a.ctaButton?.url ? enrichAdLinkWithTracking({ link: a.ctaButton.url, adId: a.id, trackingParams }) : null,
|
|
36
|
+
productId: null,
|
|
37
|
+
adId: a.id,
|
|
38
|
+
price: a.price && a.currency
|
|
39
|
+
? {
|
|
40
|
+
amount: a.price,
|
|
41
|
+
currency: a.currency,
|
|
42
|
+
label: a.priceInfoLabel
|
|
43
|
+
}
|
|
44
|
+
: null,
|
|
45
|
+
title: a.title,
|
|
46
|
+
description: a.description
|
|
47
|
+
}));
|
|
51
48
|
const result = [...ads, ...products];
|
|
52
49
|
return result;
|
|
53
50
|
});
|
|
54
51
|
const handleAttachmentClick = (attachment) => {
|
|
55
|
-
if (attachment.productId &&
|
|
52
|
+
if (attachment.productId && on?.productClick) {
|
|
56
53
|
on.productClick(attachment.productId);
|
|
57
54
|
}
|
|
58
|
-
if (attachment.adId &&
|
|
55
|
+
if (attachment.adId && on?.adClick) {
|
|
59
56
|
on.adClick(attachment.adId);
|
|
60
57
|
}
|
|
61
58
|
if (attachment.link) {
|
|
@@ -65,7 +62,7 @@ const handleAttachmentClick = (attachment) => {
|
|
|
65
62
|
let attachmentElements = $state({});
|
|
66
63
|
let observer = null;
|
|
67
64
|
$effect(() => {
|
|
68
|
-
if ((
|
|
65
|
+
if ((on?.productImpression || on?.adImpression) && Object.keys(attachmentElements).length > 0) {
|
|
69
66
|
if (observer) {
|
|
70
67
|
observer.disconnect();
|
|
71
68
|
}
|
|
@@ -74,19 +71,19 @@ $effect(() => {
|
|
|
74
71
|
if (entry.isIntersecting && entry.intersectionRatio >= 0.1) {
|
|
75
72
|
const productId = entry.target.getAttribute('data-product-id');
|
|
76
73
|
const adId = entry.target.getAttribute('data-ad-id');
|
|
77
|
-
if (productId &&
|
|
74
|
+
if (productId && on?.productImpression) {
|
|
78
75
|
on.productImpression(productId, model.id);
|
|
79
76
|
}
|
|
80
|
-
else if (adId &&
|
|
77
|
+
else if (adId && on?.adImpression) {
|
|
81
78
|
on.adImpression(adId);
|
|
82
79
|
}
|
|
83
|
-
observer
|
|
80
|
+
observer?.unobserve(entry.target); // Only track once per session
|
|
84
81
|
}
|
|
85
82
|
});
|
|
86
83
|
}, { threshold: 0.1 });
|
|
87
84
|
Object.entries(attachmentElements).forEach(([key, element]) => {
|
|
88
85
|
if (element && (key.startsWith('product-') || key.startsWith('ad-'))) {
|
|
89
|
-
observer
|
|
86
|
+
observer?.observe(element);
|
|
90
87
|
}
|
|
91
88
|
});
|
|
92
89
|
}
|
|
@@ -47,6 +47,11 @@ let { id, media, locale, autoplay = 'on-appearance', on } = $props();
|
|
|
47
47
|
}
|
|
48
48
|
.post-media {
|
|
49
49
|
--_post-media--background-color: #ffffff;
|
|
50
|
+
}
|
|
51
|
+
:global([data-theme='dark']) .post-media {
|
|
52
|
+
--_post-media--background-color: #000000;
|
|
53
|
+
}
|
|
54
|
+
.post-media {
|
|
50
55
|
width: 100%;
|
|
51
56
|
min-width: 100%;
|
|
52
57
|
max-width: 100%;
|
|
@@ -55,9 +60,6 @@ let { id, media, locale, autoplay = 'on-appearance', on } = $props();
|
|
|
55
60
|
max-height: 100%;
|
|
56
61
|
background-color: rgb(from var(--_post-media--background-color) r g b/60%);
|
|
57
62
|
}
|
|
58
|
-
:global([data-theme="dark"]) .post-media {
|
|
59
|
-
--_post-media--background-color: #000000;
|
|
60
|
-
}
|
|
61
63
|
.post-media--fit {
|
|
62
64
|
--video--media-fit: contain;
|
|
63
65
|
--image--object-fit: contain;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { CloseOrchestrator } from '../../ui/player/close-orchestrator';
|
|
1
|
+
<script lang="ts">import { CloseOrchestrator } from '../../ui/player/close-orchestrator';
|
|
11
2
|
import { createShadowRoot } from '../../ui/shadow-dom';
|
|
12
3
|
import { default as PostsPlayerProxy } from './posts-player-proxy.svelte';
|
|
13
4
|
import { mount, unmount } from 'svelte';
|
|
@@ -23,9 +14,9 @@ const initHost = (node) => {
|
|
|
23
14
|
playerSettings,
|
|
24
15
|
analyticsHandler,
|
|
25
16
|
closeOrchestrator: new CloseOrchestrator({
|
|
26
|
-
closeFn: () =>
|
|
27
|
-
|
|
28
|
-
}
|
|
17
|
+
closeFn: async () => {
|
|
18
|
+
await unmount(mounted);
|
|
19
|
+
},
|
|
29
20
|
canClose: false
|
|
30
21
|
}),
|
|
31
22
|
on
|
|
@@ -9,10 +9,9 @@ const handleBackgroundImagedLoaded = (url) => {
|
|
|
9
9
|
backgroundImageUrl = url;
|
|
10
10
|
};
|
|
11
11
|
$effect(() => {
|
|
12
|
-
void
|
|
12
|
+
void playerSettings?.theme;
|
|
13
13
|
untrack(() => {
|
|
14
|
-
|
|
15
|
-
Theme.set((_a = playerSettings === null || playerSettings === void 0 ? void 0 : playerSettings.theme) !== null && _a !== void 0 ? _a : 'dark');
|
|
14
|
+
Theme.set(playerSettings?.theme ?? 'dark');
|
|
16
15
|
});
|
|
17
16
|
});
|
|
18
17
|
</script>
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { PostType } from '../../core/enums';
|
|
1
|
+
<script lang="ts">import { PostType } from '../../core/enums';
|
|
11
2
|
import { preloadImage } from '../../core/image-preloader';
|
|
12
3
|
import { PostAttachments } from '../attachments';
|
|
13
4
|
import { PostActionsGenerator } from '../controls';
|
|
@@ -20,19 +11,20 @@ import { initBufferFromProvider } from '../../ui/player/providers/service';
|
|
|
20
11
|
import IconDelete from '@fluentui/svg-icons/icons/delete_32_regular.svg?raw';
|
|
21
12
|
import IconEdit from '@fluentui/svg-icons/icons/edit_32_regular.svg?raw';
|
|
22
13
|
import { untrack } from 'svelte';
|
|
14
|
+
import { SvelteMap } from 'svelte/reactivity';
|
|
23
15
|
let { dataProvider, socialInteractionsHandler, sharingHandler, playerSettings, analyticsHandler, managementActions, closeOrchestrator, on } = $props();
|
|
24
16
|
let buffer = $state.raw(null);
|
|
25
|
-
let mappedPostsCache = new
|
|
17
|
+
let mappedPostsCache = new SvelteMap();
|
|
26
18
|
$effect(() => {
|
|
27
19
|
void dataProvider;
|
|
28
20
|
untrack(() => {
|
|
29
21
|
contentPlayerConfig.playerBuffer = null;
|
|
30
22
|
buffer = null;
|
|
31
|
-
mappedPostsCache = new
|
|
23
|
+
mappedPostsCache = new SvelteMap();
|
|
32
24
|
initBuffer(dataProvider);
|
|
33
25
|
});
|
|
34
26
|
});
|
|
35
|
-
const initBuffer = (dataProvider) =>
|
|
27
|
+
const initBuffer = async (dataProvider) => {
|
|
36
28
|
let newBuffer;
|
|
37
29
|
if (dataProvider.type === 'buffer') {
|
|
38
30
|
newBuffer = dataProvider.buffer;
|
|
@@ -40,67 +32,64 @@ const initBuffer = (dataProvider) => __awaiter(void 0, void 0, void 0, function*
|
|
|
40
32
|
else {
|
|
41
33
|
newBuffer = initBufferFromProvider(dataProvider.provider);
|
|
42
34
|
}
|
|
43
|
-
|
|
44
|
-
if (newBuffer.loaded.length &&
|
|
35
|
+
await newBuffer.ensureWarmedUp();
|
|
36
|
+
if (newBuffer.loaded.length && on?.backgroundImageLoaded) {
|
|
45
37
|
const coverUrl = getPostCoverImage(newBuffer.loaded[0]);
|
|
46
|
-
|
|
38
|
+
await preloadImage(coverUrl);
|
|
47
39
|
on.backgroundImageLoaded(coverUrl);
|
|
48
40
|
}
|
|
49
41
|
buffer = newBuffer;
|
|
50
42
|
contentPlayerConfig.playerBuffer = newBuffer;
|
|
51
|
-
}
|
|
43
|
+
};
|
|
52
44
|
const getLoadedItemById = (id) => {
|
|
53
45
|
if (!buffer) {
|
|
54
46
|
return null;
|
|
55
47
|
}
|
|
56
48
|
return buffer.loaded.find((item) => item.id === id) || null;
|
|
57
49
|
};
|
|
58
|
-
const contentPlayerConfig = new PlayerConfig({
|
|
50
|
+
const contentPlayerConfig = untrack(() => new PlayerConfig({
|
|
59
51
|
playerBuffer: null,
|
|
60
52
|
settings: new PlayerSettings(playerSettings),
|
|
61
53
|
closeOrchestrator,
|
|
62
54
|
playerSliderCallbacks: {
|
|
63
55
|
itemActivated: (id) => {
|
|
64
|
-
var _a;
|
|
65
56
|
const post = getLoadedItemById(id);
|
|
66
57
|
if (!post) {
|
|
67
58
|
return;
|
|
68
59
|
}
|
|
69
|
-
if (on
|
|
60
|
+
if (on?.backgroundImageLoaded) {
|
|
70
61
|
on.backgroundImageLoaded(getPostCoverImage(post));
|
|
71
62
|
}
|
|
72
63
|
if (post.postType === PostType.ShortVideo) {
|
|
73
|
-
analyticsHandler
|
|
64
|
+
analyticsHandler?.trackShortVideoView(id);
|
|
74
65
|
}
|
|
75
66
|
else if (post.postType) {
|
|
76
|
-
analyticsHandler
|
|
67
|
+
analyticsHandler?.trackPostOpened(post.postType, id);
|
|
77
68
|
}
|
|
78
|
-
|
|
69
|
+
on?.postActivated?.(id);
|
|
79
70
|
}
|
|
80
71
|
}
|
|
81
|
-
});
|
|
82
|
-
const postActionsGenerator = new PostActionsGenerator({
|
|
72
|
+
}));
|
|
73
|
+
const postActionsGenerator = untrack(() => new PostActionsGenerator({
|
|
83
74
|
socialInteractionsHandler,
|
|
84
75
|
sharingHandler,
|
|
85
76
|
on: { attachmentClicked: () => (contentPlayerConfig.uiManager.attachmentsCollapsed = !contentPlayerConfig.uiManager.attachmentsCollapsed) }
|
|
86
|
-
});
|
|
77
|
+
}));
|
|
87
78
|
const onProductClick = (id, postId) => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackShortVideoProductClick(id, postId);
|
|
79
|
+
if (getLoadedItemById(postId)?.postType === PostType.ShortVideo) {
|
|
80
|
+
analyticsHandler?.trackShortVideoProductClick(id, postId);
|
|
91
81
|
}
|
|
92
82
|
};
|
|
93
83
|
const onProductImpression = (id, postId) => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackShortVideoProductImpression(id, postId);
|
|
84
|
+
if (getLoadedItemById(postId)?.postType === PostType.ShortVideo) {
|
|
85
|
+
analyticsHandler?.trackShortVideoProductImpression(id, postId);
|
|
97
86
|
}
|
|
98
87
|
};
|
|
99
88
|
const onAdClick = (id) => {
|
|
100
|
-
analyticsHandler
|
|
89
|
+
analyticsHandler?.trackAdClick(id);
|
|
101
90
|
};
|
|
102
91
|
const onAdImpression = (id) => {
|
|
103
|
-
analyticsHandler
|
|
92
|
+
analyticsHandler?.trackAdImpression(id);
|
|
104
93
|
};
|
|
105
94
|
const itemAsPostModel = (item) => {
|
|
106
95
|
if (mappedPostsCache.has(item.id)) {
|
|
@@ -111,36 +100,36 @@ const itemAsPostModel = (item) => {
|
|
|
111
100
|
return postModel;
|
|
112
101
|
};
|
|
113
102
|
const currentItemActions = $derived.by(() => {
|
|
114
|
-
if (!
|
|
103
|
+
if (!buffer?.current) {
|
|
115
104
|
return [];
|
|
116
105
|
}
|
|
117
106
|
const result = [];
|
|
118
107
|
const postModel = itemAsPostModel(buffer.current);
|
|
119
108
|
const handler = postActionsGenerator.getPostActionsHandler(postModel);
|
|
120
109
|
result.push(...handler.actions);
|
|
121
|
-
if (
|
|
110
|
+
if (managementActions?.editPost && postModel.postType !== PostType.Article) {
|
|
122
111
|
result.push({
|
|
123
112
|
icon: IconEdit,
|
|
124
|
-
callback: () =>
|
|
125
|
-
|
|
126
|
-
}
|
|
113
|
+
callback: async () => {
|
|
114
|
+
await managementActions.editPost(buffer.current.id);
|
|
115
|
+
}
|
|
127
116
|
});
|
|
128
117
|
}
|
|
129
|
-
if (
|
|
118
|
+
if (managementActions?.editArticle && postModel.postType === PostType.Article && buffer.current.articleId) {
|
|
130
119
|
result.push({
|
|
131
120
|
icon: IconEdit,
|
|
132
|
-
callback: () =>
|
|
133
|
-
|
|
134
|
-
}
|
|
121
|
+
callback: async () => {
|
|
122
|
+
await managementActions.editArticle(buffer.current.articleId);
|
|
123
|
+
}
|
|
135
124
|
});
|
|
136
125
|
}
|
|
137
|
-
if (managementActions
|
|
126
|
+
if (managementActions?.deletePost) {
|
|
138
127
|
result.push({
|
|
139
128
|
icon: IconDelete,
|
|
140
129
|
iconColor: IconColor.Red,
|
|
141
|
-
callback: () =>
|
|
142
|
-
|
|
143
|
-
}
|
|
130
|
+
callback: async () => {
|
|
131
|
+
await managementActions.deletePost(buffer.current.id);
|
|
132
|
+
}
|
|
144
133
|
});
|
|
145
134
|
}
|
|
146
135
|
return result;
|
|
@@ -8,12 +8,11 @@ let { product, colors, includeBeforeNowPrefix, trackingParams, inert = false, lo
|
|
|
8
8
|
const localization = $derived(new ProductCardLocalization(locale));
|
|
9
9
|
const shortDescriptionPresented = $derived(product.shortDescription && product.shortDescription.length > 0);
|
|
10
10
|
const trackImpression = (node) => {
|
|
11
|
-
if (on
|
|
11
|
+
if (on?.impression) {
|
|
12
12
|
const observer = new IntersectionObserver((entries) => {
|
|
13
13
|
entries.forEach((entry) => {
|
|
14
|
-
var _a;
|
|
15
14
|
if (entry.isIntersecting && entry.intersectionRatio >= 0.5) {
|
|
16
|
-
|
|
15
|
+
on.impression?.(product.id);
|
|
17
16
|
observer.unobserve(entry.target);
|
|
18
17
|
}
|
|
19
18
|
});
|
|
@@ -30,7 +29,7 @@ const enrichedLink = $derived(product.link ? enrichProductLinkWithTracking({ lin
|
|
|
30
29
|
const onProductClicked = (event) => {
|
|
31
30
|
event.preventDefault();
|
|
32
31
|
event.stopPropagation();
|
|
33
|
-
if (on
|
|
32
|
+
if (on?.click) {
|
|
34
33
|
on.click(product.id);
|
|
35
34
|
}
|
|
36
35
|
if (enrichedLink) {
|
|
@@ -39,13 +38,13 @@ const onProductClicked = (event) => {
|
|
|
39
38
|
};
|
|
40
39
|
const styles = $derived.by(() => {
|
|
41
40
|
const values = [];
|
|
42
|
-
if (colors
|
|
41
|
+
if (colors?.background) {
|
|
43
42
|
values.push(`--product-card--background-color: ${colors.background}`);
|
|
44
43
|
}
|
|
45
|
-
if (colors
|
|
44
|
+
if (colors?.price) {
|
|
46
45
|
values.push(`--product-card--price-color: ${colors.price}`);
|
|
47
46
|
}
|
|
48
|
-
if (colors
|
|
47
|
+
if (colors?.salePrice) {
|
|
49
48
|
values.push(`--product-card--sale-price-color: ${colors.salePrice}`);
|
|
50
49
|
}
|
|
51
50
|
return values.join(';');
|
|
@@ -9,7 +9,7 @@ import IconPhone from '@fluentui/svg-icons/icons/phone_20_regular.svg?raw';
|
|
|
9
9
|
import IconShoppingBag from '@fluentui/svg-icons/icons/shopping_bag_20_regular.svg?raw';
|
|
10
10
|
const ADJUST_TEXT_SIZE = false;
|
|
11
11
|
let { shortVideo, locale, on } = $props();
|
|
12
|
-
const localization = new ShortVideoCardLocalization(locale);
|
|
12
|
+
const localization = $derived(new ShortVideoCardLocalization(locale));
|
|
13
13
|
const adjustTextSize = (node) => {
|
|
14
14
|
if (!ADJUST_TEXT_SIZE) {
|
|
15
15
|
return;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { PostActionsHandler } from '../../posts/controls';
|
|
2
2
|
import IconShare from '@fluentui/svg-icons/icons/share_48_regular.svg?raw';
|
|
3
|
+
import { SvelteMap } from 'svelte/reactivity';
|
|
3
4
|
export class StreamActionsGenerator {
|
|
4
5
|
postSocialInteractionsHandler;
|
|
5
6
|
sharingHandler;
|
|
6
7
|
callbacks;
|
|
7
|
-
handlers = new
|
|
8
|
+
handlers = new SvelteMap();
|
|
8
9
|
constructor(init) {
|
|
9
10
|
this.postSocialInteractionsHandler = init.postSocialInteractionsHandler ?? null;
|
|
10
11
|
this.sharingHandler = init.sharingHandler ?? null;
|
|
@@ -31,9 +31,9 @@ const dataIsFilled = $derived.by(() => {
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
const productModel = $derived.by(() => {
|
|
34
|
-
return
|
|
34
|
+
return slotData?.type === StreamComponentDataType.Product ? slotData.product : undefined;
|
|
35
35
|
});
|
|
36
|
-
const enrichedLink = $derived(
|
|
36
|
+
const enrichedLink = $derived(productModel?.link
|
|
37
37
|
? enrichProductLinkWithTracking({
|
|
38
38
|
link: productModel.link,
|
|
39
39
|
productId: productModel.id,
|
|
@@ -45,7 +45,7 @@ const handleProductClick = (e) => {
|
|
|
45
45
|
if (!productModel) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
if (productModel.id &&
|
|
48
|
+
if (productModel.id && on?.productClick) {
|
|
49
49
|
on.productClick(productModel.id);
|
|
50
50
|
}
|
|
51
51
|
if (enrichedLink) {
|
|
@@ -53,12 +53,11 @@ const handleProductClick = (e) => {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
const productLinkMounted = (node, productModel) => {
|
|
56
|
-
if (on
|
|
56
|
+
if (on?.productImpression) {
|
|
57
57
|
const observer = new IntersectionObserver((entries) => {
|
|
58
58
|
entries.forEach((entry) => {
|
|
59
|
-
var _a;
|
|
60
59
|
if (entry.isIntersecting && entry.intersectionRatio >= 0.5) {
|
|
61
|
-
|
|
60
|
+
on.productImpression?.(productModel.id);
|
|
62
61
|
observer.unobserve(entry.target);
|
|
63
62
|
}
|
|
64
63
|
});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { PriceStreamElementLocalization } from './price-stream-element-localization';
|
|
1
|
+
<script lang="ts">import { PriceStreamElementLocalization } from './price-stream-element-localization';
|
|
3
2
|
import { default as PriceElementView } from './price-element-view.svelte';
|
|
4
3
|
let { model, data, locale } = $props();
|
|
5
4
|
const localization = $derived(new PriceStreamElementLocalization(locale));
|
|
6
|
-
let baseMaxHeight = $derived(
|
|
5
|
+
let baseMaxHeight = $derived(model.styles?.height || 32);
|
|
7
6
|
let adjustedHeight = $derived(baseMaxHeight);
|
|
8
7
|
</script>
|
|
9
8
|
|
|
@@ -4,7 +4,7 @@ import { generateProductsSliderStyles } from '../styles-transformer';
|
|
|
4
4
|
import { default as StreamElement } from './cmp.stream-element.svelte';
|
|
5
5
|
let { model, data, trackingParams, locale } = $props();
|
|
6
6
|
const getProductDataByIndex = (index) => {
|
|
7
|
-
const products =
|
|
7
|
+
const products = data?.type === StreamComponentDataType.Products ? data.products : [];
|
|
8
8
|
const product = products[index];
|
|
9
9
|
if (!product) {
|
|
10
10
|
return null;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { StockStreamElementLocalization } from './stock-stream-element-localization';
|
|
1
|
+
<script lang="ts">import { StockStreamElementLocalization } from './stock-stream-element-localization';
|
|
3
2
|
import { StockStreamElementLevel } from '../enums';
|
|
4
3
|
import { mapFlexJustifyContent, transformNumericValue, transformTextColorValue } from '../styles-transformer';
|
|
5
4
|
let { model, heightOverrideDdu, locale } = $props();
|
|
6
5
|
const localization = $derived(new StockStreamElementLocalization(locale));
|
|
7
|
-
const height = $derived(heightOverrideDdu ||
|
|
6
|
+
const height = $derived(heightOverrideDdu || model.styles?.height || 16);
|
|
8
7
|
const containerStyles = $derived.by(() => {
|
|
9
|
-
var _a;
|
|
10
8
|
const values = [
|
|
11
9
|
`align-items: center;`,
|
|
12
10
|
`height: ${transformNumericValue(height)}; gap: 1cqi;`,
|
|
13
|
-
`justify-content: ${mapFlexJustifyContent(
|
|
11
|
+
`justify-content: ${mapFlexJustifyContent(model.styles?.horizontalAlign)};`
|
|
14
12
|
];
|
|
15
13
|
return values.join('');
|
|
16
14
|
});
|
|
@@ -19,8 +17,7 @@ const dotCustomStyles = $derived.by(() => {
|
|
|
19
17
|
return values.join('');
|
|
20
18
|
});
|
|
21
19
|
const quantityCustomStyles = $derived.by(() => {
|
|
22
|
-
|
|
23
|
-
const values = [`font-size: ${transformNumericValue(height * 0.75)};`, `color: ${transformTextColorValue((_a = model.styles) === null || _a === void 0 ? void 0 : _a.color)};`];
|
|
20
|
+
const values = [`font-size: ${transformNumericValue(height * 0.75)};`, `color: ${transformTextColorValue(model.styles?.color)};`];
|
|
24
21
|
return values.join('');
|
|
25
22
|
});
|
|
26
23
|
</script>
|