@streamscloud/embeddable 15.0.0 → 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/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 +43 -41
|
@@ -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>
|
|
@@ -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 { Utils } from '../../../core/utils';
|
|
1
|
+
<script lang="ts">import { Utils } from '../../../core/utils';
|
|
11
2
|
import { toPriceRepresentation } from '../../../products/price-helper';
|
|
12
3
|
import { LineClamp } from '../../../ui/line-clamp';
|
|
13
4
|
import { PriceStreamElementLocalization } from './price-stream-element-localization';
|
|
@@ -21,7 +12,7 @@ let adjustedHeight = $derived(maxElementHeight);
|
|
|
21
12
|
const lineHeight = 1.2;
|
|
22
13
|
const elementHeight = $derived(adjustedHeight);
|
|
23
14
|
const priceHeight = $derived(model.stock ? elementHeight * 0.68 : elementHeight);
|
|
24
|
-
const adjustableHeight = $derived(!!
|
|
15
|
+
const adjustableHeight = $derived(!!on?.heightAdjusted);
|
|
25
16
|
const priceOptions = $derived({
|
|
26
17
|
currencyMode: model.includeCurrency ? 'symbol' : 'none'
|
|
27
18
|
});
|
|
@@ -41,13 +32,12 @@ const beforeValue = $derived.by(() => {
|
|
|
41
32
|
return toPriceRepresentation({ amount: data.price, currency: data.currency, options: priceOptions });
|
|
42
33
|
});
|
|
43
34
|
const elementContainerStyles = $derived.by(() => {
|
|
44
|
-
var _a, _b;
|
|
45
35
|
const values = [
|
|
46
36
|
'display: flex;',
|
|
47
37
|
'flex-direction: column;',
|
|
48
38
|
'justify-content: space-between;',
|
|
49
|
-
`align-items: ${mapFlexJustifyContent(
|
|
50
|
-
`font-family: ${mapFontFamily(
|
|
39
|
+
`align-items: ${mapFlexJustifyContent(model.styles?.horizontalAlign)};`,
|
|
40
|
+
`font-family: ${mapFontFamily(model.styles?.fontFamily)};`,
|
|
51
41
|
`height: ${transformNumericValue(elementHeight)};`
|
|
52
42
|
];
|
|
53
43
|
return values.join('');
|
|
@@ -57,34 +47,31 @@ const priceContainerStyles = $derived.by(() => {
|
|
|
57
47
|
return values.join('');
|
|
58
48
|
});
|
|
59
49
|
const priceCustomStyles = $derived.by(() => {
|
|
60
|
-
var _a, _b, _c;
|
|
61
50
|
const values = [
|
|
62
51
|
`font-size: ${transformFontSizeValue(priceHeight / lineHeight)};`,
|
|
63
52
|
`line-height: ${lineHeight};`,
|
|
64
|
-
`font-weight: ${mapFontWeight(
|
|
65
|
-
`color: ${transformTextColorValue(data.salePrice ?
|
|
53
|
+
`font-weight: ${mapFontWeight(model.styles?.fontWeight)};`,
|
|
54
|
+
`color: ${transformTextColorValue(data.salePrice ? model.styles?.salePriceColor : model.styles?.regularPriceColor)};`
|
|
66
55
|
];
|
|
67
56
|
return values.join('');
|
|
68
57
|
});
|
|
69
58
|
const saveValueCustomStyles = $derived.by(() => {
|
|
70
|
-
var _a, _b;
|
|
71
59
|
const values = [
|
|
72
60
|
`margin-top: ${transformNumericValue((priceHeight - priceHeight / lineHeight) / 2)};`,
|
|
73
61
|
`font-size: ${transformFontSizeValue(priceHeight / 4)};`,
|
|
74
62
|
`font-weight: 500;`,
|
|
75
63
|
`padding: ${transformNumericValue(priceHeight / 8)} ${transformNumericValue(priceHeight / 4)};`,
|
|
76
64
|
`border-radius: ${transformNumericValue(priceHeight / 8)};`,
|
|
77
|
-
`background-color: ${transformBackgroundColorValue(
|
|
78
|
-
`color: ${transformTextColorValue(
|
|
65
|
+
`background-color: ${transformBackgroundColorValue(model.styles?.saveValueBackgroundColor)};`,
|
|
66
|
+
`color: ${transformTextColorValue(model.styles?.saveValueColor)};`
|
|
79
67
|
];
|
|
80
68
|
return values.join('');
|
|
81
69
|
});
|
|
82
70
|
const beforeValueCustomStyles = $derived.by(() => {
|
|
83
|
-
var _a;
|
|
84
71
|
const values = [
|
|
85
72
|
`font-size: ${transformFontSizeValue(priceHeight / 5)};`,
|
|
86
73
|
`font-weight: 500;`,
|
|
87
|
-
`color: ${transformTextColorValue(
|
|
74
|
+
`color: ${transformTextColorValue(model.styles?.beforeValueColor)};`
|
|
88
75
|
];
|
|
89
76
|
return values.join('');
|
|
90
77
|
});
|
|
@@ -93,15 +80,15 @@ const textAfterCustomStyles = $derived.by(() => {
|
|
|
93
80
|
return values.join('');
|
|
94
81
|
});
|
|
95
82
|
const stockElementHeight = $derived(elementHeight * 0.23);
|
|
96
|
-
const adjustHeightToFit = () =>
|
|
83
|
+
const adjustHeightToFit = async () => {
|
|
97
84
|
if (!priceContainerRef || !priceElementRef || !adjustableHeight) {
|
|
98
85
|
return;
|
|
99
86
|
}
|
|
100
|
-
|
|
87
|
+
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
101
88
|
let currentHeight = maxElementHeight;
|
|
102
89
|
while (currentHeight > minElementHeight) {
|
|
103
90
|
adjustedHeight = currentHeight;
|
|
104
|
-
|
|
91
|
+
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
105
92
|
if (!priceContainerRef || !priceElementRef || !adjustableHeight) {
|
|
106
93
|
return;
|
|
107
94
|
}
|
|
@@ -111,8 +98,8 @@ const adjustHeightToFit = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
111
98
|
}
|
|
112
99
|
currentHeight -= 1;
|
|
113
100
|
}
|
|
114
|
-
on
|
|
115
|
-
}
|
|
101
|
+
on?.heightAdjusted(currentHeight);
|
|
102
|
+
};
|
|
116
103
|
const debouncedAdjustHeightToFit = Utils.debounce(adjustHeightToFit, 400);
|
|
117
104
|
$effect(() => {
|
|
118
105
|
const references = [maxElementHeight, currentPrice, saveValue, beforeValue, model.textAfter, model.includeCurrency, model.excludeBeforePrice];
|
|
@@ -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 StreamsPlayerProxy } from './streams-player-proxy.svelte';
|
|
13
4
|
import { mount, unmount } from 'svelte';
|
|
@@ -24,9 +15,9 @@ const initHost = (node) => {
|
|
|
24
15
|
amplificationParameters,
|
|
25
16
|
playerSettings,
|
|
26
17
|
closeOrchestrator: new CloseOrchestrator({
|
|
27
|
-
closeFn: () =>
|
|
28
|
-
|
|
29
|
-
}
|
|
18
|
+
closeFn: async () => {
|
|
19
|
+
await unmount(mounted);
|
|
20
|
+
},
|
|
30
21
|
canClose: false
|
|
31
22
|
}),
|
|
32
23
|
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>
|