@streamlayer/react-ui 0.68.0 → 0.68.1

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