@streamlayer/react-ui 0.67.6 → 0.68.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.
- package/lib/ui/animated-counter/index.d.ts +5 -0
- package/lib/ui/animated-counter/index.js +9 -0
- package/lib/ui/app/Features/Gamification/Question.js +4 -2
- package/lib/ui/app/Features/Gamification/gamification-feature.js +2 -0
- package/lib/ui/app/Features/Gamification/index.js +4 -2
- package/lib/ui/gamification/points/index.js +11 -10
- package/lib/ui/gamification/vote/index.js +9 -7
- package/lib/ui/gamification/vote/vote-option/index.js +43 -44
- package/package.json +10 -9
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import i from "react-countup";
|
|
3
|
+
const m = ({ value: e = 0, decimals: r, ...n }) => {
|
|
4
|
+
const [, t] = e.toString().split("."), o = r ?? ((t == null ? void 0 : t.length) || 0);
|
|
5
|
+
return /* @__PURE__ */ s(i, { end: e, ...n, duration: 1, decimals: o, enableScrollSpy: !1, preserveValue: !0 });
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
m as AnimatedCounter
|
|
9
|
+
};
|
|
@@ -16,6 +16,8 @@ import "../../../gamification/vote/feedback/index.js";
|
|
|
16
16
|
import "../../../gamification/vote/feedback/styles.js";
|
|
17
17
|
import "../../../gamification/vote/styles.js";
|
|
18
18
|
import "../../../gamification/vote/vote-option/index.js";
|
|
19
|
+
import "../../../animated-counter/index.js";
|
|
20
|
+
import "react-countup";
|
|
19
21
|
import "../../../gamification/vote/vote-option/styles.js";
|
|
20
22
|
import "../../../gamification/vote/win-bar/index.js";
|
|
21
23
|
import "../../../timer/index.js";
|
|
@@ -54,7 +56,7 @@ const d = /* @__PURE__ */ n("div")({
|
|
|
54
56
|
close: s,
|
|
55
57
|
openedQuestion: o
|
|
56
58
|
}) : null;
|
|
57
|
-
},
|
|
59
|
+
}, P = ({
|
|
58
60
|
gamification: t
|
|
59
61
|
}) => {
|
|
60
62
|
var o;
|
|
@@ -76,5 +78,5 @@ const d = /* @__PURE__ */ n("div")({
|
|
|
76
78
|
});
|
|
77
79
|
};
|
|
78
80
|
export {
|
|
79
|
-
|
|
81
|
+
P as Question
|
|
80
82
|
};
|
|
@@ -26,6 +26,8 @@ import "../../../gamification/vote/feedback/index.js";
|
|
|
26
26
|
import "../../../gamification/vote/feedback/styles.js";
|
|
27
27
|
import "../../../gamification/vote/styles.js";
|
|
28
28
|
import "../../../gamification/vote/vote-option/index.js";
|
|
29
|
+
import "../../../animated-counter/index.js";
|
|
30
|
+
import "react-countup";
|
|
29
31
|
import "../../../gamification/vote/vote-option/styles.js";
|
|
30
32
|
import "../../../gamification/vote/win-bar/index.js";
|
|
31
33
|
import "../../../timer/index.js";
|
|
@@ -26,6 +26,8 @@ import "../../../gamification/vote/feedback/index.js";
|
|
|
26
26
|
import "../../../gamification/vote/feedback/styles.js";
|
|
27
27
|
import "../../../gamification/vote/styles.js";
|
|
28
28
|
import "../../../gamification/vote/vote-option/index.js";
|
|
29
|
+
import "../../../animated-counter/index.js";
|
|
30
|
+
import "react-countup";
|
|
29
31
|
import "../../../gamification/vote/vote-option/styles.js";
|
|
30
32
|
import "../../../gamification/vote/win-bar/index.js";
|
|
31
33
|
import "../../../timer/index.js";
|
|
@@ -73,7 +75,7 @@ const C = () => h, n = /* @__PURE__ */ s(C())({
|
|
|
73
75
|
}) => {
|
|
74
76
|
const i = r + t;
|
|
75
77
|
return i === 0 ? 0 : Math.round(r / i * 100);
|
|
76
|
-
},
|
|
78
|
+
}, Dr = ({
|
|
77
79
|
gamification: r,
|
|
78
80
|
className: t
|
|
79
81
|
}) => {
|
|
@@ -107,5 +109,5 @@ const C = () => h, n = /* @__PURE__ */ s(C())({
|
|
|
107
109
|
});
|
|
108
110
|
};
|
|
109
111
|
export {
|
|
110
|
-
|
|
112
|
+
Dr as GamificationOverlay
|
|
111
113
|
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { PointsContainer as
|
|
1
|
+
import { jsxs as t, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { AnimatedCounter as r } from "../../animated-counter/index.js";
|
|
3
|
+
import { resetCss as n } from "../../theme/theme.js";
|
|
4
|
+
import { PointsContainer as e, PointsIcon as s, PointsSvg as m, PointsBody as p, PointsTitle as l, PointsValue as c } from "./styles.js";
|
|
5
|
+
import "react-countup";
|
|
5
6
|
import "../../theme/constants.js";
|
|
6
7
|
import "@linaria/react";
|
|
7
8
|
import "../../icons/index.js";
|
|
8
9
|
import "react";
|
|
9
|
-
const
|
|
10
|
-
/* @__PURE__ */ o(
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
/* @__PURE__ */ o(
|
|
13
|
-
/* @__PURE__ */ o(
|
|
10
|
+
const v = ({ points: i }) => /* @__PURE__ */ t(e, { className: n, children: [
|
|
11
|
+
/* @__PURE__ */ o(s, { children: /* @__PURE__ */ o(m, { name: "icon-trophy" }) }),
|
|
12
|
+
/* @__PURE__ */ t(p, { children: [
|
|
13
|
+
/* @__PURE__ */ o(l, { children: "Total points" }),
|
|
14
|
+
/* @__PURE__ */ o(c, { children: /* @__PURE__ */ o(r, { value: i }) })
|
|
14
15
|
] })
|
|
15
16
|
] });
|
|
16
17
|
export {
|
|
17
|
-
|
|
18
|
+
v as Points
|
|
18
19
|
};
|
|
@@ -11,21 +11,23 @@ import "@linaria/react";
|
|
|
11
11
|
import "../../icons/index.js";
|
|
12
12
|
import "./expired-alert/styles.js";
|
|
13
13
|
import "./feedback/styles.js";
|
|
14
|
+
import "../../animated-counter/index.js";
|
|
15
|
+
import "react-countup";
|
|
14
16
|
import "./vote-option/styles.js";
|
|
15
17
|
import "../../timer/index.js";
|
|
16
18
|
import "react-countdown-circle-timer";
|
|
17
19
|
import "../../theme/constants.js";
|
|
18
20
|
import "./win-bar/styles.js";
|
|
19
|
-
const
|
|
21
|
+
const st = ({ openedQuestion: t, vote: f, close: p }) => {
|
|
20
22
|
var q;
|
|
21
|
-
const E = t.subject, V = t.type,
|
|
23
|
+
const E = t.subject, V = t.type, m = (q = t.options) == null ? void 0 : q.options, [s, A] = l(!1), [d, T] = l(!1), [w, h] = l(""), e = t == null ? void 0 : t.id, y = C(
|
|
22
24
|
async (r) => {
|
|
23
|
-
if (
|
|
25
|
+
if (e) {
|
|
24
26
|
const c = r.currentTarget.value;
|
|
25
|
-
h(c), T(!0), await f(
|
|
27
|
+
h(c), T(!0), await f(e, c), T(!1);
|
|
26
28
|
}
|
|
27
29
|
},
|
|
28
|
-
[
|
|
30
|
+
[e, h, f]
|
|
29
31
|
), I = C(() => {
|
|
30
32
|
A(!0), setTimeout(p, 3e3);
|
|
31
33
|
}, [p]), a = n(
|
|
@@ -49,7 +51,7 @@ const it = ({ openedQuestion: t, vote: f, close: p }) => {
|
|
|
49
51
|
// ToDo: Figure out why imageMode is not in the response
|
|
50
52
|
onVote: y
|
|
51
53
|
};
|
|
52
|
-
}) : [], [o, s, d, t, a, y, w]), x =
|
|
54
|
+
}) : [], [o, s, d, t, a, y, w]), x = m && (m.case === "trivia" || m.case === "prediction") ? m.value : void 0;
|
|
53
55
|
return /* @__PURE__ */ i(b, { "data-question-header": "true", children: /* @__PURE__ */ i(j, { children: /* @__PURE__ */ g(k, { children: [
|
|
54
56
|
x && /* @__PURE__ */ i(
|
|
55
57
|
M,
|
|
@@ -84,5 +86,5 @@ const it = ({ openedQuestion: t, vote: f, close: p }) => {
|
|
|
84
86
|
] }) }) });
|
|
85
87
|
};
|
|
86
88
|
export {
|
|
87
|
-
|
|
89
|
+
st as Vote
|
|
88
90
|
};
|
|
@@ -1,71 +1,70 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { QuestionImages as a, QuestionStatus as h, QuestionType as
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as r, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { QuestionImages as a, QuestionStatus as h, QuestionType as c } from "@streamlayer/sdk-web-types";
|
|
3
|
+
import { AnimatedCounter as T } from "../../../animated-counter/index.js";
|
|
4
|
+
import { IconDefault as O, IconContainer as P, IconWrap as A, IconCircle as x, ButtonContainer as L, ButtonPct as B, ButtonBody as k, Title as Q, Indicators as b, CheckIcon as j, Percentage as U } from "./styles.js";
|
|
5
|
+
import "react-countup";
|
|
4
6
|
import "@linaria/react";
|
|
5
7
|
import "../../../icons/index.js";
|
|
6
8
|
import "react";
|
|
7
9
|
const u = {
|
|
8
|
-
[a.CENTERED]: (t) => /* @__PURE__ */
|
|
9
|
-
[a.TRANSPARENT]: (t) => /* @__PURE__ */
|
|
10
|
-
[a.ROUNDED]: (t) => /* @__PURE__ */
|
|
10
|
+
[a.CENTERED]: (t) => /* @__PURE__ */ r(O, { alt: "option-icon", src: t }),
|
|
11
|
+
[a.TRANSPARENT]: (t) => /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(A, { style: { backgroundImage: `url(${t})` } }) }),
|
|
12
|
+
[a.ROUNDED]: (t) => /* @__PURE__ */ r(x, { alt: "option-icon", src: t }),
|
|
11
13
|
[a.NONE]: () => null,
|
|
12
14
|
[a.UNSET]: () => null
|
|
13
|
-
},
|
|
14
|
-
if (t ===
|
|
15
|
+
}, V = ({ questionType: t, hasCorrectAnswer: o, correct: e, youVoted: n, questionVoted: i }) => {
|
|
16
|
+
if (t === c.POLL && n)
|
|
15
17
|
return "correct";
|
|
16
|
-
if (t ===
|
|
17
|
-
if (
|
|
18
|
+
if (t === c.PREDICTION) {
|
|
19
|
+
if (o && i)
|
|
18
20
|
return n ? e ? "correct" : "incorrect" : e ? "correct" : "unset";
|
|
19
21
|
if (n)
|
|
20
22
|
return "correct";
|
|
21
23
|
}
|
|
22
|
-
return t ===
|
|
23
|
-
},
|
|
24
|
+
return t === c.TRIVIA && i ? n ? e ? "correct" : "incorrect" : e ? "correct" : "unset" : "unset";
|
|
25
|
+
}, $ = ({
|
|
24
26
|
questionType: t,
|
|
25
|
-
questionVoted:
|
|
27
|
+
questionVoted: o,
|
|
26
28
|
correct: e,
|
|
27
29
|
hasCorrectAnswer: n,
|
|
28
|
-
questionStatus:
|
|
29
|
-
}) => t ===
|
|
30
|
+
questionStatus: i
|
|
31
|
+
}) => t === c.TRIVIA ? o && e : t === c.PREDICTION ? o && e && n || i === h.RESOLVED && e : !1, J = (t) => {
|
|
30
32
|
var S;
|
|
31
33
|
const {
|
|
32
34
|
// option props
|
|
33
|
-
id:
|
|
35
|
+
id: o,
|
|
34
36
|
icon: e,
|
|
35
37
|
text: n,
|
|
36
|
-
percentageDecimal:
|
|
38
|
+
percentageDecimal: i,
|
|
37
39
|
// extra props
|
|
38
|
-
onVote:
|
|
39
|
-
youSelected:
|
|
40
|
-
questionVoted:
|
|
40
|
+
onVote: p,
|
|
41
|
+
youSelected: C,
|
|
42
|
+
questionVoted: s,
|
|
41
43
|
// ToDo: Figure out why imageMode is not in the response, and delete default value
|
|
42
|
-
imageMode:
|
|
43
|
-
answerTimeExpired:
|
|
44
|
-
questionStatus:
|
|
45
|
-
isLoading:
|
|
46
|
-
questionType:
|
|
44
|
+
imageMode: d,
|
|
45
|
+
answerTimeExpired: R,
|
|
46
|
+
questionStatus: f,
|
|
47
|
+
isLoading: g,
|
|
48
|
+
questionType: m,
|
|
47
49
|
correct: w,
|
|
48
50
|
hasCorrectAnswer: D
|
|
49
|
-
} = t,
|
|
50
|
-
return /* @__PURE__ */
|
|
51
|
-
|
|
51
|
+
} = t, I = V(t), N = $({ questionType: m, questionVoted: s, correct: w, hasCorrectAnswer: D, questionStatus: f }), E = s || f === h.RESOLVED && m === c.PREDICTION;
|
|
52
|
+
return /* @__PURE__ */ l(
|
|
53
|
+
L,
|
|
52
54
|
{
|
|
53
|
-
value:
|
|
54
|
-
"data-selected":
|
|
55
|
-
"data-answerState":
|
|
56
|
-
disabled:
|
|
57
|
-
onClick:
|
|
55
|
+
value: o,
|
|
56
|
+
"data-selected": C,
|
|
57
|
+
"data-answerState": I,
|
|
58
|
+
disabled: s || g || R,
|
|
59
|
+
onClick: p,
|
|
58
60
|
children: [
|
|
59
|
-
E && /* @__PURE__ */
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
e &&
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
E && /* @__PURE__ */
|
|
64
|
-
N && /* @__PURE__ */
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
-
r,
|
|
67
|
-
"%"
|
|
68
|
-
] })
|
|
61
|
+
E && /* @__PURE__ */ r(B, { "data-answerState": I, style: { width: `${i}%` } }),
|
|
62
|
+
/* @__PURE__ */ l(k, { children: [
|
|
63
|
+
e && d && ((S = u[d]) == null ? void 0 : S.call(u, e)),
|
|
64
|
+
/* @__PURE__ */ r(Q, { children: n }),
|
|
65
|
+
E && /* @__PURE__ */ l(b, { children: [
|
|
66
|
+
N && /* @__PURE__ */ r(j, { name: "selected" }),
|
|
67
|
+
/* @__PURE__ */ r(U, { children: /* @__PURE__ */ r(T, { value: i, suffix: "%" }) })
|
|
69
68
|
] })
|
|
70
69
|
] })
|
|
71
70
|
]
|
|
@@ -73,5 +72,5 @@ const u = {
|
|
|
73
72
|
);
|
|
74
73
|
};
|
|
75
74
|
export {
|
|
76
|
-
|
|
75
|
+
J as VotingOption
|
|
77
76
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/react-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.68.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
@@ -35,19 +35,19 @@
|
|
|
35
35
|
"package.json"
|
|
36
36
|
],
|
|
37
37
|
"peerDependencies": {
|
|
38
|
+
"@lottiefiles/react-lottie-player": "*",
|
|
38
39
|
"@streamlayer/sl-eslib": "^5.53.6",
|
|
39
40
|
"react-virtualized-auto-sizer": "^1.0.20",
|
|
40
41
|
"react-window": "^1.8.9",
|
|
41
|
-
"@lottiefiles/react-lottie-player": "*",
|
|
42
42
|
"react-window-infinite-loader": "^1.0.9",
|
|
43
|
-
"@streamlayer/feature-gamification": "^0.26.
|
|
44
|
-
"@streamlayer/sdk-web": "^0.28.
|
|
45
|
-
"@streamlayer/sdk-web-anonymous-auth": "^0.11.
|
|
43
|
+
"@streamlayer/feature-gamification": "^0.26.5",
|
|
44
|
+
"@streamlayer/sdk-web": "^0.28.27",
|
|
45
|
+
"@streamlayer/sdk-web-anonymous-auth": "^0.11.22",
|
|
46
46
|
"@streamlayer/sdk-web-api": "^0.0.1",
|
|
47
|
-
"@streamlayer/sdk-web-core": "^0.0.
|
|
48
|
-
"@streamlayer/sdk-web-features": "^0.10.
|
|
47
|
+
"@streamlayer/sdk-web-core": "^0.0.3",
|
|
48
|
+
"@streamlayer/sdk-web-features": "^0.10.30",
|
|
49
49
|
"@streamlayer/sdk-web-interfaces": "^0.0.1",
|
|
50
|
-
"@streamlayer/sdk-web-notifications": "^0.13.
|
|
50
|
+
"@streamlayer/sdk-web-notifications": "^0.13.3",
|
|
51
51
|
"@streamlayer/sdk-web-storage": "^0.0.4",
|
|
52
52
|
"@streamlayer/sdk-web-types": "^0.0.1"
|
|
53
53
|
},
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"react": "18.2.0",
|
|
81
81
|
"react-auth-code-input": "^3.2.1",
|
|
82
82
|
"react-countdown-circle-timer": "^3.2.1",
|
|
83
|
+
"react-countup": "^6.5.0",
|
|
83
84
|
"react-phone-number-input": "^3.3.7",
|
|
84
85
|
"rollup-plugin-node-polyfills": "^0.2.1",
|
|
85
86
|
"tslib": "^2.6.2",
|
|
@@ -88,6 +89,6 @@
|
|
|
88
89
|
"vite-plugin-svgr": "^4.1.0",
|
|
89
90
|
"vite-svg-loader": "^4.0.0",
|
|
90
91
|
"vite-tsconfig-paths": "^4.2.1",
|
|
91
|
-
"@streamlayer/react": "^0.
|
|
92
|
+
"@streamlayer/react": "^0.31.0"
|
|
92
93
|
}
|
|
93
94
|
}
|