@streamlayer/react-ui 1.1.0 → 1.2.1

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.
Files changed (37) hide show
  1. package/lib/app/app/Advertisement/index.d.ts +6 -2
  2. package/lib/app/app/Advertisement/index.js +75 -24
  3. package/lib/app/app/story/content.d.ts +1 -0
  4. package/lib/app/app/story/content.js +26 -10
  5. package/lib/app/app/story/index.d.ts +2 -0
  6. package/lib/app/app/story/index.js +75 -58
  7. package/lib/app/app/story/styles.d.ts +9 -0
  8. package/lib/app/app/story/styles.js +49 -0
  9. package/lib/app/app/story/useResponsive.d.ts +1 -0
  10. package/lib/app/app/story/useResponsive.js +15 -0
  11. package/lib/app/app/story/video.d.ts +3 -1
  12. package/lib/app/app/story/video.js +63 -92
  13. package/lib/assets/style.css +1 -1
  14. package/lib/ui/advertisement/banner/index.d.ts +2 -0
  15. package/lib/ui/advertisement/banner/index.js +17 -12
  16. package/lib/ui/advertisement/index.d.ts +1 -0
  17. package/lib/ui/advertisement/index.js +12 -24
  18. package/lib/ui/advertisement/mock.d.ts +1 -0
  19. package/lib/ui/advertisement/mock.js +38 -4
  20. package/lib/ui/advertisement/overlay/index.d.ts +2 -0
  21. package/lib/ui/advertisement/overlay/index.js +68 -15
  22. package/lib/ui/advertisement/overlay/styles.d.ts +18 -0
  23. package/lib/ui/advertisement/overlay/styles.js +95 -0
  24. package/lib/ui/advertisement/sidebar/index.d.ts +1 -0
  25. package/lib/ui/advertisement/sidebar/index.js +10 -8
  26. package/lib/ui/gamification/question/index.js +1 -0
  27. package/lib/ui/gamification/vote/vote-option/index.js +6 -6
  28. package/lib/ui/icons/index.js +1 -0
  29. package/lib/ui/slide-in/index.js +18 -23
  30. package/lib/ui/theme/ThemeColorsAdvertisement.d.ts +1 -0
  31. package/lib/ui/theme/ThemeColorsAdvertisement.js +15 -0
  32. package/lib/ui/theme/constants.d.ts +11 -0
  33. package/lib/ui/theme/constants.js +28 -14
  34. package/lib/ui/theme/theme.js +11 -8
  35. package/lib/ui/video-player/index.d.ts +1 -0
  36. package/lib/ui/video-player/index.js +70 -62
  37. package/package.json +15 -14
