@streamlayer/react-ui 1.20.0 → 1.21.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.
@@ -0,0 +1,8 @@
1
+ export declare const WhyThisAd: React.FC<{
2
+ whyThisAd: any;
3
+ }>;
4
+ export declare const Container: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
5
+ export declare const ControlsContainer: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
6
+ export declare const mediaStyle: import('@linaria/core').LinariaClassName;
7
+ export declare const mediaVisible: import('@linaria/core').LinariaClassName;
8
+ export declare const mediaHidden: import('@linaria/core').LinariaClassName;
@@ -0,0 +1,39 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { styled as o } from "@linaria/react";
3
+ const s = /* @__PURE__ */ o("a")({
4
+ name: "WhyThisAdLink",
5
+ class: "w13o8uld",
6
+ propsAsIs: !1
7
+ }), i = ({
8
+ whyThisAd: e
9
+ }) => !e.iconClickThroughURLTemplate || !e.staticResource ? null : /* @__PURE__ */ t(s, {
10
+ style: {
11
+ width: e.width,
12
+ height: e.height,
13
+ [e.xPosition]: 1,
14
+ [e.yPosition]: 1
15
+ },
16
+ href: e.iconClickThroughURLTemplate,
17
+ target: "_blank",
18
+ rel: "noreferrer",
19
+ children: /* @__PURE__ */ t("img", {
20
+ alt: "GoogleWhyThisAd",
21
+ src: e.staticResource
22
+ })
23
+ }), a = /* @__PURE__ */ o("div")({
24
+ name: "Container",
25
+ class: "c1xzooj9",
26
+ propsAsIs: !1
27
+ }), l = /* @__PURE__ */ o("div")({
28
+ name: "ControlsContainer",
29
+ class: "c1bo41vr",
30
+ propsAsIs: !1
31
+ }), c = "m13efyu8", m = "mladkgh", p = "mjnga56";
32
+ export {
33
+ a as Container,
34
+ l as ControlsContainer,
35
+ i as WhyThisAd,
36
+ p as mediaHidden,
37
+ c as mediaStyle,
38
+ m as mediaVisible
39
+ };
@@ -1,31 +1,31 @@
1
1
  import { jsx as r, jsxs as m, Fragment as O } from "react/jsx-runtime";
2
2
  import { useHideTransition as gt } from "../../../hooks/showIn.js";
3
3
  import { useRef as U, useState as l, useEffect as p, useCallback as S, useMemo as g } from "react";
4
- import { QuestionType as a, QuestionStatus as b } from "@streamlayer/sdk-web-types";
5
- import { Skeleton as L } from "../../skeleton/index.js";
4
+ import { QuestionType as c, QuestionStatus as L } from "@streamlayer/sdk-web-types";
5
+ import { Skeleton as M } from "../../skeleton/index.js";
6
6
  import { Alert as It } from "./alert/index.js";
7
7
  import { Feedback as X } from "./feedback/index.js";
8
- import { Container as Z, Content as $, Options as Q, QuestionScrollContainer as Ct, TopShadow as Vt, AlertContainer as pt, EarlyPrediction as vt, EarlyPredictionIcon as yt, Title as wt, OptionsWrap as At, BottomShadow as Et, SponsorLogo as Rt, SponsorIcon as Ot } from "./styles.js";
8
+ import { Container as Z, Content as $, Options as Q, QuestionScrollContainer as Ct, TopShadow as Vt, AlertContainer as pt, EarlyPrediction as vt, EarlyPredictionIcon as wt, Title as yt, OptionsWrap as At, BottomShadow as Rt, SponsorLogo as Et, SponsorIcon as Ot } from "./styles.js";
9
9
  import { VotingOption as St } from "./vote-option/index.js";
10
10
  import { WinBar as xt } from "./win-bar/index.js";
