@streamlayer/react-ui 0.31.0 → 0.32.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/ui/app/index.js +24 -21
- package/lib/ui/app/styles.js +6 -2
- package/lib/ui/theme/index.js +4 -4
- package/lib/utils/createDemo.js +27 -26
- package/lib/utils/useStreamLayerApp.js +9 -9
- package/package.json +6 -6
package/lib/ui/app/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { jsx as o, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { useStore as s } from "@nanostores/react";
|
|
3
|
+
import { useState as c } from "react";
|
|
4
|
+
import { FeatureType as u } from "@streamlayer/sdk-web-types";
|
|
5
|
+
import { StreamLayerThemeProvider as f } from "../theme/index.js";
|
|
6
|
+
import { ActiveFeature as S } from "./Features/index.js";
|
|
7
|
+
import { MastersNavigation as b } from "./MastersNavigation/index.js";
|
|
8
|
+
import { SDKContainer as h, SDKScrollContainer as v } from "./styles.js";
|
|
8
9
|
import { useSdkFeature as y } from "./useSdkFeature.js";
|
|
9
|
-
import { FeaturedGroupsButtonId as
|
|
10
|
+
import { FeaturedGroupsButtonId as m } from "../navigation/button/FeaturedGroups.js";
|
|
10
11
|
import { ChannelsButtonId as A } from "../navigation/button/Channels.js";
|
|
11
|
-
import { LeaderBoardButtonId as
|
|
12
|
+
import { LeaderBoardButtonId as l } from "../navigation/button/LeaderBoard.js";
|
|
12
13
|
import "../theme/theme.js";
|
|
13
14
|
import "@linaria/core";
|
|
14
15
|
import "../theme/constants.js";
|
|
15
16
|
import "./Features/FeatureProvider.js";
|
|
16
|
-
import "@nanostores/react";
|
|
17
17
|
import "@streamlayer/sdk-web-interfaces";
|
|
18
18
|
import "./Features/Gamification/index.js";
|
|
19
19
|
import "./Features/Gamification/Question.js";
|
|
@@ -72,18 +72,21 @@ import "../navigation/index.js";
|
|
|
72
72
|
import "../icons/index.js";
|
|
73
73
|
import "../navigation/button/index.js";
|
|
74
74
|
import "../navigation/button/styles.js";
|
|
75
|
-
const
|
|
76
|
-
const [r,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
75
|
+
const Jr = ({ sdk: r, overlays: p, children: e }) => {
|
|
76
|
+
const [t, n] = c(m), i = s(r.enabled) === "on", [, d] = y(r);
|
|
77
|
+
return /* @__PURE__ */ o(f, { style: { height: "100%" }, children: /* @__PURE__ */ a(h, { children: [
|
|
78
|
+
i && /* @__PURE__ */ o(b, { activeOverlay: t, setActiveOverlay: n }),
|
|
79
|
+
/* @__PURE__ */ a(v, { children: [
|
|
80
|
+
/* @__PURE__ */ o("div", { style: { display: !i || t === A ? "block" : "none" }, children: e && e({ enableSdk: () => {
|
|
81
|
+
r.initializeApp().then(() => {
|
|
82
|
+
n(m), r.openFeature(u.GAMES);
|
|
83
|
+
});
|
|
84
|
+
}, disableSdk: r.disableApp }) }),
|
|
85
|
+
/* @__PURE__ */ o("div", { style: { display: t === l ? "block" : "none" }, children: p && t === l && p[t] }),
|
|
86
|
+
i && t === m && /* @__PURE__ */ o(S, { feature: d, sdk: r })
|
|
87
|
+
] })
|
|
85
88
|
] }) });
|
|
86
89
|
};
|
|
87
90
|
export {
|
|
88
|
-
|
|
91
|
+
Jr as App
|
|
89
92
|
};
|
package/lib/ui/app/styles.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { styled as o } from "@linaria/react";
|
|
2
|
-
const
|
|
2
|
+
const r = o.div`
|
|
3
3
|
height: 100%;
|
|
4
4
|
background: #fff;
|
|
5
5
|
font-family: var(--font-regular);
|
|
6
|
+
`, n = o.div`
|
|
7
|
+
overflow-y: auto;
|
|
8
|
+
height: 100%;
|
|
6
9
|
`;
|
|
7
10
|
export {
|
|
8
|
-
|
|
11
|
+
r as SDKContainer,
|
|
12
|
+
n as SDKScrollContainer
|
|
9
13
|
};
|
package/lib/ui/theme/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { theme as
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { theme as o } from "./theme.js";
|
|
3
3
|
import "@linaria/core";
|
|
4
4
|
import "./constants.js";
|
|
5
|
-
const
|
|
5
|
+
const s = ({ children: r, style: m }) => /* @__PURE__ */ e("div", { className: o, style: m, children: r });
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
s as StreamLayerThemeProvider
|
|
8
8
|
};
|
package/lib/utils/createDemo.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { anonymous as
|
|
4
|
-
import { Developer as
|
|
5
|
-
import { DeveloperStorage as
|
|
6
|
-
import { useStreamLayerApp as
|
|
1
|
+
import { jsx as e, jsxs as g, Fragment as y } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as u, useState as i, useEffect as E } from "react";
|
|
3
|
+
import { anonymous as l } from "@streamlayer/sdk-web-anonymous-auth";
|
|
4
|
+
import { Developer as D } from "./components/developer.js";
|
|
5
|
+
import { DeveloperStorage as w } from "./storage.js";
|
|
6
|
+
import { useStreamLayerApp as x } from "./useStreamLayerApp.js";
|
|
7
7
|
import "@linaria/react";
|
|
8
8
|
import "./components/bypassLogin.js";
|
|
9
9
|
import "./components/envToggle.js";
|
|
@@ -14,40 +14,41 @@ import "./components/styles.js";
|
|
|
14
14
|
import "./components/sdkKey.js";
|
|
15
15
|
import "@streamlayer/sdk-web-storage";
|
|
16
16
|
import "@streamlayer/sdk-web";
|
|
17
|
-
function
|
|
17
|
+
function K({
|
|
18
18
|
Component: o,
|
|
19
19
|
Story: r,
|
|
20
|
-
args:
|
|
20
|
+
args: n,
|
|
21
|
+
autoEnable: a
|
|
21
22
|
}) {
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
return
|
|
25
|
-
}, []), t =
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
}, [t]), /* @__PURE__ */
|
|
29
|
-
t ? /* @__PURE__ */ e(o, { Story: r, sdk: t, args:
|
|
23
|
+
const s = u(() => new w(), []), [p, f] = i(s.getEnv()), [c, v] = i(s.getSdkKey() || "set-sdk-key"), [m, k] = i(s.getEvent() || ""), S = u(() => {
|
|
24
|
+
const d = /* @__PURE__ */ new Set();
|
|
25
|
+
return d.add(l), d;
|
|
26
|
+
}, []), t = x(c, S, p === "production", a);
|
|
27
|
+
return E(() => {
|
|
28
|
+
m && t && t.createEventSession(m);
|
|
29
|
+
}, [t]), /* @__PURE__ */ g(y, { children: [
|
|
30
|
+
t ? /* @__PURE__ */ e(o, { Story: r, sdk: t, args: n }) : /* @__PURE__ */ e("div", { children: "wait sdk..." }),
|
|
30
31
|
/* @__PURE__ */ e(
|
|
31
|
-
|
|
32
|
+
D,
|
|
32
33
|
{
|
|
33
34
|
sdk: t,
|
|
34
|
-
sdkKey:
|
|
35
|
-
setSdkKey:
|
|
36
|
-
env:
|
|
37
|
-
setEnv:
|
|
38
|
-
event:
|
|
39
|
-
setEvent:
|
|
35
|
+
sdkKey: c,
|
|
36
|
+
setSdkKey: v,
|
|
37
|
+
env: p,
|
|
38
|
+
setEnv: f,
|
|
39
|
+
event: m,
|
|
40
|
+
setEvent: k
|
|
40
41
|
}
|
|
41
42
|
)
|
|
42
43
|
] });
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function O(o, r = !0) {
|
|
45
46
|
return {
|
|
46
47
|
decorators: [
|
|
47
|
-
(
|
|
48
|
+
(n) => /* @__PURE__ */ e(K, { Story: n, Component: o, autoEnable: r })
|
|
48
49
|
]
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
52
|
export {
|
|
52
|
-
|
|
53
|
+
O as createDemo
|
|
53
54
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { StreamLayer as
|
|
3
|
-
const
|
|
4
|
-
const [
|
|
5
|
-
return
|
|
1
|
+
import { useState as i, useEffect as u } from "react";
|
|
2
|
+
import { StreamLayer as l } from "@streamlayer/sdk-web";
|
|
3
|
+
const h = (t, r, n, f) => {
|
|
4
|
+
const [c, a] = i(null);
|
|
5
|
+
return u(() => {
|
|
6
6
|
let s = !1;
|
|
7
7
|
if (!t)
|
|
8
8
|
throw new Error("sdk key should be provided");
|
|
9
|
-
const o =
|
|
9
|
+
const o = l(t, n, f);
|
|
10
10
|
if (r)
|
|
11
11
|
for (const e of r)
|
|
12
12
|
o.use(e);
|
|
13
13
|
return o.ready().then((e) => {
|
|
14
|
-
s ||
|
|
14
|
+
s || a(e.sdk);
|
|
15
15
|
}).catch((e) => console.log(e)), () => {
|
|
16
16
|
s = !0, o.close(function(e) {
|
|
17
17
|
if (e)
|
|
18
18
|
throw e;
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
|
-
}, [t, n]),
|
|
21
|
+
}, [t, n]), c;
|
|
22
22
|
};
|
|
23
23
|
export {
|
|
24
|
-
|
|
24
|
+
h as useStreamLayerApp
|
|
25
25
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/react-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
],
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@streamlayer/sl-eslib": "^5.45.1",
|
|
25
|
-
"@streamlayer/feature-gamification": "^0.17.
|
|
26
|
-
"@streamlayer/sdk-web": "^0.
|
|
27
|
-
"@streamlayer/sdk-web-anonymous-auth": "^0.10.
|
|
25
|
+
"@streamlayer/feature-gamification": "^0.17.3",
|
|
26
|
+
"@streamlayer/sdk-web": "^0.28.0",
|
|
27
|
+
"@streamlayer/sdk-web-anonymous-auth": "^0.10.9",
|
|
28
28
|
"@streamlayer/sdk-web-api": "^0.0.4",
|
|
29
|
-
"@streamlayer/sdk-web-core": "^0.
|
|
30
|
-
"@streamlayer/sdk-web-features": "^0.10.
|
|
29
|
+
"@streamlayer/sdk-web-core": "^0.14.0",
|
|
30
|
+
"@streamlayer/sdk-web-features": "^0.10.3",
|
|
31
31
|
"@streamlayer/sdk-web-interfaces": "^0.18.2",
|
|
32
32
|
"@streamlayer/sdk-web-notifications": "^0.10.1",
|
|
33
33
|
"@streamlayer/sdk-web-storage": "^0.3.4",
|