@streamlayer/react-ui 0.68.1 → 0.68.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.
@@ -1,12 +1,12 @@
1
- import { jsx as a, jsxs as q, Fragment as u } from "react/jsx-runtime";
2
- import { useState as l, useCallback as C, useMemo as n } from "react";
3
- import { QuestionType as v } from "@streamlayer/sdk-web-types";
4
- import { SDKScrollContainer as O } from "../../app/styles.js";
1
+ import { jsx as a, jsxs as C, Fragment as S } from "react/jsx-runtime";
2
+ import { useState as l, useCallback as v, useMemo as n } from "react";
3
+ import { QuestionType as p } from "@streamlayer/sdk-web-types";
4
+ import { SDKScrollContainer as P } from "../../app/styles.js";
5
5
  import { ExpiredAlert as b } from "./expired-alert/index.js";
6
- import { Feedback as D } from "./feedback/index.js";
7
- import { Container as M, Content as P, Title as j, Options as k } from "./styles.js";
8
- import { VotingOption as F } from "./vote-option/index.js";
9
- import { WinBar as L } from "./win-bar/index.js";
6
+ import { Feedback as u } from "./feedback/index.js";
7
+ import { Container as D, Content as L, Title as M, Options as j } from "./styles.js";
8
+ import { VotingOption as k } from "./vote-option/index.js";
9
+ import { WinBar as F } from "./win-bar/index.js";
10
10
  import "@linaria/react";
11
11
  import "../../icons/index.js";
12
12
  import "./expired-alert/styles.js";
