@streamlayer/react-ui 1.19.1 → 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.
- package/lib/app/app/Advertisement/index.js +74 -72
- package/lib/app/app/Points/index.js +21 -14
- package/lib/app/app/index.js +79 -89
- package/lib/app/app/useApp.d.ts +2 -1
- package/lib/app/masters/BetPack/BetPackContent/EmergencyScreen/index.d.ts +2 -0
- package/lib/app/masters/BetPack/BetPackContent/EmergencyScreen/index.js +11 -10
- package/lib/app/masters/BetPack/BetPackContent/EndScreen/index.d.ts +1 -0
- package/lib/app/masters/BetPack/BetPackContent/EndScreen/index.js +22 -18
- package/lib/app/masters/BetPack/BetPackContent/ScreenContainer/index.d.ts +1 -0
- package/lib/app/masters/BetPack/BetPackContent/ScreenContainer/index.js +7 -7
- package/lib/app/masters/BetPack/BetPackContent/ScreenContainer/useDynamicParentFont.d.ts +2 -1
- package/lib/app/masters/BetPack/BetPackContent/ScreenContainer/useDynamicParentFont.js +31 -22
- package/lib/app/masters/BetPack/BetPackContent/StartScreen/index.d.ts +1 -0
- package/lib/app/masters/BetPack/BetPackContent/StartScreen/index.js +11 -11
- package/lib/app/masters/BetPack/BetPackContent/index.js +61 -49
- package/lib/app/masters/BetPack/BetPackOverlay/index.d.ts +1 -1
- package/lib/app/masters/BetPack/BetPackOverlay/index.js +3 -2
- package/lib/app/masters/BetPack/index.js +80 -75
- package/lib/app/masters/Features/Gamification/index.d.ts +0 -2
- package/lib/app/masters/Features/Gamification/index.js +29 -34
- package/lib/app/masters/Features/index.d.ts +0 -2
- package/lib/app/masters/Features/index.js +4 -12
- package/lib/app/masters/Notifications/Onboarding/index.d.ts +0 -1
- package/lib/app/masters/Notifications/Onboarding/index.js +42 -43
- package/lib/app/masters/Notifications/index.js +50 -55
- package/lib/app/masters/Points/index.js +24 -18
- package/lib/app/masters/masters.js +70 -92
- package/lib/app/masters/useOrientation.d.ts +3 -0
- package/lib/app/masters/useOrientation.js +12 -0
- package/lib/app/masters/useSdkResponsive.d.ts +2 -0
- package/lib/app/masters/useSdkResponsive.js +3 -1
- package/lib/app/masters/useSdkScroll.js +1 -1
- package/lib/app/useSdkResponsive.js +1 -1
- package/lib/app/useSdkScroll.js +1 -1
- package/lib/assets/style.css +1 -1
- package/lib/hooks/analytics.js +17 -42
- package/lib/index-CLJzLXks.js +64 -0
- package/lib/reset.css +1 -1
- package/lib/ui/advertisement/notification/index.js +8 -8
- package/lib/ui/advertisement/overlay/externalAd/index.js +40310 -114
- package/lib/ui/advertisement/overlay/externalAd/styles.d.ts +8 -0
- package/lib/ui/advertisement/overlay/externalAd/styles.js +39 -0
- package/lib/ui/close-btn/index.d.ts +2 -0
- package/lib/ui/close-btn/index.js +40 -32
- package/lib/ui/gamification/question/inapp/prediction-result/frames/content.js +48 -33
- package/lib/ui/gamification/vote/feedback/index.js +30 -30
- package/lib/ui/gamification/vote/index.js +43 -43
- package/lib/ui/gamification/vote/vote-option/index.js +51 -53
- package/lib/ui/icons/index.d.ts +3 -0
- package/lib/ui/icons/index.js +75 -54
- package/lib/ui/modal/index.js +36 -32
- package/lib/ui/show-in/index.js +26 -26
- package/lib/ui/theme/masters-theme.js +12 -4
- package/lib/ui/theme/theme.js +9 -5
- package/package.json +22 -16
- package/lib/index-BEm7B1u1.js +0 -72
|
@@ -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,49 +1,57 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { styled as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { CloseTimerAuto as
|
|
5
|
-
import { SvgIcon as
|
|
6
|
-
import { SimpleTimer as
|
|
7
|
-
const
|
|
1
|
+
import { jsx as s, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { styled as t } from "@linaria/react";
|
|
3
|
+
import { useState as u, useEffect as I, useCallback as v } from "react";
|
|
4
|
+
import { CloseTimerAuto as x } from "@streamlayer/sdk-web-types";
|
|
5
|
+
import { SvgIcon as T } from "../icons/index.js";
|
|
6
|
+
import { SimpleTimer as d } from "../timer/index.js";
|
|
7
|
+
const g = /* @__PURE__ */ t("div")({
|
|
8
8
|
name: "CloseIconWrap",
|
|
9
9
|
class: "c3v6bv6",
|
|
10
10
|
propsAsIs: !1
|
|
11
|
-
}),
|
|
11
|
+
}), h = /* @__PURE__ */ t("div")({
|
|
12
12
|
name: "TimerWrap",
|
|
13
13
|
class: "teuhmro",
|
|
14
14
|
propsAsIs: !1
|
|
15
|
-
}),
|
|
15
|
+
}), A = () => T, C = /* @__PURE__ */ t(A())({
|
|
16
16
|
name: "Icon",
|
|
17
17
|
class: "i17rfxv5",
|
|
18
18
|
propsAsIs: !0
|
|
19
|
-
}),
|
|
19
|
+
}), y = ({
|
|
20
20
|
close: r,
|
|
21
|
-
className:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
className: i,
|
|
22
|
+
timerClassName: c,
|
|
23
|
+
skipIcon: o,
|
|
24
|
+
isPlaying: p = !0,
|
|
25
|
+
duration: e = 0,
|
|
26
|
+
autoClose: m
|
|
25
27
|
}) => {
|
|
26
|
-
const [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, [
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
}, [
|
|
33
|
-
return
|
|
28
|
+
const [a, n] = u(e === 0);
|
|
29
|
+
I(() => {
|
|
30
|
+
n(!e);
|
|
31
|
+
}, [e]);
|
|
32
|
+
const l = v(() => {
|
|
33
|
+
m === x.ENABLED ? r == null || r() : n(!0);
|
|
34
|
+
}, [m, r]);
|
|
35
|
+
return a ? /* @__PURE__ */ f(g, {
|
|
34
36
|
onClick: r,
|
|
35
|
-
className:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
className: i,
|
|
38
|
+
style: o ? {
|
|
39
|
+
width: "auto"
|
|
40
|
+
} : {},
|
|
41
|
+
children: [o && /* @__PURE__ */ s("span", {
|
|
42
|
+
children: "Skip"
|
|
43
|
+
}), /* @__PURE__ */ s(C, {
|
|
44
|
+
name: o ? "iconSkip" : "icon-cross"
|
|
45
|
+
})]
|
|
46
|
+
}) : /* @__PURE__ */ s(h, {
|
|
47
|
+
children: /* @__PURE__ */ s(d, {
|
|
48
|
+
className: c,
|
|
49
|
+
isPlaying: p,
|
|
50
|
+
duration: e,
|
|
51
|
+
onTimerExpired: l
|
|
44
52
|
})
|
|
45
53
|
});
|
|
46
54
|
};
|
|
47
55
|
export {
|
|
48
|
-
|
|
56
|
+
y as CloseButton
|
|
49
57
|
};
|
|
@@ -1,57 +1,72 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { styled as s } from "@linaria/react";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { useState as r, useCallback as u, useMemo as b } from "react";
|
|
4
|
+
import { SvgIcon as a } from "../../../../../icons/index.js";
|
|
5
|
+
const v = /* @__PURE__ */ s("div")({
|
|
5
6
|
name: "Container",
|
|
6
7
|
class: "cef8huz",
|
|
7
8
|
propsAsIs: !1
|
|
8
|
-
}),
|
|
9
|
+
}), C = () => a, k = /* @__PURE__ */ s(C())({
|
|
9
10
|
name: "CheckIcon",
|
|
10
11
|
class: "c1mo15kk",
|
|
11
12
|
propsAsIs: !0
|
|
12
|
-
}),
|
|
13
|
+
}), y = () => a, A = /* @__PURE__ */ s(y())({
|
|
13
14
|
name: "PredictionIcon",
|
|
14
15
|
class: "p16zkqnm",
|
|
15
16
|
propsAsIs: !0
|
|
16
|
-
}),
|
|
17
|
+
}), x = /* @__PURE__ */ s("div")({
|
|
17
18
|
name: "PredictionIconContainer",
|
|
18
19
|
class: "pjszi7a",
|
|
19
20
|
propsAsIs: !1
|
|
20
|
-
}),
|
|
21
|
+
}), z = /* @__PURE__ */ s("div")({
|
|
21
22
|
name: "BodyContainer",
|
|
22
23
|
class: "bftbmo3",
|
|
23
24
|
propsAsIs: !1
|
|
24
|
-
}),
|
|
25
|
+
}), P = /* @__PURE__ */ s("div")({
|
|
25
26
|
name: "Body",
|
|
26
27
|
class: "barrbyu",
|
|
27
28
|
propsAsIs: !1
|
|
28
|
-
}),
|
|
29
|
+
}), B = /* @__PURE__ */ s("div")({
|
|
29
30
|
name: "Subtitle",
|
|
30
31
|
class: "sz7237i",
|
|
31
32
|
propsAsIs: !1
|
|
32
|
-
}),
|
|
33
|
-
step:
|
|
34
|
-
children:
|
|
35
|
-
answer:
|
|
36
|
-
state:
|
|
37
|
-
}) =>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}), /* @__PURE__ */
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
33
|
+
}), R = ({
|
|
34
|
+
step: d,
|
|
35
|
+
children: p,
|
|
36
|
+
answer: l,
|
|
37
|
+
state: m = "pending"
|
|
38
|
+
}) => {
|
|
39
|
+
const [I, f] = r(0), [o] = r(() => new ResizeObserver((n) => {
|
|
40
|
+
var c, t;
|
|
41
|
+
f((t = (c = n == null ? void 0 : n[0]) == null ? void 0 : c.contentRect) == null ? void 0 : t.width);
|
|
42
|
+
})), h = u((n) => {
|
|
43
|
+
n || o.disconnect(), o.observe(n);
|
|
44
|
+
}, [o]);
|
|
45
|
+
return b(() => () => {
|
|
46
|
+
o.disconnect();
|
|
47
|
+
}, [o]), /* @__PURE__ */ i(v, {
|
|
48
|
+
children: [/* @__PURE__ */ e(x, {
|
|
49
|
+
children: /* @__PURE__ */ e(A, {
|
|
50
|
+
name: "icon-prediction"
|
|
51
|
+
})
|
|
52
|
+
}), /* @__PURE__ */ e(z, {
|
|
53
|
+
style: {
|
|
54
|
+
minWidth: `${I}px`
|
|
55
|
+
},
|
|
56
|
+
children: /* @__PURE__ */ e(P, {
|
|
57
|
+
children: p
|
|
58
|
+
}, d)
|
|
59
|
+
}), /* @__PURE__ */ e(B, {
|
|
60
|
+
ref: h,
|
|
61
|
+
className: m,
|
|
62
|
+
children: /* @__PURE__ */ i("div", {
|
|
63
|
+
children: [/* @__PURE__ */ e(k, {
|
|
64
|
+
name: "icon-check"
|
|
65
|
+
}), "Your Pick: ", l]
|
|
66
|
+
})
|
|
67
|
+
})]
|
|
68
|
+
});
|
|
69
|
+
};
|
|
55
70
|
export {
|
|
56
|
-
|
|
71
|
+
R as Content
|
|
57
72
|
};
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import { jsx as i, jsxs as c, Fragment as
|
|
1
|
+
import { jsx as i, jsxs as c, Fragment as Y } from "react/jsx-runtime";
|
|
2
2
|
import { QuestionType as l } from "@streamlayer/sdk-web-types";
|
|
3
3
|
import { SvgIcon as m } from "../../../icons/index.js";
|
|
4
|
-
import { ShowInContainer as H, Container as z, FeedbackContainer as
|
|
4
|
+
import { ShowInContainer as H, Container as z, FeedbackContainer as t, IconPrediction as j, FeedbackDescription as F, FeedbackIconWrap as u, FeedbackHeader as x, FeedbackText as T, EarlyFeedbackDescription as G, FeedbackDynamicDescription as J, DynamicWrap as K, FeedbackTitle as U, FeedbackTitleWrap as X, FeedbackResultDescription as Z, FeedbackResultDescriptionWrap as _ } from "./styles.js";
|
|
5
5
|
const s = ({
|
|
6
|
-
feedbackMessages:
|
|
6
|
+
feedbackMessages: h,
|
|
7
7
|
questionVotedCorrectly: R,
|
|
8
|
-
questionVoted:
|
|
8
|
+
questionVoted: k,
|
|
9
9
|
questionType: d,
|
|
10
10
|
hasCorrectAnswer: r,
|
|
11
11
|
showExpiredNotification: f,
|
|
12
12
|
showClosedNotificationTrivia: O,
|
|
13
13
|
votedInCurrentRender: b,
|
|
14
|
-
votedAfterQuestionClosed:
|
|
15
|
-
voteErrorMessage:
|
|
16
|
-
enteredAnActiveQuestion:
|
|
14
|
+
votedAfterQuestionClosed: L,
|
|
15
|
+
voteErrorMessage: n,
|
|
16
|
+
enteredAnActiveQuestion: $,
|
|
17
17
|
marketClosed: y,
|
|
18
18
|
percentsAnimated: B,
|
|
19
19
|
votedAnswer: I,
|
|
20
|
-
isEarlyPrediction:
|
|
20
|
+
isEarlyPrediction: e,
|
|
21
21
|
correctAnswer: o
|
|
22
22
|
}) => {
|
|
23
|
-
const
|
|
24
|
-
return f || O ||
|
|
25
|
-
|
|
26
|
-
!
|
|
27
|
-
/* @__PURE__ */ i(F, { children:
|
|
23
|
+
const W = k && (d === l.TRIVIA || d === l.PREDICTION), C = d === l.PREDICTION && !r, D = y && d === l.PREDICTION && !k || d === l.PREDICTION && L && b && $, N = W && C, Q = W && r, S = d === l.PREDICTION && k && b && r, P = k && d === l.POLL && b, p = R ? "correct" : "incorrect", a = R ? h == null ? void 0 : h.correctFeedback : h == null ? void 0 : h.incorrectFeedback;
|
|
24
|
+
return f || O || N || Q || D || P || S || n ? /* @__PURE__ */ i(H, { enabled: b, animate: B, children: /* @__PURE__ */ c(z, { "data-prediction": C, children: [
|
|
25
|
+
n && !D && /* @__PURE__ */ c(t, { children: [
|
|
26
|
+
!e && /* @__PURE__ */ i(j, { name: "questionExpired" }),
|
|
27
|
+
/* @__PURE__ */ i(F, { children: n })
|
|
28
28
|
] }),
|
|
29
|
-
!
|
|
30
|
-
!
|
|
29
|
+
!n && f && /* @__PURE__ */ c(t, { children: [
|
|
30
|
+
!e && /* @__PURE__ */ i(u, { children: /* @__PURE__ */ i(m, { name: "questionExpired" }) }),
|
|
31
31
|
/* @__PURE__ */ c("div", { children: [
|
|
32
32
|
/* @__PURE__ */ i(x, { children: /* @__PURE__ */ i(F, { children: "Question Expired" }) }),
|
|
33
33
|
/* @__PURE__ */ i(T, { children: "You can still answer to see if you're correct, but no points are awarded for expired questions." })
|
|
34
34
|
] })
|
|
35
35
|
] }),
|
|
36
|
-
!
|
|
37
|
-
/* @__PURE__ */ i(
|
|
36
|
+
!n && O && /* @__PURE__ */ c(t, { children: [
|
|
37
|
+
/* @__PURE__ */ i(u, { children: /* @__PURE__ */ i(m, { name: "questionExpired" }) }),
|
|
38
38
|
/* @__PURE__ */ c("div", { children: [
|
|
39
39
|
/* @__PURE__ */ i(x, { children: /* @__PURE__ */ i(F, { children: "Question Closed" }) }),
|
|
40
40
|
/* @__PURE__ */ i(T, { children: "This question was answered after the moderator closed the question. So the points for this answer won’t tally." })
|
|
41
41
|
] })
|
|
42
42
|
] }),
|
|
43
|
-
D && /* @__PURE__ */ c(
|
|
44
|
-
!
|
|
43
|
+
D && /* @__PURE__ */ c(t, { children: [
|
|
44
|
+
!e && /* @__PURE__ */ i(u, { children: /* @__PURE__ */ i(m, { name: "questionExpired" }) }),
|
|
45
45
|
/* @__PURE__ */ c("div", { children: [
|
|
46
|
-
/* @__PURE__ */ i(x, { children: /* @__PURE__ */ i(F, { children:
|
|
47
|
-
/* @__PURE__ */ i(T, { children:
|
|
46
|
+
/* @__PURE__ */ i(x, { children: /* @__PURE__ */ i(F, { children: e ? r ? "The results are already in!" : "Question is Closed" : "Question Closed" }) }),
|
|
47
|
+
/* @__PURE__ */ i(T, { children: e ? /* @__PURE__ */ i(G, { children: r ? `Correct: ${o == null ? void 0 : o.text}` : "Event affecting the outcome has occurred." }) : "This event has already taken place, so the ability to make a prediction on its outcome is no longer available." })
|
|
48
48
|
] })
|
|
49
49
|
] }),
|
|
50
|
-
!
|
|
51
|
-
!
|
|
50
|
+
!n && N && /* @__PURE__ */ c(t, { children: [
|
|
51
|
+
!e && /* @__PURE__ */ i(j, { name: "icon-prediction" }),
|
|
52
52
|
/* @__PURE__ */ c(J, { children: [
|
|
53
53
|
"Your pick has been recorded. ",
|
|
54
54
|
/* @__PURE__ */ i(K, { children: "We’ll notify you of the result." })
|
|
55
55
|
] })
|
|
56
56
|
] }),
|
|
57
|
-
!
|
|
58
|
-
!
|
|
57
|
+
!n && P && /* @__PURE__ */ c(t, { children: [
|
|
58
|
+
!e && /* @__PURE__ */ i(u, { "data-feedback-type": "correct", children: /* @__PURE__ */ i(m, { name: "correct" }) }),
|
|
59
59
|
/* @__PURE__ */ i(F, { children: "Thanks for answering. Please stay tuned for the next question." })
|
|
60
60
|
] }),
|
|
61
|
-
!
|
|
62
|
-
!
|
|
61
|
+
!n && (Q || S) && /* @__PURE__ */ c(t, { children: [
|
|
62
|
+
!e && /* @__PURE__ */ i(u, { "data-feedback-type": p, children: /* @__PURE__ */ i(m, { name: p }) }),
|
|
63
63
|
/* @__PURE__ */ i("div", { children: /* @__PURE__ */ c(x, { children: [
|
|
64
|
-
|
|
64
|
+
e ? /* @__PURE__ */ i(X, { children: p === "incorrect" ? /* @__PURE__ */ c(Y, { children: [
|
|
65
65
|
/* @__PURE__ */ i("div", { children: "So close!" }),
|
|
66
66
|
/* @__PURE__ */ i("div", { children: "Better luck next time" })
|
|
67
|
-
] }) : /* @__PURE__ */ c(
|
|
67
|
+
] }) : /* @__PURE__ */ c(Y, { children: [
|
|
68
68
|
/* @__PURE__ */ i("div", { children: "That’s correct!" }),
|
|
69
69
|
/* @__PURE__ */ i("div", { children: "You chose wisely." })
|
|
70
70
|
] }) }) : /* @__PURE__ */ i(U, { "data-feedback-type": p, children: a == null ? void 0 : a.title }),
|
|
71
|
-
|
|
71
|
+
e ? /* @__PURE__ */ c(_, { children: [
|
|
72
72
|
/* @__PURE__ */ c("div", { children: [
|
|
73
73
|
"Your pick: ",
|
|
74
74
|
I == null ? void 0 : I.text
|
|
@@ -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
|
|
5
|
-
import { Skeleton as
|
|
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
|
|
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 ===
|
|
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(
|
|
20
|
-
/* @__PURE__ */ r(
|
|
21
|
-
/* @__PURE__ */ r(Q, { children: Array.from({ length: 5 }).map((e, u) => /* @__PURE__ */ r(
|
|
22
|
-
] }) }), Ht = ({ openedQuestion: e, isLoading: u, vote:
|
|
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), [
|
|
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 ===
|
|
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
|
|
39
|
-
} catch (
|
|
40
|
-
st(qt(
|
|
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,
|
|
44
|
+
[n, x, q, P]
|
|
45
45
|
), lt = S(() => {
|
|
46
|
-
nt(!0),
|
|
47
|
-
}, [
|
|
48
|
-
ot(!0),
|
|
49
|
-
}, [
|
|
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:
|
|
87
|
-
|
|
88
|
-
}, [k,
|
|
89
|
-
const G = v && (v.case === "trivia" || v.case === "prediction") ? v.value : void 0, d = I ===
|
|
90
|
-
if (n ===
|
|
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 ===
|
|
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
|
-
|
|
97
|
-
/* @__PURE__ */ r(Z, { style:
|
|
98
|
-
!
|
|
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:
|
|
109
|
+
votedAfterQuestionClosed: w,
|
|
110
110
|
enteredAnActiveQuestion: V,
|
|
111
111
|
marketClosed: T,
|
|
112
112
|
percentsAnimated: A,
|
|
113
|
-
voteErrorMessage:
|
|
113
|
+
voteErrorMessage: y,
|
|
114
114
|
votedAnswer: t
|
|
115
115
|
}
|
|
116
116
|
),
|
|
117
|
-
|
|
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
|
-
!
|
|
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
|
-
|
|
149
|
-
/* @__PURE__ */ r(
|
|
148
|
+
a && /* @__PURE__ */ m(vt, { children: [
|
|
149
|
+
/* @__PURE__ */ r(wt, { name: "iconEarlyPrediction" }),
|
|
150
150
|
"EARLY PREDICTION"
|
|
151
151
|
] }),
|
|
152
|
-
/* @__PURE__ */ r(
|
|
153
|
-
|
|
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:
|
|
164
|
+
votedAfterQuestionClosed: w,
|
|
165
165
|
enteredAnActiveQuestion: V,
|
|
166
166
|
marketClosed: T,
|
|
167
167
|
percentsAnimated: A,
|
|
168
|
-
voteErrorMessage:
|
|
169
|
-
isEarlyPrediction:
|
|
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:
|
|
181
|
+
votedAfterQuestionClosed: w,
|
|
182
182
|
enteredAnActiveQuestion: V,
|
|
183
183
|
marketClosed: T,
|
|
184
|
-
isEarlyPrediction:
|
|
184
|
+
isEarlyPrediction: a
|
|
185
185
|
},
|
|
186
186
|
s.id
|
|
187
187
|
)) }),
|
|
188
|
-
|
|
189
|
-
/* @__PURE__ */ r(
|
|
190
|
-
/* @__PURE__ */ r(
|
|
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
|
] })
|