11
11
  const qt = (e, u) => {
12
12
  switch (e) {
13
13
  case "already_voted":
14
- return u === a.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
18
  }, jt = () => /* @__PURE__ */ r(Z, { children: /* @__PURE__ */ m($, { children: [
19
- /* @__PURE__ */ r(L, { loading: !0, style: { height: "40px", borderRadius: "100px" } }),
20
- /* @__PURE__ */ r(L, { loading: !0, style: { height: "24px", margin: "16px 0" } }),
21
- /* @__PURE__ */ r(Q, { children: Array.from({ length: 5 }).map((e, u) => /* @__PURE__ */ r(L, { loading: !0, style: { height: "44px" } }, u)) })
22
- ] }) }), Ht = ({ openedQuestion: e, isLoading: u, vote: M, close: W, isEarlyPrediction: c }) => {
19
+ /* @__PURE__ */ r(M, { loading: !0, style: { height: "40px", borderRadius: "100px" } }),
20
+ /* @__PURE__ */ r(M, { loading: !0, style: { height: "24px", margin: "16px 0" } }),
21
+ /* @__PURE__ */ r(Q, { children: Array.from({ length: 5 }).map((e, u) => /* @__PURE__ */ r(M, { loading: !0, style: { height: "44px" } }, u)) })
22
+ ] }) }), Ht = ({ openedQuestion: e, isLoading: u, vote: P, close: W, isEarlyPrediction: a }) => {
23
23
  var J, K;
24
- const tt = e.subject, n = e.type, I = e.status, v = (J = e.options) == null ? void 0 : J.options, T = e.marketClosed, x = e.id, B = U(), [C, et] = l(!1), [y, rt] = l(!1), [V, Y] = l(!0), [f, nt] = l(!1), [j, ot] = l(!1), [H, q] = l(""), [w, st] = l(""), [A, F] = l(!1), [it, at] = l(!1), { runAnimation: E, finished: _ } = gt();
24
+ const tt = e.subject, n = e.type, I = e.status, v = (J = e.options) == null ? void 0 : J.options, T = e.marketClosed, x = e.id, B = U(), [C, et] = l(!1), [w, rt] = l(!1), [V, Y] = l(!0), [f, nt] = l(!1), [j, ot] = l(!1), [H, q] = l(""), [y, st] = l(""), [A, F] = l(!1), [it, at] = l(!1), { runAnimation: R, finished: _ } = gt();
25
25
  p(() => {
26
26
  _ && W();
27
27
  }, [W, _]), p(() => {
28
- n === a.PREDICTION ? T && Y(!1) : I === b.RESOLVED && Y(!1);
28
+ n === c.PREDICTION ? T && Y(!1) : I === L.RESOLVED && Y(!1);
29
29
  }, []);
30
30
  const ct = S((s) => {
31
31
  rt(s), et(!0);
@@ -35,18 +35,18 @@ const qt = (e, u) => {
35
35
  const h = s.currentTarget.value;
36
36
  q(h);
37
37
  try {
38
- await M(x, h);
39
- } catch (R) {
40
- st(qt(R.message, n)), q(""), console.error("Error while voting", R), D.current = !1;
38
+ await P(x, h);
39
+ } catch (E) {
40
+ st(qt(E.message, n)), q(""), console.error("Error while voting", E), D.current = !1;
41
41
  }
42
42
  }
43
43
  },
44
- [n, x, q, M]
44
+ [n, x, q, P]
45
45
  ), lt = S(() => {
46
- nt(!0), E({ delay: 3500 });
47
- }, [E]), mt = S(() => {
48
- ot(!0), E({ delay: 3500 });
49
- }, [E]), t = e == null ? void 0 : e.answers.find((s) => s.youVoted === !0), i = g(
46
+ nt(!0), R({ delay: 3500 });
47
+ }, [R]), mt = S(() => {
48
+ ot(!0), R({ delay: 3500 });
49
+ }, [R]), t = e == null ? void 0 : e.answers.find((s) => s.youVoted === !0), i = g(
50
50
  () => !!(e != null && e.answers.find((s) => s.correct === !0)),
51
51
  [e]
52
52
  ), o = g(
@@ -83,19 +83,19 @@ const qt = (e, u) => {
83
83
  H
84
84
  ]);
