@streamlayer/react-ui 0.74.2 → 0.75.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.
@@ -1,12 +1,12 @@
1
- import { jsx as a, jsxs as I, Fragment as P } from "react/jsx-runtime";
2
- import { useState as g, useCallback as n, useMemo as T } from "react";
3
- import { QuestionType as p } from "@streamlayer/sdk-web-types";
4
- import { SDKScrollContainer as D } from "../../app/styles.js";
5
- import { ExpiredAlert as M } from "./expired-alert/index.js";
6
- import { Feedback as j } from "./feedback/index.js";
7
- import { Container as k, Content as N, Title as V, Options as F } from "./styles.js";
8
- import { VotingOption as R } from "./vote-option/index.js";
9
- import { WinBar as W } from "./win-bar/index.js";
1
+ import { jsx as a, jsxs as C, Fragment as u } from "react/jsx-runtime";
2
+ import { useState as S, useCallback as V, useMemo as m } from "react";
3
+ import { QuestionStatus as M, QuestionType as y } from "@streamlayer/sdk-web-types";
4
+ import { SDKScrollContainer as j } from "../../app/styles.js";
5
+ import { ExpiredAlert as k } from "./expired-alert/index.js";
6
+ import { Feedback as N } from "./feedback/index.js";
7
+ import { Container as R, Content as B, Title as F, Options as W } from "./styles.js";
8
+ import { VotingOption as H } from "./vote-option/index.js";
9
+ import { WinBar as K } from "./win-bar/index.js";
10
10
  import "@linaria/react";
11
11
  import "../../icons/index.js";
12
12
  import "./expired-alert/styles.js";
