@streamlayer/react-ui 1.9.0 → 1.11.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/app/app/Advertisement/index.d.ts +1 -0
- package/lib/app/app/Advertisement/index.js +78 -67
- package/lib/app/app/Features/Gamification/Question.d.ts +1 -0
- package/lib/app/app/Features/Gamification/Question.js +43 -41
- package/lib/app/app/Features/Gamification/Tabs.js +22 -21
- package/lib/app/app/Features/Gamification/index.js +66 -62
- package/lib/app/app/Insight/index.d.ts +2 -0
- package/lib/app/app/Insight/index.js +28 -24
- package/lib/app/app/Navigation/index.d.ts +4 -0
- package/lib/app/app/Navigation/index.js +88 -48
- package/lib/app/app/Notifications/index.js +125 -113
- package/lib/app/app/Points/index.js +16 -16
- package/lib/app/app/index.d.ts +1 -0
- package/lib/app/app/index.js +84 -83
- package/lib/app/app/story/index.js +27 -24
- package/lib/app/app/story/insight/index.d.ts +1 -0
- package/lib/app/app/story/insight/index.js +29 -26
- package/lib/app/app/story/insight/video.d.ts +1 -0
- package/lib/app/app/story/insight/video.js +13 -13
- package/lib/app/app/story/promotion/content.d.ts +3 -1
- package/lib/app/app/story/promotion/content.js +13 -10
- package/lib/app/app/story/promotion/index.d.ts +1 -0
- package/lib/app/app/story/promotion/index.js +34 -30
- package/lib/app/app/story/promotion/video.d.ts +1 -0
- package/lib/app/app/story/promotion/video.js +34 -31
- package/lib/app/app/styles.js +44 -0
- package/lib/app/app/useApp.d.ts +2 -14
- package/lib/app/app/useApp.js +14 -43
- package/lib/app/app/useAppContext.d.ts +2 -0
- package/lib/app/app/useAppContext.js +6 -5
- package/lib/app/masters/Features/Gamification/Leaderboard.d.ts +1 -1
- package/lib/app/masters/Features/Gamification/Tabs.d.ts +2 -2
- package/lib/app/masters/Features/Gamification/Tabs.js +2 -2
- package/lib/app/masters/Features/Gamification/index.d.ts +2 -2
- package/lib/app/masters/Features/Gamification/index.js +1 -1
- package/lib/app/masters/Features/index.d.ts +2 -2
- package/lib/app/masters/Navigation/MastersNavigation/index.d.ts +1 -1
- package/lib/app/masters/Notifications/Onboarding/index.d.ts +1 -1
- package/lib/app/masters/Notifications/Onboarding/index.js +4 -4
- package/lib/app/masters/Notifications/index.d.ts +2 -2
- package/lib/app/masters/Notifications/index.js +1 -1
- package/lib/app/masters/masters.js +23 -23
- package/lib/app/masters/styles.d.ts +20 -0
- package/lib/app/{styles.js → masters/styles.js} +15 -15
- package/lib/app/masters/useSdkResponsive.d.ts +15 -0
- package/lib/app/masters/useSdkResponsive.js +45 -0
- package/lib/app/masters/useSdkScroll.d.ts +12 -0
- package/lib/app/masters/useSdkScroll.js +50 -0
- package/lib/app/useSdkResponsive.d.ts +1 -0
- package/lib/app/useSdkResponsive.js +27 -29
- package/lib/app/useSdkScroll.js +25 -24
- package/lib/assets/style.css +1 -1
- package/lib/ui/advertisement/banner/index.js +14 -11
- package/lib/ui/advertisement/index.d.ts +3 -0
- package/lib/ui/advertisement/index.js +31 -10
- package/lib/ui/advertisement/notification/index.d.ts +1 -0
- package/lib/ui/advertisement/notification/index.js +30 -27
- package/lib/ui/advertisement/notification/lower-third/index.d.ts +9 -0
- package/lib/ui/advertisement/notification/lower-third/index.js +37 -0
- package/lib/ui/advertisement/notification/lower-third/styles.d.ts +16 -0
- package/lib/ui/advertisement/notification/lower-third/styles.js +64 -0
- package/lib/ui/advertisement/overlay/index.d.ts +2 -0
- package/lib/ui/advertisement/overlay/index.js +58 -43
- package/lib/ui/advertisement/overlay/styles.d.ts +0 -2
- package/lib/ui/advertisement/overlay/styles.js +41 -52
- package/lib/ui/close-btn/index.d.ts +7 -0
- package/lib/ui/close-btn/index.js +47 -0
- package/lib/ui/gamification/detail/header/index.d.ts +2 -1
- package/lib/ui/gamification/detail/header/index.js +16 -15
- package/lib/ui/gamification/vote/styles.js +1 -1
- package/lib/ui/navigation/button/FeaturedGroups.d.ts +1 -1
- package/lib/ui/navigation/index.d.ts +5 -3
- package/lib/ui/navigation/index.js +11 -12
- package/lib/ui/navigation/masters.js +1 -1
- package/lib/ui/navigation/styles.d.ts +5 -0
- package/lib/ui/navigation/styles.js +16 -0
- package/lib/ui/questions/insight/index.js +21 -20
- package/lib/ui/theme/masters-theme.js +36 -13
- package/lib/ui/theme/theme.js +25 -26
- package/lib/ui/timer/index.d.ts +3 -1
- package/lib/ui/timer/index.js +54 -32
- package/lib/ui/video-player/index.d.ts +2 -0
- package/lib/ui/video-player/index.js +62 -51
- package/lib/ui/video-player/styles.d.ts +1 -0
- package/lib/ui/video-player/styles.js +7 -6
- package/package.json +15 -15
- /package/lib/app/{styles.d.ts → app/styles.d.ts} +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import c from "lodash.throttle";
|
|
2
|
+
import { useState as m, useEffect as u } from "react";
|
|
3
|
+
import { BREAKPOINTS as r } from "../../ui/theme/constants.js";
|
|
4
|
+
import { m as l } from "../../index-CZvwzN5o.js";
|
|
5
|
+
const d = Object.keys(r), i = () => {
|
|
6
|
+
const n = window.innerWidth;
|
|
7
|
+
let e = "sm";
|
|
8
|
+
for (let t = d.length - 1; t > 0; t--) {
|
|
9
|
+
const s = d[t];
|
|
10
|
+
if (!(n < r[s]) && n >= r[s]) {
|
|
11
|
+
e = s;
|
|
12
|
+
break;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
name: e,
|
|
17
|
+
size: r[e]
|
|
18
|
+
};
|
|
19
|
+
}, w = (n) => {
|
|
20
|
+
var e;
|
|
21
|
+
return (((e = n.current) == null ? void 0 : e.getBoundingClientRect().y) || 0) < -68;
|
|
22
|
+
}, k = (n) => n >= r.xl, v = (n) => {
|
|
23
|
+
const [e] = m(() => {
|
|
24
|
+
const t = i();
|
|
25
|
+
return l({
|
|
26
|
+
screen: i(),
|
|
27
|
+
sdkInView: w(n),
|
|
28
|
+
sdkInDesktopView: k(t.size)
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
return u(() => {
|
|
32
|
+
const t = c(() => {
|
|
33
|
+
e.setKey("sdkInView", w(n));
|
|
34
|
+
}, 200), s = c(() => {
|
|
35
|
+
const o = i();
|
|
36
|
+
e.setKey("screen", o), e.setKey("sdkInDesktopView", k(o.size));
|
|
37
|
+
}, 200);
|
|
38
|
+
return window.addEventListener("scroll", t), window.addEventListener("resize", s), () => {
|
|
39
|
+
window.removeEventListener("scroll", t), window.removeEventListener("resize", s);
|
|
40
|
+
};
|
|
41
|
+
}, [e, n]), [e];
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
v as useSdkResponsive
|
|
45
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ScrollNodeRef, AppNodeRef } from '..';
|
|
2
|
+
import { MapStore } from 'nanostores';
|
|
3
|
+
import { ResponsiveStore } from './useSdkResponsive';
|
|
4
|
+
type ScrollData = {
|
|
5
|
+
scrollPosition: number;
|
|
6
|
+
tabsShown?: boolean;
|
|
7
|
+
scrollDirection: 'forward' | 'backward';
|
|
8
|
+
};
|
|
9
|
+
export type ScrollStore = MapStore<ScrollData>;
|
|
10
|
+
export declare const scrollIntoAppView: (appNode: AppNodeRef, screenSize: number, options?: ScrollIntoViewOptions) => void;
|
|
11
|
+
export declare const useSdkScroll: (appNode: AppNodeRef, responsiveStore: ResponsiveStore) => [ScrollNodeRef, ScrollStore];
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useStore as S } from "@nanostores/react";
|
|
2
|
+
import h from "lodash.throttle";
|
|
3
|
+
import { useRef as m, useState as b, useEffect as g } from "react";
|
|
4
|
+
import { BREAKPOINTS as c } from "../../ui/theme/constants.js";
|
|
5
|
+
import { m as v } from "../../index-CZvwzN5o.js";
|
|
6
|
+
const C = (o, e, n) => {
|
|
7
|
+
const t = e >= c.lg && e < c.xl ? 75 : 52;
|
|
8
|
+
o.current && window.scrollTo({
|
|
9
|
+
top: o.current.offsetTop - t,
|
|
10
|
+
...n
|
|
11
|
+
});
|
|
12
|
+
}, T = 15, D = (o, e) => {
|
|
13
|
+
const n = m(null), t = m(0), [s] = b(
|
|
14
|
+
v({
|
|
15
|
+
scrollPosition: 0,
|
|
16
|
+
tabsShown: !0,
|
|
17
|
+
scrollDirection: "forward"
|
|
18
|
+
})
|
|
19
|
+
), i = S(e);
|
|
20
|
+
return g(() => {
|
|
21
|
+
const l = window.innerWidth < c.xl ? window : n.current;
|
|
22
|
+
if (!l)
|
|
23
|
+
return () => {
|
|
24
|
+
};
|
|
25
|
+
const f = h((d) => {
|
|
26
|
+
var a;
|
|
27
|
+
const u = d.target;
|
|
28
|
+
if (!u)
|
|
29
|
+
return;
|
|
30
|
+
let r = 0;
|
|
31
|
+
i.screen.size < c.xl ? r = ((a = o.current) == null ? void 0 : a.getBoundingClientRect().y) || 0 : r = u.scrollTop;
|
|
32
|
+
const w = t.current - r;
|
|
33
|
+
if (T > Math.abs(w))
|
|
34
|
+
return;
|
|
35
|
+
const p = t.current < r ? "forward" : "backward";
|
|
36
|
+
t.current = r, s.set({
|
|
37
|
+
scrollPosition: Math.round(r),
|
|
38
|
+
scrollDirection: p,
|
|
39
|
+
tabsShown: s.get().tabsShown
|
|
40
|
+
});
|
|
41
|
+
}, 200);
|
|
42
|
+
return l.addEventListener("scroll", f), () => {
|
|
43
|
+
l.removeEventListener("scroll", f);
|
|
44
|
+
};
|
|
45
|
+
}, [s, o, i.screen]), [n, s];
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
C as scrollIntoAppView,
|
|
49
|
+
D as useSdkScroll
|
|
50
|
+
};
|
|
@@ -10,6 +10,7 @@ type ResponsiveData = {
|
|
|
10
10
|
sdkInView: boolean;
|
|
11
11
|
sdkInDesktopView: boolean;
|
|
12
12
|
};
|
|
13
|
+
export declare const checkSdkInDesktopView: () => boolean;
|
|
13
14
|
export type ResponsiveStore = MapStore<ResponsiveData>;
|
|
14
15
|
export declare const useSdkResponsive: (appNode: AppNodeRef) => [ResponsiveStore];
|
|
15
16
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useState as m, useEffect as
|
|
1
|
+
import i from "lodash.throttle";
|
|
2
|
+
import { useState as m, useEffect as a } from "react";
|
|
3
3
|
import { BREAKPOINTS as r } from "../ui/theme/constants.js";
|
|
4
|
-
import { m as
|
|
5
|
-
const
|
|
6
|
-
const
|
|
4
|
+
import { m as u } from "../index-CZvwzN5o.js";
|
|
5
|
+
const o = Object.keys(r), c = () => {
|
|
6
|
+
const t = window.innerWidth;
|
|
7
7
|
let e = "sm";
|
|
8
|
-
for (let
|
|
9
|
-
const s =
|
|
10
|
-
if (!(
|
|
8
|
+
for (let n = o.length - 1; n > 0; n--) {
|
|
9
|
+
const s = o[n];
|
|
10
|
+
if (!(t < r[s]) && t >= r[s]) {
|
|
11
11
|
e = s;
|
|
12
12
|
break;
|
|
13
13
|
}
|
|
@@ -16,30 +16,28 @@ const d = Object.keys(r), i = () => {
|
|
|
16
16
|
name: e,
|
|
17
17
|
size: r[e]
|
|
18
18
|
};
|
|
19
|
-
},
|
|
19
|
+
}, d = (t) => {
|
|
20
20
|
var e;
|
|
21
|
-
return (((e =
|
|
22
|
-
},
|
|
23
|
-
const [e] = m(() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
e.setKey("
|
|
34
|
-
}, 200), s = c(() => {
|
|
35
|
-
const o = i();
|
|
36
|
-
e.setKey("screen", o), e.setKey("sdkInDesktopView", k(o.size));
|
|
21
|
+
return (((e = t.current) == null ? void 0 : e.getBoundingClientRect().y) || 0) < -68;
|
|
22
|
+
}, w = () => window.matchMedia("(orientation: landscape)").matches, h = (t) => {
|
|
23
|
+
const [e] = m(() => u({
|
|
24
|
+
screen: c(),
|
|
25
|
+
sdkInView: d(t),
|
|
26
|
+
sdkInDesktopView: w()
|
|
27
|
+
}));
|
|
28
|
+
return a(() => {
|
|
29
|
+
const n = i(() => {
|
|
30
|
+
e.setKey("sdkInView", d(t));
|
|
31
|
+
}, 200), s = i(() => {
|
|
32
|
+
const k = c();
|
|
33
|
+
e.setKey("screen", k), e.setKey("sdkInDesktopView", w());
|
|
37
34
|
}, 200);
|
|
38
|
-
return window.addEventListener("scroll",
|
|
39
|
-
window.removeEventListener("scroll",
|
|
35
|
+
return window.addEventListener("scroll", n), window.addEventListener("resize", s), () => {
|
|
36
|
+
window.removeEventListener("scroll", n), window.removeEventListener("resize", s);
|
|
40
37
|
};
|
|
41
|
-
}, [e,
|
|
38
|
+
}, [e, t]), [e];
|
|
42
39
|
};
|
|
43
40
|
export {
|
|
44
|
-
|
|
41
|
+
w as checkSdkInDesktopView,
|
|
42
|
+
h as useSdkResponsive
|
|
45
43
|
};
|
package/lib/app/useSdkScroll.js
CHANGED
|
@@ -1,50 +1,51 @@
|
|
|
1
|
-
import { useStore as
|
|
2
|
-
import
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { BREAKPOINTS as
|
|
1
|
+
import { useStore as h } from "@nanostores/react";
|
|
2
|
+
import b from "lodash.throttle";
|
|
3
|
+
import { useRef as u, useState as g, useEffect as k } from "react";
|
|
4
|
+
import { BREAKPOINTS as a } from "../ui/theme/constants.js";
|
|
5
|
+
import { checkSdkInDesktopView as m } from "./useSdkResponsive.js";
|
|
5
6
|
import { m as v } from "../index-CZvwzN5o.js";
|
|
6
|
-
const
|
|
7
|
-
const t = e >=
|
|
7
|
+
const I = (o, e, n) => {
|
|
8
|
+
const t = e >= a.lg && e < a.xl ? 75 : 52;
|
|
8
9
|
o.current && window.scrollTo({
|
|
9
10
|
top: o.current.offsetTop - t,
|
|
10
11
|
...n
|
|
11
12
|
});
|
|
12
|
-
}, T = 15,
|
|
13
|
-
const n =
|
|
13
|
+
}, T = 15, L = (o, e) => {
|
|
14
|
+
const n = u(null), t = u(0), [s] = g(
|
|
14
15
|
v({
|
|
15
16
|
scrollPosition: 0,
|
|
16
17
|
tabsShown: !0,
|
|
17
18
|
scrollDirection: "forward"
|
|
18
19
|
})
|
|
19
|
-
),
|
|
20
|
-
return
|
|
21
|
-
const
|
|
22
|
-
if (!
|
|
20
|
+
), d = h(e);
|
|
21
|
+
return k(() => {
|
|
22
|
+
const c = m() ? n.current : window;
|
|
23
|
+
if (!c)
|
|
23
24
|
return () => {
|
|
24
25
|
};
|
|
25
|
-
const
|
|
26
|
-
var
|
|
27
|
-
const
|
|
28
|
-
if (!
|
|
26
|
+
const l = b((p) => {
|
|
27
|
+
var f;
|
|
28
|
+
const i = p.target;
|
|
29
|
+
if (!i)
|
|
29
30
|
return;
|
|
30
31
|
let r = 0;
|
|
31
|
-
|
|
32
|
+
m() ? r = i.scrollTop : r = ((f = o.current) == null ? void 0 : f.getBoundingClientRect().y) || 0;
|
|
32
33
|
const w = t.current - r;
|
|
33
34
|
if (T > Math.abs(w))
|
|
34
35
|
return;
|
|
35
|
-
const
|
|
36
|
+
const S = t.current < r ? "forward" : "backward";
|
|
36
37
|
t.current = r, s.set({
|
|
37
38
|
scrollPosition: Math.round(r),
|
|
38
|
-
scrollDirection:
|
|
39
|
+
scrollDirection: S,
|
|
39
40
|
tabsShown: s.get().tabsShown
|
|
40
41
|
});
|
|
41
42
|
}, 200);
|
|
42
|
-
return
|
|
43
|
-
|
|
43
|
+
return c.addEventListener("scroll", l), () => {
|
|
44
|
+
c.removeEventListener("scroll", l);
|
|
44
45
|
};
|
|
45
|
-
}, [s, o,
|
|
46
|
+
}, [s, o, d.screen]), [n, s];
|
|
46
47
|
};
|
|
47
48
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
I as scrollIntoAppView,
|
|
50
|
+
L as useSdkScroll
|
|
50
51
|
};
|