@streamlayer/react-ui 0.31.0 → 0.33.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/MastersNavigation/index.js +14 -13
- package/lib/ui/app/index.js +27 -22
- package/lib/ui/app/styles.js +15 -3
- package/lib/ui/navigation/index.js +4 -9
- package/lib/ui/navigation/masters.js +36 -0
- package/lib/ui/theme/index.js +4 -4
- package/lib/ui/theme/masters.js +9 -0
- package/lib/utils/createDemo.js +27 -26
- package/lib/utils/useStreamLayerApp.js +9 -9
- package/package.json +6 -6
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import { jsxs as p, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { ChannelsButton as u, ChannelsButtonId as i } from "../../navigation/button/Channels.js";
|
|
3
|
+
import { FeaturedGroupsButton as a, FeaturedGroupsButtonId as n } from "../../navigation/button/FeaturedGroups.js";
|
|
4
|
+
import { LeaderBoardButton as d, LeaderBoardButtonId as m } from "../../navigation/button/LeaderBoard.js";
|
|
5
|
+
import { Navigation as s } from "../../navigation/masters.js";
|
|
6
6
|
import "@linaria/react";
|
|
7
7
|
import "../../icons/index.js";
|
|
8
8
|
import "react";
|
|
9
9
|
import "../../navigation/button/index.js";
|
|
10
10
|
import "../../navigation/button/styles.js";
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
import "../../navigation/index.js";
|
|
12
|
+
const l = ({ activeOverlay: o, setActiveOverlay: t }) => /* @__PURE__ */ p(s, { children: [
|
|
13
|
+
/* @__PURE__ */ r(u, { active: o === i, onClick: () => t(i) }),
|
|
13
14
|
/* @__PURE__ */ r(
|
|
14
|
-
|
|
15
|
+
a,
|
|
15
16
|
{
|
|
16
|
-
active: o ===
|
|
17
|
+
active: o === n,
|
|
17
18
|
onClick: () => {
|
|
18
|
-
t(
|
|
19
|
+
t(n);
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
),
|
|
22
23
|
/* @__PURE__ */ r(
|
|
23
|
-
|
|
24
|
+
d,
|
|
24
25
|
{
|
|
25
26
|
active: o === m,
|
|
26
27
|
onClick: () => t(m)
|
|
@@ -28,8 +29,8 @@ const j = ({ activeOverlay: o, setActiveOverlay: t }) => /* @__PURE__ */ p(u, {
|
|
|
28
29
|
)
|
|
29
30
|
] });
|
|
30
31
|
export {
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
i as ChannelsButtonId,
|
|
33
|
+
n as FeaturedGroupsButtonId,
|
|
33
34
|
m as LeaderBoardButtonId,
|
|
34
|
-
|
|
35
|
+
l as MastersNavigation
|
|
35
36
|
};
|
package/lib/ui/app/index.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as o, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { useStore as c } from "@nanostores/react";
|
|
3
|
+
import { useState as f } from "react";
|
|
4
|
+
import { FeatureType as u } from "@streamlayer/sdk-web-types";
|
|
4
5
|
import { StreamLayerThemeProvider as S } from "../theme/index.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
6
|
+
import { mastersVariables as b } from "../theme/masters.js";
|
|
7
|
+
import { ActiveFeature as v } from "./Features/index.js";
|
|
8
|
+
import { MastersNavigation as h } from "./MastersNavigation/index.js";
|
|
9
|
+
import { SDKContainer as y, SDKScrollContainer as A } from "./styles.js";
|
|
10
|
+
import { useSdkFeature as F } from "./useSdkFeature.js";
|
|
11
|
+
import { FeaturedGroupsButtonId as m } from "../navigation/button/FeaturedGroups.js";
|
|
12
|
+
import { ChannelsButtonId as B } from "../navigation/button/Channels.js";
|
|
13
|
+
import { LeaderBoardButtonId as l } from "../navigation/button/LeaderBoard.js";
|
|
12
14
|
import "../theme/theme.js";
|
|
13
15
|
import "@linaria/core";
|
|
14
16
|
import "../theme/constants.js";
|
|
15
17
|
import "./Features/FeatureProvider.js";
|
|
16
|
-
import "@nanostores/react";
|
|
17
18
|
import "@streamlayer/sdk-web-interfaces";
|
|
18
19
|
import "./Features/Gamification/index.js";
|
|
19
20
|
import "./Features/Gamification/Question.js";
|
|
@@ -68,22 +69,26 @@ import "../gamification/insight-list/index.js";
|
|
|
68
69
|
import "../gamification/insight/index.js";
|
|
69
70
|
import "../gamification/insight/styles.js";
|
|
70
71
|
import "../gamification/insight-list/styles.js";
|
|
72
|
+
import "../navigation/masters.js";
|
|
71
73
|
import "../navigation/index.js";
|
|
72
74
|
import "../icons/index.js";
|
|
73
75
|
import "../navigation/button/index.js";
|
|
74
76
|
import "../navigation/button/styles.js";
|
|
75
|
-
const
|
|
76
|
-
const [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return /* @__PURE__ */
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
n,
|
|
84
|
-
|
|
77
|
+
const Rr = ({ sdk: r, overlays: p, children: e }) => {
|
|
78
|
+
const [t, a] = f(m), i = c(r.enabled) === "on", [, s] = F(r), d = () => {
|
|
79
|
+
r.initializeApp().then(() => {
|
|
80
|
+
a(m), r.openFeature(u.GAMES);
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
return /* @__PURE__ */ o(S, { style: { height: "100%" }, children: /* @__PURE__ */ n(y, { className: b, children: [
|
|
84
|
+
i && /* @__PURE__ */ o(h, { activeOverlay: t, setActiveOverlay: a }),
|
|
85
|
+
/* @__PURE__ */ n(A, { "data-nav": i.toString(), children: [
|
|
86
|
+
/* @__PURE__ */ o("div", { style: { display: !i || t === B ? "block" : "none" }, children: e && e({ enableSdk: d, disableSdk: r.disableApp }) }),
|
|
87
|
+
/* @__PURE__ */ o("div", { style: { display: t === l ? "block" : "none" }, children: p && t === l && p[t] }),
|
|
88
|
+
i && t === m && /* @__PURE__ */ o(v, { feature: s, sdk: r })
|
|
89
|
+
] })
|
|
85
90
|
] }) });
|
|
86
91
|
};
|
|
87
92
|
export {
|
|
88
|
-
|
|
93
|
+
Rr as App
|
|
89
94
|
};
|
package/lib/ui/app/styles.js
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import { styled as
|
|
2
|
-
const
|
|
1
|
+
import { styled as t } from "@linaria/react";
|
|
2
|
+
const n = t.div`
|
|
3
3
|
height: 100%;
|
|
4
4
|
background: #fff;
|
|
5
5
|
font-family: var(--font-regular);
|
|
6
|
+
position: relative;
|
|
7
|
+
`, i = t.div`
|
|
8
|
+
overflow-y: auto;
|
|
9
|
+
height: calc(100% - var(--header-height));
|
|
10
|
+
transition: transform;
|
|
11
|
+
transition-duration: var(--animation-duration);
|
|
12
|
+
transition-timing-function: var(--animation-function);
|
|
13
|
+
|
|
14
|
+
&[data-nav='true'] {
|
|
15
|
+
transform: translateY(var(--header-height));
|
|
16
|
+
}
|
|
6
17
|
`;
|
|
7
18
|
export {
|
|
8
|
-
|
|
19
|
+
n as SDKContainer,
|
|
20
|
+
i as SDKScrollContainer
|
|
9
21
|
};
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { styled as
|
|
3
|
-
const
|
|
2
|
+
import { styled as o } from "@linaria/react";
|
|
3
|
+
const i = o.div`
|
|
4
4
|
display: flex;
|
|
5
5
|
align-items: center;
|
|
6
6
|
justify-content: space-between;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
& > button:not(:last-child) {
|
|
10
|
-
margin-right: 8px;
|
|
11
|
-
}
|
|
12
|
-
`, s = ({ children: t }) => /* @__PURE__ */ n(e, { children: t });
|
|
7
|
+
`, a = ({ children: t, className: e }) => /* @__PURE__ */ n(i, { className: e, children: t });
|
|
13
8
|
export {
|
|
14
|
-
|
|
9
|
+
a as Navigation
|
|
15
10
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { styled as o } from "@linaria/react";
|
|
2
|
+
import { Navigation as i } from "./index.js";
|
|
3
|
+
import "react/jsx-runtime";
|
|
4
|
+
const r = o(i)`
|
|
5
|
+
position: absolute;
|
|
6
|
+
top: 0;
|
|
7
|
+
left: 0;
|
|
8
|
+
right: 0;
|
|
9
|
+
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
opacity: 0;
|
|
13
|
+
|
|
14
|
+
animation: show-nav 0.5s ease;
|
|
15
|
+
animation-fill-mode: forwards;
|
|
16
|
+
|
|
17
|
+
padding: 16px;
|
|
18
|
+
|
|
19
|
+
& > button:not(:last-child) {
|
|
20
|
+
margin-right: 8px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@keyframes show-nav {
|
|
24
|
+
90% {
|
|
25
|
+
opacity: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
100% {
|
|
29
|
+
height: 68px;
|
|
30
|
+
opacity: 1;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
export {
|
|
35
|
+
r as Navigation
|
|
36
|
+
};
|
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.33.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",
|