@streamlayer/react-ui 0.100.5 → 1.0.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.d.ts +1 -4
- package/lib/index.js +4 -4
- package/lib/{ui/app/Notifications/Onboarding/index.js → mastersLogoSolid-B4Dz-vm1.js} +2 -169
- package/lib/ui/app/{Features → app/Features}/FeatureProvider.js +3 -3
- package/lib/ui/app/{Features → app/Features}/Gamification/Friends.js +2 -2
- package/lib/ui/app/{Features → app/Features}/Gamification/Leaderboard.d.ts +2 -2
- package/lib/ui/app/app/Features/Gamification/Leaderboard.js +55 -0
- package/lib/ui/app/app/Features/Gamification/Question.js +69 -0
- package/lib/ui/app/app/Features/Gamification/QuestionsList.js +11 -0
- package/lib/ui/app/{Features → app/Features}/Gamification/Tabs.d.ts +3 -3
- package/lib/ui/app/{Features → app/Features}/Gamification/Tabs.js +3 -3
- package/lib/ui/app/{Features → app/Features}/Gamification/UserSummary.js +1 -1
- package/lib/ui/app/{Features → app/Features}/Gamification/index.d.ts +3 -3
- package/lib/ui/app/app/Features/Gamification/index.js +88 -0
- package/lib/ui/app/{Features → app/Features}/index.d.ts +3 -3
- package/lib/ui/app/app/Navigation/index.d.ts +5 -0
- package/lib/ui/app/app/Navigation/index.js +42 -0
- package/lib/ui/app/app/Notifications/Onboarding/Notification/styles.js +50 -0
- package/lib/ui/app/{Notifications → app/Notifications}/Onboarding/index.d.ts +2 -2
- package/lib/ui/app/app/Notifications/Onboarding/index.js +172 -0
- package/lib/ui/app/{Notifications → app/Notifications}/index.d.ts +3 -3
- package/lib/ui/app/{Notifications → app/Notifications}/index.js +18 -18
- package/lib/ui/app/{Notifications → app/Notifications}/styles.js +9 -9
- package/lib/ui/app/{Points → app/Points}/index.js +1 -1
- package/lib/ui/app/app/index.d.ts +11 -0
- package/lib/ui/app/app/index.js +101 -0
- package/lib/ui/app/app/useApp.d.ts +19 -0
- package/lib/ui/app/app/useApp.js +45 -0
- package/lib/ui/app/app/useAppContext.d.ts +8 -0
- package/lib/ui/app/app/useAppContext.js +8 -0
- package/lib/ui/app/index.d.ts +7 -0
- package/lib/ui/app/index.js +1 -0
- package/lib/ui/app/masters/Features/FeatureProvider.d.ts +11 -0
- package/lib/ui/app/masters/Features/FeatureProvider.js +38 -0
- package/lib/ui/app/masters/Features/Gamification/Friends.d.ts +4 -0
- package/lib/ui/app/masters/Features/Gamification/Friends.js +19 -0
- package/lib/ui/app/masters/Features/Gamification/Leaderboard.d.ts +9 -0
- package/lib/ui/app/{Features → masters/Features}/Gamification/Leaderboard.js +7 -7
- package/lib/ui/app/masters/Features/Gamification/Question.d.ts +5 -0
- package/lib/ui/app/{Features → masters/Features}/Gamification/Question.js +10 -10
- package/lib/ui/app/masters/Features/Gamification/QuestionsList.d.ts +6 -0
- package/lib/ui/app/{Features → masters/Features}/Gamification/QuestionsList.js +1 -1
- package/lib/ui/app/masters/Features/Gamification/Tabs.d.ts +14 -0
- package/lib/ui/app/masters/Features/Gamification/Tabs.js +44 -0
- package/lib/ui/app/masters/Features/Gamification/UserSummary.d.ts +5 -0
- package/lib/ui/app/masters/Features/Gamification/UserSummary.js +18 -0
- package/lib/ui/app/masters/Features/Gamification/gamification-feature.d.ts +2 -0
- package/lib/ui/app/masters/Features/Gamification/gamification-feature.js +4 -0
- package/lib/ui/app/masters/Features/Gamification/index.d.ts +23 -0
- package/lib/ui/app/{Features → masters/Features}/Gamification/index.js +31 -31
- package/lib/ui/app/masters/Features/index.d.ts +24 -0
- package/lib/ui/app/masters/Features/index.js +37 -0
- package/lib/ui/app/{Navigation → masters/Navigation}/MastersNavigation/index.d.ts +4 -4
- package/lib/ui/app/{Navigation → masters/Navigation}/MastersNavigation/index.js +5 -5
- package/lib/ui/app/{Navigation → masters/Navigation}/index.d.ts +2 -2
- package/lib/ui/app/{Navigation → masters/Navigation}/index.js +2 -2
- package/lib/ui/app/masters/Notifications/Onboarding/Notification/index.d.ts +8 -0
- package/lib/ui/app/masters/Notifications/Onboarding/Notification/index.js +18 -0
- package/lib/ui/app/masters/Notifications/Onboarding/Notification/styles.d.ts +10 -0
- package/lib/ui/app/{Notifications → masters/Notifications}/Onboarding/Notification/styles.js +16 -16
- package/lib/ui/app/masters/Notifications/Onboarding/index.d.ts +14 -0
- package/lib/ui/app/masters/Notifications/Onboarding/index.js +172 -0
- package/lib/ui/app/masters/Notifications/index.d.ts +13 -0
- package/lib/ui/app/masters/Notifications/index.js +163 -0
- package/lib/ui/app/masters/Notifications/styles.d.ts +8 -0
- package/lib/ui/app/masters/Notifications/styles.js +31 -0
- package/lib/ui/app/masters/Points/index.d.ts +5 -0
- package/lib/ui/app/masters/Points/index.js +28 -0
- package/lib/ui/app/{masters.d.ts → masters/masters.d.ts} +1 -7
- package/lib/ui/app/{masters.js → masters/masters.js} +33 -31
- package/lib/ui/app/{useMastersApp.js → masters/useMastersApp.js} +2 -2
- package/lib/ui/app/useClipboardCopy.d.ts +1 -1
- package/lib/ui/app/useSdkScroll.d.ts +1 -1
- package/lib/ui/theme/MastersColors.d.ts +1 -0
- package/lib/ui/theme/MastersColors.js +15 -0
- package/lib/ui/theme/ThemeColors.js +1 -1
- package/lib/ui/theme/constants.d.ts +1 -1
- package/lib/ui/theme/constants.js +5 -5
- package/lib/ui/theme/masters-theme.d.ts +25 -0
- package/lib/ui/theme/masters-theme.js +96 -0
- package/lib/ui/theme/masters.d.ts +5 -0
- package/lib/ui/theme/masters.js +6 -0
- package/lib/ui/theme/theme.js +1 -1
- package/package.json +25 -20
- /package/lib/ui/app/{Features → app/Features}/FeatureProvider.d.ts +0 -0
- /package/lib/ui/app/{Features → app/Features}/Gamification/Friends.d.ts +0 -0
- /package/lib/ui/app/{Features → app/Features}/Gamification/Question.d.ts +0 -0
- /package/lib/ui/app/{Features → app/Features}/Gamification/QuestionsList.d.ts +0 -0
- /package/lib/ui/app/{Features → app/Features}/Gamification/UserSummary.d.ts +0 -0
- /package/lib/ui/app/{Features → app/Features}/Gamification/gamification-feature.d.ts +0 -0
- /package/lib/ui/app/{Features → app/Features}/Gamification/gamification-feature.js +0 -0
- /package/lib/ui/app/{Features → app/Features}/index.js +0 -0
- /package/lib/ui/app/{Notifications → app/Notifications}/Onboarding/Notification/index.d.ts +0 -0
- /package/lib/ui/app/{Notifications → app/Notifications}/Onboarding/Notification/index.js +0 -0
- /package/lib/ui/app/{Notifications → app/Notifications}/Onboarding/Notification/styles.d.ts +0 -0
- /package/lib/ui/app/{Notifications → app/Notifications}/styles.d.ts +0 -0
- /package/lib/ui/app/{Points → app/Points}/index.d.ts +0 -0
- /package/lib/ui/app/{useMastersApp.d.ts → masters/useMastersApp.d.ts} +0 -0
- /package/lib/ui/app/{useMastersContext.d.ts → masters/useMastersContext.d.ts} +0 -0
- /package/lib/ui/app/{useMastersContext.js → masters/useMastersContext.js} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { styled as s } from "@linaria/react";
|
|
2
|
+
import { SvgIcon as o } from "../../../../../icons/index.js";
|
|
3
|
+
const a = /* @__PURE__ */ s("div")({
|
|
4
|
+
name: "Container",
|
|
5
|
+
class: "c3q0amv",
|
|
6
|
+
propsAsIs: !1
|
|
7
|
+
}), c = /* @__PURE__ */ s("div")({
|
|
8
|
+
name: "CloseIconWrap",
|
|
9
|
+
class: "cqihknq",
|
|
10
|
+
propsAsIs: !1
|
|
11
|
+
}), n = () => o, p = /* @__PURE__ */ s(n())({
|
|
12
|
+
name: "CloseIcon",
|
|
13
|
+
class: "cl5ln9o",
|
|
14
|
+
propsAsIs: !0
|
|
15
|
+
}), l = /* @__PURE__ */ s("div")({
|
|
16
|
+
name: "Title",
|
|
17
|
+
class: "t1bejf60",
|
|
18
|
+
propsAsIs: !1
|
|
19
|
+
}), r = /* @__PURE__ */ s("img")({
|
|
20
|
+
name: "SponsorLogo",
|
|
21
|
+
class: "sb0t4y8",
|
|
22
|
+
propsAsIs: !1
|
|
23
|
+
}), i = /* @__PURE__ */ s("div")({
|
|
24
|
+
name: "PresentsTitle",
|
|
25
|
+
class: "p1nmyo08",
|
|
26
|
+
propsAsIs: !1
|
|
27
|
+
}), m = /* @__PURE__ */ s("div")({
|
|
28
|
+
name: "Subtitle",
|
|
29
|
+
class: "sgd2pup",
|
|
30
|
+
propsAsIs: !1
|
|
31
|
+
}), I = /* @__PURE__ */ s("div")({
|
|
32
|
+
name: "Description",
|
|
33
|
+
class: "d6e19hw",
|
|
34
|
+
propsAsIs: !1
|
|
35
|
+
}), f = /* @__PURE__ */ s("button")({
|
|
36
|
+
name: "ActionButton",
|
|
37
|
+
class: "a17h53j4",
|
|
38
|
+
propsAsIs: !1
|
|
39
|
+
});
|
|
40
|
+
export {
|
|
41
|
+
f as ActionButton,
|
|
42
|
+
p as CloseIcon,
|
|
43
|
+
c as CloseIconWrap,
|
|
44
|
+
a as Container,
|
|
45
|
+
I as Description,
|
|
46
|
+
i as PresentsTitle,
|
|
47
|
+
r as SponsorLogo,
|
|
48
|
+
m as Subtitle,
|
|
49
|
+
l as Title
|
|
50
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
|
|
3
3
|
import { type Notification } from '@streamlayer/sdk-web-notifications';
|
|
4
|
-
import { type AppNodeRef } from '
|
|
5
|
-
import { ResponsiveStore } from '
|
|
4
|
+
import { type AppNodeRef } from '../../..';
|
|
5
|
+
import { ResponsiveStore } from '../../../useSdkResponsive';
|
|
6
6
|
export declare const Onboarding: React.FC<{
|
|
7
7
|
sdk: StreamLayerSDK;
|
|
8
8
|
notification: Notification;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { jsx as n, jsxs as k, Fragment as T } from "react/jsx-runtime";
|
|
2
|
+
import { styled as S } from "@linaria/react";
|
|
3
|
+
import { useStore as F } from "@nanostores/react";
|
|
4
|
+
import { useRef as j, useState as A, useMemo as _, useLayoutEffect as z, useEffect as E } from "react";
|
|
5
|
+
import { FeatureType as G } from "@streamlayer/sdk-web-types";
|
|
6
|
+
import { useImagesPreload as M } from "../../../useImagesPreload.js";
|
|
7
|
+
import { scrollIntoAppView as P } from "../../../useSdkScroll.js";
|
|
8
|
+
import { OnboardingUI as R } from "../../../../gamification/onboarding/index.js";
|
|
9
|
+
import { ModalPortal as V } from "../../../../modal/index.js";
|
|
10
|
+
import { ShowIn as W } from "../../../../show-in/index.js";
|
|
11
|
+
import { m as $ } from "../../../../../mastersLogoSolid-B4Dz-vm1.js";
|
|
12
|
+
import { Onboarding as x } from "./Notification/index.js";
|
|
13
|
+
const y = [{
|
|
14
|
+
graphicSrc: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/step_1.png",
|
|
15
|
+
tagline: "Featured groups+ experience",
|
|
16
|
+
headline: /* @__PURE__ */ k(T, {
|
|
17
|
+
children: ["Welcome to ", /* @__PURE__ */ n("br", {}), " Featured Groups +"]
|
|
18
|
+
})
|
|
19
|
+
}, {
|
|
20
|
+
graphicSrc: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/step_2.png",
|
|
21
|
+
headline: "Get real-time insights"
|
|
22
|
+
}, {
|
|
23
|
+
graphicSrc: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/step_3.png",
|
|
24
|
+
headline: "Predictions, trivia & polls synced to match play"
|
|
25
|
+
}, {
|
|
26
|
+
graphicSrc: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/step_4.png",
|
|
27
|
+
headline: "Win points for every answer you get right"
|
|
28
|
+
}, {
|
|
29
|
+
graphicSrc: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/step_5.png",
|
|
30
|
+
headline: "Compete against friends on the leaderboard"
|
|
31
|
+
}], O = /* @__PURE__ */ S("div")({
|
|
32
|
+
name: "OnboardingContainer",
|
|
33
|
+
class: "o1xcysoz",
|
|
34
|
+
propsAsIs: !1
|
|
35
|
+
}), q = () => W, D = /* @__PURE__ */ S(q())({
|
|
36
|
+
name: "OnboardingNotificationContainer",
|
|
37
|
+
class: "oejzp3v",
|
|
38
|
+
propsAsIs: !0
|
|
39
|
+
}), L = /* @__PURE__ */ S("div")({
|
|
40
|
+
name: "InnerContainer",
|
|
41
|
+
class: "i134gfua",
|
|
42
|
+
propsAsIs: !1
|
|
43
|
+
}), U = ({
|
|
44
|
+
deepLink: d,
|
|
45
|
+
onboardingOpts: r,
|
|
46
|
+
notification: o,
|
|
47
|
+
gamification: u,
|
|
48
|
+
loading: i,
|
|
49
|
+
renderToNode: v,
|
|
50
|
+
sdk: l
|
|
51
|
+
}) => {
|
|
52
|
+
var a, h, b, f, C, m, s;
|
|
53
|
+
const c = F(u.friends.getStore()), [e, I] = A(void 0), g = _(() => {
|
|
54
|
+
var p, w;
|
|
55
|
+
const t = l.getInviter();
|
|
56
|
+
return t ? (w = (p = c.data) == null ? void 0 : p.find(({
|
|
57
|
+
slId: B
|
|
58
|
+
}) => B === t)) == null ? void 0 : w.name : "";
|
|
59
|
+
}, [c.data, l]);
|
|
60
|
+
return E(() => {
|
|
61
|
+
const t = d.$store.subscribe((p) => {
|
|
62
|
+
p && I(p.data);
|
|
63
|
+
});
|
|
64
|
+
return () => {
|
|
65
|
+
t();
|
|
66
|
+
};
|
|
67
|
+
}, [d.$store]), /* @__PURE__ */ n(O, {
|
|
68
|
+
children: /* @__PURE__ */ n(R, {
|
|
69
|
+
loading: i,
|
|
70
|
+
renderToNode: v,
|
|
71
|
+
rules: [{
|
|
72
|
+
label: "Answer as many questions as you like.",
|
|
73
|
+
icon: "icon-btn-feature-groups"
|
|
74
|
+
}, {
|
|
75
|
+
label: "Win points for each correct trivia or prediction answer.",
|
|
76
|
+
icon: "icon-thumb-up"
|
|
77
|
+
}, {
|
|
78
|
+
label: "Top the leader board and best your friends.",
|
|
79
|
+
icon: "icon-trophy"
|
|
80
|
+
}],
|
|
81
|
+
rulesBtnLabel: (a = r.rules) == null ? void 0 : a.buttonLabel,
|
|
82
|
+
rulesTitle: (h = r.rules) == null ? void 0 : h.heading,
|
|
83
|
+
termsTitle: "Terms and Conditions",
|
|
84
|
+
termsText: (b = r.rules) == null ? void 0 : b.terms,
|
|
85
|
+
steps: y,
|
|
86
|
+
primaryColor: (f = r.inviteCard) == null ? void 0 : f.iconColor,
|
|
87
|
+
inviteLink: e,
|
|
88
|
+
inviteCardTitle: (C = r.inviteCard) == null ? void 0 : C.heading,
|
|
89
|
+
inviteCardSubtext: (m = r.inviteCard) == null ? void 0 : m.subtext,
|
|
90
|
+
inviteCardBtnLabel: (s = r.inviteCard) == null ? void 0 : s.buttonLabel,
|
|
91
|
+
onClose: () => {
|
|
92
|
+
var t;
|
|
93
|
+
(t = o.close) == null || t.call(o);
|
|
94
|
+
},
|
|
95
|
+
gamification: u,
|
|
96
|
+
sdk: l,
|
|
97
|
+
inviterName: g
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
}, se = ({
|
|
101
|
+
sdk: d,
|
|
102
|
+
notification: r,
|
|
103
|
+
saveHeight: o,
|
|
104
|
+
style: u,
|
|
105
|
+
appNode: i,
|
|
106
|
+
sdkInDesktopView: v,
|
|
107
|
+
responsiveStore: l
|
|
108
|
+
}) => {
|
|
109
|
+
var m;
|
|
110
|
+
const c = j(null), e = r.data.onboarding, [I, g] = A(e == null ? void 0 : e.instantOpen), a = d.getFeature(G.GAMES), h = _(() => y == null ? void 0 : y.map(({
|
|
111
|
+
graphicSrc: s
|
|
112
|
+
}) => s), []), {
|
|
113
|
+
screen: b
|
|
114
|
+
} = F(l, {
|
|
115
|
+
keys: ["screen"]
|
|
116
|
+
});
|
|
117
|
+
(m = e == null ? void 0 : e.titleCard) != null && m.media && (e.titleCard.media.sponsorLogo = $), z(() => {
|
|
118
|
+
var s;
|
|
119
|
+
o(((s = c.current) == null ? void 0 : s.getBoundingClientRect().height) || 0);
|
|
120
|
+
}, [o]);
|
|
121
|
+
const {
|
|
122
|
+
loading: f,
|
|
123
|
+
throttled: C
|
|
124
|
+
} = M(h);
|
|
125
|
+
return I && a && e && i.current && !C ? /* @__PURE__ */ n(V, {
|
|
126
|
+
container: i,
|
|
127
|
+
useContainer: !v,
|
|
128
|
+
children: /* @__PURE__ */ n(U, {
|
|
129
|
+
notification: r,
|
|
130
|
+
setOpened: g,
|
|
131
|
+
gamification: a,
|
|
132
|
+
onboardingOpts: e,
|
|
133
|
+
deepLink: a.deepLink,
|
|
134
|
+
loading: f,
|
|
135
|
+
renderToNode: i,
|
|
136
|
+
sdk: d
|
|
137
|
+
})
|
|
138
|
+
}) : /* @__PURE__ */ k(T, {
|
|
139
|
+
children: [/* @__PURE__ */ n(L, {
|
|
140
|
+
ref: c,
|
|
141
|
+
style: {
|
|
142
|
+
position: "absolute",
|
|
143
|
+
visibility: "hidden"
|
|
144
|
+
},
|
|
145
|
+
children: /* @__PURE__ */ n(x, {
|
|
146
|
+
close: () => {
|
|
147
|
+
},
|
|
148
|
+
action: () => {
|
|
149
|
+
},
|
|
150
|
+
onboarding: e
|
|
151
|
+
})
|
|
152
|
+
}), /* @__PURE__ */ n(D, {
|
|
153
|
+
style: u,
|
|
154
|
+
hiding: r.hiding,
|
|
155
|
+
children: /* @__PURE__ */ n(L, {
|
|
156
|
+
children: /* @__PURE__ */ n(x, {
|
|
157
|
+
close: r.close,
|
|
158
|
+
action: () => {
|
|
159
|
+
var t;
|
|
160
|
+
g(!0), (((t = i.current) == null ? void 0 : t.getBoundingClientRect().y) || 0) < 0 && P(i, b.size, {
|
|
161
|
+
behavior: "smooth"
|
|
162
|
+
});
|
|
163
|
+
},
|
|
164
|
+
onboarding: e
|
|
165
|
+
})
|
|
166
|
+
})
|
|
167
|
+
})]
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
export {
|
|
171
|
+
se as Onboarding
|
|
172
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
|
|
3
|
-
import type { AppNodeRef, ScrollNodeRef, HeaderNodeRef } from '
|
|
4
|
-
import { ResponsiveStore } from '
|
|
5
|
-
import { ScrollStore } from '
|
|
3
|
+
import type { AppNodeRef, ScrollNodeRef, HeaderNodeRef } from '../..';
|
|
4
|
+
import { ResponsiveStore } from '../../useSdkResponsive';
|
|
5
|
+
import { ScrollStore } from '../../useSdkScroll';
|
|
6
6
|
export declare const SDKNotifications: React.FC<{
|
|
7
7
|
sdk: StreamLayerSDK;
|
|
8
8
|
scrollNode: ScrollNodeRef;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsxs as f, Fragment as D, jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import { cx as N } from "@linaria/core";
|
|
3
|
-
import { useStore as
|
|
3
|
+
import { useStore as a } from "@nanostores/react";
|
|
4
4
|
import { useState as p, useMemo as T, useEffect as h, useRef as E, useCallback as w } from "react";
|
|
5
|
-
import { r as O } from "
|
|
5
|
+
import { r as O } from "../../../../index-Bicco-Aq.js";
|
|
6
6
|
import { eventBus as b } from "@streamlayer/sdk-web-interfaces";
|
|
7
|
-
import { NotificationType as
|
|
8
|
-
import {
|
|
9
|
-
import { scrollIntoAppView as C } from "
|
|
10
|
-
import { QuestionTypeData as R } from "
|
|
11
|
-
import { Notification as V } from "
|
|
12
|
-
import { PredictionResult as P } from "
|
|
7
|
+
import { NotificationType as g } from "@streamlayer/sdk-web-notifications";
|
|
8
|
+
import { useAppContext as q } from "../useAppContext.js";
|
|
9
|
+
import { scrollIntoAppView as C } from "../../useSdkScroll.js";
|
|
10
|
+
import { QuestionTypeData as R } from "../../../gamification/constants.js";
|
|
11
|
+
import { Notification as V } from "../../../gamification/question/notification/index.js";
|
|
12
|
+
import { PredictionResult as P } from "../../../gamification/question/notification/prediction-result/index.js";
|
|
13
13
|
import { Onboarding as x } from "./Onboarding/index.js";
|
|
14
14
|
import { HiddenContainer as A, Container as B, InnerContainer as H, NotificationRefreshing as Q, Pill as U } from "./styles.js";
|
|
15
15
|
const j = (o) => {
|
|
@@ -34,12 +34,12 @@ const j = (o) => {
|
|
|
34
34
|
var s, e;
|
|
35
35
|
const {
|
|
36
36
|
sdkInDesktopView: d
|
|
37
|
-
} =
|
|
37
|
+
} = a(i, {
|
|
38
38
|
keys: ["sdkInDesktopView"]
|
|
39
39
|
}), {
|
|
40
40
|
sdk: n
|
|
41
41
|
} = q(), [r, l, m] = j(t.id);
|
|
42
|
-
return t.type ===
|
|
42
|
+
return t.type === g.QUESTION ? /* @__PURE__ */ f(D, {
|
|
43
43
|
children: [/* @__PURE__ */ c(A, {
|
|
44
44
|
ref: r,
|
|
45
45
|
children: /* @__PURE__ */ c(V, {
|
|
@@ -60,7 +60,7 @@ const j = (o) => {
|
|
|
60
60
|
})
|
|
61
61
|
}), /* @__PURE__ */ c(Q, {}, t.id)]
|
|
62
62
|
})]
|
|
63
|
-
}) : t.type ===
|
|
63
|
+
}) : t.type === g.QUESTION_RESOLVED && ((e = (s = t.data) == null ? void 0 : s.question) != null && e.predictionResult) ? /* @__PURE__ */ c(P, {
|
|
64
64
|
style: {
|
|
65
65
|
height: t.hiding ? 0 : l
|
|
66
66
|
},
|
|
@@ -68,7 +68,7 @@ const j = (o) => {
|
|
|
68
68
|
close: t.close,
|
|
69
69
|
hiding: t.hiding,
|
|
70
70
|
...t.data.question
|
|
71
|
-
}) : t.type ===
|
|
71
|
+
}) : t.type === g.ONBOARDING ? /* @__PURE__ */ c(x, {
|
|
72
72
|
style: {
|
|
73
73
|
height: t.hiding ? 0 : l
|
|
74
74
|
},
|
|
@@ -79,7 +79,7 @@ const j = (o) => {
|
|
|
79
79
|
appNode: u,
|
|
80
80
|
responsiveStore: i
|
|
81
81
|
}) : null;
|
|
82
|
-
}, F = "
|
|
82
|
+
}, F = "p6vl6vu", L = ({
|
|
83
83
|
pill: o,
|
|
84
84
|
setPill: t,
|
|
85
85
|
appNode: u,
|
|
@@ -88,15 +88,15 @@ const j = (o) => {
|
|
|
88
88
|
responsiveStore: n,
|
|
89
89
|
scrollStore: r
|
|
90
90
|
}) => {
|
|
91
|
-
var
|
|
91
|
+
var k, y;
|
|
92
92
|
const {
|
|
93
93
|
screen: l
|
|
94
|
-
} =
|
|
94
|
+
} = a(n, {
|
|
95
95
|
keys: ["screen"]
|
|
96
96
|
}), {
|
|
97
97
|
tabsShown: m,
|
|
98
98
|
scrollPosition: s
|
|
99
|
-
} =
|
|
99
|
+
} = a(r, {
|
|
100
100
|
keys: ["tabsShown", "scrollPosition"]
|
|
101
101
|
});
|
|
102
102
|
h(() => {
|
|
@@ -104,7 +104,7 @@ const j = (o) => {
|
|
|
104
104
|
}, [s, n, t]);
|
|
105
105
|
const e = n.get().sdkInDesktopView ? u : i;
|
|
106
106
|
return !o || !e.current ? null : O.createPortal(/* @__PURE__ */ c(U, {
|
|
107
|
-
title: o.type ===
|
|
107
|
+
title: o.type === g.QUESTION_RESOLVED ? "Prediction result" : `New ${((y = R[(k = o.data) == null ? void 0 : k.questionType]) == null ? void 0 : y.label) || "notification"}`,
|
|
108
108
|
onClick: () => {
|
|
109
109
|
var I;
|
|
110
110
|
n.get().sdkInDesktopView ? (I = d.current) == null || I.scrollTo({
|
|
@@ -124,7 +124,7 @@ const j = (o) => {
|
|
|
124
124
|
appNode: d,
|
|
125
125
|
scrollStore: n
|
|
126
126
|
}) => {
|
|
127
|
-
const [r] = p(o.getNotificationsStore()), l =
|
|
127
|
+
const [r] = p(o.getNotificationsStore()), l = a(r), [m, s] = p(null), e = T(() => o.getActiveNotification(), [o, l]);
|
|
128
128
|
return h(() => {
|
|
129
129
|
e && b.emit("notification", {
|
|
130
130
|
action: "rendered",
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { styled as s } from "@linaria/react";
|
|
2
|
-
import { Pill as n } from "
|
|
3
|
-
import { ShowIn as o } from "
|
|
2
|
+
import { Pill as n } from "../../../gamification/question/notification/pill/index.js";
|
|
3
|
+
import { ShowIn as o } from "../../../show-in/index.js";
|
|
4
4
|
const e = () => o, l = /* @__PURE__ */ s(e())({
|
|
5
5
|
name: "Container",
|
|
6
|
-
class: "
|
|
6
|
+
class: "c1cu0box",
|
|
7
7
|
propsAsIs: !0
|
|
8
8
|
}), i = /* @__PURE__ */ s("div")({
|
|
9
9
|
name: "InnerContainer",
|
|
10
|
-
class: "
|
|
10
|
+
class: "i1p534h4",
|
|
11
11
|
propsAsIs: !1
|
|
12
|
-
}),
|
|
12
|
+
}), t = () => i, m = /* @__PURE__ */ s(t())({
|
|
13
13
|
name: "HiddenContainer",
|
|
14
|
-
class: "
|
|
14
|
+
class: "hyh76ez",
|
|
15
15
|
propsAsIs: !0
|
|
16
16
|
}), f = /* @__PURE__ */ s("div")({
|
|
17
17
|
name: "NotificationRefreshing",
|
|
18
|
-
class: "
|
|
18
|
+
class: "n1pj3cvw",
|
|
19
19
|
propsAsIs: !1
|
|
20
|
-
}),
|
|
20
|
+
}), r = () => n, I = /* @__PURE__ */ s(r())({
|
|
21
21
|
name: "Pill",
|
|
22
|
-
class: "
|
|
22
|
+
class: "pk13by5",
|
|
23
23
|
propsAsIs: !0
|
|
24
24
|
});
|
|
25
25
|
export {
|
|
@@ -3,7 +3,7 @@ import { useStore as i } from "@nanostores/react";
|
|
|
3
3
|
import { useState as c, useEffect as f } from "react";
|
|
4
4
|
import { FeatureStatus as p } from "@streamlayer/sdk-web-interfaces";
|
|
5
5
|
import { FeatureType as S } from "@streamlayer/sdk-web-types";
|
|
6
|
-
import { Points as l } from "
|
|
6
|
+
import { Points as l } from "../../../gamification/points/index.js";
|
|
7
7
|
const a = ({ gamification: e }) => {
|
|
8
8
|
const s = e.userSummary.$store, [r, u] = c(0);
|
|
9
9
|
return f(() => {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
|
|
3
|
+
export type AppAppChildrenProps = {
|
|
4
|
+
activateEventWithId: (event: string) => void;
|
|
5
|
+
deactivate: () => void;
|
|
6
|
+
};
|
|
7
|
+
export type AppAppProps = {
|
|
8
|
+
sdk: StreamLayerSDK;
|
|
9
|
+
event?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const App: React.FC<AppAppProps>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsx as i, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { useStore as N } from "@nanostores/react";
|
|
3
|
+
import { useAnalyticsListener as m, newTabLinkListener as A, appScrollListener as C, appClickListener as L } from "../../../hooks/analytics.js";
|
|
4
|
+
import { useRef as d, useEffect as S, useMemo as x } from "react";
|
|
5
|
+
import { SDKContainer as D, SDKScrollContainer as F } from "../styles.js";
|
|
6
|
+
import { useSdkFeature as b } from "../useSdkFeature.js";
|
|
7
|
+
import { useSdkResponsive as y } from "../useSdkResponsive.js";
|
|
8
|
+
import { useSdkScroll as E } from "../useSdkScroll.js";
|
|
9
|
+
import { resetCss as v } from "../../theme/theme.js";
|
|
10
|
+
import { ActiveFeature as K, StandaloneFeature as j } from "./Features/index.js";
|
|
11
|
+
import { SDKNavigation as R } from "./Navigation/index.js";
|
|
12
|
+
import { SDKNotifications as w } from "./Notifications/index.js";
|
|
13
|
+
import { useAppApp as I } from "./useApp.js";
|
|
14
|
+
import { AppContext as M } from "./useAppContext.js";
|
|
15
|
+
const P = ({ sdk: e, className: n, scrollStore: t, appNode: l, scrollNode: o, responsiveStore: r }) => {
|
|
16
|
+
const [, s] = b(e);
|
|
17
|
+
return /* @__PURE__ */ i(
|
|
18
|
+
K,
|
|
19
|
+
{
|
|
20
|
+
className: n,
|
|
21
|
+
scrollNode: o,
|
|
22
|
+
appNode: l,
|
|
23
|
+
scrollStore: t,
|
|
24
|
+
feature: s,
|
|
25
|
+
responsiveStore: r,
|
|
26
|
+
sdk: e
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}, V = ({ sdk: e, className: n, appNode: t, responsiveStore: l }) => {
|
|
30
|
+
const o = N(e.featuresList.getStore());
|
|
31
|
+
return o ? Array.from(o, (r) => {
|
|
32
|
+
const s = e.getFeature(r);
|
|
33
|
+
return s ? /* @__PURE__ */ i(
|
|
34
|
+
j,
|
|
35
|
+
{
|
|
36
|
+
className: n,
|
|
37
|
+
appNode: t,
|
|
38
|
+
feature: s,
|
|
39
|
+
responsiveStore: l,
|
|
40
|
+
sdk: e
|
|
41
|
+
},
|
|
42
|
+
r
|
|
43
|
+
) : null;
|
|
44
|
+
}) : null;
|
|
45
|
+
}, Z = ({ sdk: e, event: n }) => {
|
|
46
|
+
const t = d(null), l = d(null), [o] = y(t), [r, s] = E(t, o), { sdkEnabled: a, sdkReady: c, activateEventWithId: u, deactivate: p, isLogged: g } = I(e);
|
|
47
|
+
S(() => {
|
|
48
|
+
n ? (e.createEventSession(n), u(n)) : p();
|
|
49
|
+
}, [n, u, p, e]), m(t, { enabled: a, event: "click", listener: A }), m(r, {
|
|
50
|
+
enabled: a,
|
|
51
|
+
event: "scrollend",
|
|
52
|
+
listener: C,
|
|
53
|
+
useDomNode: !0
|
|
54
|
+
}), m(r, {
|
|
55
|
+
enabled: a,
|
|
56
|
+
event: "click",
|
|
57
|
+
listener: L,
|
|
58
|
+
useDomNode: !0
|
|
59
|
+
});
|
|
60
|
+
const h = x(() => ({ sdk: e }), [e]);
|
|
61
|
+
return S(() => {
|
|
62
|
+
import("./Features/Gamification/gamification-feature.js");
|
|
63
|
+
}, []), /* @__PURE__ */ i(M.Provider, { value: h, children: /* @__PURE__ */ f(D, { ref: t, children: [
|
|
64
|
+
a && /* @__PURE__ */ i(R, { sdk: e }),
|
|
65
|
+
/* @__PURE__ */ f(F, { className: "sl-hide-on-modal", ref: r, "data-nav": a.toString(), children: [
|
|
66
|
+
c && /* @__PURE__ */ i(
|
|
67
|
+
w,
|
|
68
|
+
{
|
|
69
|
+
sdk: e,
|
|
70
|
+
scrollNode: r,
|
|
71
|
+
headerNode: l,
|
|
72
|
+
appNode: t,
|
|
73
|
+
scrollStore: s,
|
|
74
|
+
responsiveStore: o
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
c && /* @__PURE__ */ i(
|
|
78
|
+
P,
|
|
79
|
+
{
|
|
80
|
+
scrollStore: s,
|
|
81
|
+
responsiveStore: o,
|
|
82
|
+
scrollNode: r,
|
|
83
|
+
appNode: t,
|
|
84
|
+
className: v,
|
|
85
|
+
sdk: e
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
c && /* @__PURE__ */ i(V, { responsiveStore: o, appNode: t, className: v, sdk: e })
|
|
89
|
+
] }),
|
|
90
|
+
a && !g && /* @__PURE__ */ i(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "100%" },
|
|
94
|
+
children: "You are not logged in."
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
] }) });
|
|
98
|
+
};
|
|
99
|
+
export {
|
|
100
|
+
Z as App
|
|
101
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* A hook that provides functionality for managing the StreamLayerSDK in the App app.
|
|
4
|
+
* - On activate FG+ button, the SDK is initialized and the FG+ overlay is opened.
|
|
5
|
+
* - On activate Channels or Leaderboard button, the SDK is disabled and the FG+ overlay is closed.
|
|
6
|
+
* - On sdk status change, if sdk disabled (f.e some errors occurred), the SDK is disabled and the FG+ overlay is closed.
|
|
7
|
+
* @param sdk - The StreamLayerSDK instance to use.
|
|
8
|
+
* @returns An object containing various functions and state values for managing the SDK and app overlays.
|
|
9
|
+
* @returns deactivate - A function that disables the SDK and closes the FG+ overlay.
|
|
10
|
+
* @returns activateEventWithId - A function that initializes the SDK and opens the FG+ overlay.
|
|
11
|
+
* With event (The id of the event to create a session for.) as a parameter.
|
|
12
|
+
*/
|
|
13
|
+
export declare const useAppApp: (sdk: StreamLayerSDK) => {
|
|
14
|
+
sdkEnabled: boolean;
|
|
15
|
+
sdkReady: boolean;
|
|
16
|
+
activateEventWithId: (event: string) => void;
|
|
17
|
+
deactivate: () => void;
|
|
18
|
+
isLogged: boolean;
|
|
19
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useStore as n } from "@nanostores/react";
|
|
2
|
+
import { useRef as g, useState as m, useEffect as s } from "react";
|
|
3
|
+
import { FeatureType as E } from "@streamlayer/sdk-web-types";
|
|
4
|
+
const I = (e) => {
|
|
5
|
+
const a = g(""), [o, r] = m(!1), c = n(e.status), p = n(e.sdkStore.slStreamId), i = n(e.userId()), f = n(e.getActiveFeature()), u = c === "ready" && !!p.data;
|
|
6
|
+
s(() => {
|
|
7
|
+
const t = e.getFeature(E.GAMES);
|
|
8
|
+
t && (t.closeQuestion(), t.closeUser());
|
|
9
|
+
}, [f, e]);
|
|
10
|
+
const l = (t) => {
|
|
11
|
+
a.current = t, r(!0), e.initializeApp({ skipOrganizationSettings: !0 }).then(({ enabled: A, err: S }) => {
|
|
12
|
+
if (!S && A) {
|
|
13
|
+
e.isUserAuthorized().then((v) => {
|
|
14
|
+
v || e.disableApp();
|
|
15
|
+
});
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}, d = () => {
|
|
20
|
+
r(!1), e.disableApp();
|
|
21
|
+
};
|
|
22
|
+
return s(() => {
|
|
23
|
+
if (!i) {
|
|
24
|
+
u && e.disableApp();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (i && a.current && o) {
|
|
28
|
+
e.initializeApp({ skipOrganizationSettings: !0 }).then(() => {
|
|
29
|
+
e.createEventSession(a.current);
|
|
30
|
+
});
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}, [i]), s(() => () => {
|
|
34
|
+
r(!1), e.disableApp();
|
|
35
|
+
}, [r, e]), {
|
|
36
|
+
sdkEnabled: o,
|
|
37
|
+
sdkReady: u,
|
|
38
|
+
activateEventWithId: l,
|
|
39
|
+
deactivate: d,
|
|
40
|
+
isLogged: !!i
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
I as useAppApp
|
|
45
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
|
|
3
|
+
export declare const AppContext: import("react").Context<{
|
|
4
|
+
sdk: StreamLayerSDK | null;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const useAppContext: () => {
|
|
7
|
+
sdk: StreamLayerSDK | null;
|
|
8
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type AppNode = HTMLDivElement | null;
|
|
3
|
+
export type AppNodeRef = React.MutableRefObject<AppNode>;
|
|
4
|
+
export type ScrollNode = HTMLDivElement | null;
|
|
5
|
+
export type ScrollNodeRef = React.MutableRefObject<ScrollNode>;
|
|
6
|
+
export type HeaderNode = HTMLDivElement | null;
|
|
7
|
+
export type HeaderNodeRef = React.MutableRefObject<HeaderNode>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
className?: string;
|
|
10
|
+
noWait?: boolean;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { styled as u } from "@linaria/react";
|
|
3
|
+
import { useStore as e } from "@nanostores/react";
|
|
4
|
+
import { FeatureStatus as p } from "@streamlayer/sdk-web-interfaces";
|
|
5
|
+
const o = /* @__PURE__ */ u("div")({
|
|
6
|
+
name: "LoadingContainer",
|
|
7
|
+
class: "l9si06t",
|
|
8
|
+
propsAsIs: !1
|
|
9
|
+
}), v = ({
|
|
10
|
+
feature: n,
|
|
11
|
+
sdk: s,
|
|
12
|
+
children: a,
|
|
13
|
+
className: r,
|
|
14
|
+
noWait: d
|
|
15
|
+
}) => {
|
|
16
|
+
const f = e(n.status), t = e(s.sdkStore.slStreamId);
|
|
17
|
+
if (!d) {
|
|
18
|
+
if (t != null && t.loading && !t.data)
|
|
19
|
+
return /* @__PURE__ */ i(o, {
|
|
20
|
+
className: r,
|
|
21
|
+
children: "Event is loading..."
|
|
22
|
+
});
|
|
23
|
+
if (!(t != null && t.data))
|
|
24
|
+
return /* @__PURE__ */ i(o, {
|
|
25
|
+
className: r,
|
|
26
|
+
children: "Event is forbidden..."
|
|
27
|
+
});
|
|
28
|
+
if (f !== p.Ready)
|
|
29
|
+
return /* @__PURE__ */ i(o, {
|
|
30
|
+
className: r,
|
|
31
|
+
children: "Wait feature..."
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return a;
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
v as FeatureProvider
|
|
38
|
+
};
|