@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 D, Image as P, Content as b, Title as x, Description as B } from "./styles.js";
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
- D,
24
+ P,
25
25
  {
26
26
  className: u,
27
27
  "data-rounded": o.imageMode === I.ROUNDED,
28
- children: /* @__PURE__ */ d(P, { src: o == null ? void 0 : o.image })
28
+ children: /* @__PURE__ */ d(b, { src: o == null ? void 0 : o.image })
29
29
  }
30
30
  ),
31
- /* @__PURE__ */ h(b, { children: [
32
- /* @__PURE__ */ d(x, { children: l && e ? m : y }),
33
- /* @__PURE__ */ d(B, { children: l && e ? c : p })
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 c, jsx as n, Fragment as j } from "react/jsx-runtime";
2
- import { VideoPlayer as k } from "../../video-player/index.js";
3
- import { Account as x } from "./account/index.js";
4
- import { Container as B, Details as E, Body as N, ImagesContainer as i, ImageFullSize as l, ImageHalfSize as p, ImagesBlock as a } from "./styles.js";
5
- const R = new RegExp("\\s?https?://t.co[^\\s]+(\\s+)?$"), S = (t) => t == null ? void 0 : t.replace(R, ""), V = ({
6
- image: t,
7
- body: C,
8
- account: z,
9
- accountVerified: F,
10
- tweet: s,
11
- isDetail: d,
12
- controlVideo: T
13
- }) => {
14
- var m, g, H, U, f, u, v, I, y;
15
- const r = (g = (m = s == null ? void 0 : s.meta) == null ? void 0 : m.extendedEntities) == null ? void 0 : g.media, o = r == null ? void 0 : r.find(({ type: e }) => e === "photo"), h = (u = (f = (U = (H = r == null ? void 0 : r[0]) == null ? void 0 : H.videoInfo) == null ? void 0 : U.variants) == null ? void 0 : f.find(
16
- ({ contentType: e }) => e === "video/mp4"
17
- )) == null ? void 0 : u.url;
18
- return /* @__PURE__ */ c(B, { children: [
19
- /* @__PURE__ */ c(E, { children: [
20
- /* @__PURE__ */ n(
21
- x,
22
- {
23
- image: t,
24
- name: (v = s == null ? void 0 : s.meta) == null ? void 0 : v.accountName,
25
- userName: z,
26
- verified: F,
27
- createdTweet: s == null ? void 0 : s.date
28
- }
29
- ),
30
- /* @__PURE__ */ n(N, { children: S(C) }),
31
- !d && o && /* @__PURE__ */ n(i, { children: /* @__PURE__ */ n(l, { src: r == null ? void 0 : r[0].mediaUrlHttps }) }),
32
- d && o && /* @__PURE__ */ c(j, { children: [
33
- (r == null ? void 0 : r.length) === 1 && /* @__PURE__ */ n(i, { children: /* @__PURE__ */ n(l, { src: r[0].mediaUrlHttps }) }),
34
- (r == null ? void 0 : r.length) === 2 && /* @__PURE__ */ c(i, { children: [
35
- /* @__PURE__ */ n(p, { src: r[0].mediaUrlHttps }),
36
- /* @__PURE__ */ n(p, { src: r[1].mediaUrlHttps })
37
- ] }),
38
- (r == null ? void 0 : r.length) === 3 && /* @__PURE__ */ c(i, { children: [
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__ */ c(a, { children: [
51
- /* @__PURE__ */ n(l, { src: r[2].mediaUrlHttps }),
52
- /* @__PURE__ */ n(l, { src: r[3].mediaUrlHttps })
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
- !o && (((I = r == null ? void 0 : r[0]) == null ? void 0 : I.type) === "video" || ((y = r == null ? void 0 : r[0]) == null ? void 0 : y.type) === "animated_gif") && h && /* @__PURE__ */ n(k, { source: h, poster: r[0].mediaUrlHttps, controlVideo: T })
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
- V as TwitterContent,
62
- S as sanitizeContent
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 S, jsx as i } from "react/jsx-runtime";
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 M, useState as y, useCallback as h, useEffect as E } from "react";
4
- import { eventBus as j } from "@streamlayer/sdk-web-interfaces";
5
- import { SvgIcon as I } from "../icons/index.js";
6
- import { Container as k, ToggleIconPause as A, HideControls as B, Player as F, Poster as N, Control as q } from "./styles.js";
7
- const z = (t) => {
8
- for (const r of t)
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
- }, O = new IntersectionObserver(z, { threshold: 0.5 }), p = /* @__PURE__ */ new Set(), D = (t) => {
11
- O.observe(t), p.add(t);
12
- }, G = (t) => {
13
- O.unobserve(t), p.delete(t);
14
- }, J = () => {
15
- for (const t of p)
16
- t instanceof HTMLVideoElement && !t.paused && t.pause();
17
- }, Z = ({
18
- poster: t,
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: g,
21
+ aspectRatio: y,
21
22
  controlVideo: n,
22
- onPlay: o,
23
- onPause: u,
24
- autoPlay: T,
25
- hideControls: c,
26
- className: w
23
+ onPlay: f,
24
+ onPause: m,
25
+ autoPlay: x,
26
+ hideControls: b,
27
+ className: M
27
28
  }) => {
28
- const e = M(null), [l, f] = y(!1), [v, m] = y(!0), x = h(() => {
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]), a = h(() => {
31
+ }, [n]), l = w(() => {
31
32
  n == null || n({ muted: !1 });
32
- }, [n]), H = (s) => {
33
- s.stopPropagation();
34
- const b = e == null ? void 0 : e.current;
35
- if (b) {
36
- if (l)
37
- b.pause();
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 d = e == null ? void 0 : e.current;
40
- if (!d)
40
+ const u = t == null ? void 0 : t.current;
41
+ if (!u)
41
42
  return;
42
- J(), d.play().catch((P) => console.log(P)), m(!1);
43
+ Q(), u.play().catch((g) => console.log(g)), c(!1);
43
44
  }
44
- j.emit("interactions", {
45
+ F.emit("interactions", {
45
46
  action: "tap",
46
47
  payload: {}
47
48
  });
48
49
  }
49
- }, L = () => {
50
- var s;
51
- (s = e == null ? void 0 : e.current) == null || s.load(), m(!0);
50
+ }, j = () => {
51
+ var e;
52
+ (e = t == null ? void 0 : t.current) == null || e.load(), c(!0);
52
53
  };
53
- return E(() => {
54
- const s = e == null ? void 0 : e.current;
54
+ return O(() => {
55
+ const e = t == null ? void 0 : t.current;
55
56
  return () => {
56
- s && (s.paused || a());
57
+ e && (e.paused || l());
57
58
  };
58
- }, [a]), E(() => {
59
- const s = e.current;
60
- return s ? (D(s), () => G(s)) : () => {
59
+ }, [l]), O(() => {
60
+ const e = t.current;
61
+ return e ? (J(e), () => K(e)) : () => {
61
62
  };
62
- }, []), /* @__PURE__ */ S(
63
- k,
63
+ }, []), /* @__PURE__ */ k(
64
+ B,
64
65
  {
65
- onClick: c ? void 0 : H,
66
- className: C(l && A, c && B, w),
67
- style: g ? { aspectRatio: g } : {},
66
+ onClick: b ? void 0 : S,
67
+ className: C(d && N, b && q, M),
68
+ style: y ? { aspectRatio: y } : {},
68
69
  children: [
69
- /* @__PURE__ */ i(
70
- F,
70
+ /* @__PURE__ */ a(
71
+ z,
71
72
  {
72
- ref: e,
73
+ ref: t,
73
74
  src: r,
74
- autoPlay: T,
75
+ autoPlay: x,
75
76
  onPlay: () => {
76
- x(), f(!0), m(!1), o == null || o();
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
- a(), f(!1), u == null || u();
93
+ l(), o(!1), m == null || m();
80
94
  },
81
95
  onEnded: () => {
82
- a(), f(!1), L();
96
+ l(), o(!1), j();
83
97
  },
84
- style: { visibility: v ? "hidden" : "visible" },
98
+ style: { visibility: E ? "hidden" : "visible" },
85
99
  controls: !1,
86
100
  playsInline: !0
87
101
  }
88
102
  ),
89
- /* @__PURE__ */ i(N, { src: t, style: { visibility: v ? "visible" : "hidden" } }),
90
- !c && /* @__PURE__ */ i(q, { children: l ? /* @__PURE__ */ i(I, { name: "icon-pause" }) : /* @__PURE__ */ i(I, { name: "icon-play" }) })
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
- Z as VideoPlayer,
97
- J as pauseAllVideos
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.5",
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.7",
73
- "@streamlayer/react-polyfills": "^0.1.14",
74
- "@streamlayer/sdk-web": "^1.10.7",
75
- "@streamlayer/sdk-web-analytics": "^1.7.7",
76
- "@streamlayer/sdk-web-anonymous-auth": "^1.1.33",
77
- "@streamlayer/sdk-web-api": "^1.8.7",
78
- "@streamlayer/sdk-web-core": "^1.11.9",
79
- "@streamlayer/sdk-web-features": "^1.0.54",
80
- "@streamlayer/sdk-web-interfaces": "^1.4.20",
81
- "@streamlayer/sdk-web-logger": "^1.0.54",
82
- "@streamlayer/sdk-web-notifications": "^1.3.16",
83
- "@streamlayer/sdk-web-storage": "^1.0.54",
84
- "@streamlayer/sdk-web-types": "^1.10.11"
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.7"
124
+ "@streamlayer/react": "^1.14.8"
125
125
  },
126
126
  "dependencies": {
127
127
  "@dailymotion/vast-client": "^6.2.0",