@streamlayer/react-ui 0.96.2 → 0.96.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.
Files changed (30) hide show
  1. package/lib/assets/style.css +1 -1
  2. package/lib/ui/app/Features/FeatureProvider.d.ts +1 -0
  3. package/lib/ui/app/Features/FeatureProvider.js +34 -6
  4. package/lib/ui/app/Features/Gamification/Friends.js +24 -21
  5. package/lib/ui/app/Features/Gamification/gamification-feature.js +1 -1
  6. package/lib/ui/app/Features/Gamification/index.d.ts +10 -0
  7. package/lib/ui/app/Features/Gamification/index.js +68 -67
  8. package/lib/ui/app/Features/index.d.ts +8 -0
  9. package/lib/ui/app/Features/index.js +112 -19
  10. package/lib/ui/app/Navigation/MastersNavigation/index.js +5 -4
  11. package/lib/ui/app/Navigation/index.js +7 -6
  12. package/lib/ui/app/masters.js +153 -83
  13. package/lib/ui/app/useMastersApp.js +3 -2
  14. package/lib/ui/gamification/question/insight/index.js +11 -16
  15. package/lib/ui/gamification/question/list/index.js +45 -32
  16. package/lib/ui/gamification/question/notification/index.js +20 -23
  17. package/lib/ui/gamification/question/twitter/index.js +13 -18
  18. package/lib/ui/gamification/vote/feedback/index.js +29 -26
  19. package/lib/ui/gamification/vote/feedback/styles.d.ts +1 -0
  20. package/lib/ui/gamification/vote/feedback/styles.js +9 -4
  21. package/lib/ui/gamification/vote/index.js +52 -45
  22. package/lib/ui/icons/index.js +90 -25
  23. package/lib/ui/navigation/button/Channels.js +6 -5
  24. package/lib/ui/navigation/button/FeaturedGroups.js +4 -3
  25. package/lib/ui/navigation/button/LeaderBoard.js +6 -5
  26. package/lib/ui/navigation/button/index.js +20 -7
  27. package/lib/ui/navigation/button/styles.d.ts +3 -0
  28. package/lib/ui/navigation/button/styles.js +9 -6
  29. package/lib/ui/questions/insight/index.js +15 -16
  30. package/package.json +14 -14
@@ -1,66 +1,69 @@
1
- import { jsxs as r, Fragment as o, jsx as i } from "react/jsx-runtime";
2
- import { QuestionType as n, QuestionStatus as Q } from "@streamlayer/sdk-web-types";
1
+ import { jsxs as r, Fragment as t, jsx as i } from "react/jsx-runtime";
2
+ import { QuestionType as c, QuestionStatus as f } from "@streamlayer/sdk-web-types";
3
3
  import { SvgIcon as l } from "../../../icons/index.js";
4
- import { Container as f, FeedbackIconWrap as h, FeedbackHeader as p, FeedbackDescription as d, FeedbackText as s, IconPrediction as L, FeedbackTitle as j } from "./styles.js";
4
+ import { Container as Q, FeedbackIconWrap as h, FeedbackHeader as p, FeedbackDescription as d, FeedbackText as s, IconPrediction as W, DynamicWrap as L, FeedbackTitle as j } from "./styles.js";
5
5
  import "@linaria/react";
6
6
  import "react";