@@ -1,77 +1,85 @@
1
- import { jsxs as x, jsx as n } from "react/jsx-runtime";
2
- import { cx as C } from "@linaria/core";
3
- import { useRef as E, useState as g, useCallback as v, useEffect as d } from "react";
4
- import { eventBus as S } from "@streamlayer/sdk-web-interfaces";
5
- import { SvgIcon as y } from "../icons/index.js";
6
- import { Container as T, ToggleIconPause as L, Player as j, Poster as k, Control as H } from "./styles.js";
7
- const M = (s, a) => {
1
+ import { jsxs as C, jsx as o } from "react/jsx-runtime";
2
+ import { cx as E } from "@linaria/core";
3
+ import { useRef as S, useState as v, useCallback as d, useEffect as y } from "react";
4
+ import { eventBus as T } from "@streamlayer/sdk-web-interfaces";
5
+ import { SvgIcon as P } from "../icons/index.js";
6
+ import { Container as L, ToggleIconPause as j, Player as k, Poster as H, Control as M } from "./styles.js";
7
+ const A = (s, a) => {
8
8
  for (const t of s)
9
9
  t.isIntersecting || t.target instanceof HTMLVideoElement && !t.target.paused && (a.unobserve(t.target), t.target.pause());
10
- }, P = new IntersectionObserver(M, { threshold: 0.5 }), f = /* @__PURE__ */ new Set(), A = (s) => {
11
- P.observe(s), f.add(s);
12
- }, o = (s) => {
13
- P.unobserve(s), f.delete(s);
14
- }, B = () => {
15
- for (const s of f)
16
- s instanceof HTMLVideoElement && !s.paused && (s.pause(), o(s));
17
- }, J = ({ poster: s, source: a, controlVideo: t }) => {
18
- const e = E(null), [u, c] = g(!1), [m, p] = g(!0), h = v(() => {
19
- t == null || t({ muted: !0 });
20
- }, [t]), i = v(() => {
21
- t == null || t({ muted: !1 });
22
- }, [t]), I = (r) => {
23
- r.stopPropagation();
24
- const b = e == null ? void 0 : e.current;
25
- if (b) {
26
- if (u)
27
- b.pause(), e.current && o(e.current);
10
+ }, h = new IntersectionObserver(A, { threshold: 0.5 }), m = /* @__PURE__ */ new Set(), B = (s) => {
11
+ h.observe(s), m.add(s);
12
+ }, i = (s) => {
13
+ h.unobserve(s), m.delete(s);
14
+ }, F = () => {
15
+ for (const s of m)
16
+ s instanceof HTMLVideoElement && !s.paused && (s.pause(), i(s));
17
+ }, K = ({ poster: s, source: a, aspectRatio: t, controlVideo: r }) => {
18
+ const e = S(null), [c, l] = v(!1), [p, b] = v(!0), I = d(() => {
19
+ r == null || r({ muted: !0 });
20
+ }, [r]), u = d(() => {
21
+ r == null || r({ muted: !1 });
22
+ }, [r]), O = (n) => {
23
+ n.stopPropagation();
24
+ const g = e == null ? void 0 : e.current;
25
+ if (g) {
26
+ if (c)
27
+ g.pause(), e.current && i(e.current);
28
28
  else {
29
- const l = e == null ? void 0 : e.current;
30
- if (!l)
29
+ const f = e == null ? void 0 : e.current;
30
+ if (!f)
31
31
  return;
32
- B(), A(l), l.play().catch((w) => console.log(w)), p(!1);
32
+ F(), B(f), f.play().catch((x) => console.log(x)), b(!1);
33
33
  }
34
- S.emit("interactions", {
34
+ T.emit("interactions", {
35
35
  action: "tap",
36
36
  payload: {}
37
37
  });
38
38
  }
39
- }, O = () => {
40
- var r;
41
- e.current && o(e.current), (r = e == null ? void 0 : e.current) == null || r.load(), p(!0);
39
+ }, w = () => {
40
+ var n;
41
+ e.current && i(e.current), (n = e == null ? void 0 : e.current) == null || n.load(), b(!0);
42
42
  };
43
- return d(() => {
44
- e.current && o(e.current);
45
- }, []), d(() => {
46
- const r = e == null ? void 0 : e.current;
43
+ return y(() => {
44
+ e.current && i(e.current);
45
+ }, []), y(() => {
46
+ const n = e == null ? void 0 : e.current;
47
47
  return () => {
48
- r && (r.paused || i(), o(r));
48
+ n && (n.paused || u(), i(n));
49
49
  };
50
- }, [i]), /* @__PURE__ */ x(T, { onClick: I, className: C(u && L), children: [
51
- /* @__PURE__ */ n(
52
- j,
53
- {
54
- ref: e,
55
- src: a,
56
- onPlay: () => {
57
- h(), c(!0);
58
- },
59
- onPause: () => {
60
- i(), c(!1);
61
- },
62
- onEnded: () => {
63
- i(), c(!1), O();
64
- },
65
- style: { visibility: m ? "hidden" : "visible" },
66
- controls: !1,
67
- playsInline: !0
68
- }
69
- ),
70
- /* @__PURE__ */ n(k, { src: s, style: { visibility: m ? "visible" : "hidden" } }),
71
- /* @__PURE__ */ n(H, { children: u ? /* @__PURE__ */ n(y, { name: "icon-pause" }) : /* @__PURE__ */ n(y, { name: "icon-play" }) })
72
- ] });
50
+ }, [u]), /* @__PURE__ */ C(
51
+ L,
52
+ {
53
+ onClick: O,
54
+ className: E(c && j),
55
+ style: t ? { aspectRatio: t } : {},
56
+ children: [
57
+ /* @__PURE__ */ o(
58
+ k,
59
+ {
60
+ ref: e,
61
+ src: a,
62
+ onPlay: () => {
63
+ I(), l(!0);
64
+ },
65
+ onPause: () => {
66
+ u(), l(!1);
67
+ },
68
+ onEnded: () => {
69
+ u(), l(!1), w();
70
+ },
71
+ style: { visibility: p ? "hidden" : "visible" },
72
+ controls: !1,
73
+ playsInline: !0
74
+ }
75
+ ),
76
+ /* @__PURE__ */ o(H, { src: s, style: { visibility: p ? "visible" : "hidden" } }),
77
+ /* @__PURE__ */ o(M, { children: c ? /* @__PURE__ */ o(P, { name: "icon-pause" }) : /* @__PURE__ */ o(P, { name: "icon-play" }) })
78
+ ]
79
+ }
80
+ );
73
81
  };
74
82
  export {
75
- J as VideoPlayer,
76
- B as pauseAllVideos
83
+ K as VideoPlayer,
84
+ F as pauseAllVideos
77
85
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/react-ui",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -54,18 +54,18 @@
54
54
  "react-virtualized-auto-sizer": "^1.0.24",
55
55
  "react-window": "^1.8.10",
56
56
  "react-window-infinite-loader": "^1.0.9",
57
- "@streamlayer/feature-gamification": "^1.1.0",
58
- "@streamlayer/sdk-web": "^1.0.1",
59
- "@streamlayer/sdk-web-analytics": "^1.0.1",
60
- "@streamlayer/sdk-web-anonymous-auth": "^1.0.1",
61
- "@streamlayer/sdk-web-api": "^1.1.0",
62
- "@streamlayer/sdk-web-core": "^1.0.1",
63
- "@streamlayer/sdk-web-features": "^1.0.1",
64
- "@streamlayer/sdk-web-interfaces": "^1.0.1",
65
- "@streamlayer/sdk-web-logger": "^1.0.1",
66
- "@streamlayer/sdk-web-notifications": "^1.0.1",
67
- "@streamlayer/sdk-web-storage": "^1.0.1",
68
- "@streamlayer/sdk-web-types": "^1.1.0"
57
+ "@streamlayer/feature-gamification": "^1.2.1",
58
+ "@streamlayer/sdk-web": "^1.0.3",
59
+ "@streamlayer/sdk-web-analytics": "^1.0.3",
60
+ "@streamlayer/sdk-web-anonymous-auth": "^1.0.3",
61
+ "@streamlayer/sdk-web-api": "^1.1.2",
62
+ "@streamlayer/sdk-web-core": "^1.0.3",
63
+ "@streamlayer/sdk-web-features": "^1.0.3",
64
+ "@streamlayer/sdk-web-interfaces": "^1.0.3",
65
+ "@streamlayer/sdk-web-logger": "^1.0.3",
66
+ "@streamlayer/sdk-web-notifications": "^1.0.3",
67
+ "@streamlayer/sdk-web-storage": "^1.0.3",
68
+ "@streamlayer/sdk-web-types": "^1.1.2"
69
69
  },
70
70
  "nx": {
71
71
  "implicitDependencies": [
@@ -99,12 +99,13 @@
99
99
  "react-countup": "^6.5.3",
100
100
  "react-phone-number-input": "^3.4.3",
101
101
  "rollup-plugin-node-polyfills": "^0.2.1",
102
+ "screenfull": "^6.0.2",
102
103
  "tslib": "^2.6.3",
103
104
  "vite": "5.3.2",
104
105
  "vite-plugin-node-polyfills": "^0.22.0",
105
106
  "vite-plugin-svgr": "^4.2.0",
106
107
  "vite-svg-loader": "^5.1.0",
107
108
  "vite-tsconfig-paths": "^4.3.2",
108
- "@streamlayer/react": "^1.1.0"
109
+ "@streamlayer/react": "^1.1.2"
109
110
  }
110
111
  }