85
85
  p(() => {
86
- const s = k.some(({ percentageDecimal: R }) => R !== 0), h = t && n === a.PREDICTION;
87
- w && (!s || T && h) && F(!0);
88
- }, [k, w, T, n, t]);
89
- const G = v && (v.case === "trivia" || v.case === "prediction") ? v.value : void 0, d = I === b.RESOLVED && n === a.TRIVIA && !t && !V, N = n === a.TRIVIA && y, P = g(() => n === a.PREDICTION ? c ? !1 : !!(t && !i || t && i && (o != null && o.youVoted)) : !0, [n, t, i, o, c]), ut = g(() => {
90
- if (n === a.PREDICTION && t && (!i || i && (o != null && o.youVoted)))
86
+ const s = k.some(({ percentageDecimal: E }) => E !== 0), h = t && n === c.PREDICTION;
87
+ y && (a || !s || T && h) && F(!0);
88
+ }, [k, y, a, T, n, t]);
89
+ const G = v && (v.case === "trivia" || v.case === "prediction") ? v.value : void 0, d = I === L.RESOLVED && n === c.TRIVIA && !t && !V, N = n === c.TRIVIA && w, b = g(() => n === c.PREDICTION ? a ? !1 : !!(t && !i || t && i && (o != null && o.youVoted)) : !0, [n, t, i, o, a]), ut = g(() => {
90
+ if (n === c.PREDICTION && t && (!i || i && (o != null && o.youVoted)))
91
91
  return t.points;
92
92
  if (!(d || f))
93
93
  return t ? t.correct ? t.pointsEarned : 0 : o == null ? void 0 : o.points;
94
- }, [f, t, o, d, n, i]), ft = g(() => n === a.PREDICTION && t ? i ? i && (o != null && o.youVoted) ? "You won" : "" : "To win" : d || f ? "Time expired" : n === a.POLL ? "Time remaining" : t ? "You won" : "To win", [f, n, t, d, i, o]), dt = !P || P && n === a.PREDICTION && C && !A, ht = (n === a.TRIVIA || n === a.PREDICTION) && t && i && (o == null ? void 0 : o.youVoted), Tt = t || d || N || n === a.TRIVIA && I === b.RESOLVED && V;
94
+ }, [f, t, o, d, n, i]), ft = g(() => n === c.PREDICTION && t ? i ? i && (o != null && o.youVoted) ? "You won" : "" : "To win" : d || f ? "Time expired" : n === c.POLL ? "Time remaining" : t ? "You won" : "To win", [f, n, t, d, i, o]), dt = !b || b && n === c.PREDICTION && C && !A, ht = (n === c.TRIVIA || n === c.PREDICTION) && t && i && (o == null ? void 0 : o.youVoted), Tt = t || d || N || n === c.TRIVIA && I === L.RESOLVED && V;
95
95
  return /* @__PURE__ */ m(Ct, { children: [
96
- c && /* @__PURE__ */ r(Vt, {}),
97
- /* @__PURE__ */ r(Z, { style: c ? { marginTop: "-40px" } : {}, children: /* @__PURE__ */ m($, { id: "questionContent", children: [
98
- !c && /* @__PURE__ */ r(
96
+ a && /* @__PURE__ */ r(Vt, {}),
97
+ /* @__PURE__ */ r(Z, { style: a ? { marginTop: "-40px" } : {}, children: /* @__PURE__ */ m($, { id: "questionContent", children: [
98
+ !a && /* @__PURE__ */ r(
99
99
  X,
100
100
  {
101
101
  feedbackMessages: G,
@@ -106,15 +106,15 @@ const qt = (e, u) => {
106
106
  showExpiredNotification: d,
107
107
  showClosedNotificationTrivia: N,
108
108
  votedInCurrentRender: C,
109
- votedAfterQuestionClosed: y,
109
+ votedAfterQuestionClosed: w,
110
110
  enteredAnActiveQuestion: V,
111
111
  marketClosed: T,
112
112
  percentsAnimated: A,
113
- voteErrorMessage: w,
113
+ voteErrorMessage: y,
114
114
  votedAnswer: t
115
115
  }
116
116
  ),
117
- P && /* @__PURE__ */ r(
117
+ b && /* @__PURE__ */ r(
118
118
  xt,
119
119
  {
120
120
  title: ft,
@@ -129,7 +129,7 @@ const qt = (e, u) => {
129
129
  percentsAnimated: A
130
130
  }
131
131
  ),
132
- !c && (f || j) ? /* @__PURE__ */ r(pt, { children: /* @__PURE__ */ r(
132
+ !a && (f || j) ? /* @__PURE__ */ r(pt, { children: /* @__PURE__ */ r(
133
133
  It,
134
134
  {
135
135
  icon: "icon-check-circle",
@@ -145,12 +145,12 @@ const qt = (e, u) => {
145
145
  ] })
146
146
  }
147
147
  ) }) : /* @__PURE__ */ m(O, { children: [
148
- c && /* @__PURE__ */ m(vt, { children: [
149
- /* @__PURE__ */ r(yt, { name: "iconEarlyPrediction" }),
148
+ a && /* @__PURE__ */ m(vt, { children: [
149
+ /* @__PURE__ */ r(wt, { name: "iconEarlyPrediction" }),
150
150
  "EARLY PREDICTION"
151
151
  ] }),
152
- /* @__PURE__ */ r(wt, { style: dt ? { marginTop: 0 } : {}, children: tt }),
153
- c && /* @__PURE__ */ r(
152
+ /* @__PURE__ */ r(yt, { style: dt ? { marginTop: 0 } : {}, children: tt }),
153
+ a && /* @__PURE__ */ r(
154
154
  X,
155
155
  {
156
156
  feedbackMessages: G,
@@ -161,12 +161,12 @@ const qt = (e, u) => {
161
161
  showExpiredNotification: d,
162
162
  showClosedNotificationTrivia: N,
163
163
  votedInCurrentRender: C,
164
- votedAfterQuestionClosed: y,
164
+ votedAfterQuestionClosed: w,
165
165
  enteredAnActiveQuestion: V,
166
166
  marketClosed: T,
167
167
  percentsAnimated: A,
168
- voteErrorMessage: w,
169
- isEarlyPrediction: c,
168
+ voteErrorMessage: y,
169
+ isEarlyPrediction: a,
170
170
  correctAnswer: o,
171
171
  votedAnswer: t
172
172
  }
@@ -178,16 +178,16 @@ const qt = (e, u) => {
178
178
  ...s,
179
179
  markThatVoted: ct,
180
180
  onPercentsAnimated: () => F(!0),
181
- votedAfterQuestionClosed: y,
181
+ votedAfterQuestionClosed: w,
182
182
  enteredAnActiveQuestion: V,
183
183
  marketClosed: T,
184
- isEarlyPrediction: c
184
+ isEarlyPrediction: a
185
185
  },
186
186
  s.id
187
187
  )) }),
188
- c && /* @__PURE__ */ m(O, { children: [
189
- /* @__PURE__ */ r(Et, {}),
190
- /* @__PURE__ */ r(Rt, { children: /* @__PURE__ */ r(Ot, { name: "mastersLogoWhite" }) })
188
+ a && /* @__PURE__ */ m(O, { children: [
189
+ /* @__PURE__ */ r(Rt, {}),
190
+ /* @__PURE__ */ r(Et, { children: /* @__PURE__ */ r(Ot, { name: "mastersLogoWhite" }) })
191
191
  ] })
192
192
  ] })
193
193
  ] })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/react-ui",
3
- "version": "1.20.0",
3
+ "version": "1.21.0",
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.0",
73
- "@streamlayer/react-polyfills": "^0.1.7",
74
- "@streamlayer/sdk-web": "^1.10.0",
75
- "@streamlayer/sdk-web-analytics": "^1.7.0",
76
- "@streamlayer/sdk-web-anonymous-auth": "^1.1.26",
77
- "@streamlayer/sdk-web-api": "^1.8.0",
78
- "@streamlayer/sdk-web-core": "^1.11.2",
79
- "@streamlayer/sdk-web-features": "^1.0.47",
80
- "@streamlayer/sdk-web-interfaces": "^1.4.13",
81
- "@streamlayer/sdk-web-logger": "^1.0.47",
82
- "@streamlayer/sdk-web-notifications": "^1.3.9",
83
- "@streamlayer/sdk-web-storage": "^1.0.47",
84
- "@streamlayer/sdk-web-types": "^1.10.4"
72
+ "@streamlayer/feature-gamification": "^1.16.1",
73
+ "@streamlayer/react-polyfills": "^0.1.8",
74
+ "@streamlayer/sdk-web-analytics": "^1.7.1",
75
+ "@streamlayer/sdk-web": "^1.10.1",
76
+ "@streamlayer/sdk-web-anonymous-auth": "^1.1.27",
77
+ "@streamlayer/sdk-web-api": "^1.8.1",
78
+ "@streamlayer/sdk-web-core": "^1.11.3",
79
+ "@streamlayer/sdk-web-features": "^1.0.48",
80
+ "@streamlayer/sdk-web-interfaces": "^1.4.14",
81
+ "@streamlayer/sdk-web-logger": "^1.0.48",
82
+ "@streamlayer/sdk-web-storage": "^1.0.48",
83
+ "@streamlayer/sdk-web-types": "^1.10.5",
84
+ "@streamlayer/sdk-web-notifications": "^1.3.10"
85
85
  },
86
86
  "nx": {
87
87
  "implicitDependencies": [
@@ -123,7 +123,7 @@
123
123
  "vite-plugin-svgr": "^4.2.0",
124
124
  "vite-svg-loader": "^5.1.0",
125
125
  "vite-tsconfig-paths": "^5.0.1",
126
- "@streamlayer/react": "^1.14.0"
126
+ "@streamlayer/react": "^1.14.1"
127
127
  },
128
128
  "dependencies": {
129
129
  "@dailymotion/vast-client": "^6.2.0",