@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.
@@ -1,26 +1,27 @@
1
1
  import { jsxs as p, jsx as r } from "react/jsx-runtime";
2
- import { Navigation as u } from "../../navigation/index.js";
3
- import { ChannelsButton as a, ChannelsButtonId as n } from "../../navigation/button/Channels.js";
4
- import { FeaturedGroupsButton as d, FeaturedGroupsButtonId as i } from "../../navigation/button/FeaturedGroups.js";
5
- import { LeaderBoardButton as s, LeaderBoardButtonId as m } from "../../navigation/button/LeaderBoard.js";
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
- const j = ({ activeOverlay: o, setActiveOverlay: t }) => /* @__PURE__ */ p(u, { children: [
12
- /* @__PURE__ */ r(a, { active: o === n, onClick: () => t(n) }),
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
- d,
15
+ a,
15
16
  {
16
- active: o === i,
17
+ active: o === n,
17
18
  onClick: () => {
18
- t(i);
19
+ t(n);
19
20
  }
20
21
  }
21
22
  ),
22
23
  /* @__PURE__ */ r(
23
- s,
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
- n as ChannelsButtonId,
32
- i as FeaturedGroupsButtonId,
32
+ i as ChannelsButtonId,
33
+ n as FeaturedGroupsButtonId,
33
34
  m as LeaderBoardButtonId,
34
- j as MastersNavigation
35
+ l as MastersNavigation
35
36
  };
@@ -1,19 +1,20 @@
1
- import { jsx as i, jsxs as u } from "react/jsx-runtime";
2
- import { useState as f, useEffect as s, useMemo as c } from "react";
3
- import { FeatureType as l } from "@streamlayer/sdk-web-types";
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 { ActiveFeature as d } from "./Features/index.js";
6
- import { MastersNavigation as v } from "./MastersNavigation/index.js";
7
- import { SDKContainer as F } from "./styles.js";
8
- import { useSdkFeature as y } from "./useSdkFeature.js";
9
- import { FeaturedGroupsButtonId as o } from "../navigation/button/FeaturedGroups.js";
10
- import { ChannelsButtonId as A } from "../navigation/button/Channels.js";
11
- import { LeaderBoardButtonId as B } from "../navigation/button/LeaderBoard.js";
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 Hr = ({ sdk: t, overlays: m, children: p }) => {
76
- const [r, e] = f(o);
77
- s(() => {
78
- r === o && t.openFeature(l.GAMES);
79
- }, [r, t]);
80
- const [, a] = y(t), n = c(() => r === o || !m ? null : r === A ? p : r === B ? m[r] : null, [m, r, p]);
81
- return /* @__PURE__ */ i(S, { children: /* @__PURE__ */ u(F, { className: "StreamLayerSDK", children: [
82
- /* @__PURE__ */ i(v, { activeOverlay: r, setActiveOverlay: e }),
83
- n,
84
- r === o && /* @__PURE__ */ i(d, { feature: a, sdk: t })
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
- Hr as App
93
+ Rr as App
89
94
  };
@@ -1,9 +1,21 @@
1
- import { styled as o } from "@linaria/react";
2
- const t = o.div`
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
- t as SDKContainer
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 i } from "@linaria/react";
3
- const e = i.div`
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
- padding: 16px;
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
- s as Navigation
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
+ };
@@ -1,8 +1,8 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { theme as e } from "./theme.js";
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 a = ({ children: r }) => /* @__PURE__ */ m("div", { className: e, children: r });
5
+ const s = ({ children: r, style: m }) => /* @__PURE__ */ e("div", { className: o, style: m, children: r });
6
6
  export {
7
- a as StreamLayerThemeProvider
7
+ s as StreamLayerThemeProvider
8
8
  };
@@ -0,0 +1,9 @@
1
+ import { css as a } from "@linaria/core";
2
+ const t = a`
3
+ --header-height: 68px;
4
+ --animation-duration: 0.5s;
5
+ --animation-function: ease;
6
+ `;
7
+ export {
8
+ t as mastersVariables
9
+ };
@@ -1,9 +1,9 @@
1
- import { jsx as e, jsxs as S, Fragment as g } from "react/jsx-runtime";
2
- import { useMemo as d, useState as m, useEffect as y } from "react";
3
- import { anonymous as E } from "@streamlayer/sdk-web-anonymous-auth";
4
- import { Developer as l } from "./components/developer.js";
5
- import { DeveloperStorage as D } from "./storage.js";
6
- import { useStreamLayerApp as w } from "./useStreamLayerApp.js";
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 x({
17
+ function K({
18
18
  Component: o,
19
19
  Story: r,
20
- args: u
20
+ args: n,
21
+ autoEnable: a
21
22
  }) {
22
- const n = d(() => new D(), []), [i, a] = m(n.getEnv()), [p, f] = m(n.getSdkKey() || "set-sdk-key"), [s, v] = m(n.getEvent() || ""), k = d(() => {
23
- const c = /* @__PURE__ */ new Set();
24
- return c.add(E), c;
25
- }, []), t = w(p, k, i === "production");
26
- return y(() => {
27
- s && t && t.createEventSession(s);
28
- }, [t]), /* @__PURE__ */ S(g, { children: [
29
- t ? /* @__PURE__ */ e(o, { Story: r, sdk: t, args: u }) : /* @__PURE__ */ e("div", { children: "wait sdk..." }),
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
- l,
32
+ D,
32
33
  {
33
34
  sdk: t,
34
- sdkKey: p,
35
- setSdkKey: f,
36
- env: i,
37
- setEnv: a,
38
- event: s,
39
- setEvent: v
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 N(o) {
45
+ function O(o, r = !0) {
45
46
  return {
46
47
  decorators: [
47
- (r) => /* @__PURE__ */ e(x, { Story: r, Component: o })
48
+ (n) => /* @__PURE__ */ e(K, { Story: n, Component: o, autoEnable: r })
48
49
  ]
49
50
  };
50
51
  }
51
52
  export {
52
- N as createDemo
53
+ O as createDemo
53
54
  };
@@ -1,25 +1,25 @@
1
- import { useState as a, useEffect as i } from "react";
2
- import { StreamLayer as u } from "@streamlayer/sdk-web";
3
- const d = (t, r, n) => {
4
- const [f, c] = a(null);
5
- return i(() => {
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 = u(t, n);
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 || c(e.sdk);
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]), f;
21
+ }, [t, n]), c;
22
22
  };
23
23
  export {
24
- d as useStreamLayerApp
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.31.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.2",
26
- "@streamlayer/sdk-web": "^0.27.3",
27
- "@streamlayer/sdk-web-anonymous-auth": "^0.10.8",
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.13.2",
30
- "@streamlayer/sdk-web-features": "^0.10.2",
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",