@streamlayer/react-ui 0.76.2 → 0.77.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.
@@ -10,6 +10,8 @@ interface FeedbackProps {
10
10
  questionVotedCorrectly?: boolean;
11
11
  hasCorrectAnswer: boolean;
12
12
  questionStatus: QuestionStatus;
13
+ showExpiredNotification: boolean;
14
+ showClosedNotificationTrivia: boolean;
13
15
  votedInCurrentRender: boolean;
14
16
  votedAfterQuestionClosed: boolean;
15
17
  enteredAnActiveQuestion: boolean;
@@ -1,63 +1,65 @@
1
- import { jsxs as r, Fragment as e, jsx as i } from "react/jsx-runtime";
2
- import { QuestionType as o, QuestionStatus as I } from "@streamlayer/sdk-web-types";
1
+ import { jsxs as r, Fragment as o, jsx as i } from "react/jsx-runtime";
2
+ import { QuestionType as t, QuestionStatus as R } from "@streamlayer/sdk-web-types";
3
3
  import { SvgIcon as l } from "../../../icons/index.js";
4
- import { Container as L, FeedbackIconWrap as h, FeedbackHeader as E, FeedbackDescription as t, FeedbackText as P, IconPrediction as y, FeedbackTitle as C } from "./styles.js";
4
+ import { Container as L, FeedbackIconWrap as h, FeedbackHeader as a, FeedbackDescription as d, FeedbackText as s, IconPrediction as N, FeedbackTitle as Q } from "./styles.js";
5
5
  import "@linaria/react";
6
6
  import "react";
7
- const Q = ({
8
- feedbackMessages: n,
9
- questionVotedCorrectly: s,
10
- questionVoted: a,
11
- questionType: c,
12
- hasCorrectAnswer: x,
13
- questionStatus: w,
14
- votedInCurrentRender: m,
15
- votedAfterQuestionClosed: T,
16
- enteredAnActiveQuestion: p
7
+ const Y = ({
8
+ feedbackMessages: e,
9
+ questionVotedCorrectly: P,
10
+ questionVoted: m,
11
+ questionType: n,
12
+ hasCorrectAnswer: u,
13
+ questionStatus: E,
14
+ showExpiredNotification: I,
15
+ showClosedNotificationTrivia: w,
16
+ votedInCurrentRender: p,
17
+ votedAfterQuestionClosed: S,
18
+ enteredAnActiveQuestion: x
17
19
  }) => {
18
- const b = a && (c === o.TRIVIA || c === o.PREDICTION) && m && w !== I.RESOLVED, D = c === o.PREDICTION && !x, N = w === I.RESOLVED && c === o.TRIVIA && !a && !p, O = c === o.TRIVIA && T && m && p, R = w === I.RESOLVED && c === o.PREDICTION && !a && !p || c === o.PREDICTION && T && m && p, k = b && D, f = b && x, S = a && c === o.POLL && m;
19
- if (!N && !O && !k && !f && !R && !S)
20
+ const T = m && (n === t.TRIVIA || n === t.PREDICTION) && p && E !== R.RESOLVED, b = n === t.PREDICTION && !u, k = E === R.RESOLVED && n === t.PREDICTION && !m && !x || n === t.PREDICTION && S && p && x, D = T && b, O = T && u, y = m && n === t.POLL && p;
21
+ if (!I && !w && !D && !O && !k && !y)
20
22
  return null;
21
- const F = s ? "correct" : "incorrect", d = s ? n == null ? void 0 : n.correctFeedback : n == null ? void 0 : n.incorrectFeedback;
22
- return /* @__PURE__ */ r(L, { "data-isPrediction": D, children: [
23
- N && /* @__PURE__ */ r(e, { children: [
23
+ const F = P ? "correct" : "incorrect", c = P ? e == null ? void 0 : e.correctFeedback : e == null ? void 0 : e.incorrectFeedback;
24
+ return /* @__PURE__ */ r(L, { "data-isPrediction": b, children: [
25
+ I && /* @__PURE__ */ r(o, { children: [
24
26
  /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(l, { name: "questionExpired" }) }),
25
27
  /* @__PURE__ */ r("div", { children: [
26
- /* @__PURE__ */ i(E, { children: /* @__PURE__ */ i(t, { children: "Question Expired" }) }),
27
- /* @__PURE__ */ i(P, { children: "You can still answer to see if you're correct, but no points are awarded for expired questions." })
28
+ /* @__PURE__ */ i(a, { children: /* @__PURE__ */ i(d, { children: "Question Expired" }) }),
29
+ /* @__PURE__ */ i(s, { children: "You can still answer to see if you're correct, but no points are awarded for expired questions." })
28
30
  ] })
29
31
  ] }),
30
- O && /* @__PURE__ */ r(e, { children: [
32
+ w && /* @__PURE__ */ r(o, { children: [
31
33
  /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(l, { name: "questionExpired" }) }),
32
34
  /* @__PURE__ */ r("div", { children: [
33
- /* @__PURE__ */ i(E, { children: /* @__PURE__ */ i(t, { children: "Question Closed" }) }),
34
- /* @__PURE__ */ i(P, { children: "This question was answered after the moderator closed the question. So the points for this answer won’t tally." })
35
+ /* @__PURE__ */ i(a, { children: /* @__PURE__ */ i(d, { children: "Question Closed" }) }),
36
+ /* @__PURE__ */ i(s, { children: "This question was answered after the moderator closed the question. So the points for this answer won’t tally." })
35
37
  ] })
36
38
  ] }),
37
- R && /* @__PURE__ */ r(e, { children: [
39
+ k && /* @__PURE__ */ r(o, { children: [
38
40
  /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(l, { name: "questionExpired" }) }),
39
41
  /* @__PURE__ */ r("div", { children: [
40
- /* @__PURE__ */ i(E, { children: /* @__PURE__ */ i(t, { children: "Question Closed" }) }),
41
- /* @__PURE__ */ i(P, { children: "This event has already taken place, so the ability to make a prediction on its outcome is no longer available." })
42
+ /* @__PURE__ */ i(a, { children: /* @__PURE__ */ i(d, { children: "Question Closed" }) }),
43
+ /* @__PURE__ */ i(s, { children: "This event has already taken place, so the ability to make a prediction on its outcome is no longer available." })
42
44
  ] })
43
45
  ] }),
44
- k && /* @__PURE__ */ r(e, { children: [
45
- /* @__PURE__ */ i(y, { name: "icon-prediction" }),
46
- /* @__PURE__ */ i(t, { children: "Stay tuned to see if your prediction was correct." })
46
+ D && /* @__PURE__ */ r(o, { children: [
47
+ /* @__PURE__ */ i(N, { name: "icon-prediction" }),
48
+ /* @__PURE__ */ i(d, { children: "Stay tuned to see if your prediction was correct." })
47
49
  ] }),
48
- S && /* @__PURE__ */ r(e, { children: [
50
+ y && /* @__PURE__ */ r(o, { children: [
49
51
  /* @__PURE__ */ i(h, { "data-feedbackType": "correct", children: /* @__PURE__ */ i(l, { name: "correct" }) }),
50
- /* @__PURE__ */ i(t, { children: "That's for answering. Please stay tuned for the next question." })
52
+ /* @__PURE__ */ i(d, { children: "That's for answering. Please stay tuned for the next question." })
51
53
  ] }),
52
- f && /* @__PURE__ */ r(e, { children: [
54
+ O && /* @__PURE__ */ r(o, { children: [
53
55
  /* @__PURE__ */ i(h, { "data-feedbackType": F, children: /* @__PURE__ */ i(l, { name: F }) }),
54
- /* @__PURE__ */ i("div", { children: /* @__PURE__ */ r(E, { children: [
55
- /* @__PURE__ */ i(C, { "data-feedbackType": F, children: d == null ? void 0 : d.title }),
56
- /* @__PURE__ */ i(t, { children: d == null ? void 0 : d.description })
56
+ /* @__PURE__ */ i("div", { children: /* @__PURE__ */ r(a, { children: [
57
+ /* @__PURE__ */ i(Q, { "data-feedbackType": F, children: c == null ? void 0 : c.title }),
58
+ /* @__PURE__ */ i(d, { children: c == null ? void 0 : c.description })
57
59
  ] }) })
58
60
  ] })
59
61
  ] });
60
62
  };
61
63
  export {
62
- Q as Feedback
64
+ Y as Feedback
63
65
  };
@@ -1,12 +1,12 @@
1
- import { jsx as a, jsxs as I, Fragment as F } from "react/jsx-runtime";
2
- import { useState as m, useEffect as L, useCallback as y, useMemo as c } from "react";
3
- import { QuestionStatus as S, QuestionType as w } from "@streamlayer/sdk-web-types";
4
- import { SDKScrollContainer as W } from "../../app/styles.js";
5
- import { ExpiredAlert as H } from "./expired-alert/index.js";
6
- import { Feedback as K } from "./feedback/index.js";
7
- import { Container as Y, Content as z, Title as G, Options as J } from "./styles.js";
8
- import { VotingOption as U } from "./vote-option/index.js";
9
- import { WinBar as X } from "./win-bar/index.js";
1
+ import { jsx as c, jsxs as D, Fragment as K } from "react/jsx-runtime";
2
+ import { useState as l, useEffect as Y, useCallback as p, useMemo as m } from "react";
3
+ import { QuestionStatus as V, QuestionType as o } from "@streamlayer/sdk-web-types";
4
+ import { SDKScrollContainer as z } from "../../app/styles.js";
5
+ import { ExpiredAlert as G } from "./expired-alert/index.js";
6
+ import { Feedback as J } from "./feedback/index.js";
7
+ import { Container as U, Content as X, Title as Z, Options as _ } from "./styles.js";
8
+ import { VotingOption as $ } from "./vote-option/index.js";
9
+ import { WinBar as Q } from "./win-bar/index.js";
10
10
  import "@linaria/react";
11
11
  import "../../icons/index.js";
12
12
  import "./expired-alert/styles.js";
@@ -18,101 +18,110 @@ 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 Et = ({ openedQuestion: t, isLoading: o, vote: u, close: E }) => {
22
- var q, x;
23
- const p = t.subject, O = t.type, l = (q = t.options) == null ? void 0 : q.options, [d, g] = m(!1), [h, D] = m(!1), [v, R] = m(!0), [s, b] = m(!1), [C, V] = m(""), n = t == null ? void 0 : t.id;
24
- L(() => {
25
- t.status === S.RESOLVED && R(!1);
21
+ const pt = ({ openedQuestion: t, isLoading: y, vote: v, close: C }) => {
22
+ var S, q;
23
+ const g = t.subject, T = t.type, a = t.status, E = (S = t.options) == null ? void 0 : S.options, [d, b] = l(!1), [h, N] = l(!1), [n, P] = l(!0), [e, k] = l(!1), [u, x] = l(""), I = t == null ? void 0 : t.id;
24
+ Y(() => {
25
+ a === V.RESOLVED && P(!1);
26
26
  }, []);
27
- const P = y((r) => {
28
- D(r), g(!0);
29
- }, []), A = y(
30
- async (r) => {
31
- if (n) {
32
- const e = r.currentTarget.value;
33
- V(e), await u(n, e);
27
+ const L = p((i) => {
28
+ N(i), b(!0);
29
+ }, []), R = p(
30
+ async (i) => {
31
+ if (I) {
32
+ const f = i.currentTarget.value;
33
+ x(f), await v(I, f);
34
34
  }
35
35
  },
36
- [n, V, u]
37
- ), k = y(() => {
38
- b(!0), setTimeout(E, 3e3);
39
- }, [E]), i = c(
40
- () => t == null ? void 0 : t.answers.find((r) => r.youVoted === !0),
36
+ [I, x, v]
37
+ ), M = p(() => {
38
+ k(!0), setTimeout(C, 3e3);
39
+ }, [C]), r = m(
40
+ () => t == null ? void 0 : t.answers.find((i) => i.youVoted === !0),
41
41
  [t]
42
- ), T = c(
43
- () => !!(t != null && t.answers.find((r) => r.correct === !0)),
42
+ ), A = m(
43
+ () => !!(t != null && t.answers.find((i) => i.correct === !0)),
44
44
  [t]
45
- ), f = c(
46
- () => t == null ? void 0 : t.answers.find((r) => r.correct === !0),
45
+ ), w = m(
46
+ () => t == null ? void 0 : t.answers.find((i) => i.correct === !0),
47
47
  [t]
48
- ), M = c(() => t ? t.answers.map((r) => {
49
- var e;
48
+ ), j = m(() => t ? t.answers.map((i) => {
49
+ var f;
50
50
  return {
51
- ...r,
52
- questionVoted: !!i,
53
- youSelected: C === r.id,
54
- isLoading: o,
55
- hasCorrectAnswer: T,
51
+ ...i,
52
+ questionVoted: !!r,
53
+ youSelected: u === i.id,
54
+ isLoading: y,
55
+ hasCorrectAnswer: A,
56
56
  questionType: t.type,
57
- answerTimeExpired: s,
58
- questionStatus: t.status,
59
- imageMode: (e = t.appearance) == null ? void 0 : e.images,
60
- onVote: A
57
+ answerTimeExpired: e,
58
+ questionStatus: a,
59
+ imageMode: (f = t.appearance) == null ? void 0 : f.images,
60
+ onVote: R
61
61
  };
62
- }) : [], [T, s, o, t, i, A, C]), j = l && (l.case === "trivia" || l.case === "prediction") ? l.value : void 0, N = c(() => {
63
- if (t.status === S.RESOLVED)
64
- return 0;
65
- if (!s)
66
- return i ? i.correct ? i.points : 0 : f == null ? void 0 : f.points;
67
- }, [s, i, f, t.status]), B = c(() => s ? "Time expired" : t.type === w.POLL ? "Time remaining" : i ? "You won" : "To win", [s, t.type, i]);
68
- return /* @__PURE__ */ a(W, { "data-question-header": "true", children: /* @__PURE__ */ a(Y, { children: /* @__PURE__ */ I(z, { children: [
69
- /* @__PURE__ */ a(
70
- K,
62
+ }) : [], [
63
+ A,
64
+ e,
65
+ y,
66
+ t,
67
+ r,
68
+ a,
69
+ R,
70
+ u
71
+ ]), B = E && (E.case === "trivia" || E.case === "prediction") ? E.value : void 0, s = a === V.RESOLVED && T === o.TRIVIA && !r && !n, O = T === o.TRIVIA && h && d && n, F = m(() => {
72
+ if (!(s || e))
73
+ return a === V.RESOLVED ? 0 : r ? r.correct ? r.points : 0 : w == null ? void 0 : w.points;
74
+ }, [e, r, w, a, s]), W = m(() => s || e ? "Time expired" : t.type === o.POLL ? "Time remaining" : r ? "You won" : "To win", [e, t.type, r, s]), H = r || s || O || T === o.TRIVIA && a === V.RESOLVED && n;
75
+ return /* @__PURE__ */ c(z, { "data-question-header": "true", children: /* @__PURE__ */ c(U, { children: /* @__PURE__ */ D(X, { children: [
76
+ /* @__PURE__ */ c(
77
+ J,
71
78
  {
72
- feedbackMessages: j,
73
- questionVoted: !!i,
74
- questionVotedCorrectly: i == null ? void 0 : i.correct,
75
- questionType: O,
76
- hasCorrectAnswer: T,
77
- questionStatus: t.status,
79
+ feedbackMessages: B,
80
+ questionVoted: !!r,
81
+ questionVotedCorrectly: r == null ? void 0 : r.correct,
82
+ questionType: T,
83
+ hasCorrectAnswer: A,
84
+ questionStatus: a,
85
+ showExpiredNotification: s,
86
+ showClosedNotificationTrivia: O,
78
87
  votedInCurrentRender: d,
79
88
  votedAfterQuestionClosed: h,
80
- enteredAnActiveQuestion: v
89
+ enteredAnActiveQuestion: n
81
90
  }
82
91
  ),
83
- t.type !== w.PREDICTION && /* @__PURE__ */ a(
84
- X,
92
+ t.type !== o.PREDICTION && /* @__PURE__ */ c(
93
+ Q,
85
94
  {
86
- title: B,
87
- points: N,
88
- onTimerExpired: k,
95
+ title: W,
96
+ points: F,
97
+ onTimerExpired: M,
89
98
  questionType: t.type,
90
- isTimer: !o,
91
- isPlayingTimer: !i,
92
- timerDuration: i ? 0 : Number(((x = t == null ? void 0 : t.appearance) == null ? void 0 : x.autoHideInterval) || "30")
99
+ isTimer: !y,
100
+ isPlayingTimer: !r,
101
+ timerDuration: H ? 0 : Number(((q = t == null ? void 0 : t.appearance) == null ? void 0 : q.autoHideInterval) || "30")
93
102
  }
94
103
  ),
95
- s ? /* @__PURE__ */ a(
96
- H,
104
+ e ? /* @__PURE__ */ c(
105
+ G,
97
106
  {
98
107
  title: "More to come...",
99
108
  description: "Watch for additional enhanced stream interactive experience."
100
109
  }
101
- ) : /* @__PURE__ */ I(F, { children: [
102
- /* @__PURE__ */ a(G, { "data-isPrediction": t.type === w.PREDICTION, children: p }),
103
- /* @__PURE__ */ a(J, { children: M.map((r) => /* @__PURE__ */ a(
104
- U,
110
+ ) : /* @__PURE__ */ D(K, { children: [
111
+ /* @__PURE__ */ c(Z, { "data-isPrediction": t.type === o.PREDICTION, children: g }),
112
+ /* @__PURE__ */ c(_, { children: j.map((i) => /* @__PURE__ */ c(
113
+ $,
105
114
  {
106
- ...r,
107
- markThatVoted: P,
115
+ ...i,
116
+ markThatVoted: L,
108
117
  votedAfterQuestionClosed: h,
109
- enteredAnActiveQuestion: v
118
+ enteredAnActiveQuestion: n
110
119
  },
111
- r.id
120
+ i.id
112
121
  )) })
113
122
  ] })
114
123
  ] }) }) });
115
124
  };
116
125
  export {
117
- Et as Vote
126
+ pt as Vote
118
127
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/react-ui",
3
- "version": "0.76.2",
3
+ "version": "0.77.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -45,8 +45,8 @@
45
45
  "@streamlayer/sdk-web-anonymous-auth": "^0.11.30",
46
46
  "@streamlayer/sdk-web-api": "^0.1.0",
47
47
  "@streamlayer/sdk-web-core": "^0.0.7",
48
- "@streamlayer/sdk-web-interfaces": "^0.0.1",
49
48
  "@streamlayer/sdk-web-features": "^0.10.37",
49
+ "@streamlayer/sdk-web-interfaces": "^0.0.1",
50
50
  "@streamlayer/sdk-web-notifications": "^0.1.0",
51
51
  "@streamlayer/sdk-web-storage": "^0.0.4",
52
52
  "@streamlayer/sdk-web-logger": "^0.0.1",
@@ -90,6 +90,6 @@
90
90
  "vite-plugin-svgr": "^4.1.0",
91
91
  "vite-svg-loader": "^4.0.0",
92
92
  "vite-tsconfig-paths": "^4.2.1",
93
- "@streamlayer/react": "^0.32.9"
93
+ "@streamlayer/react": "^0.32.10"
94
94
  }
95
95
  }