@@ -18,76 +18,84 @@ 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 mr = ({ openedQuestion: r, isLoading: l, vote: f, close: y }) => {
22
- var C, E;
23
- const q = r.subject, A = r.type, s = (C = r.options) == null ? void 0 : C.options, [m, O] = g(!1), [w, h] = g(""), e = r == null ? void 0 : r.id, x = n(
21
+ const er = ({ openedQuestion: r, isLoading: f, vote: w, close: h }) => {
22
+ var n, v;
23
+ const I = r.subject, O = r.type, l = (n = r.options) == null ? void 0 : n.options, [c, g] = S(!1), [q, x] = S(""), T = r == null ? void 0 : r.id, p = V(
24
24
  async (i) => {
25
- if (e) {
26
- const c = i.currentTarget.value;
27
- h(c), await f(e, c);
25
+ if (T) {
26
+ const s = i.currentTarget.value;
27
+ x(s), await w(T, s);
28
28
  }
29
29
  },
30
- [e, h, f]
31
- ), S = n(() => {
32
- O(!0), setTimeout(y, 3e3);
33
- }, [y]), t = T(
30
+ [T, x, w]
31
+ ), b = V(() => {
32
+ g(!0), setTimeout(h, 3e3);
33
+ }, [h]), t = m(
34
34
  () => r == null ? void 0 : r.answers.find((i) => i.youVoted === !0),
35
35
  [r]
36
- ), o = T(
36
+ ), o = m(
37
37
  () => !!(r != null && r.answers.find((i) => i.correct === !0)),
38
38
  [r]
39
- ), b = T(() => r ? r.answers.map((i) => {
40
- var c;
39
+ ), e = m(
40
+ () => r == null ? void 0 : r.answers.find((i) => i.correct === !0),
41
+ [r]
42
+ ), A = m(() => r ? r.answers.map((i) => {
43
+ var s;
41
44
  return {
42
45
  ...i,
43
46
  questionVoted: !!t,
44
- youSelected: w === i.id,
45
- isLoading: l,
47
+ youSelected: q === i.id,
48
+ isLoading: f,
46
49
  hasCorrectAnswer: o,
47
50
  questionType: r.type,
48
- answerTimeExpired: m,
51
+ answerTimeExpired: c,
49
52
  questionStatus: r.status,
50
- imageMode: (c = r.appearance) == null ? void 0 : c.images,
53
+ imageMode: (s = r.appearance) == null ? void 0 : s.images,
51
54
  // ToDo: Figure out why imageMode is not in the response
52
- onVote: x
55
+ onVote: p
53
56
  };
54
- }) : [], [o, m, l, r, t, x, w]), v = s && (s.case === "trivia" || s.case === "prediction") ? s.value : void 0;
55
- return /* @__PURE__ */ a(D, { "data-question-header": "true", children: /* @__PURE__ */ a(k, { children: /* @__PURE__ */ I(N, { children: [
56
- v && /* @__PURE__ */ a(
57
- j,
57
+ }) : [], [o, c, f, r, t, p, q]), E = l && (l.case === "trivia" || l.case === "prediction") ? l.value : void 0, D = m(() => {
58
+ if (r.status === M.RESOLVED)
59
+ return 0;
60
+ if (!c)
61
+ return t ? t.correct ? t.points : 0 : e == null ? void 0 : e.points;
62
+ }, [c, t, e, r.status]), P = m(() => c ? "Time expired" : r.type === y.POLL ? "Time remaining" : t ? "You won" : "To win", [c, r.type, t]);
63
+ return /* @__PURE__ */ a(j, { "data-question-header": "true", children: /* @__PURE__ */ a(R, { children: /* @__PURE__ */ C(B, { children: [
64
+ E && /* @__PURE__ */ a(
65
+ N,
58
66
  {
59
- feedbackMessages: v,
67
+ feedbackMessages: E,
60
68
  questionVoted: !!t,
61
69
  questionVotedCorrectly: t == null ? void 0 : t.correct,
62
- questionType: A,
70
+ questionType: O,
63
71
  hasCorrectAnswer: o,
64
72
  questionStatus: r.status
65
73
  }
66
74
  ),
67
- r.type !== p.PREDICTION && /* @__PURE__ */ a(
68
- W,
75
+ r.type !== y.PREDICTION && /* @__PURE__ */ a(
76
+ K,
69
77
  {
70
- title: m ? "Time expired" : r.type === p.POLL ? "Time remaining" : "To win",
71
- points: m ? void 0 : t != null && t.correct ? t == null ? void 0 : t.points : 0,
72
- onTimerExpired: S,
78
+ title: P,
79
+ points: D,
80
+ onTimerExpired: b,
73
81
  questionType: r.type,
74
- isTimer: !l,
82
+ isTimer: !f,
75
83
  isPlayingTimer: !t,
76
- timerDuration: t ? 0 : Number(((E = r == null ? void 0 : r.appearance) == null ? void 0 : E.autoHideInterval) || "30")
84
+ timerDuration: t ? 0 : Number(((v = r == null ? void 0 : r.appearance) == null ? void 0 : v.autoHideInterval) || "30")
77
85
  }
78
86
  ),
79
- m ? /* @__PURE__ */ a(
80
- M,
87
+ c ? /* @__PURE__ */ a(
88
+ k,
81
89
  {
82
90
  title: "More to come...",
83
91
  description: "Watch for additional enhanced stream interactive experience."
84
92
  }
85
- ) : /* @__PURE__ */ I(P, { children: [
86
- /* @__PURE__ */ a(V, { "data-isPrediction": r.type === p.PREDICTION, children: q }),
87
- /* @__PURE__ */ a(F, { children: b.map((i) => /* @__PURE__ */ a(R, { ...i }, i.id)) })
93
+ ) : /* @__PURE__ */ C(u, { children: [
94
+ /* @__PURE__ */ a(F, { "data-isPrediction": r.type === y.PREDICTION, children: I }),
95
+ /* @__PURE__ */ a(W, { children: A.map((i) => /* @__PURE__ */ a(H, { ...i }, i.id)) })
88
96
  ] })
89
97
  ] }) }) });
90
98
  };
91
99
  export {
92
- mr as Vote
100
+ er as Vote
93
101
  };
@@ -1,5 +1,5 @@
1
1
  import { styled as s } from "@linaria/react";
2
- const e = /* @__PURE__ */ s("div")({
2
+ const n = /* @__PURE__ */ s("div")({
3
3
  name: "Container",
4
4
  class: "c1euiow",
5
5
  propsAsIs: !1
@@ -9,6 +9,6 @@ const e = /* @__PURE__ */ s("div")({
9
9
  propsAsIs: !1
10
10
  });
11
11
  export {
12
- e as Container,
12
+ n as Container,
13
13
  o as WebLinkBtn
14
14
  };
@@ -5,7 +5,7 @@ const m = /* @__PURE__ */ e("div")({
5
5
  name: "Container",
6
6
  class: "c1pgyo67",
7
7
  propsAsIs: !1
8
- }), a = "hx17qu6", d = ({
8
+ }), a = "hx17qu6", f = ({
9
9
  children: o,
10
10
  style: n,
11
11
  className: s,
@@ -16,5 +16,5 @@ const m = /* @__PURE__ */ e("div")({
16
16
  children: o
17
17
  });
18
18
  export {
19
- d as ShowIn
19
+ f as ShowIn
20
20
  };
@@ -1,31 +1,31 @@
1
- import { jsx as n } from "react/jsx-runtime";
1
+ import { jsx as R } from "react/jsx-runtime";
2
2
  import { styled as E } from "@linaria/react";
3
- import { useState as O, useCallback as c } from "react";
4
- import { CountdownCircleTimer as S } from "react-countdown-circle-timer";
3
+ import { useState as S, useCallback as n } from "react";
4
+ import { CountdownCircleTimer as _ } from "react-countdown-circle-timer";
5
5
  import { COLORS as o } from "../theme/constants.js";
6
- const _ = [o.PRIMARY_GREEN1, o.SECONDARY_RED1, o.SECONDARY_RED1], A = [10, 10, 0], f = /* @__PURE__ */ E("div")({
6
+ const A = [o.PRIMARY_GREEN1, o.SECONDARY_RED1, o.SECONDARY_RED1, o.NEUTRALS_GRAY3], O = [10, 10, 1, 0], N = /* @__PURE__ */ E("div")({
7
7
  name: "RemainingTime",
8
8
  class: "r165427",
9
9
  propsAsIs: !1
10
- }), D = o.SECONDARY_GREEN6, R = o.SECONDARY_RED3, N = o.NEUTRALS_GRAY3, g = ({
10
+ }), f = o.SECONDARY_GREEN6, c = o.SECONDARY_RED3, D = o.NEUTRALS_GRAY3, L = ({
11
11
  isPlaying: i = !0,
12
12
  duration: r = 30,
13
13
  onTimerExpired: t
14
14
  }) => {
15
- const [l, s] = O(r > 10 ? D : R), m = ({
15
+ const [l, s] = S(r > 10 ? f : c), m = ({
16
16
  remainingTime: e
17
- }) => /* @__PURE__ */ n(f, {
17
+ }) => /* @__PURE__ */ R(N, {
18
18
  children: e
19
- }), a = c(() => {
20
- t == null || t(), s(N);
21
- }, [t, s]), C = c((e) => {
22
- e === 10 && s(R);
19
+ }), a = n(() => {
20
+ t == null || t(), s(D);
21
+ }, [t, s]), C = n((e) => {
22
+ e === 10 && s(c);
23
23
  }, [s]);
24
- return /* @__PURE__ */ n(S, {
24
+ return /* @__PURE__ */ R(_, {
25
25
  isPlaying: i,
26
26
  duration: r,
27
- colors: _,
28
- colorsTime: A,
27
+ colors: A,
28
+ colorsTime: O,
29
29
  size: 32,
30
30
  strokeWidth: 2,
31
31
  trailStrokeWidth: 2,
@@ -36,6 +36,6 @@ const _ = [o.PRIMARY_GREEN1, o.SECONDARY_RED1, o.SECONDARY_RED1], A = [10, 10, 0
36
36
  });
37
37
  };
38
38
  export {
39
- f as RemainingTime,
40
- g as Timer
39
+ N as RemainingTime,
40
+ L as Timer
41
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/react-ui",
3
- "version": "0.74.2",
3
+ "version": "0.75.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -40,14 +40,14 @@
40
40
  "react-virtualized-auto-sizer": "^1.0.20",
41
41
  "react-window": "^1.8.9",
42
42
  "react-window-infinite-loader": "^1.0.9",
43
- "@streamlayer/feature-gamification": "^0.27.2",
44
- "@streamlayer/sdk-web": "^0.29.3",
45
- "@streamlayer/sdk-web-anonymous-auth": "^0.11.28",
43
+ "@streamlayer/feature-gamification": "^0.28.0",
44
+ "@streamlayer/sdk-web": "^0.29.4",
45
+ "@streamlayer/sdk-web-anonymous-auth": "^0.11.29",
46
46
  "@streamlayer/sdk-web-api": "^0.1.0",
47
47
  "@streamlayer/sdk-web-core": "^0.0.6",
48
- "@streamlayer/sdk-web-features": "^0.10.35",
48
+ "@streamlayer/sdk-web-features": "^0.10.36",
49
49
  "@streamlayer/sdk-web-interfaces": "^0.0.1",
50
- "@streamlayer/sdk-web-notifications": "^0.13.4",
50
+ "@streamlayer/sdk-web-notifications": "^0.1.0",
51
51
  "@streamlayer/sdk-web-storage": "^0.0.4",
52
52
  "@streamlayer/sdk-web-logger": "^0.0.1",
53
53
  "@streamlayer/sdk-web-types": "^0.0.1"
@@ -90,6 +90,6 @@
90
90
  "vite-plugin-svgr": "^4.1.0",
91
91
  "vite-svg-loader": "^4.0.0",
92
92
  "vite-tsconfig-paths": "^4.2.1",
93
- "@streamlayer/react": "^0.32.3"
93
+ "@streamlayer/react": "^0.32.5"
94
94
  }
95
95
  }
@@ -1,2 +0,0 @@
1
- /** @deprecated all variables moved to main theme */
2
- export declare const mastersVariables: import("@linaria/core").LinariaClassName;
@@ -1,4 +0,0 @@
1
- const s = "m17a8r9z";
2
- export {
3
- s as mastersVariables
4
- };