@streamlayer/react-ui 1.22.5 → 1.23.0

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.
Files changed (46) hide show
  1. package/lib/app/app/Advertisement/index.js +11 -11
  2. package/lib/app/app/Features/Gamification/Leaderboard.js +9 -8
  3. package/lib/app/app/Navigation/index.js +1 -0
  4. package/lib/app/app/Notifications/Onboarding/Notification/index.js +12 -12
  5. package/lib/app/app/Notifications/index.js +31 -30
  6. package/lib/app/app/Points/index.js +19 -13
  7. package/lib/app/masters/BetPack/BetPackContent/EndScreen/index.js +2 -1
  8. package/lib/app/masters/BetPack/BetPackContent/StartScreen/index.js +5 -4
  9. package/lib/app/masters/BetPack/index.js +38 -36
  10. package/lib/assets/style.css +1 -1
  11. package/lib/hooks/analytics.js +12 -9
  12. package/lib/ui/advertisement/banner/index.js +3 -3
  13. package/lib/ui/advertisement/overlay/externalAd/index.js +7 -7
  14. package/lib/ui/advertisement/overlay/index.js +10 -10
  15. package/lib/ui/button/index.js +2 -2
  16. package/lib/ui/close-btn/index.js +23 -20
  17. package/lib/ui/gamification/detail/header/index.js +8 -8
  18. package/lib/ui/gamification/insight/index.js +6 -6
  19. package/lib/ui/gamification/invite-link/index.js +1 -1
  20. package/lib/ui/gamification/leaderboard/static.js +14 -13
  21. package/lib/ui/gamification/onboarding/index.js +15 -15
  22. package/lib/ui/gamification/onboarding/slides/onboarding-invite-card/index.js +6 -6
  23. package/lib/ui/gamification/onboarding/slides/onboarding-rules/index.js +10 -10
  24. package/lib/ui/gamification/question/inapp/notification/index.js +1 -1
  25. package/lib/ui/gamification/question/inapp/onboarding/index.js +10 -9
  26. package/lib/ui/gamification/question/inapp/prediction-result/frames/index.js +27 -27
  27. package/lib/ui/gamification/question/index.js +23 -23
  28. package/lib/ui/gamification/question/insight/index.js +6 -6
  29. package/lib/ui/gamification/question/list/index.js +9 -9
  30. package/lib/ui/gamification/question/notification/index.js +13 -12
  31. package/lib/ui/gamification/question/notification/insight/index.js +11 -11
  32. package/lib/ui/gamification/question/notification/pill/index.js +5 -5
  33. package/lib/ui/gamification/question/notification/prediction-result/index.js +32 -32
  34. package/lib/ui/gamification/question/notification/tweet/index.js +3 -3
  35. package/lib/ui/gamification/question/twitter/index.js +4 -4
  36. package/lib/ui/gamification/tabs/index.js +8 -8
  37. package/lib/ui/gamification/vote/insight-details/index.js +6 -6
  38. package/lib/ui/gamification/vote/vote-option/index.js +20 -19
  39. package/lib/ui/navigation/button/index.js +9 -8
  40. package/lib/ui/questions/insight/index.js +7 -7
  41. package/lib/ui/questions/twitter/index.js +54 -58
  42. package/lib/ui/theme/constants.d.ts +1 -0
  43. package/lib/ui/theme/constants.js +2 -1
  44. package/lib/ui/theme/masters-theme.js +1 -1
  45. package/lib/ui/video-player/index.js +76 -60
  46. package/package.json +15 -15
@@ -1,17 +1,17 @@
1
- import { jsx as e, jsxs as d } from "react/jsx-runtime";
2
- import { Button as i, Title as l, Container as a, STabs as h } from "./styles.js";
1
+ import { jsx as t, jsxs as a } from "react/jsx-runtime";
2
+ import { Button as d, Title as i, Container as l, STabs as h } from "./styles.js";
3
3
  var m = /* @__PURE__ */ ((r) => (r.HOME = "home", r.LEADERBOARD = "leaderboard", r))(m || {});
