@streamlayer/react-ui 0.96.1 → 0.96.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.
- package/lib/ui/gamification/question/insight/index.js +16 -11
- package/lib/ui/gamification/question/notification/index.js +21 -21
- package/lib/ui/gamification/question/twitter/index.js +18 -13
- package/lib/ui/video-player/index.d.ts +1 -0
- package/lib/ui/video-player/index.js +44 -37
- package/lib/utils/createDemo.js +6 -1
- package/package.json +9 -9
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { InsightContent as
|
|
3
|
-
import {
|
|
1
|
+
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { InsightContent as p } from "../../../questions/insight/index.js";
|
|
3
|
+
import { pauseAllVideos as l } from "../../../video-player/index.js";
|
|
4
|
+
import { Container as n, ActionBtn as e } from "./styles.js";
|
|
4
5
|
import "@streamlayer/sdk-web-types";
|
|
5
|
-
import "../../../
|
|
6
|
+
import "../../../questions/insight/styles.js";
|
|
7
|
+
import "@linaria/react";
|
|
6
8
|
import "react";
|
|
7
9
|
import "../../../icons/index.js";
|
|
8
|
-
import "@linaria/react";
|
|
9
10
|
import "../../../video-player/styles.js";
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const k = ({ openInsight: r, questionId: o, ...i }) => {
|
|
12
|
+
const m = () => {
|
|
13
|
+
l(), r == null || r(o);
|
|
14
|
+
};
|
|
15
|
+
return /* @__PURE__ */ c(n, { children: [
|
|
16
|
+
/* @__PURE__ */ t(p, { questionId: o, ...i }),
|
|
17
|
+
r && /* @__PURE__ */ t(e, { onClick: m, children: "View Insight" })
|
|
18
|
+
] });
|
|
19
|
+
};
|
|
15
20
|
export {
|
|
16
|
-
|
|
21
|
+
k as Insight
|
|
17
22
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsxs as a, jsx as
|
|
2
|
-
import { QuestionType as
|
|
1
|
+
import { jsxs as a, jsx as t, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
import { QuestionType as o } from "@streamlayer/sdk-web-types";
|
|
3
3
|
import { QuestionTypeData as T } from "../../constants.js";
|
|
4
4
|
import { Insight as f } from "./insight/index.js";
|
|
5
5
|
import { Container as h, CloseIconWrap as E, CloseIcon as I, Header as C, TypeIcon as s, TypeName as A, Question as W, AnswerButton as x } from "./styles.js";
|
|
@@ -16,37 +16,37 @@ import "../../../../utils/common.js";
|
|
|
16
16
|
import "../../../questions/twitter/account/styles.js";
|
|
17
17
|
import "../../../questions/twitter/styles.js";
|
|
18
18
|
import "./tweet/styles.js";
|
|
19
|
-
const
|
|
20
|
-
close:
|
|
21
|
-
action:
|
|
22
|
-
controlVideo:
|
|
23
|
-
data: { questionType: r, question:
|
|
19
|
+
const J = ({
|
|
20
|
+
close: l,
|
|
21
|
+
action: m,
|
|
22
|
+
controlVideo: n,
|
|
23
|
+
data: { questionType: r, question: i, insight: e, tweet: c }
|
|
24
24
|
}) => {
|
|
25
25
|
const p = T[r];
|
|
26
|
-
return p ? /* @__PURE__ */ a(h, { style: r ===
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
r !==
|
|
29
|
-
/* @__PURE__ */
|
|
26
|
+
return p ? /* @__PURE__ */ a(h, { style: r === o.TWEET ? { paddingTop: "12px" } : {}, children: [
|
|
27
|
+
/* @__PURE__ */ t(E, { onClick: l, children: /* @__PURE__ */ t(I, { name: "icon-cross" }) }),
|
|
28
|
+
r !== o.TWEET && /* @__PURE__ */ a(C, { children: [
|
|
29
|
+
/* @__PURE__ */ t(
|
|
30
30
|
s,
|
|
31
31
|
{
|
|
32
|
-
"data-type-trivia": r ===
|
|
33
|
-
"data-type-poll": r ===
|
|
32
|
+
"data-type-trivia": r === o.TRIVIA,
|
|
33
|
+
"data-type-poll": r === o.POLL,
|
|
34
34
|
name: p.iconName
|
|
35
35
|
}
|
|
36
36
|
),
|
|
37
|
-
/* @__PURE__ */
|
|
37
|
+
/* @__PURE__ */ t(A, { children: p.label })
|
|
38
38
|
] }),
|
|
39
|
-
r ===
|
|
40
|
-
r ===
|
|
39
|
+
r === o.FACTOID && /* @__PURE__ */ t(f, { ...e, action: m, controlVideo: n }),
|
|
40
|
+
r === o.TWEET && // ToDo: connect with real Api data
|
|
41
41
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
42
42
|
// @ts-ignore
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
r !==
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ t(D, { ...c, action: m, controlVideo: n }),
|
|
44
|
+
r !== o.FACTOID && r !== o.TWEET && /* @__PURE__ */ a(d, { children: [
|
|
45
|
+
/* @__PURE__ */ t(W, { children: i == null ? void 0 : i.title }),
|
|
46
|
+
/* @__PURE__ */ t(x, { onClick: m, children: "Answer" })
|
|
47
47
|
] })
|
|
48
48
|
] }) : null;
|
|
49
49
|
};
|
|
50
50
|
export {
|
|
51
|
-
|
|
51
|
+
J as Notification
|
|
52
52
|
};
|
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { TwitterContent as
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
1
|
+
import { jsxs as m, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { TwitterContent as n } from "../../../questions/twitter/index.js";
|
|
3
|
+
import { pauseAllVideos as l } from "../../../video-player/index.js";
|
|
4
|
+
import { Container as c, Quote as d, ActionButton as h } from "./styles.js";
|
|
5
|
+
import "../../../questions/twitter/account/index.js";
|
|
6
6
|
import "../../../icons/index.js";
|
|
7
7
|
import "@linaria/react";
|
|
8
|
-
import "
|
|
9
|
-
import "../../../questions/twitter/account/index.js";
|
|
8
|
+
import "react";
|
|
10
9
|
import "../../../../utils/common.js";
|
|
11
10
|
import "../../../questions/twitter/account/styles.js";
|
|
12
11
|
import "../../../questions/twitter/styles.js";
|
|
12
|
+
import "../../../video-player/styles.js";
|
|
13
13
|
import "../../../button/index.js";
|
|
14
14
|
import "../../../button/styles.js";
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const B = ({ openTweet: t, ...i }) => {
|
|
16
|
+
const o = () => {
|
|
17
|
+
l(), t == null || t(i.tweetId);
|
|
18
|
+
};
|
|
19
|
+
return /* @__PURE__ */ m(c, { children: [
|
|
20
|
+
i.title && /* @__PURE__ */ r(d, { children: i.title }),
|
|
21
|
+
/* @__PURE__ */ r(n, { ...i }),
|
|
22
|
+
t && /* @__PURE__ */ r(h, { onClick: o, children: "View Insight" })
|
|
23
|
+
] });
|
|
24
|
+
};
|
|
20
25
|
export {
|
|
21
|
-
|
|
26
|
+
B as Twitter
|
|
22
27
|
};
|
|
@@ -1,62 +1,69 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
1
|
+
import { jsxs as w, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as C, useState as v, useCallback as p, useEffect as d } from "react";
|
|
3
3
|
import { SvgIcon as E } from "../icons/index.js";
|
|
4
|
-
import { Container as I, Player as S, Poster as x, Control as
|
|
4
|
+
import { Container as I, Player as S, Poster as x, Control as L } from "./styles.js";
|
|
5
5
|
import "@linaria/react";
|
|
6
|
-
const
|
|
7
|
-
for (const
|
|
8
|
-
|
|
9
|
-
}, g = new IntersectionObserver(
|
|
10
|
-
g.observe(
|
|
11
|
-
},
|
|
12
|
-
g.unobserve(
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
s
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
const T = (s, c) => {
|
|
7
|
+
for (const t of s)
|
|
8
|
+
t.isIntersecting || t.target instanceof HTMLVideoElement && !t.target.paused && (c.unobserve(t.target), t.target.pause());
|
|
9
|
+
}, g = new IntersectionObserver(T, { threshold: 0.5 }), f = /* @__PURE__ */ new Set(), j = (s) => {
|
|
10
|
+
g.observe(s), f.add(s);
|
|
11
|
+
}, n = (s) => {
|
|
12
|
+
g.unobserve(s), f.delete(s);
|
|
13
|
+
}, k = () => {
|
|
14
|
+
for (const s of f)
|
|
15
|
+
s instanceof HTMLVideoElement && !s.paused && (s.pause(), n(s));
|
|
16
|
+
}, z = ({ poster: s, source: c, controlVideo: t }) => {
|
|
17
|
+
const e = C(null), [l, o] = v(!1), [b, m] = v(!0), y = p(() => {
|
|
18
|
+
t == null || t({ muted: !0 });
|
|
19
|
+
}, [t]), u = p(() => {
|
|
20
|
+
t == null || t({ muted: !1 });
|
|
21
|
+
}, [t]), P = () => {
|
|
22
|
+
const r = e == null ? void 0 : e.current;
|
|
23
|
+
if (r)
|
|
21
24
|
if (l)
|
|
22
|
-
|
|
25
|
+
r.pause(), e.current && n(e.current);
|
|
23
26
|
else {
|
|
24
|
-
const
|
|
25
|
-
if (!
|
|
27
|
+
const a = e == null ? void 0 : e.current;
|
|
28
|
+
if (!a)
|
|
26
29
|
return;
|
|
27
|
-
|
|
28
|
-
r !== i && r instanceof HTMLVideoElement && !r.paused && (r.pause(), u(r));
|
|
29
|
-
T(i), i.play().catch((r) => console.log(r)), m(!1);
|
|
30
|
+
k(), j(a), a.play().catch((O) => console.log(O)), m(!1);
|
|
30
31
|
}
|
|
31
|
-
},
|
|
32
|
-
var
|
|
33
|
-
e.current &&
|
|
32
|
+
}, h = () => {
|
|
33
|
+
var r;
|
|
34
|
+
e.current && n(e.current), (r = e == null ? void 0 : e.current) == null || r.load(), m(!0);
|
|
34
35
|
};
|
|
35
|
-
return
|
|
36
|
-
e.current &&
|
|
37
|
-
}, []),
|
|
38
|
-
|
|
36
|
+
return d(() => {
|
|
37
|
+
e.current && n(e.current);
|
|
38
|
+
}, []), d(() => {
|
|
39
|
+
const r = e == null ? void 0 : e.current;
|
|
40
|
+
return () => {
|
|
41
|
+
r && (r.paused || u(), n(r));
|
|
42
|
+
};
|
|
43
|
+
}, [u]), /* @__PURE__ */ w(I, { onClick: P, children: [
|
|
44
|
+
/* @__PURE__ */ i(
|
|
39
45
|
S,
|
|
40
46
|
{
|
|
41
47
|
ref: e,
|
|
42
48
|
src: c,
|
|
43
49
|
onPlay: () => {
|
|
44
|
-
|
|
50
|
+
y(), o(!0);
|
|
45
51
|
},
|
|
46
52
|
onPause: () => {
|
|
47
|
-
|
|
53
|
+
u(), o(!1);
|
|
48
54
|
},
|
|
49
55
|
onEnded: () => {
|
|
50
|
-
|
|
56
|
+
u(), o(!1), h();
|
|
51
57
|
},
|
|
52
58
|
style: { visibility: b ? "hidden" : "visible" },
|
|
53
59
|
playsInline: !0
|
|
54
60
|
}
|
|
55
61
|
),
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ i(x, { src: s, style: { visibility: b ? "visible" : "hidden" } }),
|
|
63
|
+
/* @__PURE__ */ i(L, { children: !l && /* @__PURE__ */ i(E, { name: "icon-play" }) })
|
|
58
64
|
] });
|
|
59
65
|
};
|
|
60
66
|
export {
|
|
61
|
-
|
|
67
|
+
z as VideoPlayer,
|
|
68
|
+
k as pauseAllVideos
|
|
62
69
|
};
|
package/lib/utils/createDemo.js
CHANGED
|
@@ -23,7 +23,12 @@ function K({
|
|
|
23
23
|
const s = u(() => new x(), []), [p, f] = i(s.getEnv()), [c, v] = i(s.getSdkKey() || "set-sdk-key"), [m, k] = i(s.getEvent() || ""), S = u(() => {
|
|
24
24
|
const d = /* @__PURE__ */ new Set();
|
|
25
25
|
return d.add(D), d;
|
|
26
|
-
}, []), t = l(
|
|
26
|
+
}, []), t = l({
|
|
27
|
+
sdkKey: c,
|
|
28
|
+
plugins: S,
|
|
29
|
+
production: p === "production",
|
|
30
|
+
autoEnable: a
|
|
31
|
+
});
|
|
27
32
|
return E(() => {
|
|
28
33
|
m && t && t.createEventSession(m);
|
|
29
34
|
}, [t]), /* @__PURE__ */ g(y, { children: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/react-ui",
|
|
3
|
-
"version": "0.96.
|
|
3
|
+
"version": "0.96.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
@@ -44,16 +44,16 @@
|
|
|
44
44
|
"react-virtualized-auto-sizer": "^1.0.21",
|
|
45
45
|
"react-window": "^1.8.10",
|
|
46
46
|
"react-window-infinite-loader": "^1.0.9",
|
|
47
|
-
"@streamlayer/feature-gamification": "^0.37.
|
|
48
|
-
"@streamlayer/sdk-web
|
|
47
|
+
"@streamlayer/feature-gamification": "^0.37.4",
|
|
48
|
+
"@streamlayer/sdk-web": "^0.32.2",
|
|
49
|
+
"@streamlayer/sdk-web-anonymous-auth": "^0.11.40",
|
|
49
50
|
"@streamlayer/sdk-web-api": "^0.22.0",
|
|
50
|
-
"@streamlayer/sdk-web": "^0.
|
|
51
|
-
"@streamlayer/sdk-web-
|
|
52
|
-
"@streamlayer/sdk-web-features": "^0.11.21",
|
|
53
|
-
"@streamlayer/sdk-web-notifications": "^0.14.1",
|
|
51
|
+
"@streamlayer/sdk-web-core": "^0.21.2",
|
|
52
|
+
"@streamlayer/sdk-web-features": "^0.11.22",
|
|
54
53
|
"@streamlayer/sdk-web-interfaces": "^0.20.5",
|
|
55
|
-
"@streamlayer/sdk-web-
|
|
54
|
+
"@streamlayer/sdk-web-notifications": "^0.14.1",
|
|
56
55
|
"@streamlayer/sdk-web-logger": "^0.5.16",
|
|
56
|
+
"@streamlayer/sdk-web-storage": "^0.4.3",
|
|
57
57
|
"@streamlayer/sdk-web-types": "^0.22.3"
|
|
58
58
|
},
|
|
59
59
|
"nx": {
|
|
@@ -95,6 +95,6 @@
|
|
|
95
95
|
"vite-plugin-svgr": "^4.2.0",
|
|
96
96
|
"vite-svg-loader": "^5.1.0",
|
|
97
97
|
"vite-tsconfig-paths": "^4.3.1",
|
|
98
|
-
"@streamlayer/react": "^0.40.
|
|
98
|
+
"@streamlayer/react": "^0.40.2"
|
|
99
99
|
}
|
|
100
100
|
}
|