@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.
- package/lib/assets/style.css +1 -1
- package/lib/ui/app/Features/FeatureProvider.d.ts +1 -0
- package/lib/ui/app/Features/FeatureProvider.js +34 -6
- package/lib/ui/app/Features/Gamification/Friends.js +24 -21
- package/lib/ui/app/Features/Gamification/gamification-feature.js +1 -1
- package/lib/ui/app/Features/Gamification/index.d.ts +10 -0
- package/lib/ui/app/Features/Gamification/index.js +68 -67
- package/lib/ui/app/Features/index.d.ts +8 -0
- package/lib/ui/app/Features/index.js +112 -19
- package/lib/ui/app/Navigation/MastersNavigation/index.js +5 -4
- package/lib/ui/app/Navigation/index.js +7 -6
- package/lib/ui/app/masters.js +153 -83
- package/lib/ui/app/useMastersApp.js +3 -2
- package/lib/ui/gamification/question/insight/index.js +11 -16
- package/lib/ui/gamification/question/list/index.js +45 -32
- package/lib/ui/gamification/question/notification/index.js +20 -23
- package/lib/ui/gamification/question/twitter/index.js +13 -18
- package/lib/ui/gamification/vote/feedback/index.js +29 -26
- package/lib/ui/gamification/vote/feedback/styles.d.ts +1 -0
- package/lib/ui/gamification/vote/feedback/styles.js +9 -4
- package/lib/ui/gamification/vote/index.js +52 -45
- package/lib/ui/icons/index.js +90 -25
- package/lib/ui/navigation/button/Channels.js +6 -5
- package/lib/ui/navigation/button/FeaturedGroups.js +4 -3
- package/lib/ui/navigation/button/LeaderBoard.js +6 -5
- package/lib/ui/navigation/button/index.js +20 -7
- package/lib/ui/navigation/button/styles.d.ts +3 -0
- package/lib/ui/navigation/button/styles.js +9 -6
- package/lib/ui/questions/insight/index.js +15 -16
- package/package.json +14 -14
|
@@ -1,66 +1,69 @@
|
|
|
1
|
-
import { jsxs as r, Fragment as
|
|
2
|
-
import { QuestionType as
|
|
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
|
|
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
|
|
7
|
+
const G = ({
|
|
8
8
|
feedbackMessages: e,
|
|
9
|
-
questionVotedCorrectly:
|
|
9
|
+
questionVotedCorrectly: u,
|
|
10
10
|
questionVoted: a,
|
|
11
|
-
questionType:
|
|
11
|
+
questionType: n,
|
|
12
12
|
hasCorrectAnswer: F,
|
|
13
13
|
questionStatus: T,
|
|
14
|
-
showExpiredNotification:
|
|
15
|
-
showClosedNotificationTrivia:
|
|
14
|
+
showExpiredNotification: I,
|
|
15
|
+
showClosedNotificationTrivia: b,
|
|
16
16
|
votedInCurrentRender: m,
|
|
17
|
-
votedAfterQuestionClosed:
|
|
18
|
-
enteredAnActiveQuestion:
|
|
19
|
-
marketClosed:
|
|
17
|
+
votedAfterQuestionClosed: N,
|
|
18
|
+
enteredAnActiveQuestion: k,
|
|
19
|
+
marketClosed: S
|
|
20
20
|
}) => {
|
|
21
|
-
const
|
|
22
|
-
if (!
|
|
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 =
|
|
25
|
-
return /* @__PURE__ */ r(
|
|
26
|
-
|
|
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
|
-
|
|
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(
|
|
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(
|
|
48
|
-
/* @__PURE__ */ i(
|
|
49
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
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 ||
|
|
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:
|
|
59
|
-
/* @__PURE__ */ i(d, { children:
|
|
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
|
-
|
|
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
|
-
}),
|
|
25
|
+
}), m = /* @__PURE__ */ s("span")({
|
|
26
26
|
name: "FeedbackDescription",
|
|
27
27
|
class: "fzfk69z",
|
|
28
28
|
propsAsIs: !1
|
|
29
|
-
}),
|
|
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
|
-
|
|
40
|
+
I as DynamicWrap,
|
|
41
|
+
m as FeedbackDescription,
|
|
37
42
|
d as FeedbackHeader,
|
|
38
43
|
i as FeedbackIconWrap,
|
|
39
|
-
|
|
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
|
|
2
|
-
import { useState as I, useEffect as
|
|
3
|
-
import { QuestionType as
|
|
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
|
|
22
|
-
var
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
a ===
|
|
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
|
|
28
|
-
|
|
29
|
-
}, []), q =
|
|
27
|
+
const B = O((e) => {
|
|
28
|
+
M(e), L(!0);
|
|
29
|
+
}, []), q = O(
|
|
30
30
|
async (e) => {
|
|
31
|
-
if (
|
|
31
|
+
if (p) {
|
|
32
32
|
const u = e.currentTarget.value;
|
|
33
|
-
D(u), await p
|
|
33
|
+
D(u), await v(p, u);
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
|
-
[
|
|
37
|
-
),
|
|
38
|
-
|
|
39
|
-
}, [
|
|
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
|
-
),
|
|
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
|
-
)
|
|
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:
|
|
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
|
-
|
|
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
|
-
]),
|
|
72
|
-
if (a ===
|
|
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 ===
|
|
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
|
-
|
|
84
|
-
]),
|
|
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:
|
|
96
|
+
feedbackMessages: Y,
|
|
90
97
|
questionVoted: !!r,
|
|
91
98
|
questionVotedCorrectly: r == null ? void 0 : r.correct,
|
|
92
99
|
questionType: a,
|
|
93
|
-
hasCorrectAnswer:
|
|
100
|
+
hasCorrectAnswer: o,
|
|
94
101
|
questionStatus: m,
|
|
95
102
|
showExpiredNotification: l,
|
|
96
|
-
showClosedNotificationTrivia:
|
|
97
|
-
votedInCurrentRender:
|
|
98
|
-
votedAfterQuestionClosed:
|
|
103
|
+
showClosedNotificationTrivia: N,
|
|
104
|
+
votedInCurrentRender: R,
|
|
105
|
+
votedAfterQuestionClosed: h,
|
|
99
106
|
enteredAnActiveQuestion: T,
|
|
100
|
-
marketClosed:
|
|
107
|
+
marketClosed: y
|
|
101
108
|
}
|
|
102
109
|
),
|
|
103
|
-
|
|
110
|
+
P && /* @__PURE__ */ n(
|
|
104
111
|
it,
|
|
105
112
|
{
|
|
106
|
-
title:
|
|
107
|
-
points:
|
|
108
|
-
onTimerExpired:
|
|
113
|
+
title: z,
|
|
114
|
+
points: H,
|
|
115
|
+
onTimerExpired: W,
|
|
109
116
|
questionType: t.type,
|
|
110
117
|
isTimer: !C,
|
|
111
118
|
isPlayingTimer: !r,
|
|
112
|
-
animatePoints:
|
|
113
|
-
timerDuration:
|
|
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(
|
|
123
|
-
/* @__PURE__ */ n(Q, { style:
|
|
124
|
-
/* @__PURE__ */ n(tt, { children:
|
|
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:
|
|
129
|
-
votedAfterQuestionClosed:
|
|
135
|
+
markThatVoted: B,
|
|
136
|
+
votedAfterQuestionClosed: h,
|
|
130
137
|
enteredAnActiveQuestion: T,
|
|
131
|
-
marketClosed:
|
|
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
|
-
|
|
146
|
+
Ot as Vote
|
|
140
147
|
};
|