@streamlayer/react-ui 1.33.2 → 1.34.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/Polymarket/index.d.ts +4 -0
- package/lib/app/app/Polymarket/index.js +56 -0
- package/lib/app/app/Polymarket/story.d.ts +2 -0
- package/lib/app/app/Polymarket/story.js +17 -0
- package/lib/app/masters/useSdkResponsive.js +1 -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/app/webos/Advertisement/index.js +61 -61
- package/lib/app/webos/ExposedPauseAd/PauseAd.js +130 -103
- package/lib/app/webos/Question/index.js +30 -27
- package/lib/app/webos/index.d.ts +1 -0
- package/lib/app/webos/ui/Sidebar/index.js +145 -141
- package/lib/app/webos/ui/Sidebar/styles.d.ts +2 -0
- package/lib/app/webos/ui/Sidebar/styles.js +95 -85
- package/lib/assets/style.css +1 -1
- package/lib/{index-tnt2CtQe.js → index-Deo5_bIg.js} +6 -12
- package/lib/{index-DSi8Qgfs.js → index-Fv2CC2QU.js} +4 -4
- package/lib/ui/advertisement/overlay/externalAd/vast-player/useGAMPlayer.js +1 -1
- package/lib/ui/advertisement/overlay/externalAd/vast-player/useVastAds.js +1 -1
- package/lib/ui/gamification/question/inapp/notification/AdNotification/index.d.ts +1 -0
- package/lib/ui/gamification/question/inapp/notification/AdNotification/index.js +62 -48
- package/lib/ui/gamification/question/inapp/prediction-result/index.d.ts +1 -0
- package/lib/ui/gamification/question/inapp/prediction-result/index.js +4 -4
- package/lib/ui/gamification/question/inapp/prediction-result-ad/index.d.ts +1 -0
- package/lib/ui/gamification/question/inapp/prediction-result-ad/index.js +27 -16
- package/lib/ui/gamification/vote/insight-details/index.js +5 -5
- package/lib/ui/polymarket/index.d.ts +21 -0
- package/lib/ui/polymarket/index.js +226 -0
- package/lib/ui/polymarket/styles.d.ts +13 -0
- package/lib/ui/polymarket/styles.js +69 -0
- package/lib/utils/decorators/container.d.ts +1 -0
- package/lib/utils/decorators/container.js +9 -8
- package/lib/utils/decorators/styles.d.ts +1 -0
- package/lib/utils/decorators/styles.js +9 -4
- package/package.json +19 -16
- package/lib/ui/advertisement/overlay/externalAd/vast-player/useGAMStatic.d.ts +0 -10
- package/lib/ui/advertisement/overlay/externalAd/vast-player/useGAMStatic.js +0 -69
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
let t = [], i = 0;
|
|
2
|
-
const
|
|
3
|
-
let a = (s) => {
|
|
2
|
+
const s = 4, a = /* @__NO_SIDE_EFFECTS__ */ (r) => {
|
|
4
3
|
let f = [], e = {
|
|
5
4
|
get() {
|
|
6
5
|
return e.lc || e.listen(() => {
|
|
@@ -9,8 +8,8 @@ let a = (s) => {
|
|
|
9
8
|
lc: 0,
|
|
10
9
|
listen(l) {
|
|
11
10
|
return e.lc = f.push(l), () => {
|
|
12
|
-
for (let u = i +
|
|
13
|
-
t[u] === l ? t.splice(u,
|
|
11
|
+
for (let u = i + s; u < t.length; )
|
|
12
|
+
t[u] === l ? t.splice(u, s) : u += s;
|
|
14
13
|
let n = f.indexOf(l);
|
|
15
14
|
~n && (f.splice(n, 1), --e.lc || e.off());
|
|
16
15
|
};
|
|
@@ -18,14 +17,9 @@ let a = (s) => {
|
|
|
18
17
|
notify(l, n) {
|
|
19
18
|
let u = !t.length;
|
|
20
19
|
for (let o of f)
|
|
21
|
-
t.push(
|
|
22
|
-
o,
|
|
23
|
-
e.value,
|
|
24
|
-
l,
|
|
25
|
-
n
|
|
26
|
-
);
|
|
20
|
+
t.push(o, e.value, l, n);
|
|
27
21
|
if (u) {
|
|
28
|
-
for (i = 0; i < t.length; i +=
|
|
22
|
+
for (i = 0; i < t.length; i += s)
|
|
29
23
|
t[i](
|
|
30
24
|
t[i + 1],
|
|
31
25
|
t[i + 2],
|
|
@@ -46,7 +40,7 @@ let a = (s) => {
|
|
|
46
40
|
let n = e.listen(l);
|
|
47
41
|
return l(e.value), n;
|
|
48
42
|
},
|
|
49
|
-
value:
|
|
43
|
+
value: r
|
|
50
44
|
};
|
|
51
45
|
return e;
|
|
52
46
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
|
|
3
|
-
let e =
|
|
1
|
+
import { a as n } from "./index-Deo5_bIg.js";
|
|
2
|
+
const f = /* @__NO_SIDE_EFFECTS__ */ (o = {}) => {
|
|
3
|
+
let e = n(o);
|
|
4
4
|
return e.setKey = function(a, t) {
|
|
5
5
|
let l = e.value;
|
|
6
6
|
typeof t > "u" && a in e.value ? (e.value = { ...e.value }, delete e.value[a], e.notify(l, a)) : e.value[a] !== t && (e.value = {
|
|
@@ -10,5 +10,5 @@ let i = (o = {}) => {
|
|
|
10
10
|
}, e;
|
|
11
11
|
};
|
|
12
12
|
export {
|
|
13
|
-
|
|
13
|
+
f as m
|
|
14
14
|
};
|
|
@@ -2,7 +2,7 @@ import { VASTTracker as R } from "@dailymotion/vast-client";
|
|
|
2
2
|
import { useRef as b, useCallback as m, useEffect as A } from "react";
|
|
3
3
|
import U from "video.js";
|
|
4
4
|
import { useVastAds as x } from "./useVastAds.js";
|
|
5
|
-
import { m as D } from "../../../../../index-
|
|
5
|
+
import { m as D } from "../../../../../index-Fv2CC2QU.js";
|
|
6
6
|
const V = (u) => {
|
|
7
7
|
const c = b();
|
|
8
8
|
return A(() => {
|
|
@@ -2,7 +2,7 @@ import { VASTClient as R } from "@dailymotion/vast-client";
|
|
|
2
2
|
import { useState as A, useRef as P, useEffect as w } from "react";
|
|
3
3
|
import D from "vmap";
|
|
4
4
|
import { v4 as S, validate as L, v5 as y } from "uuid";
|
|
5
|
-
import { a as F } from "../../../../../index-
|
|
5
|
+
import { a as F } from "../../../../../index-Deo5_bIg.js";
|
|
6
6
|
const N = (a, s) => {
|
|
7
7
|
const o = goog.pal, c = new o.ConsentSettings();
|
|
8
8
|
c.allowStorage = !1;
|
|
@@ -1,103 +1,117 @@
|
|
|
1
1
|
import { jsx as r, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import { cx as Q } from "@linaria/core";
|
|
2
3
|
import { withFocusable as D } from "../../../../../../app/webos/useTvButton.js";
|
|
3
|
-
import { useState as
|
|
4
|
-
import { QuestionType as
|
|
5
|
-
import { QuestionTypeData as
|
|
6
|
-
import { QuestionTypeHeader as
|
|
7
|
-
import { NotificationMedia as
|
|
8
|
-
import { NotificationContainer as
|
|
9
|
-
const
|
|
4
|
+
import { useState as R, useRef as W, useEffect as j } from "react";
|
|
5
|
+
import { QuestionType as l, NotificationUseContentMedia as O, QuestionStatus as P } from "@streamlayer/sdk-web-types";
|
|
6
|
+
import { QuestionTypeData as y } from "../../../../constants.js";
|
|
7
|
+
import { QuestionTypeHeader as H } from "../../../index.js";
|
|
8
|
+
import { NotificationMedia as S } from "./NotificationMedia/index.js";
|
|
9
|
+
import { NotificationContainer as _, LogoImgContainer as h, LogoImg as E, NotificationContent as b, MainContent as z, StyledChevronRight as G, TVButtons as J, Body as K, Title as X, Description as Y, DismissButton as Z, AnswerButton as $, NotificationInterstitialContainer as q } from "./styles.js";
|
|
10
|
+
const g = ({ title: a, questionType: c, questionTypeData: e, description: o, imageMode: t, webos: n }) => /* @__PURE__ */ u(K, { imageMode: t, questionType: c, webos: n, children: [
|
|
10
11
|
/* @__PURE__ */ r(
|
|
11
|
-
|
|
12
|
+
H,
|
|
12
13
|
{
|
|
13
14
|
questionTypeData: e,
|
|
14
15
|
questionType: c,
|
|
15
|
-
questionStatus:
|
|
16
|
+
questionStatus: P.UNSET
|
|
16
17
|
}
|
|
17
18
|
),
|
|
18
|
-
a && /* @__PURE__ */ r(
|
|
19
|
-
o && /* @__PURE__ */ r(
|
|
20
|
-
] }),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
a && /* @__PURE__ */ r(X, { webos: n, children: a }),
|
|
20
|
+
o && /* @__PURE__ */ r(Y, { children: o })
|
|
21
|
+
] }), A = D(q), p = D(Z), oo = D($), to = ({
|
|
22
|
+
className: a,
|
|
23
|
+
sponsorLogo: c,
|
|
24
|
+
onClick: e,
|
|
25
|
+
webos: o
|
|
26
|
+
}) => /* @__PURE__ */ r(
|
|
27
|
+
A,
|
|
28
|
+
{
|
|
29
|
+
className: a,
|
|
30
|
+
autoFocus: !0,
|
|
31
|
+
webos: o,
|
|
32
|
+
onClick: e,
|
|
33
|
+
"data-webos": o,
|
|
34
|
+
children: /* @__PURE__ */ r(b, { withoutPadding: !0, children: /* @__PURE__ */ r(E, { src: c }) })
|
|
35
|
+
}
|
|
36
|
+
), io = ({
|
|
25
37
|
action: a,
|
|
26
38
|
close: c,
|
|
27
39
|
questionType: e,
|
|
28
40
|
inApp: o,
|
|
29
41
|
insight: t,
|
|
30
42
|
color: n,
|
|
31
|
-
webos: s
|
|
43
|
+
webos: s,
|
|
44
|
+
className: L
|
|
32
45
|
}) => {
|
|
33
|
-
var
|
|
34
|
-
const [
|
|
35
|
-
|
|
46
|
+
var B, F, w;
|
|
47
|
+
const [v, m] = R(!1), N = W();
|
|
48
|
+
j(() => (o != null && o.sponsorLogo && (m(!0), N.current = setTimeout(() => {
|
|
36
49
|
m(!1);
|
|
37
|
-
}, 5e3)), () => clearTimeout(
|
|
38
|
-
const
|
|
39
|
-
if (!
|
|
50
|
+
}, 5e3)), () => clearTimeout(N.current)), [o == null ? void 0 : o.sponsorLogo]);
|
|
51
|
+
const T = y[e];
|
|
52
|
+
if (!T || !o || !o.notification)
|
|
40
53
|
return null;
|
|
41
|
-
const { title:
|
|
42
|
-
return o != null && o.sponsorLogo &&
|
|
43
|
-
|
|
54
|
+
const { title: M, image: U, imageMode: i, useContentMedia: f } = o.notification, V = e === l.FACTOID ? t == null ? void 0 : t.heading : M, k = e === l.FACTOID ? t == null ? void 0 : t.body : "", x = U, C = e === l.FACTOID && ((B = t == null ? void 0 : t.video) == null ? void 0 : B.url) && (o == null ? void 0 : o.isVideo) && f === O.ENABLED, I = f === O.ENABLED ? C ? (F = t == null ? void 0 : t.video) == null ? void 0 : F.url : t == null ? void 0 : t.image : "";
|
|
55
|
+
return o != null && o.sponsorLogo && v ? /* @__PURE__ */ r(
|
|
56
|
+
to,
|
|
44
57
|
{
|
|
58
|
+
className: L,
|
|
45
59
|
sponsorLogo: o == null ? void 0 : o.sponsorLogo,
|
|
46
60
|
webos: s,
|
|
47
61
|
onClick: () => m(!1)
|
|
48
62
|
}
|
|
49
63
|
) : /* @__PURE__ */ u(
|
|
50
|
-
|
|
64
|
+
_,
|
|
51
65
|
{
|
|
52
66
|
"data-a": "intr",
|
|
53
|
-
className: "SL_InApp",
|
|
54
|
-
onClick: (
|
|
55
|
-
s || a == null || a(
|
|
67
|
+
className: Q("SL_InApp", L),
|
|
68
|
+
onClick: (d) => {
|
|
69
|
+
s || a == null || a(d);
|
|
56
70
|
},
|
|
57
|
-
"data-is-insight": e ===
|
|
71
|
+
"data-is-insight": e === l.FACTOID,
|
|
58
72
|
"data-webos": s,
|
|
59
73
|
children: [
|
|
60
|
-
(o == null ? void 0 : o.sponsorLogo) && /* @__PURE__ */ r(
|
|
61
|
-
/* @__PURE__ */ u(
|
|
62
|
-
/* @__PURE__ */ u(
|
|
63
|
-
!I && /* @__PURE__ */ r(
|
|
74
|
+
(o == null ? void 0 : o.sponsorLogo) && /* @__PURE__ */ r(h, { children: /* @__PURE__ */ r(E, { src: o == null ? void 0 : o.sponsorLogo }) }),
|
|
75
|
+
/* @__PURE__ */ u(b, { children: [
|
|
76
|
+
/* @__PURE__ */ u(z, { children: [
|
|
77
|
+
!I && /* @__PURE__ */ r(S, { src: x, imageMode: i, withVideo: !!C, color: n }),
|
|
64
78
|
I && /* @__PURE__ */ r(
|
|
65
|
-
|
|
79
|
+
S,
|
|
66
80
|
{
|
|
67
81
|
src: I,
|
|
68
82
|
imageMode: i,
|
|
69
83
|
withVideo: !!C,
|
|
70
84
|
color: n,
|
|
71
85
|
useContentMedia: f,
|
|
72
|
-
thumbnailUrl: (
|
|
86
|
+
thumbnailUrl: (w = t == null ? void 0 : t.video) == null ? void 0 : w.thumbnailUrl
|
|
73
87
|
}
|
|
74
88
|
),
|
|
75
89
|
/* @__PURE__ */ r(
|
|
76
|
-
|
|
90
|
+
g,
|
|
77
91
|
{
|
|
78
|
-
questionTypeData:
|
|
92
|
+
questionTypeData: T,
|
|
79
93
|
questionType: e,
|
|
80
|
-
title:
|
|
81
|
-
description:
|
|
94
|
+
title: V,
|
|
95
|
+
description: k,
|
|
82
96
|
imageMode: i,
|
|
83
97
|
webos: s
|
|
84
98
|
}
|
|
85
99
|
)
|
|
86
100
|
] }),
|
|
87
|
-
!s && /* @__PURE__ */ r(
|
|
88
|
-
s && /* @__PURE__ */ u(
|
|
101
|
+
!s && /* @__PURE__ */ r(G, { name: "chevronRight" }),
|
|
102
|
+
s && /* @__PURE__ */ u(J, { children: [
|
|
89
103
|
/* @__PURE__ */ r(
|
|
90
|
-
|
|
104
|
+
p,
|
|
91
105
|
{
|
|
92
106
|
webos: !0,
|
|
93
107
|
"data-close-btn": "true",
|
|
94
|
-
onClick: (
|
|
95
|
-
|
|
108
|
+
onClick: (d) => {
|
|
109
|
+
d.stopPropagation(), c == null || c(d);
|
|
96
110
|
},
|
|
97
111
|
children: "Dismiss"
|
|
98
112
|
}
|
|
99
113
|
),
|
|
100
|
-
/* @__PURE__ */ r(
|
|
114
|
+
/* @__PURE__ */ r(oo, { webos: !0, autoFocus: !0, onClick: a, children: "Answer" })
|
|
101
115
|
] })
|
|
102
116
|
] })
|
|
103
117
|
]
|
|
@@ -105,5 +119,5 @@ const $ = ({ title: a, questionType: c, questionTypeData: e, description: o, ima
|
|
|
105
119
|
);
|
|
106
120
|
};
|
|
107
121
|
export {
|
|
108
|
-
|
|
122
|
+
io as InAppNotification
|
|
109
123
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { PredictionResult as
|
|
3
|
-
import { NotificationContainer as
|
|
4
|
-
const
|
|
2
|
+
import { PredictionResult as i } from "./frames/index.js";
|
|
3
|
+
import { NotificationContainer as n } from "./styles.js";
|
|
4
|
+
const c = ({ className: r, ...t }) => /* @__PURE__ */ o(n, { className: r, children: /* @__PURE__ */ o(i, { ...t }) });
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
c as InAppPredictionResult
|
|
7
7
|
};
|
|
@@ -3,6 +3,7 @@ type InAppProps = NotificationProps['data'] & {
|
|
|
3
3
|
action: NotificationProps['action'];
|
|
4
4
|
};
|
|
5
5
|
export declare const InAppPredictionResultAd: React.FC<Exclude<InAppProps['question'], undefined> & {
|
|
6
|
+
className?: string;
|
|
6
7
|
action?: () => void;
|
|
7
8
|
close?: () => void;
|
|
8
9
|
inApp?: InAppProps['inApp'];
|
|
@@ -1,20 +1,31 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { PredictionResult as
|
|
4
|
-
import { NotificationContainer as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
(
|
|
15
|
-
|
|
1
|
+
import { jsx as o, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { useState as s, useRef as h, useEffect as L } from "react";
|
|
3
|
+
import { PredictionResult as A } from "./frames/index.js";
|
|
4
|
+
import { NotificationContainer as I, LogoImgContainer as C, LogoImg as g, NotificationInterstitialContainer as w, NotificationContent as x } from "./styles.js";
|
|
5
|
+
const N = ({
|
|
6
|
+
className: t,
|
|
7
|
+
sponsorLogo: r,
|
|
8
|
+
onClick: i
|
|
9
|
+
}) => /* @__PURE__ */ o(w, { className: t, onClick: i, children: /* @__PURE__ */ o(x, { withoutPadding: !0, children: /* @__PURE__ */ o(g, { src: r }) }) }), S = ({ className: t, ...r }) => {
|
|
10
|
+
var c, e, a, f, l;
|
|
11
|
+
const [i, p] = s(!1), n = h();
|
|
12
|
+
return L(() => {
|
|
13
|
+
var d;
|
|
14
|
+
return (d = r == null ? void 0 : r.inApp) != null && d.sponsorLogo && (p(!0), n.current = setTimeout(() => {
|
|
15
|
+
p(!1);
|
|
16
|
+
}, 5e3)), () => clearTimeout(n.current);
|
|
17
|
+
}, [(c = r == null ? void 0 : r.inApp) == null ? void 0 : c.sponsorLogo]), (e = r == null ? void 0 : r.inApp) != null && e.sponsorLogo && i ? /* @__PURE__ */ o(
|
|
18
|
+
N,
|
|
19
|
+
{
|
|
20
|
+
className: t,
|
|
21
|
+
sponsorLogo: (a = r.inApp) == null ? void 0 : a.sponsorLogo,
|
|
22
|
+
onClick: () => p(!1)
|
|
23
|
+
}
|
|
24
|
+
) : /* @__PURE__ */ o(I, { className: t, children: /* @__PURE__ */ m("div", { children: [
|
|
25
|
+
((f = r == null ? void 0 : r.inApp) == null ? void 0 : f.sponsorLogo) && /* @__PURE__ */ o(C, { children: /* @__PURE__ */ o(g, { src: (l = r == null ? void 0 : r.inApp) == null ? void 0 : l.sponsorLogo }) }),
|
|
26
|
+
/* @__PURE__ */ o(A, { ...r })
|
|
16
27
|
] }) });
|
|
17
28
|
};
|
|
18
29
|
export {
|
|
19
|
-
|
|
30
|
+
S as InAppPredictionResultAd
|
|
20
31
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsxs as b, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { InsightContentTV as e } from "../../../../app/webos/ui/insight/index.js";
|
|
3
3
|
import { InsightContent as m } from "../../../questions/insight/index.js";
|
|
4
|
-
import { Container as k, WebLinkBtn as h, WebLinkIcon as
|
|
5
|
-
const
|
|
6
|
-
o.
|
|
4
|
+
import { Container as k, WebLinkBtn as h, WebLinkIcon as L } from "./styles.js";
|
|
5
|
+
const u = ({ instantView: r, ...o }) => /* @__PURE__ */ b(k, { children: [
|
|
6
|
+
o.SL - CardWebOs ? /* @__PURE__ */ l(e, { instantView: r, ...o, isDetail: !0 }) : /* @__PURE__ */ l(m, { instantView: r, ...o, isDetail: !0 }),
|
|
7
7
|
(r == null ? void 0 : r.webLink) && /* @__PURE__ */ b(h, { href: r == null ? void 0 : r.webLink.url, target: "_blank", "data-a": "web-link", children: [
|
|
8
8
|
r == null ? void 0 : r.webLink.label,
|
|
9
|
-
/* @__PURE__ */ l(
|
|
9
|
+
/* @__PURE__ */ l(L, { name: "icon-external-link" })
|
|
10
10
|
] })
|
|
11
11
|
] });
|
|
12
12
|
export {
|
|
13
|
-
|
|
13
|
+
u as InsightDetails
|
|
14
14
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type PolymarketCardProps = {
|
|
2
|
+
logo: string;
|
|
3
|
+
volume: number;
|
|
4
|
+
drawProbabilityPct: number;
|
|
5
|
+
teams: {
|
|
6
|
+
teamName: string;
|
|
7
|
+
probabilityPct: number;
|
|
8
|
+
teamColor: string;
|
|
9
|
+
teamLogo: string;
|
|
10
|
+
}[];
|
|
11
|
+
drawColor: string;
|
|
12
|
+
chartData: {
|
|
13
|
+
label: string;
|
|
14
|
+
color: string;
|
|
15
|
+
points: Array<{
|
|
16
|
+
t: string;
|
|
17
|
+
p: number;
|
|
18
|
+
}>;
|
|
19
|
+
}[];
|
|
20
|
+
};
|
|
21
|
+
export declare const PolymarketCard: React.FC<PolymarketCardProps>;
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { jsxs as m, jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { createChart as M, ColorType as U, LineStyle as k, LineSeries as H } from "lightweight-charts";
|
|
3
|
+
import { useRef as P, useEffect as z } from "react";
|
|
4
|
+
import { Container as R, Header as F, Logo as q, AdTitle as W, Vol as A, Teams as B, Team as I, TeamLogo as j, TeamName as D, TeamPercentage as N, Draw as O, DrawPercentage as Z, Chart as G } from "./styles.js";
|
|
5
|
+
const J = (c) => `${(c / 1e3).toFixed(1)}`, V = (c) => c && !c.startsWith("#") ? `#${c}` : c ?? "#fff", _ = ({
|
|
6
|
+
logo: c,
|
|
7
|
+
volume: S,
|
|
8
|
+
drawProbabilityPct: E,
|
|
9
|
+
teams: f,
|
|
10
|
+
drawColor: v,
|
|
11
|
+
chartData: n
|
|
12
|
+
}) => {
|
|
13
|
+
var w;
|
|
14
|
+
const C = P(null);
|
|
15
|
+
return z(() => {
|
|
16
|
+
var x;
|
|
17
|
+
const a = C.current;
|
|
18
|
+
if (!a || !n || n.length === 0)
|
|
19
|
+
return;
|
|
20
|
+
let u = 0;
|
|
21
|
+
n.forEach((t) => {
|
|
22
|
+
t.points.forEach((e) => {
|
|
23
|
+
const o = e.p * 100;
|
|
24
|
+
o > u && (u = o);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
const y = Math.floor(u / 10) * 10, b = 0, d = ((x = n[0]) == null ? void 0 : x.points) || [];
|
|
28
|
+
let l = "day";
|
|
29
|
+
if (d.length >= 2) {
|
|
30
|
+
const t = new Date(d[0].t).getTime() / 1e3, o = new Date(d[1].t).getTime() / 1e3 - t;
|
|
31
|
+
o >= 20 * 60 * 60 ? l = "day" : o >= 60 * 60 ? l = "hour" : l = "minute";
|
|
32
|
+
}
|
|
33
|
+
const h = M(a, {
|
|
34
|
+
layout: {
|
|
35
|
+
background: { type: U.Solid, color: "transparent" },
|
|
36
|
+
textColor: "rgba(255, 255, 255, 0.5)",
|
|
37
|
+
fontSize: 12
|
|
38
|
+
},
|
|
39
|
+
grid: {
|
|
40
|
+
vertLines: { visible: !1 },
|
|
41
|
+
horzLines: {
|
|
42
|
+
color: "rgba(255, 255, 255, 0.2)",
|
|
43
|
+
style: k.Dashed
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
crosshair: {
|
|
47
|
+
mode: 0,
|
|
48
|
+
vertLine: {
|
|
49
|
+
visible: !1,
|
|
50
|
+
labelVisible: !1
|
|
51
|
+
},
|
|
52
|
+
horzLine: {
|
|
53
|
+
visible: !1,
|
|
54
|
+
labelVisible: !1
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
width: a.clientWidth,
|
|
58
|
+
handleScroll: !1,
|
|
59
|
+
handleScale: !1,
|
|
60
|
+
height: 300,
|
|
61
|
+
localization: {
|
|
62
|
+
timeFormatter: (t) => {
|
|
63
|
+
const e = new Date(t * 1e3);
|
|
64
|
+
if (l === "day") {
|
|
65
|
+
const o = e.getUTCDate(), i = e.toLocaleDateString("en-US", { month: "short", timeZone: "UTC" });
|
|
66
|
+
return `${o} ${i}`;
|
|
67
|
+
} else {
|
|
68
|
+
if (l === "hour")
|
|
69
|
+
return `${e.getUTCHours()}h`;
|
|
70
|
+
{
|
|
71
|
+
const o = e.getUTCHours(), i = e.getUTCMinutes(), s = o >= 12 ? "pm" : "am";
|
|
72
|
+
return `${o % 12 || 12}:${i.toString().padStart(2, "0")}${s}`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
timeScale: {
|
|
78
|
+
timeVisible: !0,
|
|
79
|
+
secondsVisible: !1,
|
|
80
|
+
barSpacing: 30,
|
|
81
|
+
minBarSpacing: 8,
|
|
82
|
+
rightOffset: 15,
|
|
83
|
+
allowBoldLabels: !1,
|
|
84
|
+
borderColor: "rgba(255, 255, 255, 0.5)",
|
|
85
|
+
fixLeftEdge: !0,
|
|
86
|
+
fixRightEdge: !0,
|
|
87
|
+
tickMarkFormatter: (t) => {
|
|
88
|
+
const e = new Date(t * 1e3);
|
|
89
|
+
if (!d.slice(-4).map((i) => Math.floor(new Date(i.t).getTime() / 1e3)).includes(t))
|
|
90
|
+
return "";
|
|
91
|
+
if (l === "day") {
|
|
92
|
+
const i = e.getUTCDate(), s = e.toLocaleDateString("en-US", { month: "short", timeZone: "UTC" });
|
|
93
|
+
return `${i} ${s}`;
|
|
94
|
+
} else {
|
|
95
|
+
if (l === "hour")
|
|
96
|
+
return `${e.getUTCHours()}h`;
|
|
97
|
+
{
|
|
98
|
+
const i = e.getUTCHours(), s = e.getUTCMinutes(), r = i >= 12 ? "pm" : "am";
|
|
99
|
+
return `${i % 12 || 12}:${s.toString().padStart(2, "0")}${r}`;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
rightPriceScale: {
|
|
105
|
+
visible: !0,
|
|
106
|
+
borderVisible: !1,
|
|
107
|
+
autoScale: !1
|
|
108
|
+
},
|
|
109
|
+
leftPriceScale: {
|
|
110
|
+
visible: !1
|
|
111
|
+
}
|
|
112
|
+
}), $ = [];
|
|
113
|
+
if (n.forEach((t) => {
|
|
114
|
+
var s;
|
|
115
|
+
const e = h.addSeries(H, {
|
|
116
|
+
color: t.color,
|
|
117
|
+
lineWidth: 4,
|
|
118
|
+
lastValueVisible: !1,
|
|
119
|
+
priceLineVisible: !1,
|
|
120
|
+
priceFormat: {
|
|
121
|
+
type: "custom",
|
|
122
|
+
formatter: (r) => `${Math.round(r)}%`
|
|
123
|
+
},
|
|
124
|
+
autoscaleInfoProvider: () => ({
|
|
125
|
+
priceRange: {
|
|
126
|
+
minValue: b,
|
|
127
|
+
maxValue: y
|
|
128
|
+
}
|
|
129
|
+
})
|
|
130
|
+
}), o = (s = t.points) == null ? void 0 : s.map((r) => ({
|
|
131
|
+
time: Math.floor(new Date(r.t).getTime() / 1e3),
|
|
132
|
+
value: r.p * 100
|
|
133
|
+
})), i = o == null ? void 0 : o.filter(
|
|
134
|
+
(r, p, T) => p === 0 || r.time !== T[p - 1].time
|
|
135
|
+
);
|
|
136
|
+
e.setData(i), i.length > 0 && $.push({
|
|
137
|
+
series: e,
|
|
138
|
+
lastPoint: i[i.length - 1],
|
|
139
|
+
color: t.color
|
|
140
|
+
});
|
|
141
|
+
}), d.length >= 4) {
|
|
142
|
+
const t = d.slice(-4), e = Math.floor(new Date(t[0].t).getTime() / 1e3), o = Math.floor(new Date(t[3].t).getTime() / 1e3), i = o - e, s = i * 0.02, r = i * 0.03;
|
|
143
|
+
h.timeScale().setVisibleRange({
|
|
144
|
+
from: e - s,
|
|
145
|
+
to: o + r
|
|
146
|
+
});
|
|
147
|
+
} else
|
|
148
|
+
h.timeScale().fitContent();
|
|
149
|
+
setTimeout(() => {
|
|
150
|
+
const t = a.querySelector(".tv-lightweight-charts");
|
|
151
|
+
if (!t)
|
|
152
|
+
return;
|
|
153
|
+
t.style.position = "relative";
|
|
154
|
+
const e = t.querySelector("table");
|
|
155
|
+
e && (e.style.position = "relative", e.style.zIndex = "1", e.style.pointerEvents = "none"), $.forEach(({ series: o, lastPoint: i, color: s }) => {
|
|
156
|
+
const r = o.priceToCoordinate(i.value), p = h.timeScale().timeToCoordinate(i.time);
|
|
157
|
+
if (r !== null && p !== null) {
|
|
158
|
+
const T = document.createElement("div");
|
|
159
|
+
T.style.cssText = `
|
|
160
|
+
position: absolute !important;
|
|
161
|
+
width: 40px !important;
|
|
162
|
+
height: 40px !important;
|
|
163
|
+
border-radius: 50% !important;
|
|
164
|
+
background-color: ${s} !important;
|
|
165
|
+
border: 10px solid rgba(26, 26, 26, 0.75) !important;
|
|
166
|
+
left: ${p - 20}px !important;
|
|
167
|
+
top: ${r - 20}px !important;
|
|
168
|
+
pointer-events: none !important;
|
|
169
|
+
display: block !important;
|
|
170
|
+
visibility: visible !important;
|
|
171
|
+
opacity: 1 !important;
|
|
172
|
+
`, T.className = "chart-endpoint-marker", t.appendChild(T);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}, 100);
|
|
176
|
+
const L = () => {
|
|
177
|
+
a && h.applyOptions({ width: a.clientWidth });
|
|
178
|
+
};
|
|
179
|
+
return window.addEventListener("resize", L), () => {
|
|
180
|
+
window.removeEventListener("resize", L);
|
|
181
|
+
const t = a.querySelector(".tv-lightweight-charts");
|
|
182
|
+
t && t.querySelectorAll(".chart-endpoint-marker").forEach((o) => o.remove()), h.remove();
|
|
183
|
+
};
|
|
184
|
+
}, [n]), /* @__PURE__ */ m(R, { children: [
|
|
185
|
+
/* @__PURE__ */ m(F, { children: [
|
|
186
|
+
/* @__PURE__ */ g(q, { src: c }),
|
|
187
|
+
/* @__PURE__ */ g(W, { children: "Ad" })
|
|
188
|
+
] }),
|
|
189
|
+
/* @__PURE__ */ m(A, { children: [
|
|
190
|
+
"$",
|
|
191
|
+
J(S),
|
|
192
|
+
"k Vol."
|
|
193
|
+
] }),
|
|
194
|
+
/* @__PURE__ */ g(B, { children: f == null ? void 0 : f.map(({ teamLogo: a, teamName: u, probabilityPct: y, teamColor: b }, d) => {
|
|
195
|
+
var l;
|
|
196
|
+
return /* @__PURE__ */ m(I, { children: [
|
|
197
|
+
/* @__PURE__ */ g(j, { src: a }),
|
|
198
|
+
/* @__PURE__ */ g(D, { children: u }),
|
|
199
|
+
/* @__PURE__ */ m(N, { style: { color: b ? V(b) : ((l = n == null ? void 0 : n[d]) == null ? void 0 : l.color) ?? "#fff" }, children: [
|
|
200
|
+
Math.round(y),
|
|
201
|
+
"%"
|
|
202
|
+
] })
|
|
203
|
+
] }, u);
|
|
204
|
+
}) }),
|
|
205
|
+
/* @__PURE__ */ m(O, { children: [
|
|
206
|
+
"Draw",
|
|
207
|
+
" ",
|
|
208
|
+
/* @__PURE__ */ m(
|
|
209
|
+
Z,
|
|
210
|
+
{
|
|
211
|
+
style: {
|
|
212
|
+
color: v ? V(v) : ((w = n == null ? void 0 : n[(f == null ? void 0 : f.length) ?? 0]) == null ? void 0 : w.color) ?? "#fff"
|
|
213
|
+
},
|
|
214
|
+
children: [
|
|
215
|
+
Math.round(E),
|
|
216
|
+
"%"
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
] }),
|
|
221
|
+
/* @__PURE__ */ g(G, { ref: C })
|
|
222
|
+
] });
|
|
223
|
+
};
|
|
224
|
+
export {
|
|
225
|
+
_ as PolymarketCard
|
|
226
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const Container: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
2
|
+
export declare const Header: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
3
|
+
export declare const Logo: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLImageElement> & import('react').ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown>>;
|
|
4
|
+
export declare const AdTitle: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLSpanElement> & import('react').HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
|
|
5
|
+
export declare const Vol: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
6
|
+
export declare const Teams: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
7
|
+
export declare const Team: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
8
|
+
export declare const TeamLogo: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLImageElement> & import('react').ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown>>;
|
|
9
|
+
export declare const TeamName: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLSpanElement> & import('react').HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
|
|
10
|
+
export declare const TeamPercentage: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLSpanElement> & import('react').HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
|
|
11
|
+
export declare const Draw: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
12
|
+
export declare const DrawPercentage: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLSpanElement> & import('react').HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
|
|
13
|
+
export declare const Chart: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|