7
- const B = ({
7
+ const G = ({
8
8
  feedbackMessages: e,
9
- questionVotedCorrectly: I,
9
+ questionVotedCorrectly: u,
10
10
  questionVoted: a,
11
- questionType: c,
11
+ questionType: n,
12
12
  hasCorrectAnswer: F,
13
13
  questionStatus: T,
14
- showExpiredNotification: u,
15
- showClosedNotificationTrivia: w,
14
+ showExpiredNotification: I,
15
+ showClosedNotificationTrivia: b,
16
16
  votedInCurrentRender: m,
17
- votedAfterQuestionClosed: y,
18
- enteredAnActiveQuestion: E,
19
- marketClosed: N
17
+ votedAfterQuestionClosed: N,
18
+ enteredAnActiveQuestion: k,
19
+ marketClosed: S
20
20
  }) => {
21
- const b = a && (c === n.TRIVIA || c === n.PREDICTION) && m && T !== Q.RESOLVED, k = c === n.PREDICTION && !F, x = N && c === n.PREDICTION && !a && !E || c === n.PREDICTION && y && m && E, D = b && k, O = b && F, R = c === n.PREDICTION && a && m && F, S = a && c === n.POLL && m;
22
- if (!u && !w && !D && !O && !x && !S && !R)
21
+ const E = a && (n === c.TRIVIA || n === c.PREDICTION) && m && T !== f.RESOLVED, w = n === c.PREDICTION && !F, x = S && n === c.PREDICTION && !a && !k || n === c.PREDICTION && N && m && k, D = E && w, O = E && F, y = n === c.PREDICTION && a && m && F, R = a && n === c.POLL && m;
22
+ if (!I && !b && !D && !O && !x && !R && !y)
23
23
  return null;
24
- const P = I ? "correct" : "incorrect", t = I ? e == null ? void 0 : e.correctFeedback : e == null ? void 0 : e.incorrectFeedback;
25
- return /* @__PURE__ */ r(f, { "data-isPrediction": k, children: [
26
- u && /* @__PURE__ */ r(o, { children: [
24
+ const P = u ? "correct" : "incorrect", o = u ? e == null ? void 0 : e.correctFeedback : e == null ? void 0 : e.incorrectFeedback;
25
+ return /* @__PURE__ */ r(Q, { "data-isPrediction": w, children: [
26
+ I && /* @__PURE__ */ r(t, { children: [
27
27
  /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(l, { name: "questionExpired" }) }),
28
28
  /* @__PURE__ */ r("div", { children: [
29
29
  /* @__PURE__ */ i(p, { children: /* @__PURE__ */ i(d, { children: "Question Expired" }) }),
30
30
  /* @__PURE__ */ i(s, { children: "You can still answer to see if you're correct, but no points are awarded for expired questions." })
31
31
  ] })
32
32
  ] }),
33
- w && /* @__PURE__ */ r(o, { children: [
33
+ b && /* @__PURE__ */ r(t, { children: [
34
34
  /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(l, { name: "questionExpired" }) }),
35
35
  /* @__PURE__ */ r("div", { children: [
36
36
  /* @__PURE__ */ i(p, { children: /* @__PURE__ */ i(d, { children: "Question Closed" }) }),
37
37
  /* @__PURE__ */ i(s, { children: "This question was answered after the moderator closed the question. So the points for this answer won’t tally." })
38
38
  ] })
39
39
  ] }),
40
- x && /* @__PURE__ */ r(o, { children: [
40
+ x && /* @__PURE__ */ r(t, { children: [
41
41
  /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(l, { name: "questionExpired" }) }),
42
42
  /* @__PURE__ */ r("div", { children: [
43
43
  /* @__PURE__ */ i(p, { children: /* @__PURE__ */ i(d, { children: "Question Closed" }) }),
44
44
  /* @__PURE__ */ i(s, { children: "This event has already taken place, so the ability to make a prediction on its outcome is no longer available." })
45
45
  ] })
46
46
  ] }),
47
- D && /* @__PURE__ */ r(o, { children: [
48
- /* @__PURE__ */ i(L, { name: "icon-prediction" }),
49
- /* @__PURE__ */ i(d, { children: "Stay tuned to see if your prediction was correct." })
47
+ D && /* @__PURE__ */ r(t, { children: [
48
+ /* @__PURE__ */ i(W, { name: "icon-prediction" }),
49
+ /* @__PURE__ */ r(d, { children: [
50
+ "Your pick has been recorded. ",
51
+ /* @__PURE__ */ i(L, { children: "We’ll notify you of the result." })
52
+ ] })
50
53
  ] }),
51
- S && /* @__PURE__ */ r(o, { children: [
54
+ R && /* @__PURE__ */ r(t, { children: [
52
55
  /* @__PURE__ */ i(h, { "data-feedback-type": "correct", children: /* @__PURE__ */ i(l, { name: "correct" }) }),
53
56
  /* @__PURE__ */ i(d, { children: "Thanks for answering. Please stay tuned for the next question." })
54
57
  ] }),
55
- (O || R) && /* @__PURE__ */ r(o, { children: [
58
+ (O || y) && /* @__PURE__ */ r(t, { children: [
56
59
  /* @__PURE__ */ i(h, { "data-feedback-type": P, children: /* @__PURE__ */ i(l, { name: P }) }),
57
60
  /* @__PURE__ */ i("div", { children: /* @__PURE__ */ r(p, { children: [
58
- /* @__PURE__ */ i(j, { "data-feedback-type": P, children: t == null ? void 0 : t.title }),
59
- /* @__PURE__ */ i(d, { children: t == null ? void 0 : t.description })
61
+ /* @__PURE__ */ i(j, { "data-feedback-type": P, children: o == null ? void 0 : o.title }),
62
+ /* @__PURE__ */ i(d, { children: o == null ? void 0 : o.description })
60
63
  ] }) })
61
64
  ] })
62
65
  ] });
63
66
  };
64
67
  export {
65
- B as Feedback
68
+ G as Feedback
66
69
  };
@@ -6,3 +6,4 @@ export declare const FeedbackHeader: import("@linaria/react").StyledComponent<im
6
6
  export declare const FeedbackTitle: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
7
7
  export declare const FeedbackDescription: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
8
8
  export declare const FeedbackText: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
9
+ export declare const DynamicWrap: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
@@ -22,21 +22,26 @@ const r = /* @__PURE__ */ s("div")({
22
22
  name: "FeedbackTitle",
23
23
  class: "f1913njx",
24
24
  propsAsIs: !1
25
- }), f = /* @__PURE__ */ s("span")({
25
+ }), m = /* @__PURE__ */ s("span")({
26
26
  name: "FeedbackDescription",
27
27
  class: "fzfk69z",
28
28
  propsAsIs: !1
29
- }), m = /* @__PURE__ */ s("div")({
29
+ }), f = /* @__PURE__ */ s("div")({
30
30
  name: "FeedbackText",
31
31
  class: "fx87qaj",
32
32
  propsAsIs: !1
33
+ }), I = /* @__PURE__ */ s("span")({
34
+ name: "DynamicWrap",
35
+ class: "dvek9ew",
36
+ propsAsIs: !1
33
37
  });
34
38
  export {
35
39
  r as Container,
36
- f as FeedbackDescription,
40
+ I as DynamicWrap,
41
+ m as FeedbackDescription,
37
42
  d as FeedbackHeader,
38
43
  i as FeedbackIconWrap,
39
- m as FeedbackText,
44
+ f as FeedbackText,
40
45
  l as FeedbackTitle,
41
46
  t as IconPrediction
42
47
  };
@@ -1,6 +1,6 @@
1
- import { jsx as n, jsxs as k, Fragment as J } from "react/jsx-runtime";
2
- import { useState as I, useEffect as K, useCallback as R, useMemo as f } from "react";
3
- import { QuestionType as o, QuestionStatus as E } from "@streamlayer/sdk-web-types";
1
+ import { jsx as n, jsxs as k, Fragment as K } from "react/jsx-runtime";
2
+ import { useState as I, useEffect as A, useCallback as O, useMemo as f } from "react";
3
+ import { QuestionType as s, QuestionStatus as V } from "@streamlayer/sdk-web-types";
4
4
  import { ExpiredAlert as U } from "./expired-alert/index.js";
5
5
  import { Feedback as X } from "./feedback/index.js";
6
6
  import { QuestionScrollContainer as Z, Container as _, Content as $, Title as Q, Options as tt } from "./styles.js";
@@ -18,41 +18,48 @@ import "../../timer/index.js";
18
18
  import "react-countdown-circle-timer";
19
19
  import "../../theme/constants.js";
20
20
  import "./win-bar/styles.js";
21
- const vt = ({ openedQuestion: t, isLoading: C, vote: p, close: v }) => {
22
- var P, g;
23
- const A = t.subject, a = t.type, m = t.status, V = (P = t.options) == null ? void 0 : P.options, d = t.marketClosed, [O, b] = I(!1), [y, L] = I(!1), [T, w] = I(!0), [c, M] = I(!1), [x, D] = I(""), h = t == null ? void 0 : t.id;
24
- K(() => {
25
- a === o.PREDICTION ? d && w(!1) : m === E.RESOLVED && w(!1);
21
+ const Ot = ({ openedQuestion: t, isLoading: C, vote: v, close: d }) => {
22
+ var S, g;
23
+ const b = t.subject, a = t.type, m = t.status, E = (S = t.options) == null ? void 0 : S.options, y = t.marketClosed, [R, L] = I(!1), [h, M] = I(!1), [T, w] = I(!0), [c, j] = I(!1), [x, D] = I(""), p = t == null ? void 0 : t.id;
24
+ A(() => {
25
+ a === s.PREDICTION ? y && w(!1) : m === V.RESOLVED && w(!1);
26
26
  }, []);
27
- const j = R((e) => {
28
- L(e), b(!0);
29
- }, []), q = R(
27
+ const B = O((e) => {
28
+ M(e), L(!0);
29
+ }, []), q = O(
30
30
  async (e) => {
31
- if (h) {
31
+ if (p) {
32
32
  const u = e.currentTarget.value;
33
- D(u), await p(h, u);
33
+ D(u), await v(p, u);
34
34
  }
35
35
  },
36
- [h, D, p]
37
- ), B = R(() => {
38
- M(!0), setTimeout(v, 3e3);
39
- }, [v]), r = f(
36
+ [p, D, v]
37
+ ), W = O(() => {
38
+ j(!0), setTimeout(d, 3e3);
39
+ }, [d]), r = f(
40
40
  () => t == null ? void 0 : t.answers.find((e) => e.youVoted === !0),
41
41
  [t]
42
- ), s = f(
42
+ ), o = f(
43
43
  () => !!(t != null && t.answers.find((e) => e.correct === !0)),
44
44
  [t]
45
45
  ), i = f(
46
46
  () => t == null ? void 0 : t.answers.find((e) => e.correct === !0),
47
47
  [t]
48
- ), W = f(() => t ? t.answers.map((e) => {
48
+ );
49
+ A(() => {
50
+ let e;
51
+ return a === s.PREDICTION && r && R && (e = setTimeout(d, 1e4)), () => {
52
+ clearTimeout(e);
53
+ };
54
+ }, [r]);
55
+ const F = f(() => t ? t.answers.map((e) => {
49
56
  var u;
50
57
  return {
51
58
  ...e,
52
59
  questionVoted: !!r,
53
60
  youSelected: x === e.id,
54
61
  isLoading: C,
55
- hasCorrectAnswer: s,
62
+ hasCorrectAnswer: o,
56
63
  questionType: t.type,
57
64
  answerTimeExpired: c,
58
65
  questionStatus: m,
@@ -60,7 +67,7 @@ const vt = ({ openedQuestion: t, isLoading: C, vote: p, close: v }) => {
60
67
  onVote: q
61
68
  };
62
69
  }) : [], [
63
- s,
70
+ o,
64
71
  c,
65
72
  C,
66
73
  t,
@@ -68,11 +75,11 @@ const vt = ({ openedQuestion: t, isLoading: C, vote: p, close: v }) => {
68
75
  m,
69
76
  q,
70
77
  x
71
- ]), F = V && (V.case === "trivia" || V.case === "prediction") ? V.value : void 0, l = m === E.RESOLVED && a === o.TRIVIA && !r && !T, S = a === o.TRIVIA && y && O && T, N = f(() => a === o.PREDICTION ? !!(r && !s || r && s && (i != null && i.youVoted)) : !0, [a, r, s, i]), Y = f(() => {
72
- if (a === o.PREDICTION && r && (!s || s && (i != null && i.youVoted)))
78
+ ]), Y = E && (E.case === "trivia" || E.case === "prediction") ? E.value : void 0, l = m === V.RESOLVED && a === s.TRIVIA && !r && !T, N = a === s.TRIVIA && h && R && T, P = f(() => a === s.PREDICTION ? !!(r && !o || r && o && (i != null && i.youVoted)) : !0, [a, r, o, i]), H = f(() => {
79
+ if (a === s.PREDICTION && r && (!o || o && (i != null && i.youVoted)))
73
80
  return r.points;
74
81
  if (!(l || c))
75
- return m === E.RESOLVED ? 0 : r ? r.correct ? r.points : 0 : i == null ? void 0 : i.points;
82
+ return m === V.RESOLVED ? 0 : r ? r.correct ? r.points : 0 : i == null ? void 0 : i.points;
76
83
  }, [
77
84
  c,
78
85
  r,
@@ -80,37 +87,37 @@ const vt = ({ openedQuestion: t, isLoading: C, vote: p, close: v }) => {
80
87
  m,
81
88
  l,
82
89
  a,
83
- s
84
- ]), H = f(() => a === o.PREDICTION && r ? s ? s && (i != null && i.youVoted) ? "You won" : "" : "To win" : l || c ? "Time expired" : a === o.POLL ? "Time remaining" : r ? "You won" : "To win", [c, a, r, l, s, i]), z = (a === o.TRIVIA || a === o.PREDICTION) && r && s && (i == null ? void 0 : i.youVoted), G = r || l || S || a === o.TRIVIA && m === E.RESOLVED && T;
90
+ o
91
+ ]), z = f(() => a === s.PREDICTION && r ? o ? o && (i != null && i.youVoted) ? "You won" : "" : "To win" : l || c ? "Time expired" : a === s.POLL ? "Time remaining" : r ? "You won" : "To win", [c, a, r, l, o, i]), G = (a === s.TRIVIA || a === s.PREDICTION) && r && o && (i == null ? void 0 : i.youVoted), J = r || l || N || a === s.TRIVIA && m === V.RESOLVED && T;
85
92
  return /* @__PURE__ */ n(Z, { children: /* @__PURE__ */ n(_, { children: /* @__PURE__ */ k($, { children: [
86
93
  /* @__PURE__ */ n(
87
94
  X,
88
95
  {
89
- feedbackMessages: F,
96
+ feedbackMessages: Y,
90
97
  questionVoted: !!r,
91
98
  questionVotedCorrectly: r == null ? void 0 : r.correct,
92
99
  questionType: a,
93
- hasCorrectAnswer: s,
100
+ hasCorrectAnswer: o,
94
101
  questionStatus: m,
95
102
  showExpiredNotification: l,
96
- showClosedNotificationTrivia: S,
97
- votedInCurrentRender: O,
98
- votedAfterQuestionClosed: y,
103
+ showClosedNotificationTrivia: N,
104
+ votedInCurrentRender: R,
105
+ votedAfterQuestionClosed: h,
99
106
  enteredAnActiveQuestion: T,
100
- marketClosed: d
107
+ marketClosed: y
101
108
  }
102
109
  ),
103
- N && /* @__PURE__ */ n(
110
+ P && /* @__PURE__ */ n(
104
111
  it,
105
112
  {
106
- title: H,
107
- points: Y,
108
- onTimerExpired: B,
113
+ title: z,
114
+ points: H,
115
+ onTimerExpired: W,
109
116
  questionType: t.type,
110
117
  isTimer: !C,
111
118
  isPlayingTimer: !r,
112
- animatePoints: z,
113
- timerDuration: G ? 0 : Number(((g = t == null ? void 0 : t.appearance) == null ? void 0 : g.autoHideInterval) || "30")
119
+ animatePoints: G,
120
+ timerDuration: J ? 0 : Number(((g = t == null ? void 0 : t.appearance) == null ? void 0 : g.autoHideInterval) || "30")
114
121
  }
115
122
  ),
116
123
  c ? /* @__PURE__ */ n(
@@ -119,16 +126,16 @@ const vt = ({ openedQuestion: t, isLoading: C, vote: p, close: v }) => {
119
126
  title: "More to come...",
120
127
  description: "Watch for additional enhanced stream interactive experience."
121
128
  }
122
- ) : /* @__PURE__ */ k(J, { children: [
123
- /* @__PURE__ */ n(Q, { style: N ? {} : { marginTop: 0 }, children: A }),
124
- /* @__PURE__ */ n(tt, { children: W.map((e) => /* @__PURE__ */ n(
129
+ ) : /* @__PURE__ */ k(K, { children: [
130
+ /* @__PURE__ */ n(Q, { style: P ? {} : { marginTop: 0 }, children: b }),
131
+ /* @__PURE__ */ n(tt, { children: F.map((e) => /* @__PURE__ */ n(
125
132
  rt,
126
133
  {
127
134
  ...e,
128
- markThatVoted: j,
129
- votedAfterQuestionClosed: y,
135
+ markThatVoted: B,
136
+ votedAfterQuestionClosed: h,
130
137
  enteredAnActiveQuestion: T,
131
- marketClosed: d
138
+ marketClosed: y
132
139
  },
133
140
  e.id
134
141
  )) })
@@ -136,5 +143,5 @@ const vt = ({ openedQuestion: t, isLoading: C, vote: p, close: v }) => {
136
143
  ] }) }) });
137
144
  };
138
145
  export {
139
- vt as Vote
146
+ Ot as Vote
140
147
  };