@streamlayer/react-ui 1.22.5 → 1.22.6
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as h, jsx as d } from "react/jsx-runtime";
|
|
2
2
|
import { AutoPlayVideo as C, QuestionImages as I } from "@streamlayer/sdk-web-types";
|
|
3
3
|
import { VideoPlayer as N } from "../../video-player/index.js";
|
|
4
|
-
import { Container as v, contentContainerClassName as u, ImageContainer as
|
|
4
|
+
import { Container as v, contentContainerClassName as u, ImageContainer as P, Image as b, Content as x, Title as B, Description as D } from "./styles.js";
|
|
5
5
|
const U = ({
|
|
6
6
|
instantView: o,
|
|
7
7
|
isDetail: l,
|
|
@@ -17,20 +17,20 @@ const U = ({
|
|
|
17
17
|
source: o.video.url,
|
|
18
18
|
poster: o.video.thumbnailUrl,
|
|
19
19
|
controlVideo: g,
|
|
20
|
-
autoPlay: o.autoPlayVideo === C.ENABLED
|
|
20
|
+
autoPlay: l && o.autoPlayVideo === C.ENABLED
|
|
21
21
|
}
|
|
22
22
|
),
|
|
23
23
|
(o == null ? void 0 : o.image) && !(o != null && o.video) && /* @__PURE__ */ d(
|
|
24
|
-
|
|
24
|
+
P,
|
|
25
25
|
{
|
|
26
26
|
className: u,
|
|
27
27
|
"data-rounded": o.imageMode === I.ROUNDED,
|
|
28
|
-
children: /* @__PURE__ */ d(
|
|
28
|
+
children: /* @__PURE__ */ d(b, { src: o == null ? void 0 : o.image })
|
|
29
29
|
}
|
|
30
30
|
),
|
|
31
|
-
/* @__PURE__ */ h(
|
|
32
|
-
/* @__PURE__ */ d(
|
|
33
|
-
/* @__PURE__ */ d(
|
|
31
|
+
/* @__PURE__ */ h(x, { children: [
|
|
32
|
+
/* @__PURE__ */ d(B, { children: l && e ? m : y }),
|
|
33
|
+
/* @__PURE__ */ d(D, { children: l && e ? c : p })
|
|
34
34
|
] })
|
|
35
35
|
] });
|
|
36
36
|
};
|
|
@@ -1,63 +1,59 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
body: C,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/* @__PURE__ */ n(p, { src: r[0].mediaUrlHttps }),
|
|
40
|
-
/* @__PURE__ */ c(a, { children: [
|
|
41
|
-
/* @__PURE__ */ n(l, { src: r[1].mediaUrlHttps }),
|
|
42
|
-
/* @__PURE__ */ n(l, { src: r[2].mediaUrlHttps })
|
|
43
|
-
] })
|
|
44
|
-
] }),
|
|
45
|
-
(r == null ? void 0 : r.length) === 4 && /* @__PURE__ */ c(i, { children: [
|
|
46
|
-
/* @__PURE__ */ c(a, { children: [
|
|
47
|
-
/* @__PURE__ */ n(l, { src: r[0].mediaUrlHttps }),
|
|
48
|
-
/* @__PURE__ */ n(l, { src: r[1].mediaUrlHttps })
|
|
1
|
+
import { jsxs as o, jsx as s, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { memo as k, useMemo as x } from "react";
|
|
3
|
+
import { VideoPlayer as B } from "../../video-player/index.js";
|
|
4
|
+
import { Account as E } from "./account/index.js";
|
|
5
|
+
import { Container as L, Details as N, Body as R, ImagesContainer as l, ImageFullSize as t, ImageHalfSize as p, ImagesBlock as a } from "./styles.js";
|
|
6
|
+
const S = new RegExp("\\s?https?://t.co[^\\s]+(\\s+)?$"), A = (c) => c == null ? void 0 : c.replace(S, ""), $ = k(
|
|
7
|
+
({ image: c, body: y, account: C, accountVerified: z, tweet: n, isDetail: d, controlVideo: F }) => {
|
|
8
|
+
var h, g, H, U, f;
|
|
9
|
+
const r = (g = (h = n == null ? void 0 : n.meta) == null ? void 0 : h.extendedEntities) == null ? void 0 : g.media, i = r == null ? void 0 : r.find(({ type: e }) => e === "photo"), m = x(() => {
|
|
10
|
+
var e, u, v, I;
|
|
11
|
+
return (I = (v = (u = (e = r == null ? void 0 : r[0]) == null ? void 0 : e.videoInfo) == null ? void 0 : u.variants) == null ? void 0 : v.findLast(({ contentType: T }) => T === "video/mp4")) == null ? void 0 : I.url;
|
|
12
|
+
}, [r]);
|
|
13
|
+
return /* @__PURE__ */ o(L, { children: [
|
|
14
|
+
/* @__PURE__ */ o(N, { children: [
|
|
15
|
+
/* @__PURE__ */ s(
|
|
16
|
+
E,
|
|
17
|
+
{
|
|
18
|
+
image: c,
|
|
19
|
+
name: (H = n == null ? void 0 : n.meta) == null ? void 0 : H.accountName,
|
|
20
|
+
userName: C,
|
|
21
|
+
verified: z,
|
|
22
|
+
createdTweet: n == null ? void 0 : n.date
|
|
23
|
+
}
|
|
24
|
+
),
|
|
25
|
+
/* @__PURE__ */ s(R, { children: A(y) }),
|
|
26
|
+
!d && i && /* @__PURE__ */ s(l, { children: /* @__PURE__ */ s(t, { src: r == null ? void 0 : r[0].mediaUrlHttps }) }),
|
|
27
|
+
d && i && /* @__PURE__ */ o(j, { children: [
|
|
28
|
+
(r == null ? void 0 : r.length) === 1 && /* @__PURE__ */ s(l, { children: /* @__PURE__ */ s(t, { src: r[0].mediaUrlHttps }) }),
|
|
29
|
+
(r == null ? void 0 : r.length) === 2 && /* @__PURE__ */ o(l, { children: [
|
|
30
|
+
/* @__PURE__ */ s(p, { src: r[0].mediaUrlHttps }),
|
|
31
|
+
/* @__PURE__ */ s(p, { src: r[1].mediaUrlHttps })
|
|
32
|
+
] }),
|
|
33
|
+
(r == null ? void 0 : r.length) === 3 && /* @__PURE__ */ o(l, { children: [
|
|
34
|
+
/* @__PURE__ */ s(p, { src: r[0].mediaUrlHttps }),
|
|
35
|
+
/* @__PURE__ */ o(a, { children: [
|
|
36
|
+
/* @__PURE__ */ s(t, { src: r[1].mediaUrlHttps }),
|
|
37
|
+
/* @__PURE__ */ s(t, { src: r[2].mediaUrlHttps })
|
|
38
|
+
] })
|
|
49
39
|
] }),
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
|
|
40
|
+
(r == null ? void 0 : r.length) === 4 && /* @__PURE__ */ o(l, { children: [
|
|
41
|
+
/* @__PURE__ */ o(a, { children: [
|
|
42
|
+
/* @__PURE__ */ s(t, { src: r[0].mediaUrlHttps }),
|
|
43
|
+
/* @__PURE__ */ s(t, { src: r[1].mediaUrlHttps })
|
|
44
|
+
] }),
|
|
45
|
+
/* @__PURE__ */ o(a, { children: [
|
|
46
|
+
/* @__PURE__ */ s(t, { src: r[2].mediaUrlHttps }),
|
|
47
|
+
/* @__PURE__ */ s(t, { src: r[3].mediaUrlHttps })
|
|
48
|
+
] })
|
|
53
49
|
] })
|
|
54
50
|
] })
|
|
55
|
-
] })
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
] }),
|
|
52
|
+
!i && (((U = r == null ? void 0 : r[0]) == null ? void 0 : U.type) === "video" || ((f = r == null ? void 0 : r[0]) == null ? void 0 : f.type) === "animated_gif") && m && /* @__PURE__ */ s(B, { source: m, poster: r[0].mediaUrlHttps, controlVideo: F })
|
|
53
|
+
] });
|
|
54
|
+
}
|
|
55
|
+
);
|
|
60
56
|
export {
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
$ as TwitterContent,
|
|
58
|
+
A as sanitizeContent
|
|
63
59
|
};
|
|
@@ -94,7 +94,7 @@ const _ = {
|
|
|
94
94
|
--font-size-secondary: ${t.SIZE_DEFAULT1};
|
|
95
95
|
--font-size-small: ${t.SIZE_DEFAULT2};
|
|
96
96
|
--line-height-default: ${t.LINE_HEIGHT};
|
|
97
|
-
--margin-title-default: 0px;
|
|
97
|
+
--margin-title-default: 0px 0px 12px;
|
|
98
98
|
--font-header-title: 20px;
|
|
99
99
|
|
|
100
100
|
--header-offset: 0px;
|
|
@@ -1,98 +1,113 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as k, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { cx as C } from "@linaria/core";
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { eventBus as
|
|
5
|
-
import { SvgIcon as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { useRef as U, useState as p, useCallback as w, useEffect as O } from "react";
|
|
4
|
+
import { eventBus as F } from "@streamlayer/sdk-web-interfaces";
|
|
5
|
+
import { SvgIcon as T } from "../icons/index.js";
|
|
6
|
+
import { Loader as A } from "../loader/index.js";
|
|
7
|
+
import { Container as B, ToggleIconPause as N, HideControls as q, Player as z, Poster as D, Control as H } from "./styles.js";
|
|
8
|
+
const G = (s) => {
|
|
9
|
+
for (const r of s)
|
|
9
10
|
r.isIntersecting ? r.target instanceof HTMLVideoElement && r.target.autoplay && r.target.play() : r.target instanceof HTMLVideoElement && !r.target.paused && r.target.pause();
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
for (const
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
poster:
|
|
11
|
+
}, I = new IntersectionObserver(G, { threshold: 0.5 }), v = /* @__PURE__ */ new Set(), J = (s) => {
|
|
12
|
+
I.observe(s), v.add(s);
|
|
13
|
+
}, K = (s) => {
|
|
14
|
+
I.unobserve(s), v.delete(s);
|
|
15
|
+
}, Q = () => {
|
|
16
|
+
for (const s of v)
|
|
17
|
+
s instanceof HTMLVideoElement && !s.paused && s.pause();
|
|
18
|
+
}, R = ({
|
|
19
|
+
poster: s,
|
|
19
20
|
source: r,
|
|
20
|
-
aspectRatio:
|
|
21
|
+
aspectRatio: y,
|
|
21
22
|
controlVideo: n,
|
|
22
|
-
onPlay:
|
|
23
|
-
onPause:
|
|
24
|
-
autoPlay:
|
|
25
|
-
hideControls:
|
|
26
|
-
className:
|
|
23
|
+
onPlay: f,
|
|
24
|
+
onPause: m,
|
|
25
|
+
autoPlay: x,
|
|
26
|
+
hideControls: b,
|
|
27
|
+
className: M
|
|
27
28
|
}) => {
|
|
28
|
-
const
|
|
29
|
+
const t = U(null), [d, o] = p(!1), [h, L] = p(!1), [E, c] = p(!0), P = w(() => {
|
|
29
30
|
n == null || n({ muted: !0 });
|
|
30
|
-
}, [n]),
|
|
31
|
+
}, [n]), l = w(() => {
|
|
31
32
|
n == null || n({ muted: !1 });
|
|
32
|
-
}, [n]),
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
if (
|
|
37
|
-
|
|
33
|
+
}, [n]), S = (e) => {
|
|
34
|
+
e.stopPropagation();
|
|
35
|
+
const i = t == null ? void 0 : t.current;
|
|
36
|
+
if (i) {
|
|
37
|
+
if (d)
|
|
38
|
+
i.pause();
|
|
38
39
|
else {
|
|
39
|
-
const
|
|
40
|
-
if (!
|
|
40
|
+
const u = t == null ? void 0 : t.current;
|
|
41
|
+
if (!u)
|
|
41
42
|
return;
|
|
42
|
-
|
|
43
|
+
Q(), u.play().catch((g) => console.log(g)), c(!1);
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
+
F.emit("interactions", {
|
|
45
46
|
action: "tap",
|
|
46
47
|
payload: {}
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
|
-
},
|
|
50
|
-
var
|
|
51
|
-
(
|
|
50
|
+
}, j = () => {
|
|
51
|
+
var e;
|
|
52
|
+
(e = t == null ? void 0 : t.current) == null || e.load(), c(!0);
|
|
52
53
|
};
|
|
53
|
-
return
|
|
54
|
-
const
|
|
54
|
+
return O(() => {
|
|
55
|
+
const e = t == null ? void 0 : t.current;
|
|
55
56
|
return () => {
|
|
56
|
-
|
|
57
|
+
e && (e.paused || l());
|
|
57
58
|
};
|
|
58
|
-
}, [
|
|
59
|
-
const
|
|
60
|
-
return
|
|
59
|
+
}, [l]), O(() => {
|
|
60
|
+
const e = t.current;
|
|
61
|
+
return e ? (J(e), () => K(e)) : () => {
|
|
61
62
|
};
|
|
62
|
-
}, []), /* @__PURE__ */
|
|
63
|
-
|
|
63
|
+
}, []), /* @__PURE__ */ k(
|
|
64
|
+
B,
|
|
64
65
|
{
|
|
65
|
-
onClick:
|
|
66
|
-
className: C(
|
|
67
|
-
style:
|
|
66
|
+
onClick: b ? void 0 : S,
|
|
67
|
+
className: C(d && N, b && q, M),
|
|
68
|
+
style: y ? { aspectRatio: y } : {},
|
|
68
69
|
children: [
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
|
|
70
|
+
/* @__PURE__ */ a(
|
|
71
|
+
z,
|
|
71
72
|
{
|
|
72
|
-
ref:
|
|
73
|
+
ref: t,
|
|
73
74
|
src: r,
|
|
74
|
-
autoPlay:
|
|
75
|
+
autoPlay: x,
|
|
75
76
|
onPlay: () => {
|
|
76
|
-
|
|
77
|
+
P(), o(!0), c(!1), f == null || f();
|
|
78
|
+
},
|
|
79
|
+
onError: async (e) => {
|
|
80
|
+
try {
|
|
81
|
+
if (e.target instanceof HTMLVideoElement) {
|
|
82
|
+
L(!0);
|
|
83
|
+
const u = await (await fetch(e.target.src)).blob(), g = URL.createObjectURL(u);
|
|
84
|
+
e.target.src = g;
|
|
85
|
+
}
|
|
86
|
+
} catch (i) {
|
|
87
|
+
console.error("video fallback fetch failed", i), o(!0), c(!0);
|
|
88
|
+
} finally {
|
|
89
|
+
L(!1);
|
|
90
|
+
}
|
|
77
91
|
},
|
|
78
92
|
onPause: () => {
|
|
79
|
-
|
|
93
|
+
l(), o(!1), m == null || m();
|
|
80
94
|
},
|
|
81
95
|
onEnded: () => {
|
|
82
|
-
|
|
96
|
+
l(), o(!1), j();
|
|
83
97
|
},
|
|
84
|
-
style: { visibility:
|
|
98
|
+
style: { visibility: E ? "hidden" : "visible" },
|
|
85
99
|
controls: !1,
|
|
86
100
|
playsInline: !0
|
|
87
101
|
}
|
|
88
102
|
),
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
!
|
|
103
|
+
/* @__PURE__ */ a(D, { src: s, style: { visibility: E ? "visible" : "hidden" } }),
|
|
104
|
+
!b && !h && /* @__PURE__ */ a(H, { children: d ? /* @__PURE__ */ a(T, { name: "icon-pause" }) : /* @__PURE__ */ a(T, { name: "icon-play" }) }),
|
|
105
|
+
h && /* @__PURE__ */ a(H, { children: /* @__PURE__ */ a(A, {}) })
|
|
91
106
|
]
|
|
92
107
|
}
|
|
93
108
|
);
|
|
94
109
|
};
|
|
95
110
|
export {
|
|
96
|
-
|
|
97
|
-
|
|
111
|
+
R as VideoPlayer,
|
|
112
|
+
Q as pauseAllVideos
|
|
98
113
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/react-ui",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
@@ -69,19 +69,19 @@
|
|
|
69
69
|
"react-window": "^1.8.10",
|
|
70
70
|
"react-window-infinite-loader": "^1.0.9",
|
|
71
71
|
"uuid": "^11.1.0",
|
|
72
|
-
"@streamlayer/feature-gamification": "^1.16.
|
|
73
|
-
"@streamlayer/react-polyfills": "^0.1.
|
|
74
|
-
"@streamlayer/sdk-web": "^1.10.
|
|
75
|
-
"@streamlayer/sdk-web-analytics": "^1.7.
|
|
76
|
-
"@streamlayer/sdk-web-anonymous-auth": "^1.1.
|
|
77
|
-
"@streamlayer/sdk-web-api": "^1.8.
|
|
78
|
-
"@streamlayer/sdk-web-core": "^1.11.
|
|
79
|
-
"@streamlayer/sdk-web-features": "^1.0.
|
|
80
|
-
"@streamlayer/sdk-web-interfaces": "^1.4.
|
|
81
|
-
"@streamlayer/sdk-web-logger": "^1.0.
|
|
82
|
-
"@streamlayer/sdk-web-notifications": "^1.3.
|
|
83
|
-
"@streamlayer/sdk-web-storage": "^1.0.
|
|
84
|
-
"@streamlayer/sdk-web-types": "^1.10.
|
|
72
|
+
"@streamlayer/feature-gamification": "^1.16.8",
|
|
73
|
+
"@streamlayer/react-polyfills": "^0.1.15",
|
|
74
|
+
"@streamlayer/sdk-web": "^1.10.8",
|
|
75
|
+
"@streamlayer/sdk-web-analytics": "^1.7.8",
|
|
76
|
+
"@streamlayer/sdk-web-anonymous-auth": "^1.1.34",
|
|
77
|
+
"@streamlayer/sdk-web-api": "^1.8.8",
|
|
78
|
+
"@streamlayer/sdk-web-core": "^1.11.10",
|
|
79
|
+
"@streamlayer/sdk-web-features": "^1.0.55",
|
|
80
|
+
"@streamlayer/sdk-web-interfaces": "^1.4.21",
|
|
81
|
+
"@streamlayer/sdk-web-logger": "^1.0.55",
|
|
82
|
+
"@streamlayer/sdk-web-notifications": "^1.3.17",
|
|
83
|
+
"@streamlayer/sdk-web-storage": "^1.0.55",
|
|
84
|
+
"@streamlayer/sdk-web-types": "^1.10.12"
|
|
85
85
|
},
|
|
86
86
|
"nx": {
|
|
87
87
|
"implicitDependencies": [
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"vite-plugin-svgr": "^4.2.0",
|
|
122
122
|
"vite-svg-loader": "^5.1.0",
|
|
123
123
|
"vite-tsconfig-paths": "^5.0.1",
|
|
124
|
-
"@streamlayer/react": "^1.14.
|
|
124
|
+
"@streamlayer/react": "^1.14.8"
|
|
125
125
|
},
|
|
126
126
|
"dependencies": {
|
|
127
127
|
"@dailymotion/vast-client": "^6.2.0",
|