@streamlayer/react-ui 0.35.0 → 0.37.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/index.d.ts +13 -0
- package/lib/ui/app/Features/FeatureProvider.d.ts +9 -0
- package/lib/ui/app/Features/Gamification/Leaderboard.d.ts +5 -0
- package/lib/ui/app/Features/Gamification/Question.d.ts +7 -0
- package/lib/ui/app/Features/Gamification/QuestionsList.d.ts +6 -0
- package/lib/ui/app/Features/Gamification/Tabs.d.ts +5 -0
- package/lib/ui/app/Features/Gamification/UserSummary.d.ts +5 -0
- package/lib/ui/app/Features/Gamification/index.d.ts +7 -0
- package/lib/ui/app/Features/Highlights/Insight.d.ts +7 -0
- package/lib/ui/app/Features/Highlights/Insights.d.ts +6 -0
- package/lib/ui/app/Features/Highlights/index.d.ts +7 -0
- package/lib/ui/app/Features/index.d.ts +8 -0
- package/lib/ui/app/Navigation/MastersNavigation/index.d.ts +11 -0
- package/lib/ui/app/Navigation/MastersNavigation/index.js +11 -10
- package/lib/ui/app/Navigation/index.d.ts +9 -0
- package/lib/ui/app/Notifications/index.d.ts +5 -0
- package/lib/ui/app/masters.d.ts +14 -0
- package/lib/ui/app/{index.js → masters.js} +35 -25
- package/lib/ui/app/styles.d.ts +3 -0
- package/lib/ui/app/useMastersApp.d.ts +21 -0
- package/lib/ui/app/useMastersApp.js +47 -0
- package/lib/ui/app/useSdkFeature.d.ts +9 -0
- package/lib/ui/demo/DemoPoints.d.ts +5 -0
- package/lib/ui/demo/Gamification.d.ts +7 -0
- package/lib/ui/demo/Highlights.d.ts +7 -0
- package/lib/ui/demo/Login.d.ts +5 -0
- package/lib/ui/demo/components/EventProvider.d.ts +2 -0
- package/lib/ui/demo/components/Insight.d.ts +7 -0
- package/lib/ui/demo/components/Insights.d.ts +6 -0
- package/lib/ui/demo/components/Leaderboard.d.ts +5 -0
- package/lib/ui/demo/components/Question.d.ts +7 -0
- package/lib/ui/demo/components/QuestionsList.d.ts +6 -0
- package/lib/ui/demo/components/UserSummary.d.ts +5 -0
- package/lib/ui/demo/components/index.d.ts +7 -0
- package/lib/ui/demo/index.d.ts +5 -0
- package/lib/ui/demo/index.js +43 -51
- package/lib/ui/demo/styles.d.ts +6 -0
- package/lib/ui/gamification/common-header/index.d.ts +8 -0
- package/lib/ui/gamification/common-header/styles.d.ts +4 -0
- package/lib/ui/gamification/detailed-insight/index.d.ts +12 -0
- package/lib/ui/gamification/detailed-insight/styles.d.ts +8 -0
- package/lib/ui/gamification/insight/index.d.ts +11 -0
- package/lib/ui/gamification/insight/styles.d.ts +9 -0
- package/lib/ui/gamification/insight-list/index.d.ts +13 -0
- package/lib/ui/gamification/insight-list/styles.d.ts +3 -0
- package/lib/ui/gamification/leaderboard-invite-link/index.d.ts +8 -0
- package/lib/ui/gamification/leaderboard-invite-link/styles.d.ts +8 -0
- package/lib/ui/gamification/leaderboard-item/index.d.ts +7 -0
- package/lib/ui/gamification/leaderboard-item/styles.d.ts +10 -0
- package/lib/ui/gamification/leaderboard-item-detail/index.d.ts +7 -0
- package/lib/ui/gamification/leaderboard-item-detail/styles.d.ts +2 -0
- package/lib/ui/gamification/leaderboard-list/index.d.ts +8 -0
- package/lib/ui/gamification/leaderboard-list/styles.d.ts +2 -0
- package/lib/ui/gamification/onboarding/components/onboarding-slides/onboarding-instructions/index.d.ts +7 -0
- package/lib/ui/gamification/onboarding/components/onboarding-slides/onboarding-instructions/styles.d.ts +5 -0
- package/lib/ui/gamification/onboarding/components/onboarding-slides/onboarding-invite-card/index.d.ts +8 -0
- package/lib/ui/gamification/onboarding/components/onboarding-slides/onboarding-invite-card/styles.d.ts +8 -0
- package/lib/ui/gamification/onboarding/components/onboarding-slides/onboarding-rules/index.d.ts +8 -0
- package/lib/ui/gamification/onboarding/components/onboarding-slides/onboarding-rules/styles.d.ts +7 -0
- package/lib/ui/gamification/onboarding/index.d.ts +21 -0
- package/lib/ui/gamification/onboarding/styles.d.ts +11 -0
- package/lib/ui/gamification/points/index.d.ts +4 -0
- package/lib/ui/gamification/points/styles.d.ts +7 -0
- package/lib/ui/gamification/question/index.d.ts +5 -0
- package/lib/ui/gamification/question/styles.d.ts +12 -0
- package/lib/ui/gamification/question-list/index.d.ts +8 -0
- package/lib/ui/gamification/question-list/styles.d.ts +4 -0
- package/lib/ui/gamification/tabs/index.d.ts +17 -0
- package/lib/ui/gamification/tabs/styles.d.ts +5 -0
- package/lib/ui/gamification/user-statistics/components/rank/index.d.ts +7 -0
- package/lib/ui/gamification/user-statistics/components/rank/styles.d.ts +4 -0
- package/lib/ui/gamification/user-statistics/components/statistics/index.d.ts +7 -0
- package/lib/ui/gamification/user-statistics/components/statistics/styles.d.ts +3 -0
- package/lib/ui/gamification/user-statistics/index.d.ts +14 -0
- package/lib/ui/gamification/user-statistics/styles.d.ts +16 -0
- package/lib/ui/gamification/vote/components/voting-header/components/points/index.d.ts +6 -0
- package/lib/ui/gamification/vote/components/voting-header/components/points/styles.d.ts +6 -0
- package/lib/ui/gamification/vote/components/voting-header/components/timer/index.d.ts +8 -0
- package/lib/ui/gamification/vote/components/voting-header/components/timer/styles.d.ts +2 -0
- package/lib/ui/gamification/vote/components/voting-header/index.d.ts +12 -0
- package/lib/ui/gamification/vote/components/voting-header/styles.d.ts +11 -0
- package/lib/ui/gamification/vote/components/voting-option/index.d.ts +20 -0
- package/lib/ui/gamification/vote/components/voting-option/styles.d.ts +13 -0
- package/lib/ui/gamification/vote/index.d.ts +13 -0
- package/lib/ui/gamification/vote/styles.d.ts +9 -0
- package/lib/ui/icons/index.d.ts +43 -0
- package/lib/ui/login/index.d.ts +6 -0
- package/lib/ui/login/styles.d.ts +8 -0
- package/lib/ui/navigation/button/Channels.d.ts +4 -0
- package/lib/ui/navigation/button/FeaturedGroups.d.ts +4 -0
- package/lib/ui/navigation/button/LeaderBoard.d.ts +4 -0
- package/lib/ui/navigation/button/index.d.ts +12 -0
- package/lib/ui/navigation/button/styles.d.ts +3 -0
- package/lib/ui/navigation/index.d.ts +6 -0
- package/lib/ui/navigation/masters.d.ts +5 -0
- package/lib/ui/notifications/decorator.d.ts +4 -0
- package/lib/ui/notifications/index.d.ts +5 -0
- package/lib/ui/notifications/notification/index.d.ts +6 -0
- package/lib/ui/notifications/notification/onboarding-inapp/index.d.ts +3 -0
- package/lib/ui/notifications/notification/onboarding-inapp/styles.d.ts +12 -0
- package/lib/ui/notifications/notification/question-inapp/index.d.ts +3 -0
- package/lib/ui/notifications/notification/question-inapp/styles.d.ts +10 -0
- package/lib/ui/notifications/notification/styles.d.ts +2 -0
- package/lib/ui/notifications/styles.d.ts +2 -0
- package/lib/ui/theme/ThemeColors.d.ts +1 -0
- package/lib/ui/theme/Typography.d.ts +2 -0
- package/lib/ui/theme/constants.d.ts +79 -0
- package/lib/ui/theme/index.d.ts +5 -0
- package/lib/ui/theme/masters.d.ts +1 -0
- package/lib/ui/theme/theme.d.ts +3 -0
- package/lib/utils/createDemo.js +6 -6
- package/lib/utils/{components → debug/components}/developer.js +22 -27
- package/lib/utils/{components → debug/components}/envToggle.js +2 -0
- package/lib/utils/{components → debug/components}/styles.js +8 -0
- package/lib/utils/debug/index.js +33 -0
- package/lib/utils/debug/storage.js +52 -0
- package/package.json +27 -16
- /package/lib/utils/{components → debug/components}/bypassLogin.js +0 -0
- /package/lib/utils/{components → debug/components}/eventInput.js +0 -0
- /package/lib/utils/{components → debug/components}/sdkKey.js +0 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './ui/notifications/notification/question-inapp';
|
|
2
|
+
export * from './ui/login';
|
|
3
|
+
export * from './ui/gamification/onboarding';
|
|
4
|
+
export * from './ui/gamification/tabs';
|
|
5
|
+
export * from './ui/gamification/leaderboard-item-detail';
|
|
6
|
+
export * from './ui/gamification/question';
|
|
7
|
+
export * from './ui/gamification/question-list';
|
|
8
|
+
export * from './ui/gamification/user-statistics';
|
|
9
|
+
export * from './ui/gamification/vote';
|
|
10
|
+
export * from './ui/demo';
|
|
11
|
+
export * from './ui/gamification/points';
|
|
12
|
+
export * from './ui/theme';
|
|
13
|
+
export * from './ui/theme/theme';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Features } from '@streamlayer/sdk-web-features';
|
|
3
|
+
import { type StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
|
|
4
|
+
/** Here we check data, render loaders, load data and perform some side effects for the active feature */
|
|
5
|
+
export declare const FeatureProvider: React.FC<{
|
|
6
|
+
feature: Features;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
sdk: StreamLayerSDK;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { GamificationBackground } from '@streamlayer/feature-gamification';
|
|
3
|
+
export declare const Question: React.FC<{
|
|
4
|
+
openedQuestion: Awaited<ReturnType<GamificationBackground['openedQuestion']['getValue']>>;
|
|
5
|
+
closeQuestion: () => void;
|
|
6
|
+
vote: (questionId: string, answerId: string) => void;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Gamification } from '@streamlayer/feature-gamification';
|
|
3
|
+
export declare const QuestionsList: React.FC<{
|
|
4
|
+
store: ReturnType<Exclude<Gamification['questions'], undefined>['getStore']>;
|
|
5
|
+
openQuestion: (questionId: string) => void;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type Gamification as GamificationClass } from '@streamlayer/feature-gamification';
|
|
3
|
+
import { type StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
|
|
4
|
+
export declare const GamificationOverlay: React.FC<{
|
|
5
|
+
gamification: GamificationClass;
|
|
6
|
+
sdk: StreamLayerSDK;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Highlights } from '@streamlayer/feature-gamification';
|
|
3
|
+
export declare const Insight: React.FC<{
|
|
4
|
+
openedInsight: Exclude<Highlights['openedInsight']['value'], undefined>;
|
|
5
|
+
closeHighlights: () => void;
|
|
6
|
+
closeInsight: () => void;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Highlights } from '@streamlayer/feature-gamification';
|
|
3
|
+
import { type StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
|
|
4
|
+
export declare const HighlightsOverlay: React.FC<{
|
|
5
|
+
highlights: Highlights;
|
|
6
|
+
sdk: StreamLayerSDK;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Features } from '@streamlayer/sdk-web-features';
|
|
3
|
+
import { type StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
|
|
4
|
+
/** render feature by type */
|
|
5
|
+
export declare const ActiveFeature: React.FC<{
|
|
6
|
+
sdk: StreamLayerSDK;
|
|
7
|
+
feature: Features | null;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ChannelsButtonId } from '../../../navigation/button/Channels';
|
|
3
|
+
import { FeaturedGroupsButtonId } from '../../../navigation/button/FeaturedGroups';
|
|
4
|
+
import { LeaderBoardButtonId } from '../../../navigation/button/LeaderBoard';
|
|
5
|
+
export { ChannelsButtonId, LeaderBoardButtonId, FeaturedGroupsButtonId };
|
|
6
|
+
export type AvailableOverlays = typeof ChannelsButtonId | typeof LeaderBoardButtonId | typeof FeaturedGroupsButtonId;
|
|
7
|
+
export declare const MastersNavigation: React.FC<{
|
|
8
|
+
activeOverlay: AvailableOverlays;
|
|
9
|
+
setActiveOverlay: (overlay: AvailableOverlays) => void;
|
|
10
|
+
sdkReady: boolean;
|
|
11
|
+
}>;
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { ChannelsButton as
|
|
3
|
-
import { FeaturedGroupsButton as
|
|
4
|
-
import { LeaderBoardButton as
|
|
5
|
-
import { Navigation as
|
|
1
|
+
import { jsxs as d, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { ChannelsButton as a, ChannelsButtonId as i } from "../../../navigation/button/Channels.js";
|
|
3
|
+
import { FeaturedGroupsButton as u, FeaturedGroupsButtonId as n } from "../../../navigation/button/FeaturedGroups.js";
|
|
4
|
+
import { LeaderBoardButton as s, LeaderBoardButtonId as m } from "../../../navigation/button/LeaderBoard.js";
|
|
5
|
+
import { Navigation as e } 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
11
|
import "../../../navigation/index.js";
|
|
12
|
-
const
|
|
13
|
-
/* @__PURE__ */ r(
|
|
12
|
+
const F = ({ activeOverlay: o, setActiveOverlay: t, sdkReady: p }) => /* @__PURE__ */ d(e, { children: [
|
|
13
|
+
/* @__PURE__ */ r(a, { active: o === i, onClick: () => t(i) }),
|
|
14
14
|
/* @__PURE__ */ r(
|
|
15
|
-
|
|
15
|
+
u,
|
|
16
16
|
{
|
|
17
17
|
active: o === n,
|
|
18
|
+
disabled: !p,
|
|
18
19
|
onClick: () => {
|
|
19
20
|
t(n);
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
),
|
|
23
24
|
/* @__PURE__ */ r(
|
|
24
|
-
|
|
25
|
+
s,
|
|
25
26
|
{
|
|
26
27
|
active: o === m,
|
|
27
28
|
onClick: () => t(m)
|
|
@@ -32,5 +33,5 @@ export {
|
|
|
32
33
|
i as ChannelsButtonId,
|
|
33
34
|
n as FeaturedGroupsButtonId,
|
|
34
35
|
m as LeaderBoardButtonId,
|
|
35
|
-
|
|
36
|
+
F as MastersNavigation
|
|
36
37
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
|
|
3
|
+
import { Overlays } from '..';
|
|
4
|
+
import { ButtonProps } from '../../navigation/button';
|
|
5
|
+
export declare const SDKNavigation: React.FC<{
|
|
6
|
+
customOverlays: Overlays;
|
|
7
|
+
activeButton?: ButtonProps['id'];
|
|
8
|
+
sdk: StreamLayerSDK;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
|
|
3
|
+
export type Overlays = {};
|
|
4
|
+
export type AppChildrenProps = {
|
|
5
|
+
enableSdk: () => void;
|
|
6
|
+
disableSdk: () => void;
|
|
7
|
+
};
|
|
8
|
+
export type AppProps = {
|
|
9
|
+
sdk: StreamLayerSDK;
|
|
10
|
+
event: string;
|
|
11
|
+
overlays?: Overlays;
|
|
12
|
+
children?: (methods: AppChildrenProps) => React.ReactNode;
|
|
13
|
+
};
|
|
14
|
+
export declare const MastersApp: React.FC<AppProps>;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { FeatureType as u } from "@streamlayer/sdk-web-types";
|
|
5
|
-
import { StreamLayerThemeProvider as S } from "../theme/index.js";
|
|
6
|
-
import { mastersVariables as b } from "../theme/masters.js";
|
|
1
|
+
import { jsx as t, jsxs as e } from "react/jsx-runtime";
|
|
2
|
+
import { StreamLayerThemeProvider as u } from "../theme/index.js";
|
|
3
|
+
import { mastersVariables as f } from "../theme/masters.js";
|
|
7
4
|
import { ActiveFeature as v } from "./Features/index.js";
|
|
8
|
-
import { MastersNavigation as
|
|
9
|
-
import { SDKContainer as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { ChannelsButtonId as
|
|
13
|
-
import { LeaderBoardButtonId as
|
|
5
|
+
import { MastersNavigation as y } from "./Navigation/MastersNavigation/index.js";
|
|
6
|
+
import { SDKContainer as S, SDKScrollContainer as h } from "./styles.js";
|
|
7
|
+
import { useMastersApp as b } from "./useMastersApp.js";
|
|
8
|
+
import { useSdkFeature as k } from "./useSdkFeature.js";
|
|
9
|
+
import { ChannelsButtonId as A } from "../navigation/button/Channels.js";
|
|
10
|
+
import { LeaderBoardButtonId as a } from "../navigation/button/LeaderBoard.js";
|
|
11
|
+
import { FeaturedGroupsButtonId as B } from "../navigation/button/FeaturedGroups.js";
|
|
14
12
|
import "../theme/theme.js";
|
|
15
13
|
import "@linaria/core";
|
|
16
14
|
import "../theme/constants.js";
|
|
15
|
+
import "react";
|
|
16
|
+
import "@streamlayer/sdk-web-types";
|
|
17
17
|
import "./Features/FeatureProvider.js";
|
|
18
|
+
import "@nanostores/react";
|
|
18
19
|
import "@streamlayer/sdk-web-interfaces";
|
|
19
20
|
import "./Features/Gamification/index.js";
|
|
20
21
|
import "./Features/Gamification/Question.js";
|
|
@@ -74,21 +75,30 @@ import "../navigation/index.js";
|
|
|
74
75
|
import "../icons/index.js";
|
|
75
76
|
import "../navigation/button/index.js";
|
|
76
77
|
import "../navigation/button/styles.js";
|
|
77
|
-
const
|
|
78
|
-
const [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
78
|
+
const F = ({ sdk: o }) => {
|
|
79
|
+
const [, i] = k(o);
|
|
80
|
+
return /* @__PURE__ */ t(v, { feature: i, sdk: o });
|
|
81
|
+
}, Ur = ({ sdk: o, overlays: i, children: p, event: n }) => {
|
|
82
|
+
const { sdkEnabled: m, sdkReady: s, activeOverlay: r, activateAndLoadOverlay: d, enableSdk: l, disableSdk: c } = b(
|
|
83
|
+
o,
|
|
84
|
+
n
|
|
85
|
+
);
|
|
86
|
+
return /* @__PURE__ */ t(u, { style: { height: "100%" }, children: /* @__PURE__ */ e(S, { className: f, children: [
|
|
87
|
+
m && /* @__PURE__ */ t(
|
|
88
|
+
y,
|
|
89
|
+
{
|
|
90
|
+
sdkReady: s,
|
|
91
|
+
activeOverlay: r,
|
|
92
|
+
setActiveOverlay: d
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ e(h, { "data-nav": m.toString(), children: [
|
|
96
|
+
/* @__PURE__ */ t("div", { style: { display: !m || r === A ? "block" : "none" }, children: p && p({ enableSdk: l, disableSdk: c }) }),
|
|
97
|
+
/* @__PURE__ */ t("div", { style: { display: r === a ? "block" : "none" }, children: i && r === a && i[r] }),
|
|
98
|
+
m && r === B && /* @__PURE__ */ t(F, { sdk: o })
|
|
89
99
|
] })
|
|
90
100
|
] }) });
|
|
91
101
|
};
|
|
92
102
|
export {
|
|
93
|
-
|
|
103
|
+
Ur as MastersApp
|
|
94
104
|
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const SDKContainer: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
3
|
+
export declare const SDKScrollContainer: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
|
|
2
|
+
import { AvailableOverlays } from './Navigation/MastersNavigation';
|
|
3
|
+
/**
|
|
4
|
+
* A hook that provides functionality for managing the StreamLayerSDK in the Masters app.
|
|
5
|
+
* - On activate FG+ button, the SDK is initialized and the FG+ overlay is opened.
|
|
6
|
+
* - On activate Channels or Leaderboard button, the SDK is disabled and the FG+ overlay is closed.
|
|
7
|
+
* - On sdk status change, if sdk disabled (f.e some errors occurred), the SDK is disabled and the FG+ overlay is closed.
|
|
8
|
+
* @param sdk - The StreamLayerSDK instance to use.
|
|
9
|
+
* @param event - The name of the event to create a session for.
|
|
10
|
+
* @returns An object containing various functions and state values for managing the SDK and app overlays.
|
|
11
|
+
* @returns disableSdk - A function that disables the SDK and closes the FG+ overlay.
|
|
12
|
+
* @returns enableSdk - A function that initializes the SDK and opens the FG+ overlay.
|
|
13
|
+
*/
|
|
14
|
+
export declare const useMastersApp: (sdk: StreamLayerSDK, event: string) => {
|
|
15
|
+
sdkEnabled: boolean;
|
|
16
|
+
sdkReady: boolean;
|
|
17
|
+
activeOverlay: any;
|
|
18
|
+
activateAndLoadOverlay: (overlay: AvailableOverlays) => void;
|
|
19
|
+
enableSdk: () => void;
|
|
20
|
+
disableSdk: () => void;
|
|
21
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useStore as d } from "@nanostores/react";
|
|
2
|
+
import { useState as u, useCallback as f, useEffect as S } from "react";
|
|
3
|
+
import { FeatureType as b } from "@streamlayer/sdk-web-types";
|
|
4
|
+
import "react/jsx-runtime";
|
|
5
|
+
import { ChannelsButtonId as l } from "../navigation/button/Channels.js";
|
|
6
|
+
import { FeaturedGroupsButtonId as r } from "../navigation/button/FeaturedGroups.js";
|
|
7
|
+
import "../navigation/button/LeaderBoard.js";
|
|
8
|
+
import "../navigation/masters.js";
|
|
9
|
+
import "@linaria/react";
|
|
10
|
+
import "../icons/index.js";
|
|
11
|
+
import "../navigation/button/index.js";
|
|
12
|
+
import "../navigation/button/styles.js";
|
|
13
|
+
import "../navigation/index.js";
|
|
14
|
+
const R = (e, s) => {
|
|
15
|
+
const [m, n] = u(!1), o = d(e.status) === "ready", [a, p] = u(r), i = f(
|
|
16
|
+
(t) => {
|
|
17
|
+
p(t), t === r ? (e.createEventSession(s), e.openFeature(b.GAMES)) : e.closeFeature();
|
|
18
|
+
},
|
|
19
|
+
[s, e]
|
|
20
|
+
);
|
|
21
|
+
return S(() => {
|
|
22
|
+
!o && a === r && (p(l), e.closeFeature());
|
|
23
|
+
}, [o, a, e]), {
|
|
24
|
+
sdkEnabled: m,
|
|
25
|
+
sdkReady: o,
|
|
26
|
+
activeOverlay: a,
|
|
27
|
+
activateAndLoadOverlay: i,
|
|
28
|
+
enableSdk: () => {
|
|
29
|
+
e.initializeApp().then(({ enabled: t, err: c }) => {
|
|
30
|
+
if (n(!0), c) {
|
|
31
|
+
i(l);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (t) {
|
|
35
|
+
i(r);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
disableSdk: () => {
|
|
41
|
+
n(!1), e.disableApp();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
R as useMastersApp
|
|
47
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Features } from '@streamlayer/sdk-web-features';
|
|
2
|
+
import { type StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
|
|
3
|
+
import { FeatureType } from '@streamlayer/sdk-web-types';
|
|
4
|
+
/**
|
|
5
|
+
* A hook that manages the active feature of a StreamLayerSDK instance.
|
|
6
|
+
* @param sdk - The StreamLayerSDK instance to manage the feature for.
|
|
7
|
+
* @returns A tuple containing the active feature type and the active feature instance, or null if there is no active feature.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useSdkFeature: (sdk: StreamLayerSDK) => [FeatureType, Features | null];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
|
|
3
|
+
import type { Gamification } from '@streamlayer/feature-gamification';
|
|
4
|
+
export declare const GamificationComponent: React.FC<{
|
|
5
|
+
gamification: Gamification;
|
|
6
|
+
sdk: StreamLayerSDK;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
|
|
3
|
+
import type { Highlights } from '@streamlayer/feature-gamification';
|
|
4
|
+
export declare const HighlightsComponent: React.FC<{
|
|
5
|
+
highlights: Highlights;
|
|
6
|
+
sdk: StreamLayerSDK;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Highlights } from '@streamlayer/feature-gamification';
|
|
3
|
+
export declare const Insight: React.FC<{
|
|
4
|
+
openedInsight: Exclude<Highlights['openedInsight']['value'], undefined>;
|
|
5
|
+
closeHighlights: () => void;
|
|
6
|
+
closeInsight: () => void;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { GamificationBackground } from '@streamlayer/feature-gamification';
|
|
3
|
+
export declare const Question: React.FC<{
|
|
4
|
+
openedQuestion: Awaited<ReturnType<GamificationBackground['openedQuestion']['getValue']>>;
|
|
5
|
+
closeQuestion: () => void;
|
|
6
|
+
vote: (questionId: string, answerId: string) => void;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Gamification } from '@streamlayer/feature-gamification';
|
|
3
|
+
export declare const QuestionsList: React.FC<{
|
|
4
|
+
store: ReturnType<Exclude<Gamification['questions'], undefined>['getStore']>;
|
|
5
|
+
openQuestion: (questionId: string) => void;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { UserSummary } from './UserSummary';
|
|
2
|
+
export { QuestionsList } from './QuestionsList';
|
|
3
|
+
export { Question } from './Question';
|
|
4
|
+
export { Onboarding } from '../../gamification/onboarding';
|
|
5
|
+
export { Insights } from './Insights';
|
|
6
|
+
export { Insight } from './Insight';
|
|
7
|
+
export { Leaderboard } from './Leaderboard';
|
package/lib/ui/demo/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { FeatureStatus as
|
|
1
|
+
import { jsx as i, jsxs as f, Fragment as v } from "react/jsx-runtime";
|
|
2
|
+
import { FeatureStatus as l } from "@streamlayer/sdk-web-interfaces";
|
|
3
3
|
import { FeatureType as g } from "@streamlayer/sdk-web-types";
|
|
4
|
-
import { AvailableFeatures as
|
|
5
|
-
import { useState as
|
|
4
|
+
import { AvailableFeatures as S } from "@streamlayer/sdk-web-features";
|
|
5
|
+
import { useState as b, useMemo as h, useEffect as C } from "react";
|
|
6
6
|
import "@streamlayer/sdk-web-storage";
|
|
7
7
|
import "@streamlayer/sdk-web-api";
|
|
8
8
|
import { useStore as c } from "@nanostores/react";
|
|
9
|
-
import { Notifications as
|
|
10
|
-
import { GamificationComponent as
|
|
11
|
-
import { HighlightsComponent as
|
|
12
|
-
import { LoginComponent as
|
|
13
|
-
import { Buttons as
|
|
9
|
+
import { Notifications as F } from "../notifications/index.js";
|
|
10
|
+
import { GamificationComponent as w } from "./Gamification.js";
|
|
11
|
+
import { HighlightsComponent as G } from "./Highlights.js";
|
|
12
|
+
import { LoginComponent as H } from "./Login.js";
|
|
13
|
+
import { Buttons as x, Button as s } from "./styles.js";
|
|
14
14
|
import "../notifications/notification/index.js";
|
|
15
15
|
import "@streamlayer/sdk-web-notifications";
|
|
16
16
|
import "../notifications/notification/onboarding-inapp/index.js";
|
|
@@ -87,62 +87,54 @@ import "@connectrpc/connect";
|
|
|
87
87
|
import "@connectrpc/connect-web";
|
|
88
88
|
import "@streamlayer/sl-eslib/users/users_connect";
|
|
89
89
|
import "../login/styles.js";
|
|
90
|
-
|
|
91
|
-
(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const i = (l == null ? void 0 : l.data) || (a == null ? void 0 : a.data);
|
|
101
|
-
return i != null && i.overlays ? i.overlays : [];
|
|
102
|
-
}, [a, l]);
|
|
103
|
-
F(() => {
|
|
104
|
-
const i = r.getFeatures();
|
|
105
|
-
if (t)
|
|
106
|
-
for (const [m, p] of i)
|
|
107
|
-
m === t ? p.status.get() === f.Suspended && (p.enable(), n(p)) : p.status.get() === f.Ready && p.disable();
|
|
90
|
+
const A = ({ activeFeature: r, sdk: o }) => {
|
|
91
|
+
const [e, n] = b(null), { organizationSettings: a, streamSettings: u } = c(o.sdkStore), y = h(() => {
|
|
92
|
+
const t = (u == null ? void 0 : u.data) || (a == null ? void 0 : a.data);
|
|
93
|
+
return t != null && t.overlays ? t.overlays : [];
|
|
94
|
+
}, [a, u]);
|
|
95
|
+
C(() => {
|
|
96
|
+
const t = o.getFeatures();
|
|
97
|
+
if (r)
|
|
98
|
+
for (const [m, p] of t)
|
|
99
|
+
m === r ? p.status.get() === l.Suspended && (p.enable(), n(p)) : p.status.get() === l.Ready && p.disable();
|
|
108
100
|
else {
|
|
109
|
-
for (const [, m] of
|
|
110
|
-
m.status.get() ===
|
|
101
|
+
for (const [, m] of t)
|
|
102
|
+
m.status.get() === l.Ready && m.disable();
|
|
111
103
|
n(null);
|
|
112
104
|
}
|
|
113
105
|
return () => {
|
|
114
|
-
for (const [, m] of
|
|
115
|
-
m.status.get() ===
|
|
106
|
+
for (const [, m] of t)
|
|
107
|
+
m.status.get() === l.Ready && m.disable();
|
|
116
108
|
};
|
|
117
|
-
}, [
|
|
118
|
-
const d = h(() => e ? e.featureConfig.get().type === g.GAMES ? e ? /* @__PURE__ */
|
|
119
|
-
return /* @__PURE__ */
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
/* @__PURE__ */
|
|
122
|
-
/* @__PURE__ */
|
|
123
|
-
|
|
109
|
+
}, [r, o]);
|
|
110
|
+
const d = h(() => e ? e.featureConfig.get().type === g.GAMES ? e ? /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(w, { gamification: e, sdk: o }) }) : /* @__PURE__ */ i("div", { children: "wait gamification..." }) : e.featureConfig.get().type === g.HIGHLIGHTS ? e ? /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(G, { highlights: e, sdk: o }) }) : /* @__PURE__ */ i("div", { children: "wait highlights..." }) : /* @__PURE__ */ i("div", { children: "unknown feature" }) : null, [o, e]);
|
|
111
|
+
return /* @__PURE__ */ f("div", { children: [
|
|
112
|
+
/* @__PURE__ */ f(x, { children: [
|
|
113
|
+
/* @__PURE__ */ i(s, { onClick: () => o.closeFeature(), disabled: !d, children: "close" }),
|
|
114
|
+
/* @__PURE__ */ i(s, { onClick: () => o.logout(), children: "logout" }),
|
|
115
|
+
y.map((t) => /* @__PURE__ */ f(
|
|
124
116
|
s,
|
|
125
117
|
{
|
|
126
|
-
onClick: () =>
|
|
127
|
-
disabled: !(
|
|
128
|
-
"data-enable_sdk_button":
|
|
129
|
-
"data-selected":
|
|
118
|
+
onClick: () => o.openFeature(t.type),
|
|
119
|
+
disabled: !(t.type in S),
|
|
120
|
+
"data-enable_sdk_button": t.enableSdkButton.toString(),
|
|
121
|
+
"data-selected": t.type === r,
|
|
130
122
|
children: [
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
|
|
123
|
+
/* @__PURE__ */ i("img", { src: t.icon, alt: "" }),
|
|
124
|
+
t.name
|
|
133
125
|
]
|
|
134
126
|
},
|
|
135
|
-
|
|
127
|
+
t.name
|
|
136
128
|
))
|
|
137
129
|
] }),
|
|
138
130
|
d
|
|
139
131
|
] });
|
|
140
|
-
}, ui = ({ sdk:
|
|
141
|
-
const
|
|
142
|
-
return
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
] }) : /* @__PURE__ */
|
|
132
|
+
}, ui = ({ sdk: r }) => {
|
|
133
|
+
const o = c(r.organizationStore()), e = c(r.getUserStore()), n = c(r.getActiveFeature());
|
|
134
|
+
return o.loading ? /* @__PURE__ */ i("div", { children: "authentication..." }) : o.data ? e.loading ? /* @__PURE__ */ i("div", { children: "authentication..." }) : e.data ? /* @__PURE__ */ f(v, { children: [
|
|
135
|
+
/* @__PURE__ */ i(F, { notificationsStore: r.getNotificationsStore() }),
|
|
136
|
+
/* @__PURE__ */ i(A, { sdk: r, activeFeature: n })
|
|
137
|
+
] }) : /* @__PURE__ */ i(H, { sdk: r }) : /* @__PURE__ */ i("div", { children: "wrong sdk key..." });
|
|
146
138
|
};
|
|
147
139
|
export {
|
|
148
140
|
ui as Demo
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const DemoContainer: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
3
|
+
export declare const UserStatisticsContainer: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
4
|
+
export declare const QuestionsContainer: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
5
|
+
export declare const Buttons: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
6
|
+
export declare const Button: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown>>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Container: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
3
|
+
export declare const Button: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown>>;
|
|
4
|
+
export declare const HeaderIcon: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLImageElement> & import("react").ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown>>;
|