@streamlayer/react-ui 1.23.0 → 1.23.2
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/app/masters/Points/index.js +24 -16
- package/lib/ui/gamification/question/notification/insight/index.js +11 -11
- package/lib/ui/gamification/question/notification/pill/index.js +6 -6
- package/lib/ui/gamification/question/notification/tweet/index.js +3 -3
- package/lib/ui/gamification/vote/index.js +34 -34
- package/package.json +15 -15
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useStore as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { useState as c, useEffect as a, useCallback as f } from "react";
|
|
3
|
+
import { useStore as p } from "@streamlayer/react-polyfills";
|
|
4
|
+
import { eventBus as l } from "@streamlayer/sdk-web-interfaces";
|
|
5
|
+
import { FeatureType as S } from "@streamlayer/sdk-web-types";
|
|
6
|
+
import { Points as y } from "../../../ui/gamification/points/index.js";
|
|
7
|
+
const P = ({ gamification: t }) => {
|
|
8
|
+
const o = t.userSummary.$store, [r, i] = c(0);
|
|
9
|
+
a(() => {
|
|
10
|
+
const u = o.subscribe((e) => {
|
|
10
11
|
var s;
|
|
11
|
-
(s = e == null ? void 0 : e.summary) != null && s.points &&
|
|
12
|
+
(s = e == null ? void 0 : e.summary) != null && s.points && i(e.summary.points);
|
|
12
13
|
});
|
|
13
14
|
return () => {
|
|
14
|
-
|
|
15
|
+
u();
|
|
15
16
|
};
|
|
16
|
-
}, [o])
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
}, [o]);
|
|
18
|
+
const m = f(() => {
|
|
19
|
+
l.emit("interactions", {
|
|
20
|
+
action: "tap",
|
|
21
|
+
payload: {}
|
|
22
|
+
});
|
|
23
|
+
}, []);
|
|
24
|
+
return /* @__PURE__ */ n(y, { onClick: m, points: r });
|
|
25
|
+
}, x = ({ sdk: t }) => {
|
|
26
|
+
if (!p(t.featuresList.getStore()))
|
|
19
27
|
return null;
|
|
20
|
-
const
|
|
21
|
-
return
|
|
28
|
+
const r = t.getFeature(S.GAMES);
|
|
29
|
+
return r ? /* @__PURE__ */ n(P, { gamification: r }) : null;
|
|
22
30
|
};
|
|
23
31
|
export {
|
|
24
|
-
|
|
32
|
+
x as StreamLayerSDKPoints
|
|
25
33
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { QuestionImages as
|
|
3
|
-
import { VideoPlayer as
|
|
4
|
-
import { InsightContainer as
|
|
5
|
-
const V = ({ video: r, image:
|
|
6
|
-
(r == null ? void 0 : r.url) && /* @__PURE__ */
|
|
7
|
-
|
|
8
|
-
/* @__PURE__ */
|
|
9
|
-
/* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
s && /* @__PURE__ */
|
|
1
|
+
import { jsxs as c, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { QuestionImages as h } from "@streamlayer/sdk-web-types";
|
|
3
|
+
import { VideoPlayer as o } from "../../../../video-player/index.js";
|
|
4
|
+
import { InsightContainer as u, ImageContainer as a, Image as p, InsightContent as I, Title as g, Description as f, ActionBtn as C } from "./styles.js";
|
|
5
|
+
const V = ({ video: r, image: t, imageMode: i, heading: l, body: m, action: s, controlVideo: e }) => /* @__PURE__ */ c(u, { children: [
|
|
6
|
+
(r == null ? void 0 : r.url) && /* @__PURE__ */ n(o, { source: r.url, poster: r.thumbnailUrl, controlVideo: e }),
|
|
7
|
+
t && !(r != null && r.url) && /* @__PURE__ */ n(a, { "data-rounded": i === h.ROUNDED, children: /* @__PURE__ */ n(p, { src: t, alt: l }) }),
|
|
8
|
+
/* @__PURE__ */ c(I, { children: [
|
|
9
|
+
/* @__PURE__ */ n(g, { children: l }),
|
|
10
|
+
/* @__PURE__ */ n(f, { children: m }),
|
|
11
|
+
s && /* @__PURE__ */ n(C, { onClick: s, children: "View Insight" })
|
|
12
12
|
] })
|
|
13
13
|
] });
|
|
14
14
|
export {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { SvgIcon as
|
|
3
|
-
import { Container as
|
|
4
|
-
const f = ({ title: n, onClick:
|
|
5
|
-
/* @__PURE__ */ r(
|
|
6
|
-
n && /* @__PURE__ */ r(
|
|
1
|
+
import { jsx as r, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import { SvgIcon as e } from "../../../../icons/index.js";
|
|
3
|
+
import { Container as d, Content as m, Title as c } from "./styles.js";
|
|
4
|
+
const f = ({ title: n, onClick: t, className: a, style: i }) => /* @__PURE__ */ r(d, { "data-a": "intr", onClick: t, className: a, style: i, children: /* @__PURE__ */ o(m, { "data-a": "intr", children: [
|
|
5
|
+
/* @__PURE__ */ r(e, { "data-a": "intr", name: "iconUp" }),
|
|
6
|
+
n && /* @__PURE__ */ r(c, { "data-a": "intr", children: n })
|
|
7
7
|
] }) });
|
|
8
8
|
export {
|
|
9
9
|
f as Pill
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { TwitterContent as n } from "../../../../questions/twitter/index.js";
|
|
3
3
|
import { Container as o, QuoteWrap as l, Quote as c, ActionBtn as m } from "./styles.js";
|
|
4
|
-
const
|
|
4
|
+
const s = ({ action: i, ...e }) => /* @__PURE__ */ r(o, { children: [
|
|
5
5
|
e.title && /* @__PURE__ */ t(l, { children: /* @__PURE__ */ t(c, { children: e.title }) }),
|
|
6
6
|
/* @__PURE__ */ t(n, { ...e }),
|
|
7
|
-
i && /* @__PURE__ */ t(m, {
|
|
7
|
+
i && /* @__PURE__ */ t(m, { onClick: i, children: "View Insight" })
|
|
8
8
|
] });
|
|
9
9
|
export {
|
|
10
|
-
|
|
10
|
+
s as Tweet
|
|
11
11
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
1
|
+
import { jsx as r, jsxs as f, Fragment as S } from "react/jsx-runtime";
|
|
2
2
|
import { useHideTransition as It } from "../../../hooks/showIn.js";
|
|
3
|
-
import { useRef as X, useState as
|
|
3
|
+
import { useRef as X, useState as m, useEffect as p, useCallback as v, useMemo as g } from "react";
|
|
4
4
|
import { QuestionType as c, QuestionStatus as L } from "@streamlayer/sdk-web-types";
|
|
5
5
|
import { Skeleton as M } from "../../skeleton/index.js";
|
|
6
6
|
import { Alert as Ct } from "./alert/index.js";
|
|
@@ -8,20 +8,20 @@ import { Feedback as Z } from "./feedback/index.js";
|
|
|
8
8
|
import { Container as $, Content as Q, Options as tt, QuestionScrollContainer as Vt, TopShadow as pt, AlertContainer as vt, EarlyPrediction as wt, EarlyPredictionIcon as At, Title as yt, OptionsWrap as Rt, BottomShadow as Et, SponsorLogo as Ot, SponsorIcon as St } from "./styles.js";
|
|
9
9
|
import { VotingOption as xt } from "./vote-option/index.js";
|
|
10
10
|
import { WinBar as qt } from "./win-bar/index.js";
|
|
11
|
-
const Dt = (e,
|
|
11
|
+
const Dt = (e, u) => {
|
|
12
12
|
switch (e) {
|
|
13
13
|
case "already_voted":
|
|
14
|
-
return
|
|
14
|
+
return u === c.POLL ? "You’ve already answered this question on another device." : "You’ve already answered this question on another device. So the points for this answer won't tally.";
|
|
15
15
|
default:
|
|
16
16
|
return "Something went wrong, please try again";
|
|
17
17
|
}
|
|
18
|
-
}, Ht = () => /* @__PURE__ */ r($, { children: /* @__PURE__ */
|
|
18
|
+
}, Ht = () => /* @__PURE__ */ r($, { children: /* @__PURE__ */ f(Q, { children: [
|
|
19
19
|
/* @__PURE__ */ r(M, { loading: !0, style: { height: "40px", borderRadius: "100px" } }),
|
|
20
20
|
/* @__PURE__ */ r(M, { loading: !0, style: { height: "24px", margin: "16px 0" } }),
|
|
21
|
-
/* @__PURE__ */ r(tt, { children: Array.from({ length: 5 }).map((e,
|
|
22
|
-
] }) }), Ft = ({ openedQuestion: e, isLoading:
|
|
21
|
+
/* @__PURE__ */ r(tt, { children: Array.from({ length: 5 }).map((e, u) => /* @__PURE__ */ r(M, { loading: !0, style: { height: "44px" } }, u)) })
|
|
22
|
+
] }) }), Ft = ({ openedQuestion: e, isLoading: u, vote: W, close: B, isEarlyPrediction: i }) => {
|
|
23
23
|
var K, U;
|
|
24
|
-
const et = e.subject, n = e.type, I = e.status, w = (K = e.options) == null ? void 0 : K.options, T = e.marketClosed, x = e.id, P = X(), [C, Y] =
|
|
24
|
+
const et = e.subject, n = e.type, I = e.status, w = (K = e.options) == null ? void 0 : K.options, T = e.marketClosed, x = e.id, P = X(), [C, Y] = m(!1), [A, rt] = m(!1), [V, j] = m(!0), [d, nt] = m(!1), [H, ot] = m(!1), [F, q] = m(""), [y, st] = m(""), [R, _] = m(!1), [it, at] = m(!1), { runAnimation: E, finished: z } = It();
|
|
25
25
|
p(() => {
|
|
26
26
|
z && B();
|
|
27
27
|
}, [B, z]), p(() => {
|
|
@@ -34,10 +34,10 @@ const Dt = (e, f) => {
|
|
|
34
34
|
}, [i]), D = X(!1), G = v(
|
|
35
35
|
async (s) => {
|
|
36
36
|
if (!D.current && (D.current = !0, x)) {
|
|
37
|
-
const
|
|
38
|
-
q(
|
|
37
|
+
const l = s.currentTarget.value;
|
|
38
|
+
q(l);
|
|
39
39
|
try {
|
|
40
|
-
await W(x,
|
|
40
|
+
await W(x, l);
|
|
41
41
|
} catch (O) {
|
|
42
42
|
st(Dt(O.message, n)), q(""), console.error("Error while voting", O), D.current = !1;
|
|
43
43
|
}
|
|
@@ -61,23 +61,23 @@ const Dt = (e, f) => {
|
|
|
61
61
|
clearTimeout(P.current);
|
|
62
62
|
}, []);
|
|
63
63
|
const k = g(() => e ? e.answers.map((s) => {
|
|
64
|
-
var
|
|
64
|
+
var l;
|
|
65
65
|
return {
|
|
66
66
|
...s,
|
|
67
67
|
questionVoted: !!t,
|
|
68
68
|
youSelected: F === s.id,
|
|
69
|
-
isLoading:
|
|
69
|
+
isLoading: u,
|
|
70
70
|
hasCorrectAnswer: a,
|
|
71
71
|
questionType: e.type,
|
|
72
|
-
answerTimeExpired:
|
|
72
|
+
answerTimeExpired: d,
|
|
73
73
|
questionStatus: I,
|
|
74
|
-
imageMode: (
|
|
74
|
+
imageMode: (l = e.appearance) == null ? void 0 : l.images,
|
|
75
75
|
onVote: G
|
|
76
76
|
};
|
|
77
77
|
}) : [], [
|
|
78
78
|
a,
|
|
79
|
+
d,
|
|
79
80
|
u,
|
|
80
|
-
f,
|
|
81
81
|
e,
|
|
82
82
|
t,
|
|
83
83
|
I,
|
|
@@ -85,18 +85,18 @@ const Dt = (e, f) => {
|
|
|
85
85
|
F
|
|
86
86
|
]);
|
|
87
87
|
p(() => {
|
|
88
|
-
const s = k.some(({ percentageDecimal: O }) => O !== 0),
|
|
89
|
-
y && (i || !s || T &&
|
|
88
|
+
const s = k.some(({ percentageDecimal: O }) => O !== 0), l = t && n === c.PREDICTION;
|
|
89
|
+
y && (i || !s || T && l) && _(!0);
|
|
90
90
|
}, [k, y, i, T, n, t]);
|
|
91
|
-
const J = w && (w.case === "trivia" || w.case === "prediction") ? w.value : void 0,
|
|
91
|
+
const J = w && (w.case === "trivia" || w.case === "prediction") ? w.value : void 0, h = I === L.RESOLVED && n === c.TRIVIA && !t && !V, N = n === c.TRIVIA && A, b = g(() => n === c.PREDICTION ? i ? !1 : !!(t && !a || t && a && (o != null && o.youVoted)) : !0, [n, t, a, o, i]), ut = g(() => {
|
|
92
92
|
if (n === c.PREDICTION && t && (!a || a && (o != null && o.youVoted)))
|
|
93
93
|
return t.points;
|
|
94
|
-
if (!(
|
|
94
|
+
if (!(h || d))
|
|
95
95
|
return t ? t.correct ? t.pointsEarned : 0 : o == null ? void 0 : o.points;
|
|
96
|
-
}, [
|
|
97
|
-
return /* @__PURE__ */
|
|
96
|
+
}, [d, t, o, h, n, a]), dt = g(() => n === c.PREDICTION && t ? a ? a && (o != null && o.youVoted) ? "You won" : "" : "To win" : h || d ? "Time expired" : n === c.POLL ? "Time remaining" : t ? "You won" : "To win", [d, n, t, h, a, o]), ht = !b || b && n === c.PREDICTION && C && !R, Tt = (n === c.TRIVIA || n === c.PREDICTION) && t && a && (o == null ? void 0 : o.youVoted), gt = t || h || N || n === c.TRIVIA && I === L.RESOLVED && V;
|
|
97
|
+
return /* @__PURE__ */ f(Vt, { children: [
|
|
98
98
|
i && /* @__PURE__ */ r(pt, {}),
|
|
99
|
-
/* @__PURE__ */ r($, { style: i ? { marginTop: "-40px" } : {}, children: /* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ r($, { style: i ? { marginTop: "-40px" } : {}, children: /* @__PURE__ */ f(Q, { children: [
|
|
100
100
|
!i && /* @__PURE__ */ r(
|
|
101
101
|
Z,
|
|
102
102
|
{
|
|
@@ -105,7 +105,7 @@ const Dt = (e, f) => {
|
|
|
105
105
|
questionVotedCorrectly: t == null ? void 0 : t.correct,
|
|
106
106
|
questionType: n,
|
|
107
107
|
hasCorrectAnswer: a,
|
|
108
|
-
showExpiredNotification:
|
|
108
|
+
showExpiredNotification: h,
|
|
109
109
|
showClosedNotificationTrivia: N,
|
|
110
110
|
votedInCurrentRender: C,
|
|
111
111
|
votedAfterQuestionClosed: A,
|
|
@@ -123,7 +123,7 @@ const Dt = (e, f) => {
|
|
|
123
123
|
points: ut,
|
|
124
124
|
onTimerExpired: mt,
|
|
125
125
|
questionType: e.type,
|
|
126
|
-
isTimer: !
|
|
126
|
+
isTimer: !u,
|
|
127
127
|
isPlayingTimer: !t,
|
|
128
128
|
animatePoints: Tt,
|
|
129
129
|
timerDuration: gt ? 0 : Number(((U = e == null ? void 0 : e.appearance) == null ? void 0 : U.autoHideInterval) || "30"),
|
|
@@ -131,23 +131,23 @@ const Dt = (e, f) => {
|
|
|
131
131
|
percentsAnimated: R
|
|
132
132
|
}
|
|
133
133
|
),
|
|
134
|
-
!i && (
|
|
134
|
+
!i && (d || H) ? /* @__PURE__ */ r(vt, { children: /* @__PURE__ */ r(
|
|
135
135
|
Ct,
|
|
136
136
|
{
|
|
137
137
|
icon: "icon-check-circle",
|
|
138
138
|
title: "More to come...",
|
|
139
|
-
description: H ? /* @__PURE__ */
|
|
139
|
+
description: H ? /* @__PURE__ */ f(S, { children: [
|
|
140
140
|
"Stay tuned for more questions ",
|
|
141
141
|
/* @__PURE__ */ r("br", {}),
|
|
142
142
|
" and insights."
|
|
143
|
-
] }) : /* @__PURE__ */
|
|
143
|
+
] }) : /* @__PURE__ */ f(S, { children: [
|
|
144
144
|
"Watch for additional enhanced stream ",
|
|
145
145
|
/* @__PURE__ */ r("br", {}),
|
|
146
146
|
" interactive experience."
|
|
147
147
|
] })
|
|
148
148
|
}
|
|
149
|
-
) }) : /* @__PURE__ */
|
|
150
|
-
i && /* @__PURE__ */
|
|
149
|
+
) }) : /* @__PURE__ */ f(S, { children: [
|
|
150
|
+
i && /* @__PURE__ */ f(wt, { children: [
|
|
151
151
|
/* @__PURE__ */ r(At, { name: "iconEarlyPrediction" }),
|
|
152
152
|
"EARLY PREDICTION"
|
|
153
153
|
] }),
|
|
@@ -160,7 +160,7 @@ const Dt = (e, f) => {
|
|
|
160
160
|
questionVotedCorrectly: t == null ? void 0 : t.correct,
|
|
161
161
|
questionType: n,
|
|
162
162
|
hasCorrectAnswer: a,
|
|
163
|
-
showExpiredNotification:
|
|
163
|
+
showExpiredNotification: h,
|
|
164
164
|
showClosedNotificationTrivia: N,
|
|
165
165
|
votedInCurrentRender: C,
|
|
166
166
|
votedAfterQuestionClosed: A,
|
|
@@ -174,8 +174,8 @@ const Dt = (e, f) => {
|
|
|
174
174
|
onAnimationEnd: lt
|
|
175
175
|
}
|
|
176
176
|
),
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
/* @__PURE__ */ r(tt, { children: k.map((s) => /* @__PURE__ */ r(
|
|
177
|
+
/* @__PURE__ */ f(Rt, { children: [
|
|
178
|
+
/* @__PURE__ */ r(tt, { children: k.sort((s, l) => s.id > l.id ? 1 : -1).map((s) => /* @__PURE__ */ r(
|
|
179
179
|
xt,
|
|
180
180
|
{
|
|
181
181
|
...s,
|
|
@@ -188,7 +188,7 @@ const Dt = (e, f) => {
|
|
|
188
188
|
},
|
|
189
189
|
s.id
|
|
190
190
|
)) }),
|
|
191
|
-
i && /* @__PURE__ */
|
|
191
|
+
i && /* @__PURE__ */ f(S, { children: [
|
|
192
192
|
/* @__PURE__ */ r(Et, {}),
|
|
193
193
|
/* @__PURE__ */ r(Ot, { children: /* @__PURE__ */ r(St, { name: "mastersLogoWhite" }) })
|
|
194
194
|
] })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/react-ui",
|
|
3
|
-
"version": "1.23.
|
|
3
|
+
"version": "1.23.2",
|
|
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.
|
|
73
|
-
"@streamlayer/react-polyfills": "^0.1.
|
|
74
|
-
"@streamlayer/sdk-web": "^1.10.
|
|
75
|
-
"@streamlayer/sdk-web-
|
|
76
|
-
"@streamlayer/sdk-web-
|
|
77
|
-
"@streamlayer/sdk-web-
|
|
78
|
-
"@streamlayer/sdk-web-
|
|
79
|
-
"@streamlayer/sdk-web-features": "^1.0.
|
|
80
|
-
"@streamlayer/sdk-web-interfaces": "^1.5.
|
|
81
|
-
"@streamlayer/sdk-web-logger": "^1.0.
|
|
82
|
-
"@streamlayer/sdk-web-
|
|
83
|
-
"@streamlayer/sdk-web-
|
|
84
|
-
"@streamlayer/sdk-web-types": "^1.10.
|
|
72
|
+
"@streamlayer/feature-gamification": "^1.16.11",
|
|
73
|
+
"@streamlayer/react-polyfills": "^0.1.18",
|
|
74
|
+
"@streamlayer/sdk-web": "^1.10.11",
|
|
75
|
+
"@streamlayer/sdk-web-anonymous-auth": "^1.1.37",
|
|
76
|
+
"@streamlayer/sdk-web-analytics": "^1.7.11",
|
|
77
|
+
"@streamlayer/sdk-web-core": "^1.11.13",
|
|
78
|
+
"@streamlayer/sdk-web-api": "^1.8.11",
|
|
79
|
+
"@streamlayer/sdk-web-features": "^1.0.58",
|
|
80
|
+
"@streamlayer/sdk-web-interfaces": "^1.5.2",
|
|
81
|
+
"@streamlayer/sdk-web-logger": "^1.0.58",
|
|
82
|
+
"@streamlayer/sdk-web-storage": "^1.0.58",
|
|
83
|
+
"@streamlayer/sdk-web-notifications": "^1.3.20",
|
|
84
|
+
"@streamlayer/sdk-web-types": "^1.10.15"
|
|
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.15.
|
|
124
|
+
"@streamlayer/react": "^1.15.2"
|
|
125
125
|
},
|
|
126
126
|
"dependencies": {
|
|
127
127
|
"@dailymotion/vast-client": "^6.2.0",
|