4
- const t = ({ title: r, active: o, onClick: n }) => /* @__PURE__ */ e(i, { onClick: n, "data-selected": o, children: /* @__PURE__ */ e(l, { children: r }) }), b = ({ activePage: r = "home", toggleActivePage: o }) => /* @__PURE__ */ e(a, { children: /* @__PURE__ */ d(h, { "data-position": r === "home" ? "left" : "right", children: [
5
- /* @__PURE__ */ e(t, { title: "Home", active: r === "home", onClick: () => o(
4
+ const o = ({ title: r, active: e, onClick: n }) => /* @__PURE__ */ t(d, { "data-a": "intr", onClick: n, "data-selected": e, children: /* @__PURE__ */ t(i, { "data-a": "intr", children: r }) }), b = ({ activePage: r = "home", toggleActivePage: e }) => /* @__PURE__ */ t(l, { children: /* @__PURE__ */ a(h, { "data-position": r === "home" ? "left" : "right", children: [
5
+ /* @__PURE__ */ t(o, { title: "Home", active: r === "home", onClick: () => e(
6
6
  "home"
7
7
  /* HOME */
8
8
  ) }),
9
- /* @__PURE__ */ e(
10
- t,
9
+ /* @__PURE__ */ t(
10
+ o,
11
11
  {
12
12
  title: "Friends",
13
13
  active: r === "leaderboard",
14
- onClick: () => o(
14
+ onClick: () => e(
15
15
  "leaderboard"
16
16
  /* LEADERBOARD */
17
17
  )
@@ -20,6 +20,6 @@ const t = ({ title: r, active: o, onClick: n }) => /* @__PURE__ */ e(i, { onClic
20
20
  ] }) });
21
21
  export {
22
22
  m as ActivePages,
23
- t as Tab,
23
+ o as Tab,
24
24
  b as Tabs
25
25
  };
@@ -1,11 +1,11 @@
1
- import { jsxs as l, jsx as o } from "react/jsx-runtime";
1
+ import { jsxs as o, jsx as l } from "react/jsx-runtime";
2
2
  import { InsightContent as k } from "../../../questions/insight/index.js";
3
- import { Container as m, WebLinkBtn as c, WebLinkIcon as e } from "./styles.js";
4
- const p = ({ instantView: r, ...b }) => /* @__PURE__ */ l(m, { children: [
5
- /* @__PURE__ */ o(k, { instantView: r, ...b, isDetail: !0 }),
6
- (r == null ? void 0 : r.webLink) && /* @__PURE__ */ l(c, { href: r == null ? void 0 : r.webLink.url, target: "_blank", "data-analytics": "web-link", children: [
3
+ import { Container as m, WebLinkBtn as e, WebLinkIcon as c } from "./styles.js";
4
+ const p = ({ instantView: r, ...b }) => /* @__PURE__ */ o(m, { children: [
5
+ /* @__PURE__ */ l(k, { instantView: r, ...b, isDetail: !0 }),
6
+ (r == null ? void 0 : r.webLink) && /* @__PURE__ */ o(e, { href: r == null ? void 0 : r.webLink.url, target: "_blank", "data-a": "web-link", children: [
7
7
  r == null ? void 0 : r.webLink.label,
8
- /* @__PURE__ */ o(e, { name: "icon-external-link" })
8
+ /* @__PURE__ */ l(c, { name: "icon-external-link" })
9
9
  ] })
10
10
  ] });
11
11
  export {
@@ -1,21 +1,21 @@
1
1
  import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
2
  import { useState as j, useLayoutEffect as y } from "react";
3
- import { QuestionImages as a, QuestionType as o, QuestionStatus as S } from "@streamlayer/sdk-web-types";
3
+ import { QuestionImages as s, QuestionType as o, QuestionStatus as S } from "@streamlayer/sdk-web-types";
4
4
  import { AnimatedCounter as U } from "../../../animated-counter/index.js";
5
5
  import { IconDefault as V, IconContainer as $, IconWrap as F, IconCircle as M, ButtonContainer as z, ButtonPctWrap as G, ButtonPct as H, ButtonBody as J, Title as K, PtsWrap as X, Pts as Y, Indicators as Z, CheckIcon as _, Percentage as q } from "./styles.js";
6
6
  const E = {
7
- [a.CENTERED]: (t) => /* @__PURE__ */ e(V, { "data-testid": "vote-icon", alt: "option-icon", src: t }),
8
- [a.TRANSPARENT]: (t) => /* @__PURE__ */ e($, { "data-testid": "vote-icon", children: /* @__PURE__ */ e(F, { style: { backgroundImage: `url(${t})` } }) }),
9
- [a.ROUNDED]: (t) => /* @__PURE__ */ e(M, { "data-testid": "vote-icon", alt: "option-icon", src: t }),
10
- [a.NONE]: () => null,
11
- [a.UNSET]: () => null
12
- }, tt = ({ questionType: t, hasCorrectAnswer: c, correct: n, youVoted: r, questionVoted: i }) => {
7
+ [s.CENTERED]: (t) => /* @__PURE__ */ e(V, { "data-testid": "vote-icon", alt: "option-icon", src: t }),
8
+ [s.TRANSPARENT]: (t) => /* @__PURE__ */ e($, { "data-testid": "vote-icon", children: /* @__PURE__ */ e(F, { style: { backgroundImage: `url(${t})` } }) }),
9
+ [s.ROUNDED]: (t) => /* @__PURE__ */ e(M, { "data-testid": "vote-icon", alt: "option-icon", src: t }),
10
+ [s.NONE]: () => null,
11
+ [s.UNSET]: () => null
12
+ }, tt = ({ questionType: t, hasCorrectAnswer: a, correct: n, youVoted: r, questionVoted: i }) => {
13
13
  if (t === o.POLL && r)
14
14
  return "voted";
15
15
  if (t === o.PREDICTION) {
16
- if (!c && i)
16
+ if (!a && i)
17
17
  return r ? "voted" : "unset";
18
- if (c && i)
18
+ if (a && i)
19
19
  return r ? n ? "correct" : "incorrect" : "unset";
20
20
  if (r)
21
21
  return "correct";
@@ -23,15 +23,15 @@ const E = {
23
23
  return t === o.TRIVIA && i && r ? n ? "correct" : "incorrect" : "unset";
24
24
  }, et = ({
25
25
  questionType: t,
26
- questionVoted: c,
26
+ questionVoted: a,
27
27
  correct: n,
28
28
  hasCorrectAnswer: r,
29
29
  questionStatus: i
30
- }) => t === o.TRIVIA ? c && n : t === o.PREDICTION ? c && n && r || i === S.RESOLVED && n : !1, st = (t) => {
30
+ }) => t === o.TRIVIA ? a && n : t === o.PREDICTION ? a && n && r || i === S.RESOLVED && n : !1, ct = (t) => {
31
31
  var N;
32
32
  const {
33
33
  // option props
34
- id: c,
34
+ id: a,
35
35
  icon: n,
36
36
  text: r,
37
37
  percentageDecimal: i,
@@ -42,7 +42,7 @@ const E = {
42
42
  onPercentsAnimated: u,
43
43
  youSelected: h,
44
44
  youVoted: w,
45
- questionVoted: s,
45
+ questionVoted: c,
46
46
  imageMode: P,
47
47
  answerTimeExpired: k,
48
48
  questionStatus: C,
@@ -52,7 +52,7 @@ const E = {
52
52
  hasCorrectAnswer: x,
53
53
  marketClosed: f,
54
54
  isEarlyPrediction: B
55
- } = t, [L, R] = j(0), I = tt(t), Q = et({ questionType: d, questionVoted: s, correct: A, hasCorrectAnswer: x, questionStatus: C }), m = f && d === o.PREDICTION, T = s || m, W = d === o.PREDICTION && !s && !f, p = s && !h && I !== "incorrect" && !w;
55
+ } = t, [L, R] = j(0), I = tt(t), Q = et({ questionType: d, questionVoted: c, correct: A, hasCorrectAnswer: x, questionStatus: C }), m = f && d === o.PREDICTION, T = c || m, W = d === o.PREDICTION && !c && !f, p = c && !h && I !== "incorrect" && !w;
56
56
  return y(() => {
57
57
  R(0), requestAnimationFrame(() => {
58
58
  R(i);
@@ -60,11 +60,12 @@ const E = {
60
60
  }, [i]), /* @__PURE__ */ l(
61
61
  z,
62
62
  {
63
- value: c,
63
+ value: a,
64
64
  "data-selected": h,
65
65
  "data-answer-state": I,
66
- disabled: s || v || k || m,
66
+ disabled: c || v || k || m,
67
67
  "data-is-not-checked": p,
68
+ "data-a": "intr",
68
69
  onClick: (b) => {
69
70
  g(
70
71
  d === o.PREDICTION ? f : C === S.RESOLVED
@@ -82,9 +83,9 @@ const E = {
82
83
  }
83
84
  }
84
85
  ) }),
85
- /* @__PURE__ */ l(J, { children: [
86
+ /* @__PURE__ */ l(J, { "data-a": "intr", children: [
86
87
  n && P && ((N = E[P]) == null ? void 0 : N.call(E, n)),
87
- /* @__PURE__ */ e(K, { children: r }),
88
+ /* @__PURE__ */ e(K, { "data-a": "intr", children: r }),
88
89
  W && /* @__PURE__ */ l(X, { children: [
89
90
  D,
90
91
  /* @__PURE__ */ e(Y, { children: "pts" })
@@ -99,5 +100,5 @@ const E = {
99
100
  );
100
101
  };
101
102
  export {
102
- st as VotingOption
103
+ ct as VotingOption
103
104
  };
@@ -1,22 +1,23 @@
1
- import { jsx as t, jsxs as l, Fragment as d } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as d, Fragment as l } from "react/jsx-runtime";
2
2
  import { cx as m } from "@linaria/core";
3
3
  import { SButton as s, SelectedButton as u, HoverIconState as h, HoverIconLeaderboardState as p, ButtonIcon as B, ButtonLabel as f } from "./styles.js";
4
- const I = ({ disabled: n, active: r, onClick: a, label: c, icon: o, id: e }) => /* @__PURE__ */ t(
4
+ const i = ({ disabled: n, active: r, onClick: a, label: c, icon: o, id: t }) => /* @__PURE__ */ e(
5
5
  s,
6
6
  {
7
7
  onClick: a,
8
+ "data-a": "intr",
8
9
  disabled: n,
9
10
  className: m(
10
11
  r && u,
11
- !r && (e === "channels" || e === "featuredGroups") && h,
12
- !r && e === "leaderboard" && p
12
+ !r && (t === "channels" || t === "featuredGroups") && h,
13
+ !r && t === "leaderboard" && p
13
14
  ),
14
- children: /* @__PURE__ */ l(d, { children: [
15
- o && /* @__PURE__ */ t(B, { children: o }),
16
- /* @__PURE__ */ t(f, { children: c })
15
+ children: /* @__PURE__ */ d(l, { children: [
16
+ o && /* @__PURE__ */ e(B, { children: o }),
17
+ /* @__PURE__ */ e(f, { children: c })
17
18
  ] })
18
19
  }
19
20
  );
20
21
  export {
21
- I as Button
22
+ i as Button
22
23
  };
@@ -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
  };
@@ -9,6 +9,7 @@ export declare const COLORS: {
9
9
  PRIMARY_TEXT: string;
10
10
  SECONDARY_TEXT: string;
11
11
  QUESTION_TYPE_ICON: string;
12
+ QUESTION_BODY_TEXT: string;
12
13
  SUCCESS: string;
13
14
  UNSUCCESS: string;
14
15
  SECONDARY_RED1: string;
@@ -11,6 +11,7 @@ const R = {
11
11
  PRIMARY_TEXT: "#090E13",
12
12
  SECONDARY_TEXT: "rgba(10, 14, 19, 0.70)",
13
13
  QUESTION_TYPE_ICON: "#1D7BFF",
14
+ QUESTION_BODY_TEXT: "#090E13",
14
15
  SUCCESS: "#107D57",
15
16
  UNSUCCESS: "#DF2F3B",
16
17
  SECONDARY_RED1: "#DF2F3B",
@@ -87,7 +88,7 @@ const R = {
87
88
  SIZE_DEFAULT1: "14px",
88
89
  SIZE_DEFAULT2: "12px",
89
90
  LINE_HEIGHT: "24px",
90
- MARGIN_TITLE_DEFAULT: "24px 0px"
91
+ MARGIN_TITLE_DEFAULT: "0px 0px 12px"
91
92
  }, A = {
92
93
  xs: 324,
93
94
  sm: 576,
@@ -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,114 @@
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
+ "data-a": "intr",
68
+ className: C(d && N, b && q, M),
69
+ style: y ? { aspectRatio: y } : {},
68
70
  children: [
69
- /* @__PURE__ */ i(
70
- F,
71
+ /* @__PURE__ */ a(
72
+ z,
71
73
  {
72
- ref: e,
74
+ ref: t,
73
75
  src: r,
74
- autoPlay: T,
76
+ autoPlay: x,
75
77
  onPlay: () => {
76
- x(), f(!0), m(!1), o == null || o();
78
+ P(), o(!0), c(!1), f == null || f();
79
+ },
80
+ onError: async (e) => {
81
+ try {
82
+ if (e.target instanceof HTMLVideoElement) {
83
+ L(!0);
84
+ const u = await (await fetch(e.target.src)).blob(), g = URL.createObjectURL(u);
85
+ e.target.src = g;
86
+ }
87
+ } catch (i) {
88
+ console.error("video fallback fetch failed", i), o(!0), c(!0);
89
+ } finally {
90
+ L(!1);
91
+ }
77
92
  },
78
93
  onPause: () => {
79
- a(), f(!1), u == null || u();
94
+ l(), o(!1), m == null || m();
80
95
  },
81
96
  onEnded: () => {
82
- a(), f(!1), L();
97
+ l(), o(!1), j();
83
98
  },
84
- style: { visibility: v ? "hidden" : "visible" },
99
+ style: { visibility: E ? "hidden" : "visible" },
85
100
  controls: !1,
86
101
  playsInline: !0
87
102
  }
88
103
  ),
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" }) })
104
+ /* @__PURE__ */ a(D, { src: s, style: { visibility: E ? "visible" : "hidden" } }),
105
+ !b && !h && /* @__PURE__ */ a(H, { children: d ? /* @__PURE__ */ a(T, { name: "icon-pause" }) : /* @__PURE__ */ a(T, { name: "icon-play" }) }),
106
+ h && /* @__PURE__ */ a(H, { children: /* @__PURE__ */ a(A, {}) })
91
107
  ]
92
108
  }
93
109
  );
94
110
  };
95
111
  export {
96
- Z as VideoPlayer,
97
- J as pauseAllVideos
112
+ R as VideoPlayer,
113
+ Q as pauseAllVideos
98
114
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/react-ui",
3
- "version": "1.22.5",
3
+ "version": "1.23.0",
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.9",
73
+ "@streamlayer/react-polyfills": "^0.1.16",
74
+ "@streamlayer/sdk-web": "^1.10.9",
75
+ "@streamlayer/sdk-web-analytics": "^1.7.9",
76
+ "@streamlayer/sdk-web-anonymous-auth": "^1.1.35",
77
+ "@streamlayer/sdk-web-api": "^1.8.9",
78
+ "@streamlayer/sdk-web-core": "^1.11.11",
79
+ "@streamlayer/sdk-web-features": "^1.0.56",
80
+ "@streamlayer/sdk-web-interfaces": "^1.5.0",
81
+ "@streamlayer/sdk-web-logger": "^1.0.56",
82
+ "@streamlayer/sdk-web-notifications": "^1.3.18",
83
+ "@streamlayer/sdk-web-storage": "^1.0.56",
84
+ "@streamlayer/sdk-web-types": "^1.10.13"
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.15.0"
125
125
  },
126
126
  "dependencies": {
127
127
  "@dailymotion/vast-client": "^6.2.0",