@streamscloud/embeddable 15.0.1 → 15.0.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.
- 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 +3 -3
- 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 +38 -50
- 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 +3 -3
- 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 +46 -60
- 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
|
}
|
|
@@ -3,14 +3,14 @@ export class PostActionsGenerator {
|
|
|
3
3
|
socialInteractionsHandler;
|
|
4
4
|
sharingHandler;
|
|
5
5
|
callbacks;
|
|
6
|
-
handlers =
|
|
6
|
+
handlers = {};
|
|
7
7
|
constructor(init) {
|
|
8
8
|
this.socialInteractionsHandler = init.socialInteractionsHandler ?? null;
|
|
9
9
|
this.sharingHandler = init.sharingHandler ?? null;
|
|
10
10
|
this.callbacks = init.on;
|
|
11
11
|
}
|
|
12
12
|
getPostActionsHandler = (model) => {
|
|
13
|
-
let handler = this.handlers
|
|
13
|
+
let handler = this.handlers[model.id];
|
|
14
14
|
if (!handler) {
|
|
15
15
|
handler = new PostActionsHandler({
|
|
16
16
|
post: model,
|
|
@@ -20,7 +20,7 @@ export class PostActionsGenerator {
|
|
|
20
20
|
shareClicked: this.sharingHandler ? () => this.sharingHandler?.share(model.id) : undefined
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
|
-
this.handlers
|
|
23
|
+
this.handlers[model.id] = handler;
|
|
24
24
|
}
|
|
25
25
|
return handler;
|
|
26
26
|
};
|
|
@@ -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';
|
|
@@ -22,17 +13,17 @@ import IconEdit from '@fluentui/svg-icons/icons/edit_32_regular.svg?raw';
|
|
|
22
13
|
import { untrack } from 'svelte';
|
|
23
14
|
let { dataProvider, socialInteractionsHandler, sharingHandler, playerSettings, analyticsHandler, managementActions, closeOrchestrator, on } = $props();
|
|
24
15
|
let buffer = $state.raw(null);
|
|
25
|
-
let mappedPostsCache =
|
|
16
|
+
let mappedPostsCache = {};
|
|
26
17
|
$effect(() => {
|
|
27
18
|
void dataProvider;
|
|
28
19
|
untrack(() => {
|
|
29
20
|
contentPlayerConfig.playerBuffer = null;
|
|
30
21
|
buffer = null;
|
|
31
|
-
mappedPostsCache =
|
|
22
|
+
mappedPostsCache = {};
|
|
32
23
|
initBuffer(dataProvider);
|
|
33
24
|
});
|
|
34
25
|
});
|
|
35
|
-
const initBuffer = (dataProvider) =>
|
|
26
|
+
const initBuffer = async (dataProvider) => {
|
|
36
27
|
let newBuffer;
|
|
37
28
|
if (dataProvider.type === 'buffer') {
|
|
38
29
|
newBuffer = dataProvider.buffer;
|
|
@@ -40,107 +31,104 @@ const initBuffer = (dataProvider) => __awaiter(void 0, void 0, void 0, function*
|
|
|
40
31
|
else {
|
|
41
32
|
newBuffer = initBufferFromProvider(dataProvider.provider);
|
|
42
33
|
}
|
|
43
|
-
|
|
44
|
-
if (newBuffer.loaded.length &&
|
|
34
|
+
await newBuffer.ensureWarmedUp();
|
|
35
|
+
if (newBuffer.loaded.length && on?.backgroundImageLoaded) {
|
|
45
36
|
const coverUrl = getPostCoverImage(newBuffer.loaded[0]);
|
|
46
|
-
|
|
37
|
+
await preloadImage(coverUrl);
|
|
47
38
|
on.backgroundImageLoaded(coverUrl);
|
|
48
39
|
}
|
|
49
40
|
buffer = newBuffer;
|
|
50
41
|
contentPlayerConfig.playerBuffer = newBuffer;
|
|
51
|
-
}
|
|
42
|
+
};
|
|
52
43
|
const getLoadedItemById = (id) => {
|
|
53
44
|
if (!buffer) {
|
|
54
45
|
return null;
|
|
55
46
|
}
|
|
56
47
|
return buffer.loaded.find((item) => item.id === id) || null;
|
|
57
48
|
};
|
|
58
|
-
const contentPlayerConfig = new PlayerConfig({
|
|
49
|
+
const contentPlayerConfig = untrack(() => new PlayerConfig({
|
|
59
50
|
playerBuffer: null,
|
|
60
51
|
settings: new PlayerSettings(playerSettings),
|
|
61
52
|
closeOrchestrator,
|
|
62
53
|
playerSliderCallbacks: {
|
|
63
54
|
itemActivated: (id) => {
|
|
64
|
-
var _a;
|
|
65
55
|
const post = getLoadedItemById(id);
|
|
66
56
|
if (!post) {
|
|
67
57
|
return;
|
|
68
58
|
}
|
|
69
|
-
if (on
|
|
59
|
+
if (on?.backgroundImageLoaded) {
|
|
70
60
|
on.backgroundImageLoaded(getPostCoverImage(post));
|
|
71
61
|
}
|
|
72
62
|
if (post.postType === PostType.ShortVideo) {
|
|
73
|
-
analyticsHandler
|
|
63
|
+
analyticsHandler?.trackShortVideoView(id);
|
|
74
64
|
}
|
|
75
65
|
else if (post.postType) {
|
|
76
|
-
analyticsHandler
|
|
66
|
+
analyticsHandler?.trackPostOpened(post.postType, id);
|
|
77
67
|
}
|
|
78
|
-
|
|
68
|
+
on?.postActivated?.(id);
|
|
79
69
|
}
|
|
80
70
|
}
|
|
81
|
-
});
|
|
82
|
-
const postActionsGenerator = new PostActionsGenerator({
|
|
71
|
+
}));
|
|
72
|
+
const postActionsGenerator = untrack(() => new PostActionsGenerator({
|
|
83
73
|
socialInteractionsHandler,
|
|
84
74
|
sharingHandler,
|
|
85
75
|
on: { attachmentClicked: () => (contentPlayerConfig.uiManager.attachmentsCollapsed = !contentPlayerConfig.uiManager.attachmentsCollapsed) }
|
|
86
|
-
});
|
|
76
|
+
}));
|
|
87
77
|
const onProductClick = (id, postId) => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackShortVideoProductClick(id, postId);
|
|
78
|
+
if (getLoadedItemById(postId)?.postType === PostType.ShortVideo) {
|
|
79
|
+
analyticsHandler?.trackShortVideoProductClick(id, postId);
|
|
91
80
|
}
|
|
92
81
|
};
|
|
93
82
|
const onProductImpression = (id, postId) => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
analyticsHandler === null || analyticsHandler === void 0 ? void 0 : analyticsHandler.trackShortVideoProductImpression(id, postId);
|
|
83
|
+
if (getLoadedItemById(postId)?.postType === PostType.ShortVideo) {
|
|
84
|
+
analyticsHandler?.trackShortVideoProductImpression(id, postId);
|
|
97
85
|
}
|
|
98
86
|
};
|
|
99
87
|
const onAdClick = (id) => {
|
|
100
|
-
analyticsHandler
|
|
88
|
+
analyticsHandler?.trackAdClick(id);
|
|
101
89
|
};
|
|
102
90
|
const onAdImpression = (id) => {
|
|
103
|
-
analyticsHandler
|
|
91
|
+
analyticsHandler?.trackAdImpression(id);
|
|
104
92
|
};
|
|
105
93
|
const itemAsPostModel = (item) => {
|
|
106
|
-
if (mappedPostsCache
|
|
107
|
-
return mappedPostsCache
|
|
94
|
+
if (mappedPostsCache[item.id]) {
|
|
95
|
+
return mappedPostsCache[item.id];
|
|
108
96
|
}
|
|
109
97
|
const postModel = new PostModel(item);
|
|
110
|
-
mappedPostsCache
|
|
98
|
+
mappedPostsCache[item.id] = postModel;
|
|
111
99
|
return postModel;
|
|
112
100
|
};
|
|
113
101
|
const currentItemActions = $derived.by(() => {
|
|
114
|
-
if (!
|
|
102
|
+
if (!buffer?.current) {
|
|
115
103
|
return [];
|
|
116
104
|
}
|
|
117
105
|
const result = [];
|
|
118
106
|
const postModel = itemAsPostModel(buffer.current);
|
|
119
107
|
const handler = postActionsGenerator.getPostActionsHandler(postModel);
|
|
120
108
|
result.push(...handler.actions);
|
|
121
|
-
if (
|
|
109
|
+
if (managementActions?.editPost && postModel.postType !== PostType.Article) {
|
|
122
110
|
result.push({
|
|
123
111
|
icon: IconEdit,
|
|
124
|
-
callback: () =>
|
|
125
|
-
|
|
126
|
-
}
|
|
112
|
+
callback: async () => {
|
|
113
|
+
await managementActions.editPost(buffer.current.id);
|
|
114
|
+
}
|
|
127
115
|
});
|
|
128
116
|
}
|
|
129
|
-
if (
|
|
117
|
+
if (managementActions?.editArticle && postModel.postType === PostType.Article && buffer.current.articleId) {
|
|
130
118
|
result.push({
|
|
131
119
|
icon: IconEdit,
|
|
132
|
-
callback: () =>
|
|
133
|
-
|
|
134
|
-
}
|
|
120
|
+
callback: async () => {
|
|
121
|
+
await managementActions.editArticle(buffer.current.articleId);
|
|
122
|
+
}
|
|
135
123
|
});
|
|
136
124
|
}
|
|
137
|
-
if (managementActions
|
|
125
|
+
if (managementActions?.deletePost) {
|
|
138
126
|
result.push({
|
|
139
127
|
icon: IconDelete,
|
|
140
128
|
iconColor: IconColor.Red,
|
|
141
|
-
callback: () =>
|
|
142
|
-
|
|
143
|
-
}
|
|
129
|
+
callback: async () => {
|
|
130
|
+
await managementActions.deletePost(buffer.current.id);
|
|
131
|
+
}
|
|
144
132
|
});
|
|
145
133
|
}
|
|
146
134
|
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;
|
|
@@ -4,7 +4,7 @@ export class StreamActionsGenerator {
|
|
|
4
4
|
postSocialInteractionsHandler;
|
|
5
5
|
sharingHandler;
|
|
6
6
|
callbacks;
|
|
7
|
-
handlers =
|
|
7
|
+
handlers = {};
|
|
8
8
|
constructor(init) {
|
|
9
9
|
this.postSocialInteractionsHandler = init.postSocialInteractionsHandler ?? null;
|
|
10
10
|
this.sharingHandler = init.sharingHandler ?? null;
|
|
@@ -12,7 +12,7 @@ export class StreamActionsGenerator {
|
|
|
12
12
|
}
|
|
13
13
|
getPostActionsHandler = (data) => {
|
|
14
14
|
const { model, streamId, streamPageId } = data;
|
|
15
|
-
let handler = this.handlers
|
|
15
|
+
let handler = this.handlers[streamPageId];
|
|
16
16
|
if (!handler) {
|
|
17
17
|
handler = new PostActionsHandler({
|
|
18
18
|
post: model,
|
|
@@ -22,7 +22,7 @@ export class StreamActionsGenerator {
|
|
|
22
22
|
shareClicked: this.sharingHandler ? () => this.sharingHandler?.share(streamId) : undefined
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
this.handlers
|
|
25
|
+
this.handlers[streamPageId] = handler;
|
|
26
26
|
}
|
|
27
27
|
return handler;
|
|
28
28
|
};
|
|
@@ -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>
|