@streamlayer/react-ui 1.23.1 → 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.
@@ -1,6 +1,6 @@
1
- import { jsx as r, jsxs as m, Fragment as S } from "react/jsx-runtime";
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 l, useEffect as p, useCallback as v, useMemo as g } from "react";
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, f) => {
11
+ const Dt = (e, u) => {
12
12
  switch (e) {
13
13
  case "already_voted":
14
- return f === 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.";
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__ */ m(Q, { children: [
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, f) => /* @__PURE__ */ r(M, { loading: !0, style: { height: "44px" } }, f)) })
22
- ] }) }), Ft = ({ openedQuestion: e, isLoading: f, vote: W, close: B, isEarlyPrediction: i }) => {
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] = l(!1), [A, rt] = l(!1), [V, j] = l(!0), [u, nt] = l(!1), [H, ot] = l(!1), [F, q] = l(""), [y, st] = l(""), [R, _] = l(!1), [it, at] = l(!1), { runAnimation: E, finished: z } = It();
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 h = s.currentTarget.value;
38
- q(h);
37
+ const l = s.currentTarget.value;
38
+ q(l);
39
39
  try {
40
- await W(x, h);
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 h;
64
+ var l;
65
65
  return {
66
66
  ...s,
67
67
  questionVoted: !!t,
68
68
  youSelected: F === s.id,
69
- isLoading: f,
69
+ isLoading: u,
70
70
  hasCorrectAnswer: a,
71
71
  questionType: e.type,
72
- answerTimeExpired: u,
72
+ answerTimeExpired: d,
73
73
  questionStatus: I,
74
- imageMode: (h = e.appearance) == null ? void 0 : h.images,
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), h = t && n === c.PREDICTION;
89
- y && (i || !s || T && h) && _(!0);
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, d = 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(() => {
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 (!(d || u))
94
+ if (!(h || d))
95
95
  return t ? t.correct ? t.pointsEarned : 0 : o == null ? void 0 : o.points;
96
- }, [u, t, o, d, n, a]), dt = g(() => n === c.PREDICTION && t ? a ? a && (o != null && o.youVoted) ? "You won" : "" : "To win" : d || u ? "Time expired" : n === c.POLL ? "Time remaining" : t ? "You won" : "To win", [u, n, t, d, 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 || d || N || n === c.TRIVIA && I === L.RESOLVED && V;
97
- return /* @__PURE__ */ m(Vt, { children: [
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__ */ m(Q, { children: [
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: d,
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: !f,
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 && (u || H) ? /* @__PURE__ */ r(vt, { children: /* @__PURE__ */ r(
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__ */ m(S, { children: [
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__ */ m(S, { children: [
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__ */ m(S, { children: [
150
- i && /* @__PURE__ */ m(wt, { children: [
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: d,
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__ */ m(Rt, { children: [
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__ */ m(S, { children: [
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.1",
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.10",
73
- "@streamlayer/sdk-web": "^1.10.10",
74
- "@streamlayer/react-polyfills": "^0.1.17",
75
- "@streamlayer/sdk-web-analytics": "^1.7.10",
76
- "@streamlayer/sdk-web-anonymous-auth": "^1.1.36",
77
- "@streamlayer/sdk-web-api": "^1.8.10",
78
- "@streamlayer/sdk-web-core": "^1.11.12",
79
- "@streamlayer/sdk-web-features": "^1.0.57",
80
- "@streamlayer/sdk-web-interfaces": "^1.5.1",
81
- "@streamlayer/sdk-web-logger": "^1.0.57",
82
- "@streamlayer/sdk-web-notifications": "^1.3.19",
83
- "@streamlayer/sdk-web-storage": "^1.0.57",
84
- "@streamlayer/sdk-web-types": "^1.10.14"
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.1"
124
+ "@streamlayer/react": "^1.15.2"
125
125
  },
126
126
  "dependencies": {
127
127
  "@dailymotion/vast-client": "^6.2.0",