@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.
@@ -1,17 +1,22 @@
1
- import { jsxs as m, jsx as i } from "react/jsx-runtime";
2
- import { InsightContent as n } from "../../../questions/insight/index.js";
3
- import { Container as p, ActionBtn as c } from "./styles.js";
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 "../../../video-player/index.js";
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
- import "../../../questions/insight/styles.js";
11
- const d = ({ openInsight: r, questionId: t, ...o }) => /* @__PURE__ */ m(p, { children: [
12
- /* @__PURE__ */ i(n, { questionId: t, ...o }),
13
- r && /* @__PURE__ */ i(c, { onClick: () => r(t), children: "View Insight" })
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
- d as Insight
21
+ k as Insight
17
22
  };
@@ -1,5 +1,5 @@
1
- import { jsxs as a, jsx as o, Fragment as d } from "react/jsx-runtime";
2
- import { QuestionType as t } from "@streamlayer/sdk-web-types";
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 G = ({
20
- close: n,
21
- action: i,
22
- controlVideo: l,
23
- data: { questionType: r, question: m, insight: e, tweet: c }
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 === t.TWEET ? { paddingTop: "12px" } : {}, children: [
27
- /* @__PURE__ */ o(E, { onClick: n, children: /* @__PURE__ */ o(I, { name: "icon-cross" }) }),
28
- r !== t.TWEET && /* @__PURE__ */ a(C, { children: [
29
- /* @__PURE__ */ o(
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 === t.TRIVIA,
33
- "data-type-poll": r === t.POLL,
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__ */ o(A, { children: p.label })
37
+ /* @__PURE__ */ t(A, { children: p.label })
38
38
  ] }),
39
- r === t.FACTOID && /* @__PURE__ */ o(f, { ...e, action: i, controlVideo: l }),
40
- r === t.TWEET && // ToDo: connect with real Api data
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__ */ o(D, { ...c, action: i }),
44
- r !== t.FACTOID && r !== t.TWEET && /* @__PURE__ */ a(d, { children: [
45
- /* @__PURE__ */ o(W, { children: m == null ? void 0 : m.title }),
46
- /* @__PURE__ */ o(x, { onClick: i, children: "Answer" })
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
- G as Notification
51
+ J as Notification
52
52
  };
@@ -1,22 +1,27 @@
1
- import { jsxs as r, jsx as i } from "react/jsx-runtime";
2
- import { TwitterContent as m } from "../../../questions/twitter/index.js";
3
- import { Container as e, Quote as n, ActionButton as p } from "./styles.js";
4
- import "../../../video-player/index.js";
5
- import "react";
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 "../../../video-player/styles.js";
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 k = ({ openTweet: o, ...t }) => /* @__PURE__ */ r(e, { children: [
16
- t.title && /* @__PURE__ */ i(n, { children: t.title }),
17
- /* @__PURE__ */ i(m, { ...t }),
18
- o && /* @__PURE__ */ i(p, { onClick: () => o(t.tweetId), children: "View Insight" })
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
- k as Twitter
26
+ B as Twitter
22
27
  };
@@ -7,6 +7,7 @@ export type VideoPlayerProps = {
7
7
  source?: string;
8
8
  controlVideo?: (props: ControlVideoProps) => void;
9
9
  };
10
+ export declare const pauseAllVideos: () => void;
10
11
  /**
11
12
  * VideoPlayer component for playing videos with a poster image.
12
13
  *
@@ -1,62 +1,69 @@
1
- import { jsxs as h, jsx as o } from "react/jsx-runtime";
2
- import { useRef as O, useState as d, useEffect as w } from "react";
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 C } from "./styles.js";
4
+ import { Container as I, Player as S, Poster as x, Control as L } from "./styles.js";
5
5
  import "@linaria/react";
6
- const L = (t, c) => {
7
- for (const s of t)
8
- s.isIntersecting || s.target instanceof HTMLVideoElement && !s.target.paused && (c.unobserve(s.target), s.target.pause());
9
- }, g = new IntersectionObserver(L, { threshold: 0.5 }), f = /* @__PURE__ */ new Set(), T = (t) => {
10
- g.observe(t), f.add(t);
11
- }, u = (t) => {
12
- g.unobserve(t), f.delete(t);
13
- }, q = ({ poster: t, source: c, controlVideo: s }) => {
14
- const e = O(null), [l, a] = d(!1), [b, m] = d(!0), p = () => {
15
- s == null || s({ muted: !0 });
16
- }, v = () => {
17
- s == null || s({ muted: !1 });
18
- }, y = () => {
19
- const n = e == null ? void 0 : e.current;
20
- if (n)
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
- n.pause(), e.current && u(e.current);
25
+ r.pause(), e.current && n(e.current);
23
26
  else {
24
- const i = e == null ? void 0 : e.current;
25
- if (!i)
27
+ const a = e == null ? void 0 : e.current;
28
+ if (!a)
26
29
  return;
27
- for (const r of f)
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
- }, P = () => {
32
- var n;
33
- e.current && u(e.current), (n = e == null ? void 0 : e.current) == null || n.load(), m(!0);
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 w(() => {
36
- e.current && u(e.current);
37
- }, []), /* @__PURE__ */ h(I, { onClick: y, children: [
38
- /* @__PURE__ */ o(
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
- p(), a(!0);
50
+ y(), o(!0);
45
51
  },
46
52
  onPause: () => {
47
- v(), a(!1);
53
+ u(), o(!1);
48
54
  },
49
55
  onEnded: () => {
50
- v(), a(!1), P();
56
+ u(), o(!1), h();
51
57
  },
52
58
  style: { visibility: b ? "hidden" : "visible" },
53
59
  playsInline: !0
54
60
  }
55
61
  ),
56
- /* @__PURE__ */ o(x, { src: t, style: { visibility: b ? "visible" : "hidden" } }),
57
- /* @__PURE__ */ o(C, { children: !l && /* @__PURE__ */ o(E, { name: "icon-play" }) })
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
- q as VideoPlayer
67
+ z as VideoPlayer,
68
+ k as pauseAllVideos
62
69
  };
@@ -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(c, S, p === "production", a);
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.1",
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.3",
48
- "@streamlayer/sdk-web-anonymous-auth": "^0.11.39",
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.32.1",
51
- "@streamlayer/sdk-web-core": "^0.21.1",
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-storage": "^0.4.3",
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.1"
98
+ "@streamlayer/react": "^0.40.2"
99
99
  }
100
100
  }