@streamlayer/react-ui 0.44.0 → 0.45.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/demo/index.js +86 -47
- package/package.json +8 -8
package/lib/ui/demo/index.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var y = Object.defineProperty;
|
|
2
|
+
var b = (o, r, t) => r in o ? y(o, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[r] = t;
|
|
3
|
+
var m = (o, r, t) => (b(o, typeof r != "symbol" ? r + "" : r, t), t);
|
|
4
|
+
import { jsx as e, jsxs as l, Fragment as T } from "react/jsx-runtime";
|
|
5
|
+
import { FeatureStatus as c } from "@streamlayer/sdk-web-interfaces";
|
|
3
6
|
import { FeatureType as g } from "@streamlayer/sdk-web-types";
|
|
4
|
-
import { AvailableFeatures as
|
|
5
|
-
import { useState as
|
|
7
|
+
import { AvailableFeatures as C } from "@streamlayer/sdk-web-features";
|
|
8
|
+
import { useState as w, useMemo as S, useEffect as F } from "react";
|
|
6
9
|
import "@streamlayer/sdk-web-api";
|
|
7
|
-
import "@streamlayer/sdk-web-storage";
|
|
8
|
-
import { useStore as
|
|
9
|
-
import { Notifications as
|
|
10
|
-
import { GamificationComponent as
|
|
10
|
+
import { Storage as k } from "@streamlayer/sdk-web-storage";
|
|
11
|
+
import { useStore as f } from "@nanostores/react";
|
|
12
|
+
import { Notifications as x } from "../notifications/index.js";
|
|
13
|
+
import { GamificationComponent as E } from "./Gamification.js";
|
|
11
14
|
import { HighlightsComponent as G } from "./Highlights.js";
|
|
12
15
|
import { LoginComponent as H } from "./Login.js";
|
|
13
|
-
import { Buttons as
|
|
16
|
+
import { Buttons as A, Button as d } from "./styles.js";
|
|
14
17
|
import "../notifications/notification/index.js";
|
|
15
18
|
import "@streamlayer/sdk-web-notifications";
|
|
16
19
|
import "../notifications/notification/onboarding-inapp/index.js";
|
|
@@ -84,55 +87,91 @@ import "@connectrpc/connect";
|
|
|
84
87
|
import "@connectrpc/connect-web";
|
|
85
88
|
import "@streamlayer/sl-eslib/users/users_connect";
|
|
86
89
|
import "../login/styles.js";
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
class B extends k {
|
|
91
|
+
constructor() {
|
|
92
|
+
super("user");
|
|
93
|
+
// Schema
|
|
94
|
+
m(this, "setSchema", (t) => {
|
|
95
|
+
this.write("schema", t);
|
|
96
|
+
});
|
|
97
|
+
m(this, "getSchema", () => this.read(
|
|
98
|
+
"schema"
|
|
99
|
+
/* SCHEMA */
|
|
100
|
+
));
|
|
101
|
+
// Token
|
|
102
|
+
m(this, "setToken", (t) => {
|
|
103
|
+
this.write("token", t);
|
|
104
|
+
});
|
|
105
|
+
m(this, "getToken", () => this.read(
|
|
106
|
+
"token"
|
|
107
|
+
/* TOKEN */
|
|
108
|
+
));
|
|
109
|
+
// External Token
|
|
110
|
+
m(this, "setExternalToken", (t) => {
|
|
111
|
+
this.write("eToken", t);
|
|
112
|
+
});
|
|
113
|
+
m(this, "getExternalToken", () => this.read(
|
|
114
|
+
"eToken"
|
|
115
|
+
/* EXTERNAL_TOKEN */
|
|
116
|
+
));
|
|
117
|
+
m(this, "removeToken", () => {
|
|
118
|
+
this.remove(
|
|
119
|
+
"token"
|
|
120
|
+
/* TOKEN */
|
|
121
|
+
);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
new B();
|
|
126
|
+
const R = ({ activeFeature: o, sdk: r }) => {
|
|
127
|
+
const [t, a] = w(null), { organizationSettings: s, streamSettings: u } = f(r.sdkStore), v = S(() => {
|
|
128
|
+
const i = (u == null ? void 0 : u.data) || (s == null ? void 0 : s.data);
|
|
129
|
+
return i != null && i.overlays ? i.overlays : [];
|
|
130
|
+
}, [s, u]);
|
|
131
|
+
F(() => {
|
|
132
|
+
const i = r.getFeatures();
|
|
133
|
+
if (o)
|
|
134
|
+
for (const [n, p] of i)
|
|
135
|
+
n === o ? p.status.get() === c.Suspended && (p.enable(), a(p)) : p.status.get() === c.Ready && p.disable();
|
|
97
136
|
else {
|
|
98
|
-
for (const [,
|
|
99
|
-
|
|
100
|
-
|
|
137
|
+
for (const [, n] of i)
|
|
138
|
+
n.status.get() === c.Ready && n.disable();
|
|
139
|
+
a(null);
|
|
101
140
|
}
|
|
102
141
|
return () => {
|
|
103
|
-
for (const [,
|
|
104
|
-
|
|
142
|
+
for (const [, n] of i)
|
|
143
|
+
n.status.get() === c.Ready && n.disable();
|
|
105
144
|
};
|
|
106
|
-
}, [
|
|
107
|
-
const
|
|
108
|
-
return /* @__PURE__ */
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
|
|
113
|
-
|
|
145
|
+
}, [o, r]);
|
|
146
|
+
const h = S(() => t ? t.featureConfig.get().type === g.GAMES ? t ? /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(E, { gamification: t, sdk: r }) }) : /* @__PURE__ */ e("div", { children: "wait gamification..." }) : t.featureConfig.get().type === g.HIGHLIGHTS ? t ? /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(G, { highlights: t, sdk: r }) }) : /* @__PURE__ */ e("div", { children: "wait highlights..." }) : /* @__PURE__ */ e("div", { children: "unknown feature" }) : null, [r, t]);
|
|
147
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
148
|
+
/* @__PURE__ */ l(A, { children: [
|
|
149
|
+
/* @__PURE__ */ e(d, { onClick: () => r.closeFeature(), disabled: !h, children: "close" }),
|
|
150
|
+
/* @__PURE__ */ e(d, { onClick: () => r.logout(), children: "logout" }),
|
|
151
|
+
v.map((i) => /* @__PURE__ */ l(
|
|
152
|
+
d,
|
|
114
153
|
{
|
|
115
|
-
onClick: () =>
|
|
116
|
-
disabled: !(
|
|
117
|
-
"data-enable_sdk_button":
|
|
118
|
-
"data-selected":
|
|
154
|
+
onClick: () => r.openFeature(i.type),
|
|
155
|
+
disabled: !(i.type in C),
|
|
156
|
+
"data-enable_sdk_button": i.enableSdkButton.toString(),
|
|
157
|
+
"data-selected": i.type === o,
|
|
119
158
|
children: [
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
|
|
159
|
+
/* @__PURE__ */ e("img", { src: i.icon, alt: "" }),
|
|
160
|
+
i.name
|
|
122
161
|
]
|
|
123
162
|
},
|
|
124
|
-
|
|
163
|
+
i.name
|
|
125
164
|
))
|
|
126
165
|
] }),
|
|
127
|
-
|
|
166
|
+
h
|
|
128
167
|
] });
|
|
129
|
-
},
|
|
130
|
-
const
|
|
131
|
-
return
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
] }) : /* @__PURE__ */
|
|
168
|
+
}, lr = ({ sdk: o }) => {
|
|
169
|
+
const r = f(o.organizationStore()), t = f(o.getUserStore()), a = f(o.getActiveFeature());
|
|
170
|
+
return r.loading ? /* @__PURE__ */ e("div", { children: "authentication..." }) : r.data ? t.loading ? /* @__PURE__ */ e("div", { children: "authentication..." }) : t.data ? /* @__PURE__ */ l(T, { children: [
|
|
171
|
+
/* @__PURE__ */ e(x, { notificationsStore: o.getNotificationsStore() }),
|
|
172
|
+
/* @__PURE__ */ e(R, { sdk: o, activeFeature: a })
|
|
173
|
+
] }) : /* @__PURE__ */ e(H, { sdk: o }) : /* @__PURE__ */ e("div", { children: "wrong sdk key..." });
|
|
135
174
|
};
|
|
136
175
|
export {
|
|
137
|
-
|
|
176
|
+
lr as Demo
|
|
138
177
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/react-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
],
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@streamlayer/sl-eslib": "^5.52.0",
|
|
30
|
-
"@streamlayer/feature-gamification": "^0.18.
|
|
31
|
-
"@streamlayer/sdk-web": "^0.28.
|
|
32
|
-
"@streamlayer/sdk-web-anonymous-auth": "^0.
|
|
33
|
-
"@streamlayer/sdk-web-api": "^0.0
|
|
34
|
-
"@streamlayer/sdk-web-core": "^0.
|
|
35
|
-
"@streamlayer/sdk-web-features": "^0.10.
|
|
30
|
+
"@streamlayer/feature-gamification": "^0.18.3",
|
|
31
|
+
"@streamlayer/sdk-web": "^0.28.5",
|
|
32
|
+
"@streamlayer/sdk-web-anonymous-auth": "^0.11.0",
|
|
33
|
+
"@streamlayer/sdk-web-api": "^0.1.0",
|
|
34
|
+
"@streamlayer/sdk-web-core": "^0.16.0",
|
|
35
|
+
"@streamlayer/sdk-web-features": "^0.10.8",
|
|
36
36
|
"@streamlayer/sdk-web-interfaces": "^0.18.5",
|
|
37
37
|
"@streamlayer/sdk-web-notifications": "^0.10.4",
|
|
38
38
|
"@streamlayer/sdk-web-storage": "^0.3.7",
|
|
@@ -73,6 +73,6 @@
|
|
|
73
73
|
"vite-plugin-svgr": "^4.1.0",
|
|
74
74
|
"vite-svg-loader": "^4.0.0",
|
|
75
75
|
"vite-tsconfig-paths": "^4.2.1",
|
|
76
|
-
"@streamlayer/react": "^0.24.
|
|
76
|
+
"@streamlayer/react": "^0.24.5"
|
|
77
77
|
}
|
|
78
78
|
}
|