@@ -18,45 +18,45 @@ 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 st = ({ openedQuestion: t, vote: f, close: p }) => {
22
- var g;
23
- const E = t.subject, V = t.type, m = (g = t.options) == null ? void 0 : g.options, [s, A] = l(!1), [T, d] = l(!1), [w, y] = l(""), e = t == null ? void 0 : t.id, h = C(
21
+ const mt = ({ openedQuestion: t, vote: f, close: T }) => {
22
+ var x;
23
+ const E = t.subject, V = t.type, c = (x = t.options) == null ? void 0 : x.options, [m, A] = l(!1), [y, d] = l(!1), [w, h] = l(""), e = t == null ? void 0 : t.id, g = v(
24
24
  async (r) => {
25
25
  if (e) {
26
- const c = r.currentTarget.value;
27
- y(c), d(!0), await f(e, c), d(!1);
26
+ const s = r.currentTarget.value;
27
+ h(s), d(!0), await f(e, s), d(!1);
28
28
  }
29
29
  },
30
- [e, y, f]
31
- ), I = C(() => {
32
- A(!0), setTimeout(p, 3e3);
33
- }, [p]), i = n(
30
+ [e, h, f]
31
+ ), I = v(() => {
32
+ A(!0), setTimeout(T, 3e3);
33
+ }, [T]), i = n(
34
34
  () => t == null ? void 0 : t.answers.find((r) => r.youVoted === !0),
35
35
  [t]
36
36
  ), o = n(
37
37
  () => !!(t != null && t.answers.find((r) => r.correct === !0)),
38
38
  [t]
39
- ), S = n(() => t ? t.answers.map((r) => {
40
- var c;
39
+ ), O = n(() => t ? t.answers.map((r) => {
40
+ var s;
41
41
  return {
42
42
  ...r,
43
43
  questionVoted: !!i,
44
44
  youSelected: w === r.id,
45
- isLoading: T,
45
+ isLoading: y,
46
46
  hasCorrectAnswer: o,
47
47
  questionType: t.type,
48
- answerTimeExpired: s,
48
+ answerTimeExpired: m,
49
49
  questionStatus: t.status,
50
- imageMode: (c = t.appearance) == null ? void 0 : c.images,
50
+ imageMode: (s = t.appearance) == null ? void 0 : s.images,
51
51
  // ToDo: Figure out why imageMode is not in the response
52
- onVote: h
52
+ onVote: g
53
53
  };
54
- }) : [], [o, s, T, t, i, h, w]), x = m && (m.case === "trivia" || m.case === "prediction") ? m.value : void 0;
55
- return /* @__PURE__ */ a(O, { "data-question-header": "true", children: /* @__PURE__ */ a(M, { children: /* @__PURE__ */ q(P, { children: [
56
- x && /* @__PURE__ */ a(
57
- D,
54
+ }) : [], [o, m, y, t, i, g, w]), q = c && (c.case === "trivia" || c.case === "prediction") ? c.value : void 0;
55
+ return /* @__PURE__ */ a(P, { "data-question-header": "true", children: /* @__PURE__ */ a(D, { children: /* @__PURE__ */ C(L, { children: [
56
+ q && /* @__PURE__ */ a(
57
+ u,
58
58
  {
59
- feedbackMessages: x,
59
+ feedbackMessages: q,
60
60
  questionVoted: !!i,
61
61
  questionVotedCorrectly: i == null ? void 0 : i.correct,
62
62
  questionType: V,
@@ -64,29 +64,30 @@ const st = ({ openedQuestion: t, vote: f, close: p }) => {
64
64
  questionStatus: t.status
65
65
  }
66
66
  ),
67
- t.type !== v.PREDICTION && /* @__PURE__ */ a(
68
- L,
67
+ t.type !== p.PREDICTION && /* @__PURE__ */ a(
68
+ F,
69
69
  {
70
- title: s ? "Time expired" : "To win",
71
- points: s ? void 0 : 100,
70
+ title: m ? "Time expired" : t.type === p.POLL ? "Time remaining" : "To win",
71
+ points: m ? void 0 : 100,
72
72
  onTimerExpired: I,
73
+ questionType: t.type,
73
74
  isTimer: !0,
74
75
  isPlayingTimer: !i,
75
76
  timerDuration: i ? 0 : 30
76
77
  }
77
78
  ),
78
- s ? /* @__PURE__ */ a(
79
+ m ? /* @__PURE__ */ a(
79
80
  b,
80
81
  {
81
82
  title: "More to come...",
82
83
  description: "Watch for additional enhanced stream interactive experience."
83
84
  }
84
- ) : /* @__PURE__ */ q(u, { children: [
85
- /* @__PURE__ */ a(j, { "data-isPrediction": t.type === v.PREDICTION, children: E }),
86
- /* @__PURE__ */ a(k, { children: S.map((r) => /* @__PURE__ */ a(F, { ...r }, r.id)) })
85
+ ) : /* @__PURE__ */ C(S, { children: [
86
+ /* @__PURE__ */ a(M, { "data-isPrediction": t.type === p.PREDICTION, children: E }),
87
+ /* @__PURE__ */ a(j, { children: O.map((r) => /* @__PURE__ */ a(k, { ...r }, r.id)) })
87
88
  ] })
88
89
  ] }) }) });
89
90
  };
90
91
  export {
91
- st as Vote
92
+ mt as Vote
92
93
  };
@@ -1,9 +1,11 @@
1
1
  /// <reference types="react" />
2
+ import { QuestionType } from '@streamlayer/sdk-web-types';
2
3
  interface WinBarProps {
3
4
  title?: string;
4
5
  points?: number;
5
6
  isPlayingTimer?: boolean;
6
7
  isTimer?: boolean;
8
+ questionType?: QuestionType;
7
9
  timerDuration?: number;
8
10
  onTimerExpired?: () => void;
9
11
  }
@@ -1,31 +1,33 @@
1
1
  import { jsxs as r, jsx as i, Fragment as d } from "react/jsx-runtime";
2
- import { Timer as p } from "../../../timer/index.js";
3
- import { WinBarContainer as h, Content as l, Title as s, WinIcon as a, Points as P, PointsCount as f, PointsUnits as u } from "./styles.js";
2
+ import { QuestionType as s } from "@streamlayer/sdk-web-types";
3
+ import { Timer as h } from "../../../timer/index.js";
4
+ import { WinBarContainer as l, Content as a, Title as P, WinIcon as f, Points as u, PointsCount as T, PointsUnits as x } from "./styles.js";
4
5
  import "@linaria/react";
5
6
  import "react";
6
7
  import "react-countdown-circle-timer";
7
8
  import "../../../theme/constants.js";
8
9
  import "../../../icons/index.js";
9
- const v = ({
10
+ const I = ({
10
11
  title: n,
11
12
  points: o,
12
13
  isPlayingTimer: t,
13
14
  isTimer: e,
14
- timerDuration: m,
15
+ questionType: m,
16
+ timerDuration: p,
15
17
  onTimerExpired: c
16
- }) => /* @__PURE__ */ r(h, { children: [
17
- /* @__PURE__ */ r(l, { children: [
18
- n && /* @__PURE__ */ i(s, { children: n }),
19
- o !== void 0 && /* @__PURE__ */ r(d, { children: [
20
- /* @__PURE__ */ i(a, { name: "icon-trophy" }),
21
- /* @__PURE__ */ r(P, { children: [
22
- /* @__PURE__ */ i(f, { children: o }),
23
- /* @__PURE__ */ i(u, { children: "PTS" })
18
+ }) => /* @__PURE__ */ r(l, { children: [
19
+ /* @__PURE__ */ r(a, { children: [
20
+ n && /* @__PURE__ */ i(P, { children: n }),
21
+ o !== void 0 && m !== s.POLL && /* @__PURE__ */ r(d, { children: [
22
+ /* @__PURE__ */ i(f, { name: "icon-trophy" }),
23
+ /* @__PURE__ */ r(u, { children: [
24
+ /* @__PURE__ */ i(T, { children: o }),
25
+ /* @__PURE__ */ i(x, { children: "PTS" })
24
26
  ] })
25
27
  ] })
26
28
  ] }),
27
- e && /* @__PURE__ */ i(p, { isPlaying: t, onTimerExpired: c, duration: m })
29
+ e && /* @__PURE__ */ i(h, { isPlaying: t, onTimerExpired: c, duration: p })
28
30
  ] });
29
31
  export {
30
- v as WinBar
32
+ I as WinBar
31
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/react-ui",
3
- "version": "0.68.1",
3
+ "version": "0.68.2",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -42,10 +42,10 @@
42
42
  "react-window-infinite-loader": "^1.0.9",
43
43
  "@streamlayer/feature-gamification": "^0.26.5",
44
44
  "@streamlayer/sdk-web": "^0.28.27",
45
+ "@streamlayer/sdk-web-anonymous-auth": "^0.11.22",
45
46
  "@streamlayer/sdk-web-api": "^0.0.1",
46
47
  "@streamlayer/sdk-web-core": "^0.0.3",
47
48
  "@streamlayer/sdk-web-features": "^0.10.30",
48
- "@streamlayer/sdk-web-anonymous-auth": "^0.11.22",
49
49
  "@streamlayer/sdk-web-interfaces": "^0.0.1",
50
50
  "@streamlayer/sdk-web-notifications": "^0.13.3",
51
51
  "@streamlayer/sdk-web-storage": "^0.0.4",
@@ -89,6 +89,6 @@
89
89
  "vite-plugin-svgr": "^4.1.0",
90
90
  "vite-svg-loader": "^4.0.0",
91
91
  "vite-tsconfig-paths": "^4.2.1",
92
- "@streamlayer/react": "^0.31.1"
92
+ "@streamlayer/react": "^0.31.2"
93
93
  }
94
94
  }