@streamlayer/react-ui 0.91.1 → 0.93.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/assets/style.css +1 -1
- package/lib/index-keh7OLCY.js +67 -0
- package/lib/index.js +5 -4
- package/lib/ui/app/Features/Gamification/Friends.d.ts +2 -1
- package/lib/ui/app/Features/Gamification/Friends.js +6 -6
- package/lib/ui/app/Features/Gamification/Leaderboard.d.ts +3 -2
- package/lib/ui/app/Features/Gamification/Leaderboard.js +26 -24
- package/lib/ui/app/Features/Gamification/Question.js +1 -1
- package/lib/ui/app/Features/Gamification/Tabs.d.ts +7 -2
- package/lib/ui/app/Features/Gamification/Tabs.js +42 -31
- package/lib/ui/app/Features/Gamification/gamification-feature.js +5 -2
- package/lib/ui/app/Features/Gamification/index.d.ts +6 -2
- package/lib/ui/app/Features/Gamification/index.js +86 -45
- package/lib/ui/app/Features/index.d.ts +6 -2
- package/lib/ui/app/Features/index.js +13 -11
- package/lib/ui/app/Navigation/MastersNavigation/index.d.ts +3 -2
- package/lib/ui/app/Navigation/MastersNavigation/index.js +37 -31
- package/lib/ui/app/Navigation/index.js +6 -7
- package/lib/ui/app/Notifications/Onboarding/index.d.ts +2 -1
- package/lib/ui/app/Notifications/Onboarding/index.js +91 -73
- package/lib/ui/app/Notifications/index.d.ts +6 -2
- package/lib/ui/app/Notifications/index.js +120 -91
- package/lib/ui/app/Points/index.js +6 -5
- package/lib/ui/app/masters.d.ts +7 -0
- package/lib/ui/app/masters.js +73 -51
- package/lib/ui/app/styles.d.ts +1 -0
- package/lib/ui/app/styles.js +6 -1
- package/lib/ui/app/useClipboardCopy.d.ts +2 -1
- package/lib/ui/app/useImagesPreload.d.ts +4 -0
- package/lib/ui/app/useImagesPreload.js +23 -0
- package/lib/ui/app/useMastersApp.js +15 -14
- package/lib/ui/app/useSdkResponsive.d.ts +14 -0
- package/lib/ui/app/useSdkResponsive.js +46 -0
- package/lib/ui/app/useSdkScroll.d.ts +4 -1
- package/lib/ui/app/useSdkScroll.js +36 -85
- package/lib/ui/gamification/detail/header/index.js +11 -11
- package/lib/ui/gamification/detail/header/styles.d.ts +1 -1
- package/lib/ui/gamification/detail/header/styles.js +11 -11
- package/lib/ui/gamification/leaderboard/static.d.ts +2 -1
- package/lib/ui/gamification/onboarding/index.d.ts +5 -0
- package/lib/ui/gamification/onboarding/index.js +69 -42
- package/lib/ui/gamification/onboarding/invitingUser/index.d.ts +7 -0
- package/lib/ui/gamification/onboarding/invitingUser/index.js +16 -0
- package/lib/ui/gamification/onboarding/invitingUser/styles.d.ts +5 -0
- package/lib/ui/gamification/onboarding/invitingUser/styles.js +24 -0
- package/lib/ui/gamification/onboarding/slides/onboarding-instructions/index.d.ts +1 -1
- package/lib/ui/gamification/onboarding/slides/onboarding-instructions/index.js +15 -13
- package/lib/ui/gamification/onboarding/slides/onboarding-instructions/styles.d.ts +1 -1
- package/lib/ui/gamification/onboarding/slides/onboarding-instructions/styles.js +9 -9
- package/lib/ui/gamification/onboarding/slides/onboarding-invite-card/index.d.ts +2 -1
- package/lib/ui/gamification/onboarding/slides/onboarding-invite-card/index.js +1 -1
- package/lib/ui/gamification/onboarding/slides/onboarding-rules/index.d.ts +2 -0
- package/lib/ui/gamification/onboarding/slides/onboarding-rules/index.js +18 -12
- package/lib/ui/gamification/onboarding/slides/onboarding-terms/index.d.ts +7 -0
- package/lib/ui/gamification/onboarding/slides/onboarding-terms/index.js +10 -0
- package/lib/ui/gamification/onboarding/slides/onboarding-terms/styles.d.ts +5 -0
- package/lib/ui/gamification/onboarding/slides/onboarding-terms/styles.js +24 -0
- package/lib/ui/gamification/points/index.js +5 -4
- package/lib/ui/gamification/question/insight/index.js +5 -5
- package/lib/ui/gamification/question/notification/prediction-result/animation-lines/index.js +17 -17
- package/lib/ui/gamification/question/notification/prediction-result/index.js +37 -39
- package/lib/ui/gamification/question/notification/prediction-result/styles.d.ts +1 -1
- package/lib/ui/gamification/question/notification/prediction-result/styles.js +12 -12
- package/lib/ui/gamification/vote/index.js +55 -54
- package/lib/ui/gamification/vote/insight-details/index.js +1 -1
- package/lib/ui/gamification/vote/styles.d.ts +1 -0
- package/lib/ui/gamification/vote/styles.js +17 -11
- package/lib/ui/gamification/vote/vote-option/index.js +62 -58
- package/lib/ui/gamification/vote/win-bar/index.d.ts +1 -0
- package/lib/ui/gamification/vote/win-bar/index.js +21 -20
- package/lib/ui/navigation/button/LeaderBoard.js +5 -6
- package/lib/ui/navigation/index.js +6 -7
- package/lib/ui/navigation/masters.d.ts +2 -1
- package/lib/ui/navigation/masters.js +9 -6
- package/lib/ui/questions/insight/index.d.ts +1 -1
- package/lib/ui/questions/insight/index.js +18 -25
- package/lib/ui/skeleton/index.d.ts +7 -0
- package/lib/ui/skeleton/index.js +7 -0
- package/lib/ui/skeleton/styles.d.ts +2 -0
- package/lib/ui/skeleton/styles.js +9 -0
- package/lib/ui/theme/breakpoints.d.ts +4 -1
- package/lib/ui/theme/breakpoints.js +24 -12
- package/lib/ui/theme/constants.d.ts +4 -0
- package/lib/ui/theme/constants.js +6 -2
- package/lib/ui/theme/index.js +4 -3
- package/lib/ui/theme/theme.js +29 -21
- package/lib/utils/createDemo.js +12 -13
- package/lib/utils/debug/components/copyLogs.js +10 -9
- package/lib/utils/decorators/container.js +4 -3
- package/package.json +18 -18
- package/lib/LeaderBoard_fzzlxb-w40geAFS.js +0 -1
- package/lib/index_ej4hfx-w40geAFS.js +0 -1
- package/lib/masters_m6itlr-w40geAFS.js +0 -1
- package/lib/utils/useStreamLayerApp.js +0 -25
package/lib/ui/app/masters.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { jsxs as c, jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { resetCss as
|
|
4
|
-
import { ActiveFeature as
|
|
5
|
-
import { MastersNavigation as
|
|
6
|
-
import { SDKNotifications as
|
|
7
|
-
import { SDKContainer as
|
|
8
|
-
import { useMastersApp as
|
|
9
|
-
import { useSdkFeature as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
1
|
+
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as f, useEffect as N } from "react";
|
|
3
|
+
import { resetCss as u } from "../theme/theme.js";
|
|
4
|
+
import { ActiveFeature as A } from "./Features/index.js";
|
|
5
|
+
import { MastersNavigation as C } from "./Navigation/MastersNavigation/index.js";
|
|
6
|
+
import { SDKNotifications as I } from "./Notifications/index.js";
|
|
7
|
+
import { SDKContainer as x, SDKScrollContainer as B } from "./styles.js";
|
|
8
|
+
import { useMastersApp as F } from "./useMastersApp.js";
|
|
9
|
+
import { useSdkFeature as j } from "./useSdkFeature.js";
|
|
10
|
+
import { useSdkResponsive as k } from "./useSdkResponsive.js";
|
|
11
|
+
import { useSdkScroll as D } from "./useSdkScroll.js";
|
|
12
|
+
import { ChannelsButtonId as E } from "../navigation/button/Channels.js";
|
|
13
|
+
import { LeaderBoardButtonId as K } from "../navigation/button/LeaderBoard.js";
|
|
14
|
+
import { FeaturedGroupsButtonId as L } from "../navigation/button/FeaturedGroups.js";
|
|
15
|
+
import "../theme/breakpoints.js";
|
|
14
16
|
import "../theme/constants.js";
|
|
15
17
|
import "@streamlayer/sdk-web-types";
|
|
16
18
|
import "./Features/FeatureProvider.js";
|
|
@@ -19,12 +21,12 @@ import "@streamlayer/sdk-web-interfaces";
|
|
|
19
21
|
import "../navigation/masters.js";
|
|
20
22
|
import "@linaria/react";
|
|
21
23
|
import "../navigation/index.js";
|
|
22
|
-
import "
|
|
23
|
-
import "
|
|
24
|
+
import "../icons/index.js";
|
|
25
|
+
import "../navigation/button/index.js";
|
|
26
|
+
import "../navigation/button/styles.js";
|
|
24
27
|
import "../../useClipboardCopy-E5rEe6It.js";
|
|
25
28
|
import "../../index-uEuzH3jr.js";
|
|
26
29
|
import "../gamification/copyNotification/index.js";
|
|
27
|
-
import "../icons/index.js";
|
|
28
30
|
import "../gamification/copyNotification/styles.js";
|
|
29
31
|
import "@streamlayer/sdk-web-notifications";
|
|
30
32
|
import "../gamification/constants.js";
|
|
@@ -41,20 +43,27 @@ import "../questions/twitter/account/styles.js";
|
|
|
41
43
|
import "../questions/twitter/styles.js";
|
|
42
44
|
import "../gamification/question/notification/tweet/styles.js";
|
|
43
45
|
import "../gamification/question/notification/prediction-result/index.js";
|
|
46
|
+
import "../animated-counter/index.js";
|
|
47
|
+
import "react-countup";
|
|
44
48
|
import "../gamification/question/notification/prediction-result/animation-lines/index.js";
|
|
45
49
|
import "../gamification/question/notification/prediction-result/animation-lines/styles.js";
|
|
46
50
|
import "../gamification/question/notification/prediction-result/styles.js";
|
|
47
51
|
import "../show-in/index.js";
|
|
48
52
|
import "@linaria/core";
|
|
49
53
|
import "./Notifications/Onboarding/index.js";
|
|
54
|
+
import "./useImagesPreload.js";
|
|
50
55
|
import "../gamification/onboarding/index.js";
|
|
51
56
|
import "react-virtualized-auto-sizer";
|
|
57
|
+
import "../skeleton/index.js";
|
|
58
|
+
import "../skeleton/styles.js";
|
|
52
59
|
import "../gamification/onboarding/slides/onboarding-instructions/index.js";
|
|
53
60
|
import "../gamification/onboarding/slides/onboarding-instructions/styles.js";
|
|
54
61
|
import "../gamification/onboarding/slides/onboarding-invite-card/index.js";
|
|
55
62
|
import "../gamification/onboarding/slides/onboarding-invite-card/styles.js";
|
|
56
63
|
import "../gamification/onboarding/slides/onboarding-rules/index.js";
|
|
57
64
|
import "../gamification/onboarding/slides/onboarding-rules/styles.js";
|
|
65
|
+
import "../gamification/onboarding/slides/onboarding-terms/index.js";
|
|
66
|
+
import "../gamification/onboarding/slides/onboarding-terms/styles.js";
|
|
58
67
|
import "../gamification/onboarding/styles.js";
|
|
59
68
|
import "../button/index.js";
|
|
60
69
|
import "../button/styles.js";
|
|
@@ -63,55 +72,68 @@ import "./Notifications/Onboarding/Notification/styles.js";
|
|
|
63
72
|
import "./Notifications/styles.js";
|
|
64
73
|
import "../gamification/question/notification/pill/index.js";
|
|
65
74
|
import "../gamification/question/notification/pill/styles.js";
|
|
66
|
-
import "../navigation/button/styles.js";
|
|
67
|
-
import "../../LeaderBoard_fzzlxb-w40geAFS.js";
|
|
68
|
-
import "../navigation/button/index.js";
|
|
69
75
|
import "lodash.throttle";
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
76
|
+
import "../../index-keh7OLCY.js";
|
|
77
|
+
const M = ({ sdk: r, className: s, scrollStore: n, appNode: t, scrollNode: i, headerNode: m, responsiveStore: p }) => {
|
|
78
|
+
const [, a] = j(r);
|
|
79
|
+
return /* @__PURE__ */ o(
|
|
80
|
+
A,
|
|
74
81
|
{
|
|
75
|
-
className:
|
|
76
|
-
scrollNode:
|
|
77
|
-
appNode:
|
|
78
|
-
scrollStore:
|
|
79
|
-
feature:
|
|
80
|
-
|
|
82
|
+
className: s,
|
|
83
|
+
scrollNode: i,
|
|
84
|
+
appNode: t,
|
|
85
|
+
scrollStore: n,
|
|
86
|
+
feature: a,
|
|
87
|
+
headerNode: m,
|
|
88
|
+
responsiveStore: p,
|
|
89
|
+
sdk: r
|
|
81
90
|
}
|
|
82
91
|
);
|
|
83
|
-
},
|
|
84
|
-
const
|
|
85
|
-
return
|
|
92
|
+
}, or = ({ sdk: r, overlays: s, children: n }) => {
|
|
93
|
+
const t = f(null), i = f(null), [m] = k(t), [p, a] = D(t, m), { sdkEnabled: d, sdkReady: l, activeOverlay: e, activateAndLoadOverlay: v, activateEventWithId: S, deactivate: h, isLogged: g } = F(r);
|
|
94
|
+
return N(() => {
|
|
86
95
|
import("./Features/Gamification/gamification-feature.js");
|
|
87
|
-
}, []), /* @__PURE__ */ c(
|
|
88
|
-
|
|
89
|
-
|
|
96
|
+
}, []), /* @__PURE__ */ c(x, { ref: t, children: [
|
|
97
|
+
d && /* @__PURE__ */ o(
|
|
98
|
+
C,
|
|
90
99
|
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
100
|
+
ref: i,
|
|
101
|
+
sdkReady: l,
|
|
102
|
+
activeOverlay: e,
|
|
103
|
+
className: u,
|
|
104
|
+
setActiveOverlay: (y) => v("", y)
|
|
95
105
|
}
|
|
96
106
|
),
|
|
97
|
-
/* @__PURE__ */ c(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
107
|
+
/* @__PURE__ */ c(B, { ref: p, "data-nav": d.toString(), children: [
|
|
108
|
+
l && /* @__PURE__ */ o(
|
|
109
|
+
I,
|
|
110
|
+
{
|
|
111
|
+
sdk: r,
|
|
112
|
+
scrollNode: p,
|
|
113
|
+
headerNode: i,
|
|
114
|
+
appNode: t,
|
|
115
|
+
scrollStore: a,
|
|
116
|
+
responsiveStore: m
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
/* @__PURE__ */ o("div", { style: !d || e === E ? {} : { display: "none" }, children: n && n({ activateEventWithId: S, deactivate: h }) }),
|
|
120
|
+
s && e === K && s[e],
|
|
121
|
+
l && e === L && /* @__PURE__ */ o(
|
|
122
|
+
M,
|
|
103
123
|
{
|
|
104
124
|
scrollStore: a,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
125
|
+
responsiveStore: m,
|
|
126
|
+
scrollNode: p,
|
|
127
|
+
appNode: t,
|
|
128
|
+
headerNode: i,
|
|
129
|
+
className: u,
|
|
130
|
+
sdk: r
|
|
109
131
|
}
|
|
110
132
|
)
|
|
111
133
|
] }),
|
|
112
|
-
!
|
|
134
|
+
d && !g && /* @__PURE__ */ o("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "100%" }, children: "You are not logged in." })
|
|
113
135
|
] });
|
|
114
136
|
};
|
|
115
137
|
export {
|
|
116
|
-
|
|
138
|
+
or as MastersApp
|
|
117
139
|
};
|
package/lib/ui/app/styles.d.ts
CHANGED
|
@@ -12,3 +12,4 @@ export declare const LeaderboardContainer: import("@linaria/react").WYWEvalMeta
|
|
|
12
12
|
export declare const TabsNavContainer: import("@linaria/react").WYWEvalMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
|
|
13
13
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
14
14
|
}>;
|
|
15
|
+
export declare const UserSummaryContainer: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
package/lib/ui/app/styles.js
CHANGED
|
@@ -27,6 +27,10 @@ const i = /* @__PURE__ */ s("div")({
|
|
|
27
27
|
name: "TabsNavContainer",
|
|
28
28
|
class: "tvdam54",
|
|
29
29
|
propsAsIs: !0
|
|
30
|
+
}), m = /* @__PURE__ */ s("div")({
|
|
31
|
+
name: "UserSummaryContainer",
|
|
32
|
+
class: "u14fk93k",
|
|
33
|
+
propsAsIs: !1
|
|
30
34
|
});
|
|
31
35
|
export {
|
|
32
36
|
l as LeaderboardContainer,
|
|
@@ -35,5 +39,6 @@ export {
|
|
|
35
39
|
c as SDKScrollContainer,
|
|
36
40
|
n as SDKWhiteContainer,
|
|
37
41
|
p as TabsContainer,
|
|
38
|
-
C as TabsNavContainer
|
|
42
|
+
C as TabsNavContainer,
|
|
43
|
+
m as UserSummaryContainer
|
|
39
44
|
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { HeaderNodeRef, type AppNodeRef } from './masters';
|
|
3
|
+
export declare const useClipboardCopy: (renderToNode: AppNodeRef | HeaderNodeRef) => [(link: string | undefined) => Promise<void>, import("react").ReactPortal | null];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useState as u, useRef as T, useCallback as c, useEffect as p } from "react";
|
|
2
|
+
const I = (e) => {
|
|
3
|
+
const [i, r] = u(!1), [f, s] = u(!1), t = T(null), a = c(() => {
|
|
4
|
+
s(!0), t.current && clearTimeout(t.current), t.current = setTimeout(() => {
|
|
5
|
+
s(!1);
|
|
6
|
+
}, 1e3);
|
|
7
|
+
}, []), l = c(async (m) => {
|
|
8
|
+
r(!0);
|
|
9
|
+
const d = m.map(
|
|
10
|
+
(n) => new Promise((g, h) => {
|
|
11
|
+
const o = new Image();
|
|
12
|
+
o.onload = () => g(n), o.onerror = () => h(), o.src = n;
|
|
13
|
+
})
|
|
14
|
+
);
|
|
15
|
+
await Promise.allSettled(d), r(!1);
|
|
16
|
+
}, []);
|
|
17
|
+
return p(() => {
|
|
18
|
+
e && (a(), l(e));
|
|
19
|
+
}, [e, a, l]), { loading: i, throttled: f };
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
I as useImagesPreload
|
|
23
|
+
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { useStore as
|
|
1
|
+
import { useStore as l } from "@nanostores/react";
|
|
2
2
|
import { useRef as h, useState as d, useCallback as F, useEffect as v } from "react";
|
|
3
3
|
import { FeatureType as y } from "@streamlayer/sdk-web-types";
|
|
4
|
-
import "
|
|
5
|
-
import { ChannelsButtonId as c } from "../navigation/button/Channels.js";
|
|
4
|
+
import "./Navigation/MastersNavigation/index.js";
|
|
6
5
|
import { FeaturedGroupsButtonId as n } from "../navigation/button/FeaturedGroups.js";
|
|
6
|
+
import { ChannelsButtonId as c } from "../navigation/button/Channels.js";
|
|
7
|
+
import "react/jsx-runtime";
|
|
8
|
+
import "../navigation/button/LeaderBoard.js";
|
|
7
9
|
import "@linaria/react";
|
|
8
10
|
import "../icons/index.js";
|
|
9
|
-
import "../navigation/button/styles.js";
|
|
10
|
-
import "../../LeaderBoard_fzzlxb-w40geAFS.js";
|
|
11
|
-
import "../../index_ej4hfx-w40geAFS.js";
|
|
12
|
-
import "../../masters_m6itlr-w40geAFS.js";
|
|
13
11
|
import "../navigation/button/index.js";
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
import "../navigation/button/styles.js";
|
|
13
|
+
import "../navigation/masters.js";
|
|
14
|
+
import "../navigation/index.js";
|
|
15
|
+
const W = (t) => {
|
|
16
|
+
const a = h(""), [m, f] = d(!1), A = l(t.status), r = l(t.userId()), i = A === "ready", [s, u] = d(n), p = F(
|
|
16
17
|
(e, o) => {
|
|
17
18
|
u(o), o === n ? (e && t.createEventSession(e), window.requestAnimationFrame(() => {
|
|
18
19
|
t.openFeature(y.GAMES);
|
|
@@ -24,7 +25,7 @@ const U = (t) => {
|
|
|
24
25
|
!i && s === n && (u(c), t.closeFeature(!0));
|
|
25
26
|
}, [i, s, t]);
|
|
26
27
|
const S = (e) => {
|
|
27
|
-
a.current = e,
|
|
28
|
+
a.current = e, f(!0), t.initializeApp({ skipOrganizationSettings: !0 }).then(({ enabled: o, err: b }) => {
|
|
28
29
|
if (b) {
|
|
29
30
|
p(e, c);
|
|
30
31
|
return;
|
|
@@ -41,18 +42,18 @@ const U = (t) => {
|
|
|
41
42
|
}
|
|
42
43
|
});
|
|
43
44
|
}, E = () => {
|
|
44
|
-
|
|
45
|
+
f(!1), t.disableApp();
|
|
45
46
|
};
|
|
46
47
|
return v(() => {
|
|
47
48
|
if (!r) {
|
|
48
49
|
i && (u(c), t.disableApp());
|
|
49
50
|
return;
|
|
50
51
|
}
|
|
51
|
-
r && a.current &&
|
|
52
|
+
r && a.current && m && t.initializeApp({ skipOrganizationSettings: !0 }).then(() => {
|
|
52
53
|
t.createEventSession(a.current);
|
|
53
54
|
});
|
|
54
55
|
}, [r]), {
|
|
55
|
-
sdkEnabled:
|
|
56
|
+
sdkEnabled: m,
|
|
56
57
|
sdkReady: i,
|
|
57
58
|
activeOverlay: s,
|
|
58
59
|
activateAndLoadOverlay: p,
|
|
@@ -62,5 +63,5 @@ const U = (t) => {
|
|
|
62
63
|
};
|
|
63
64
|
};
|
|
64
65
|
export {
|
|
65
|
-
|
|
66
|
+
W as useMastersApp
|
|
66
67
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MapStore } from 'nanostores';
|
|
2
|
+
import { BREAKPOINTS } from '../theme/constants';
|
|
3
|
+
type BREAKPOINTS_KEYS = keyof typeof BREAKPOINTS;
|
|
4
|
+
type ResponsiveData = {
|
|
5
|
+
screen: {
|
|
6
|
+
name: BREAKPOINTS_KEYS;
|
|
7
|
+
size: (typeof BREAKPOINTS)[BREAKPOINTS_KEYS];
|
|
8
|
+
};
|
|
9
|
+
sdkInView?: boolean;
|
|
10
|
+
sdkInScrollView?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type ResponsiveStore = MapStore<ResponsiveData>;
|
|
13
|
+
export declare const useSdkResponsive: (appNode: AppNodeRef) => [ResponsiveStore];
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import c from "lodash.throttle";
|
|
2
|
+
import { useState as m, useEffect as k } from "react";
|
|
3
|
+
import { BREAKPOINTS as s } from "../theme/constants.js";
|
|
4
|
+
import { m as u } from "../../index-keh7OLCY.js";
|
|
5
|
+
import "../../index-uEuzH3jr.js";
|
|
6
|
+
const d = Object.keys(s), i = () => {
|
|
7
|
+
const n = window.innerWidth;
|
|
8
|
+
let e = "sm";
|
|
9
|
+
for (let t = d.length - 1; t > 0; t--) {
|
|
10
|
+
const r = d[t];
|
|
11
|
+
if (!(n < s[r]) && n >= s[r]) {
|
|
12
|
+
e = r;
|
|
13
|
+
break;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
name: e,
|
|
18
|
+
size: s[e]
|
|
19
|
+
};
|
|
20
|
+
}, w = (n) => {
|
|
21
|
+
var e;
|
|
22
|
+
return (((e = n.current) == null ? void 0 : e.getBoundingClientRect().y) || 0) < -68;
|
|
23
|
+
}, l = (n) => n >= s.xl, I = (n) => {
|
|
24
|
+
const [e] = m(() => {
|
|
25
|
+
const t = i();
|
|
26
|
+
return u({
|
|
27
|
+
screen: i(),
|
|
28
|
+
sdkInView: w(n),
|
|
29
|
+
sdkInScrollView: l(t.size)
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
return k(() => {
|
|
33
|
+
const t = c(() => {
|
|
34
|
+
e.setKey("sdkInView", w(n));
|
|
35
|
+
}, 200), r = c(() => {
|
|
36
|
+
const o = i();
|
|
37
|
+
e.setKey("screen", o), e.setKey("sdkInScrollView", l(o.size));
|
|
38
|
+
}, 200);
|
|
39
|
+
return window.addEventListener("scroll", t), window.addEventListener("resize", r), () => {
|
|
40
|
+
window.removeEventListener("scroll", t), window.removeEventListener("resize", r);
|
|
41
|
+
};
|
|
42
|
+
}, [e, n]), [e];
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
I as useSdkResponsive
|
|
46
|
+
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { MapStore } from 'nanostores';
|
|
2
|
+
import { type ScrollNodeRef } from './masters';
|
|
3
|
+
import { type ResponsiveStore } from './useSdkResponsive';
|
|
2
4
|
type ScrollData = {
|
|
3
5
|
scrollPosition: number;
|
|
4
6
|
tabsShown?: boolean;
|
|
5
7
|
scrollDirection: 'forward' | 'backward';
|
|
6
8
|
};
|
|
7
9
|
export type ScrollStore = MapStore<ScrollData>;
|
|
8
|
-
export declare const
|
|
10
|
+
export declare const scrollIntoAppView: (appNode: AppNodeRef, options?: ScrollIntoViewOptions) => void;
|
|
11
|
+
export declare const useSdkScroll: (appNode: AppNodeRef, responsiveStore: ResponsiveStore) => [ScrollNodeRef, ScrollStore];
|
|
9
12
|
export {};
|
|
@@ -1,93 +1,44 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return e.lc = l.push(o, s || e.l) / 2, () => {
|
|
14
|
-
let t = l.indexOf(o);
|
|
15
|
-
~t && (l.splice(t, 2), --e.lc || e.off());
|
|
16
|
-
};
|
|
17
|
-
},
|
|
18
|
-
notify(o) {
|
|
19
|
-
let s = !n.length;
|
|
20
|
-
for (let t = 0; t < l.length; t += 2)
|
|
21
|
-
n.push(
|
|
22
|
-
l[t],
|
|
23
|
-
l[t + 1],
|
|
24
|
-
e.value,
|
|
25
|
-
o
|
|
26
|
-
);
|
|
27
|
-
if (s) {
|
|
28
|
-
for (let t = 0; t < n.length; t += 4) {
|
|
29
|
-
let c;
|
|
30
|
-
for (let u = t + 1; !c && (u += 4) < n.length; )
|
|
31
|
-
n[u] < n[t + 1] && (c = n.push(
|
|
32
|
-
n[t],
|
|
33
|
-
n[t + 1],
|
|
34
|
-
n[t + 2],
|
|
35
|
-
n[t + 3]
|
|
36
|
-
));
|
|
37
|
-
c || n[t](n[t + 2], n[t + 3]);
|
|
38
|
-
}
|
|
39
|
-
n.length = 0;
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
off() {
|
|
43
|
-
},
|
|
44
|
-
/* It will be called on last listener unsubscribing.
|
|
45
|
-
We will redefine it in onMount and onStop. */
|
|
46
|
-
set(o) {
|
|
47
|
-
e.value !== o && (e.value = o, e.notify());
|
|
48
|
-
},
|
|
49
|
-
subscribe(o, s) {
|
|
50
|
-
let t = e.listen(o, s);
|
|
51
|
-
return o(e.value), t;
|
|
52
|
-
},
|
|
53
|
-
value: i
|
|
54
|
-
};
|
|
55
|
-
return m.env.NODE_ENV !== "production" && (e[h] = () => {
|
|
56
|
-
l = [], e.lc = 0, e.off();
|
|
57
|
-
}), e;
|
|
58
|
-
}, g = (i = {}) => {
|
|
59
|
-
let r = b(i);
|
|
60
|
-
return r.setKey = function(l, e) {
|
|
61
|
-
typeof e > "u" ? l in r.value && (r.value = { ...r.value }, delete r.value[l], r.notify(l)) : r.value[l] !== e && (r.value = {
|
|
62
|
-
...r.value,
|
|
63
|
-
[l]: e
|
|
64
|
-
}, r.notify(l));
|
|
65
|
-
}, r;
|
|
66
|
-
};
|
|
67
|
-
const w = () => {
|
|
68
|
-
const i = f(null), r = f(0), [l] = v(
|
|
69
|
-
g({
|
|
1
|
+
import { useStore as w } from "@nanostores/react";
|
|
2
|
+
import S from "lodash.throttle";
|
|
3
|
+
import { useRef as f, useState as h, useEffect as g } from "react";
|
|
4
|
+
import { BREAKPOINTS as m } from "../theme/constants.js";
|
|
5
|
+
import { m as v } from "../../index-keh7OLCY.js";
|
|
6
|
+
import "../../index-uEuzH3jr.js";
|
|
7
|
+
const D = (t, n) => {
|
|
8
|
+
var r;
|
|
9
|
+
(r = t.current) == null || r.scrollIntoView(n);
|
|
10
|
+
}, I = (t, n) => {
|
|
11
|
+
const r = f(null), l = f(0), [e] = h(
|
|
12
|
+
v({
|
|
70
13
|
scrollPosition: 0,
|
|
71
14
|
scrollDirection: "forward"
|
|
72
15
|
})
|
|
73
|
-
),
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
16
|
+
), c = w(n);
|
|
17
|
+
return g(() => {
|
|
18
|
+
const s = window.innerWidth < m.xl ? window : r.current;
|
|
19
|
+
if (!s)
|
|
20
|
+
return () => {
|
|
21
|
+
};
|
|
22
|
+
const i = S((d) => {
|
|
23
|
+
var a;
|
|
24
|
+
const u = d.target;
|
|
25
|
+
if (!u)
|
|
77
26
|
return;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
27
|
+
let o = 0;
|
|
28
|
+
c.screen.size < m.xl ? o = ((a = t.current) == null ? void 0 : a.getBoundingClientRect().y) || 0 : o = u.scrollTop;
|
|
29
|
+
const p = l.current < o ? "forward" : "backward";
|
|
30
|
+
l.current = o, e.set({
|
|
31
|
+
scrollPosition: Math.round(o),
|
|
32
|
+
scrollDirection: p,
|
|
33
|
+
tabsShown: e.get().tabsShown
|
|
34
|
+
});
|
|
35
|
+
}, 200);
|
|
36
|
+
return s.addEventListener("scroll", i), () => {
|
|
37
|
+
s.removeEventListener("scroll", i);
|
|
88
38
|
};
|
|
89
|
-
}, [e]), [
|
|
39
|
+
}, [e, t, c.screen]), [r, e];
|
|
90
40
|
};
|
|
91
41
|
export {
|
|
92
|
-
|
|
42
|
+
D as scrollIntoAppView,
|
|
43
|
+
I as useSdkScroll
|
|
93
44
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { QuestionType as n } from "@streamlayer/sdk-web-types";
|
|
3
3
|
import { QuestionTypeData as c } from "../../constants.js";
|
|
4
|
-
import { Container as l, QuestionTypeWrap as a, QuestionTypeIcon as p, QuestionTypeTitle as s,
|
|
4
|
+
import { Container as l, QuestionTypeWrap as a, QuestionTypeIcon as p, QuestionTypeTitle as s, CloseIconWrap as d, CloseIcon as I } from "./styles.js";
|
|
5
5
|
import "@linaria/react";
|
|
6
6
|
import "../../../icons/index.js";
|
|
7
7
|
import "react";
|
|
8
|
-
const N = ({ type:
|
|
9
|
-
const o =
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
(o == null ? void 0 : o.iconName) && /* @__PURE__ */
|
|
8
|
+
const N = ({ type: r, close: m, label: t }) => {
|
|
9
|
+
const o = r ? c[r] : { label: t, iconName: void 0 };
|
|
10
|
+
return /* @__PURE__ */ i(l, { children: [
|
|
11
|
+
/* @__PURE__ */ i(a, { children: [
|
|
12
|
+
(o == null ? void 0 : o.iconName) && /* @__PURE__ */ e(
|
|
13
13
|
p,
|
|
14
14
|
{
|
|
15
|
-
"data-type-trivia":
|
|
16
|
-
"data-type-poll":
|
|
15
|
+
"data-type-trivia": r === n.TRIVIA,
|
|
16
|
+
"data-type-poll": r === n.POLL,
|
|
17
17
|
name: o.iconName
|
|
18
18
|
}
|
|
19
19
|
),
|
|
20
|
-
(o == null ? void 0 : o.label) && /* @__PURE__ */
|
|
20
|
+
(o == null ? void 0 : o.label) && /* @__PURE__ */ e(s, { children: o.label })
|
|
21
21
|
] }),
|
|
22
|
-
/* @__PURE__ */
|
|
22
|
+
/* @__PURE__ */ e(d, { onClick: m, children: /* @__PURE__ */ e(I, { name: "icon-cross" }) })
|
|
23
23
|
] });
|
|
24
24
|
};
|
|
25
25
|
export {
|
|
@@ -3,5 +3,5 @@ export declare const Container: import("@linaria/react").StyledComponent<import(
|
|
|
3
3
|
export declare const QuestionTypeWrap: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
4
4
|
export declare const QuestionTypeIcon: any;
|
|
5
5
|
export declare const QuestionTypeTitle: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const CloseIconWrap: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
7
7
|
export declare const CloseIcon: any;
|
|
@@ -2,11 +2,11 @@ import { styled as s } from "@linaria/react";
|
|
|
2
2
|
import { SvgIcon as o } from "../../../icons/index.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
|
-
const
|
|
5
|
+
const r = /* @__PURE__ */ s("div")({
|
|
6
6
|
name: "Container",
|
|
7
7
|
class: "c1vwopgc",
|
|
8
8
|
propsAsIs: !1
|
|
9
|
-
}),
|
|
9
|
+
}), l = /* @__PURE__ */ s("div")({
|
|
10
10
|
name: "QuestionTypeWrap",
|
|
11
11
|
class: "qyktpt0",
|
|
12
12
|
propsAsIs: !1
|
|
@@ -14,24 +14,24 @@ const l = /* @__PURE__ */ s("div")({
|
|
|
14
14
|
name: "QuestionTypeIcon",
|
|
15
15
|
class: "q951jdx",
|
|
16
16
|
propsAsIs: !0
|
|
17
|
-
}),
|
|
17
|
+
}), I = /* @__PURE__ */ s("span")({
|
|
18
18
|
name: "QuestionTypeTitle",
|
|
19
19
|
class: "qss5f0e",
|
|
20
20
|
propsAsIs: !1
|
|
21
|
-
}),
|
|
22
|
-
name: "
|
|
21
|
+
}), m = /* @__PURE__ */ s("div")({
|
|
22
|
+
name: "CloseIconWrap",
|
|
23
23
|
class: "c1ao1jtv",
|
|
24
24
|
propsAsIs: !1
|
|
25
|
-
}),
|
|
25
|
+
}), n = () => o, u = /* @__PURE__ */ s(n())({
|
|
26
26
|
name: "CloseIcon",
|
|
27
27
|
class: "cvsl7l3",
|
|
28
28
|
propsAsIs: !0
|
|
29
29
|
});
|
|
30
30
|
export {
|
|
31
|
-
u as
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
u as CloseIcon,
|
|
32
|
+
m as CloseIconWrap,
|
|
33
|
+
r as Container,
|
|
34
34
|
i as QuestionTypeIcon,
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
I as QuestionTypeTitle,
|
|
36
|
+
l as QuestionTypeWrap
|
|
37
37
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { type ScrollNodeRef } from '../../app/masters';
|
|
2
3
|
import { ScrollStore } from '../../app/useSdkScroll';
|
|
3
4
|
import { LeaderboardItemProps } from './list-item';
|
|
4
5
|
type LeaderboardListProps = {
|
|
@@ -6,7 +7,7 @@ type LeaderboardListProps = {
|
|
|
6
7
|
currentUserId?: string;
|
|
7
8
|
openItemDetail: (id: string) => void;
|
|
8
9
|
fetchMore: () => void;
|
|
9
|
-
scrollNode:
|
|
10
|
+
scrollNode: ScrollNodeRef;
|
|
10
11
|
scrollStore: ScrollStore;
|
|
11
12
|
hasMore: boolean;
|
|
12
13
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { Gamification } from '@streamlayer/feature-gamification';
|
|
3
|
+
import { HeaderNodeRef, type AppNodeRef } from '../../app/masters';
|
|
3
4
|
import { OnboardingStep } from './slides/onboarding-instructions';
|
|
4
5
|
import { OnboardingInviteCardProps } from './slides/onboarding-invite-card';
|
|
5
6
|
import { OnboardingRule } from './slides/onboarding-rules';
|
|
@@ -9,8 +10,12 @@ type OnboardingType = OnboardingInviteCardProps & {
|
|
|
9
10
|
rules?: OnboardingRule[];
|
|
10
11
|
rulesBtnLabel?: string;
|
|
11
12
|
rulesTitle?: string;
|
|
13
|
+
termsTitle?: string;
|
|
14
|
+
termsText?: string;
|
|
12
15
|
primaryColor?: string;
|
|
13
16
|
inviteCardBtnLabel?: string;
|
|
17
|
+
loading: boolean;
|
|
18
|
+
renderToNode: AppNodeRef | HeaderNodeRef;
|
|
14
19
|
onClose: () => void;
|
|
15
20
|
};
|
|
16
21
|
export declare const Onboarding: React.FC<OnboardingType>;
|