@streamlayer/react-ui 0.94.0 → 0.95.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.
@@ -1,30 +1,54 @@
1
- import { jsxs as f, jsx as e } from "react/jsx-runtime";
2
- import { useRef as y, useState as s } from "react";
3
- import { SvgIcon as d } from "../icons/index.js";
4
- import { Container as g, Player as m, Poster as P, Control as p } from "./styles.js";
1
+ import { jsxs as y, jsx as o } from "react/jsx-runtime";
2
+ import { useRef as m, useState as b, useEffect as P } from "react";
3
+ import { SvgIcon as h } from "../icons/index.js";
4
+ import { Container as O, Player as w, Poster as E, Control as I } from "./styles.js";
5
5
  import "@linaria/react";
6
- const w = ({ poster: l, source: a }) => {
7
- const t = y(null), [c, n] = s(!1), [i, o] = s(!0);
8
- return /* @__PURE__ */ f(g, { onClick: () => {
9
- const r = t == null ? void 0 : t.current;
10
- r && n((u) => u ? (r.pause(), !1) : (r.play(), o(!1), !0));
11
- }, children: [
12
- /* @__PURE__ */ e(
13
- m,
6
+ const S = (r, c) => {
7
+ for (const e of r)
8
+ e.isIntersecting || e.target instanceof HTMLVideoElement && !e.target.paused && (c.unobserve(e.target), e.target.pause());
9
+ }, v = new IntersectionObserver(S, { threshold: 0.5 }), a = /* @__PURE__ */ new Set(), V = (r) => {
10
+ v.observe(r), a.add(r);
11
+ }, i = (r) => {
12
+ v.unobserve(r), a.delete(r);
13
+ }, H = ({ poster: r, source: c }) => {
14
+ const e = m(null), [l, u] = b(!1), [f, d] = b(!0), g = () => {
15
+ const s = e == null ? void 0 : e.current;
16
+ if (s)
17
+ if (l)
18
+ s.pause(), e.current && i(e.current);
19
+ else {
20
+ const n = e == null ? void 0 : e.current;
21
+ if (!n)
22
+ return;
23
+ for (const t of a)
24
+ t !== n && t instanceof HTMLVideoElement && !t.paused && (t.pause(), i(t));
25
+ V(n), n.play().catch((t) => console.log(t)), d(!1);
26
+ }
27
+ }, p = () => {
28
+ var s;
29
+ e.current && i(e.current), (s = e == null ? void 0 : e.current) == null || s.load(), d(!0);
30
+ };
31
+ return P(() => {
32
+ e.current && i(e.current);
33
+ }, []), /* @__PURE__ */ y(O, { onClick: g, children: [
34
+ /* @__PURE__ */ o(
35
+ w,
14
36
  {
15
- ref: t,
16
- src: a,
37
+ ref: e,
38
+ src: c,
39
+ onPlay: () => u(!0),
40
+ onPause: () => u(!1),
17
41
  onEnded: () => {
18
- var r;
19
- (r = t == null ? void 0 : t.current) == null || r.load(), n(!1), o(!0);
42
+ u(!1), p();
20
43
  },
21
- style: { visibility: i ? "hidden" : "visible" }
44
+ style: { visibility: f ? "hidden" : "visible" },
45
+ playsInline: !0
22
46
  }
23
47
  ),
24
- /* @__PURE__ */ e(P, { src: l, style: { visibility: i ? "visible" : "hidden" } }),
25
- /* @__PURE__ */ e(p, { children: !c && /* @__PURE__ */ e(d, { name: "icon-play" }) })
48
+ /* @__PURE__ */ o(E, { src: r, style: { visibility: f ? "visible" : "hidden" } }),
49
+ /* @__PURE__ */ o(I, { children: !l && /* @__PURE__ */ o(h, { name: "icon-play" }) })
26
50
  ] });
27
51
  };
28
52
  export {
29
- w as VideoPlayer
53
+ H as VideoPlayer
30
54
  };
@@ -1,65 +1,84 @@
1
- import { jsxs as t, jsx as o } from "react/jsx-runtime";
2
- import { styled as s } from "@linaria/react";
3
- import { useMemo as v, useState as u } from "react";
4
- import { DeveloperStorage as D } from "../../storage.js";
5
- import { BypassLogin as I } from "./bypassLogin.js";
6
- import { CopyLogs as B } from "./copyLogs.js";
7
- import { EnvToggle as x } from "./envToggle.js";
8
- import { EventInput as C } from "./eventInput.js";
9
- import { SdkKey as h } from "./sdkKey.js";
1
+ import { jsxs as m, jsx as o } from "react/jsx-runtime";
2
+ import { styled as n } from "@linaria/react";
3
+ import { useMemo as b, useState as h } from "react";
4
+ import { DeveloperStorage as q } from "../../storage.js";
5
+ import { BypassLogin as u } from "./bypassLogin.js";
6
+ import { CopyLogs as D } from "./copyLogs.js";
7
+ import { EnvToggle as I } from "./envToggle.js";
8
+ import { EventInput as B } from "./eventInput.js";
9
+ import { SdkKey as v } from "./sdkKey.js";
10
10
  import "@streamlayer/sdk-web-storage";
11
11
  import "./styles.js";
12
12
  import "@nanostores/react";
13
13
  import "@streamlayer/sdk-web-core";
14
- const j = /* @__PURE__ */ s("div")({
14
+ const A = /* @__PURE__ */ n("div")({
15
15
  name: "DeveloperContainer",
16
16
  class: "d1sqxt7l",
17
17
  propsAsIs: !1
18
- }), y = /* @__PURE__ */ s("div")({
18
+ }), x = /* @__PURE__ */ n("div")({
19
19
  name: "DeveloperItems",
20
20
  class: "d1a3478s",
21
21
  propsAsIs: !1
22
- }), A = /* @__PURE__ */ s("button")({
22
+ }), L = /* @__PURE__ */ n("button")({
23
23
  name: "BurgerBtn",
24
24
  class: "butjcq8",
25
25
  propsAsIs: !1
26
- }), J = ({
27
- sdk: e,
28
- sdkKey: i,
26
+ }), P = ({
27
+ sdk: r,
28
+ sdkKey: s,
29
29
  setSdkKey: p,
30
- env: a,
31
- setEnv: n,
32
- event: l,
33
- setEvent: c,
34
- hideAuth: f
30
+ env: i,
31
+ setEnv: t,
32
+ event: a,
33
+ setEvent: l,
34
+ hideAuth: c,
35
+ standalone: f = !1
35
36
  }) => {
36
- const r = v(() => new D(), []), [m, d] = u(!1);
37
- return /* @__PURE__ */ t(j, {
38
- children: [/* @__PURE__ */ t(A, {
39
- "data-opened": m.toString(),
40
- onClick: () => d((g) => !g),
37
+ const e = b(() => new q(), []), [g, C] = h(f);
38
+ return f ? /* @__PURE__ */ m(x, {
39
+ children: [t && /* @__PURE__ */ o(I, {
40
+ env: i,
41
+ setEnv: t,
42
+ storage: e
43
+ }), p && /* @__PURE__ */ o(v, {
44
+ sdkKey: s,
45
+ setSdkKey: p,
46
+ storage: e
47
+ }), r && /* @__PURE__ */ o(B, {
48
+ sdk: r,
49
+ storage: e,
50
+ event: a,
51
+ setEvent: l
52
+ }), !c && r && /* @__PURE__ */ o(u, {
53
+ sdk: r,
54
+ storage: e
55
+ }), /* @__PURE__ */ o(D, {})]
56
+ }) : /* @__PURE__ */ m(A, {
57
+ children: [/* @__PURE__ */ m(L, {
58
+ "data-opened": g.toString(),
59
+ onClick: () => C((j) => !j),
41
60
  children: [/* @__PURE__ */ o("span", {}), /* @__PURE__ */ o("span", {}), /* @__PURE__ */ o("span", {})]
42
- }), m && /* @__PURE__ */ t(y, {
43
- children: [n && /* @__PURE__ */ o(x, {
44
- env: a,
45
- setEnv: n,
46
- storage: r
47
- }), p && /* @__PURE__ */ o(h, {
48
- sdkKey: i,
61
+ }), g && /* @__PURE__ */ m(x, {
62
+ children: [t && /* @__PURE__ */ o(I, {
63
+ env: i,
64
+ setEnv: t,
65
+ storage: e
66
+ }), p && /* @__PURE__ */ o(v, {
67
+ sdkKey: s,
49
68
  setSdkKey: p,
50
- storage: r
51
- }), e && /* @__PURE__ */ o(C, {
52
- sdk: e,
53
- storage: r,
54
- event: l,
55
- setEvent: c
56
- }), !f && e && /* @__PURE__ */ o(I, {
57
- sdk: e,
58
- storage: r
59
- }), /* @__PURE__ */ o(B, {})]
69
+ storage: e
70
+ }), r && /* @__PURE__ */ o(B, {
71
+ sdk: r,
72
+ storage: e,
73
+ event: a,
74
+ setEvent: l
75
+ }), !c && r && /* @__PURE__ */ o(u, {
76
+ sdk: r,
77
+ storage: e
78
+ }), /* @__PURE__ */ o(D, {})]
60
79
  })]
61
80
  });
62
81
  };
63
82
  export {
64
- J as Developer
83
+ P as Developer
65
84
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/react-ui",
3
- "version": "0.94.0",
3
+ "version": "0.95.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -36,24 +36,24 @@
36
36
  ],
37
37
  "peerDependencies": {
38
38
  "@lottiefiles/react-lottie-player": "*",
39
- "@streamlayer/sl-eslib": "^5.66.0",
39
+ "@streamlayer/sl-eslib": "^5.67.0",
40
40
  "@types/lodash.throttle": "^4.1.9",
41
41
  "lodash.throttle": "^4.1.1",
42
42
  "react-infinite-scroller": "^1.2.6",
43
43
  "react-virtualized-auto-sizer": "^1.0.21",
44
44
  "react-window": "^1.8.10",
45
45
  "react-window-infinite-loader": "^1.0.9",
46
- "@streamlayer/feature-gamification": "^0.36.0",
47
- "@streamlayer/sdk-web": "^0.31.0",
48
- "@streamlayer/sdk-web-api": "^0.21.0",
49
- "@streamlayer/sdk-web-anonymous-auth": "^0.11.35",
50
- "@streamlayer/sdk-web-core": "^0.19.0",
51
- "@streamlayer/sdk-web-features": "^0.11.17",
52
- "@streamlayer/sdk-web-interfaces": "^0.20.2",
53
- "@streamlayer/sdk-web-logger": "^0.5.13",
54
- "@streamlayer/sdk-web-notifications": "^0.13.8",
55
- "@streamlayer/sdk-web-storage": "^0.4.0",
56
- "@streamlayer/sdk-web-types": "^0.22.0"
46
+ "@streamlayer/feature-gamification": "^0.37.0",
47
+ "@streamlayer/sdk-web": "^0.31.1",
48
+ "@streamlayer/sdk-web-anonymous-auth": "^0.11.36",
49
+ "@streamlayer/sdk-web-api": "^0.21.1",
50
+ "@streamlayer/sdk-web-core": "^0.20.0",
51
+ "@streamlayer/sdk-web-features": "^0.11.18",
52
+ "@streamlayer/sdk-web-interfaces": "^0.20.3",
53
+ "@streamlayer/sdk-web-logger": "^0.5.14",
54
+ "@streamlayer/sdk-web-notifications": "^0.13.9",
55
+ "@streamlayer/sdk-web-storage": "^0.4.1",
56
+ "@streamlayer/sdk-web-types": "^0.22.1"
57
57
  },
58
58
  "nx": {
59
59
  "implicitDependencies": [
@@ -94,6 +94,6 @@
94
94
  "vite-plugin-svgr": "^4.2.0",
95
95
  "vite-svg-loader": "^5.1.0",
96
96
  "vite-tsconfig-paths": "^4.3.1",
97
- "@streamlayer/react": "^0.38.0"
97
+ "@streamlayer/react": "^0.39.0"
98
98
  }
99
99
  }