@streamlayer/react-ui 0.95.1 → 0.96.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.
Files changed (41) hide show
  1. package/lib/assets/style.css +1 -1
  2. package/lib/ui/app/Features/Gamification/Question.js +38 -32
  3. package/lib/ui/app/Features/Gamification/QuestionsList.js +9 -8
  4. package/lib/ui/app/Features/Gamification/Tabs.js +3 -2
  5. package/lib/ui/app/Features/Gamification/gamification-feature.js +1 -0
  6. package/lib/ui/app/Features/Gamification/index.js +26 -25
  7. package/lib/ui/app/Notifications/Onboarding/index.js +90 -77
  8. package/lib/ui/app/Notifications/index.js +80 -74
  9. package/lib/ui/app/masters.js +59 -48
  10. package/lib/ui/app/useMastersApp.js +44 -40
  11. package/lib/ui/app/useMastersContext.d.ts +8 -0
  12. package/lib/ui/app/useMastersContext.js +8 -0
  13. package/lib/ui/app/useSdkResponsive.d.ts +2 -2
  14. package/lib/ui/gamification/onboarding/index.d.ts +4 -1
  15. package/lib/ui/gamification/onboarding/index.js +56 -48
  16. package/lib/ui/gamification/onboarding/invitingUser/index.js +10 -8
  17. package/lib/ui/gamification/onboarding/invitingUser/styles.d.ts +1 -0
  18. package/lib/ui/gamification/onboarding/invitingUser/styles.js +12 -7
  19. package/lib/ui/gamification/onboarding/slides/onboarding-instructions/index.d.ts +1 -0
  20. package/lib/ui/gamification/onboarding/slides/onboarding-instructions/index.js +21 -16
  21. package/lib/ui/gamification/onboarding/slides/onboarding-instructions/styles.d.ts +1 -0
  22. package/lib/ui/gamification/onboarding/slides/onboarding-instructions/styles.js +11 -6
  23. package/lib/ui/gamification/question/insight/index.d.ts +6 -2
  24. package/lib/ui/gamification/question/insight/index.js +1 -5
  25. package/lib/ui/gamification/question/list/index.d.ts +2 -0
  26. package/lib/ui/gamification/question/list/index.js +22 -13
  27. package/lib/ui/gamification/question/notification/index.d.ts +2 -1
  28. package/lib/ui/gamification/question/notification/index.js +20 -19
  29. package/lib/ui/gamification/question/notification/insight/index.d.ts +3 -1
  30. package/lib/ui/gamification/question/notification/insight/index.js +11 -11
  31. package/lib/ui/gamification/question/twitter/index.d.ts +6 -2
  32. package/lib/ui/gamification/question/twitter/index.js +1 -4
  33. package/lib/ui/modal/index.d.ts +7 -2
  34. package/lib/ui/modal/index.js +32 -22
  35. package/lib/ui/questions/insight/index.d.ts +2 -0
  36. package/lib/ui/questions/insight/index.js +23 -11
  37. package/lib/ui/questions/twitter/index.d.ts +2 -0
  38. package/lib/ui/questions/twitter/index.js +14 -13
  39. package/lib/ui/video-player/index.d.ts +5 -0
  40. package/lib/ui/video-player/index.js +43 -35
  41. package/package.json +14 -13
@@ -1,34 +1,44 @@
1
- import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
- import { cx as l } from "@linaria/core";
3
- import { styled as m } from "@linaria/react";
4
- import { r as n } from "../../index-jRXrW6ie.js";
1
+ import { jsxs as i, jsx as n } from "react/jsx-runtime";
2
+ import { cx as a } from "@linaria/core";
3
+ import { styled as d } from "@linaria/react";
4
+ import { useState as m, useCallback as f, useEffect as l } from "react";
5
+ import { r as c } from "../../index-jRXrW6ie.js";
5
6
  import "../../index-uEuzH3jr.js";
6
- import "react";
7
- const c = /* @__PURE__ */ m("div")({
7
+ const u = /* @__PURE__ */ d("div")({
8
8
  name: "StaticContainer",
9
9
  class: "svm502q",
10
10
  propsAsIs: !1
11
- }), i = "fd3gza8", d = `
11
+ }), p = "fd3gza8", v = `
12
12
  body {
13
13
  overflow: hidden !important;
14
14
  }
15
- `, p = `
15
+ `, x = `
16
16
  .sl-hide-on-modal {
17
17
  display: none !important;
18
18
  }
19
- `, C = ({
20
- Modal: o,
21
- container: t,
22
- fixedView: r,
23
- useContainer: s
24
- }) => t.current ? s ? n.createPortal(/* @__PURE__ */ a(c, {
25
- className: l(r && i),
26
- children: [o, r && /* @__PURE__ */ e("style", {
27
- children: d
28
- }), !r && /* @__PURE__ */ e("style", {
29
- children: p
30
- })]
31
- }), t.current, "modal-node") : n.createPortal(o, t.current, "modal-node") : null;
19
+ `, y = (r) => {
20
+ const [e, o] = m(r), t = f(() => o(!1), []);
21
+ return l(() => (r && document.addEventListener("scroll", t), () => {
22
+ document.removeEventListener("scroll", t);
23
+ }), [r, t]), l(() => {
24
+ e === !1 && document.removeEventListener("scroll", t);
25
+ }, [e, t]), [e];
26
+ }, V = ({
27
+ children: r,
28
+ container: e,
29
+ fixedView: o,
30
+ useContainer: t
31
+ }) => {
32
+ const [s] = y(o);
33
+ return e.current ? t ? c.createPortal(/* @__PURE__ */ i(u, {
34
+ className: a(s && p),
35
+ children: [r, s && /* @__PURE__ */ n("style", {
36
+ children: v
37
+ }), !s && /* @__PURE__ */ n("style", {
38
+ children: x
39
+ })]
40
+ }), e.current, "modal-node") : c.createPortal(r, e.current, "modal-node") : null;
41
+ };
32
42
  export {
33
- C as createModal
43
+ V as ModalPortal
34
44
  };
@@ -1,6 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { InsightHistory } from '@streamlayer/sdk-web-types';
3
+ import { VideoPlayerProps } from '../../video-player';
3
4
  export type InsightContentProps = InsightHistory & {
4
5
  isDetail?: boolean;
6
+ controlVideo: VideoPlayerProps['controlVideo'];
5
7
  };
6
8
  export declare const InsightContent: React.FC<InsightContentProps>;
@@ -1,21 +1,33 @@
1
1
  import { jsxs as c, jsx as d } from "react/jsx-runtime";
2
- import { VideoPlayer as u } from "../../video-player/index.js";
3
- import { Container as v, Image as b, Content as x, Title as C, Description as I } from "./styles.js";
2
+ import { VideoPlayer as v } from "../../video-player/index.js";
3
+ import { Container as b, Image as x, Content as C, Title as I, Description as T } from "./styles.js";
4
4
  import "react";
5
5
  import "../../icons/index.js";
6
6
  import "@linaria/react";
7
7
  import "../../video-player/styles.js";
8
- const q = ({ instantView: r, isDetail: l, notification: o }) => {
9
- const m = r == null ? void 0 : r.heading, p = r == null ? void 0 : r.body, h = m || p, g = o == null ? void 0 : o.title, y = o == null ? void 0 : o.body;
10
- return /* @__PURE__ */ c(v, { children: [
11
- (r == null ? void 0 : r.video) && /* @__PURE__ */ d(u, { source: r.video.url, poster: r.video.thumbnailUrl }),
12
- (r == null ? void 0 : r.image) && !(r != null && r.video) && /* @__PURE__ */ d(b, { src: r == null ? void 0 : r.image }),
13
- /* @__PURE__ */ c(x, { children: [
14
- /* @__PURE__ */ d(C, { children: l && h ? m : g }),
15
- /* @__PURE__ */ d(I, { children: l && h ? p : y })
8
+ const z = ({
9
+ instantView: r,
10
+ isDetail: l,
11
+ notification: o,
12
+ controlVideo: g
13
+ }) => {
14
+ const m = r == null ? void 0 : r.heading, p = r == null ? void 0 : r.body, h = m || p, y = o == null ? void 0 : o.title, u = o == null ? void 0 : o.body;
15
+ return /* @__PURE__ */ c(b, { children: [
16
+ (r == null ? void 0 : r.video) && /* @__PURE__ */ d(
17
+ v,
18
+ {
19
+ source: r.video.url,
20
+ poster: r.video.thumbnailUrl,
21
+ controlVideo: g
22
+ }
23
+ ),
24
+ (r == null ? void 0 : r.image) && !(r != null && r.video) && /* @__PURE__ */ d(x, { src: r == null ? void 0 : r.image }),
25
+ /* @__PURE__ */ c(C, { children: [
26
+ /* @__PURE__ */ d(I, { children: l && h ? m : y }),
27
+ /* @__PURE__ */ d(T, { children: l && h ? p : u })
16
28
  ] })
17
29
  ] });
18
30
  };
19
31
  export {
20
- q as InsightContent
32
+ z as InsightContent
21
33
  };
@@ -1,6 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { TweetHistory } from '@streamlayer/sdk-web-types';
3
+ import { VideoPlayerProps } from '../../video-player';
3
4
  export type TwitterContentProps = TweetHistory & {
4
5
  isDetail?: boolean;
6
+ controlVideo: VideoPlayerProps['controlVideo'];
5
7
  };
6
8
  export declare const TwitterContent: React.FC<TwitterContentProps>;
@@ -1,29 +1,30 @@
1
- import { jsxs as t, jsx as n, Fragment as T } from "react/jsx-runtime";
2
- import { VideoPlayer as j } from "../../video-player/index.js";
3
- import { Account as k } from "./account/index.js";
4
- import { Container as x, Details as B, Body as E, ImagesContainer as c, ImageFullSize as i, ImageHalfSize as e, ImagesBlock as m } from "./styles.js";
1
+ import { jsxs as t, jsx as n, Fragment as j } from "react/jsx-runtime";
2
+ import { VideoPlayer as k } from "../../video-player/index.js";
3
+ import { Account as x } from "./account/index.js";
4
+ import { Container as B, Details as E, Body as N, ImagesContainer as c, ImageFullSize as i, ImageHalfSize as e, ImagesBlock as m } from "./styles.js";
5
5
  import "react";
6
6
  import "../../icons/index.js";
7
7
  import "@linaria/react";
8
8
  import "../../video-player/styles.js";
9
9
  import "../../../utils/common.js";
10
10
  import "./account/styles.js";
11
- const N = new RegExp("\\s?https?://t.co[^\\s]+(\\s+)?$"), R = (o) => o == null ? void 0 : o.replace(N, ""), G = ({
11
+ const R = new RegExp("\\s?https?://t.co[^\\s]+(\\s+)?$"), S = (o) => o == null ? void 0 : o.replace(R, ""), J = ({
12
12
  image: o,
13
13
  body: C,
14
14
  account: z,
15
15
  accountVerified: F,
16
16
  tweet: s,
17
- isDetail: a
17
+ isDetail: a,
18
+ controlVideo: T
18
19
  }) => {
19
20
  var h, g, H, U, f, u, v, I, y;
20
21
  const r = (g = (h = s == null ? void 0 : s.meta) == null ? void 0 : h.extendedEntities) == null ? void 0 : g.media, l = r == null ? void 0 : r.find(({ type: p }) => p === "photo"), d = (u = (f = (U = (H = r == null ? void 0 : r[0]) == null ? void 0 : H.videoInfo) == null ? void 0 : U.variants) == null ? void 0 : f.find(
21
22
  ({ contentType: p }) => p === "video/mp4"
22
23
  )) == null ? void 0 : u.url;
23
- return /* @__PURE__ */ t(x, { children: [
24
- /* @__PURE__ */ t(B, { children: [
24
+ return /* @__PURE__ */ t(B, { children: [
25
+ /* @__PURE__ */ t(E, { children: [
25
26
  /* @__PURE__ */ n(
26
- k,
27
+ x,
27
28
  {
28
29
  image: o,
29
30
  name: (v = s == null ? void 0 : s.meta) == null ? void 0 : v.accountName,
@@ -32,9 +33,9 @@ const N = new RegExp("\\s?https?://t.co[^\\s]+(\\s+)?$"), R = (o) => o == null ?
32
33
  createdTweet: s == null ? void 0 : s.date
33
34
  }
34
35
  ),
35
- /* @__PURE__ */ n(E, { children: R(C) }),
36
+ /* @__PURE__ */ n(N, { children: S(C) }),
36
37
  !a && l && /* @__PURE__ */ n(c, { children: /* @__PURE__ */ n(i, { src: r == null ? void 0 : r[0].mediaUrlHttps }) }),
37
- a && l && /* @__PURE__ */ t(T, { children: [
38
+ a && l && /* @__PURE__ */ t(j, { children: [
38
39
  (r == null ? void 0 : r.length) === 1 && /* @__PURE__ */ n(c, { children: /* @__PURE__ */ n(i, { src: r[0].mediaUrlHttps }) }),
39
40
  (r == null ? void 0 : r.length) === 2 && /* @__PURE__ */ t(c, { children: [
40
41
  /* @__PURE__ */ n(e, { src: r[0].mediaUrlHttps }),
@@ -59,9 +60,9 @@ const N = new RegExp("\\s?https?://t.co[^\\s]+(\\s+)?$"), R = (o) => o == null ?
59
60
  ] })
60
61
  ] })
61
62
  ] }),
62
- !l && (((I = r == null ? void 0 : r[0]) == null ? void 0 : I.type) === "video" || ((y = r == null ? void 0 : r[0]) == null ? void 0 : y.type) === "animated_gif") && d && /* @__PURE__ */ n(j, { source: d, poster: r[0].mediaUrlHttps })
63
+ !l && (((I = r == null ? void 0 : r[0]) == null ? void 0 : I.type) === "video" || ((y = r == null ? void 0 : r[0]) == null ? void 0 : y.type) === "animated_gif") && d && /* @__PURE__ */ n(k, { source: d, poster: r[0].mediaUrlHttps, controlVideo: T })
63
64
  ] });
64
65
  };
65
66
  export {
66
- G as TwitterContent
67
+ J as TwitterContent
67
68
  };
@@ -1,7 +1,11 @@
1
1
  /// <reference types="react" />
2
+ type ControlVideoProps = {
3
+ muted: boolean;
4
+ };
2
5
  export type VideoPlayerProps = {
3
6
  poster?: string;
4
7
  source?: string;
8
+ controlVideo?: (props: ControlVideoProps) => void;
5
9
  };
6
10
  /**
7
11
  * VideoPlayer component for playing videos with a poster image.
@@ -31,3 +35,4 @@ export type VideoPlayerProps = {
31
35
  * @returns {JSX.Element} The rendered VideoPlayer component.
32
36
  */
33
37
  export declare const VideoPlayer: React.FC<VideoPlayerProps>;
38
+ export {};
@@ -1,54 +1,62 @@
1
- import { jsxs as y, jsx as o } from "react/jsx-runtime";
2
- import { useRef as m, useState as b, useEffect as P } from "react";
3
- import { SvgIcon as h } from "../icons/index.js";
4
- import { Container as O, Player as w, Poster as E, Control as I } from "./styles.js";
1
+ import { jsxs as h, jsx as o } from "react/jsx-runtime";
2
+ import { useRef as O, useState as d, useEffect as w } from "react";
3
+ import { SvgIcon as E } from "../icons/index.js";
4
+ import { Container as I, Player as S, Poster as x, Control as C } from "./styles.js";
5
5
  import "@linaria/react";
6
- const S = (r, c) => {
7
- for (const e of r)
8
- e.isIntersecting || e.target instanceof HTMLVideoElement && !e.target.paused && (c.unobserve(e.target), e.target.pause());
9
- }, v = new IntersectionObserver(S, { threshold: 0.5 }), a = /* @__PURE__ */ new Set(), V = (r) => {
10
- v.observe(r), a.add(r);
11
- }, i = (r) => {
12
- v.unobserve(r), a.delete(r);
13
- }, H = ({ poster: r, source: c }) => {
14
- const e = m(null), [l, u] = b(!1), [f, d] = b(!0), g = () => {
15
- const s = e == null ? void 0 : e.current;
16
- if (s)
6
+ const L = (t, c) => {
7
+ for (const s of t)
8
+ s.isIntersecting || s.target instanceof HTMLVideoElement && !s.target.paused && (c.unobserve(s.target), s.target.pause());
9
+ }, g = new IntersectionObserver(L, { threshold: 0.5 }), f = /* @__PURE__ */ new Set(), T = (t) => {
10
+ g.observe(t), f.add(t);
11
+ }, u = (t) => {
12
+ g.unobserve(t), f.delete(t);
13
+ }, q = ({ poster: t, source: c, controlVideo: s }) => {
14
+ const e = O(null), [l, a] = d(!1), [b, m] = d(!0), p = () => {
15
+ s == null || s({ muted: !0 });
16
+ }, v = () => {
17
+ s == null || s({ muted: !1 });
18
+ }, y = () => {
19
+ const n = e == null ? void 0 : e.current;
20
+ if (n)
17
21
  if (l)
18
- s.pause(), e.current && i(e.current);
22
+ n.pause(), e.current && u(e.current);
19
23
  else {
20
- const n = e == null ? void 0 : e.current;
21
- if (!n)
24
+ const i = e == null ? void 0 : e.current;
25
+ if (!i)
22
26
  return;
23
- for (const t of a)
24
- t !== n && t instanceof HTMLVideoElement && !t.paused && (t.pause(), i(t));
25
- V(n), n.play().catch((t) => console.log(t)), d(!1);
27
+ for (const r of f)
28
+ r !== i && r instanceof HTMLVideoElement && !r.paused && (r.pause(), u(r));
29
+ T(i), i.play().catch((r) => console.log(r)), m(!1);
26
30
  }
27
- }, p = () => {
28
- var s;
29
- e.current && i(e.current), (s = e == null ? void 0 : e.current) == null || s.load(), d(!0);
31
+ }, P = () => {
32
+ var n;
33
+ e.current && u(e.current), (n = e == null ? void 0 : e.current) == null || n.load(), m(!0);
30
34
  };
31
- return P(() => {
32
- e.current && i(e.current);
33
- }, []), /* @__PURE__ */ y(O, { onClick: g, children: [
35
+ return w(() => {
36
+ e.current && u(e.current);
37
+ }, []), /* @__PURE__ */ h(I, { onClick: y, children: [
34
38
  /* @__PURE__ */ o(
35
- w,
39
+ S,
36
40
  {
37
41
  ref: e,
38
42
  src: c,
39
- onPlay: () => u(!0),
40
- onPause: () => u(!1),
43
+ onPlay: () => {
44
+ p(), a(!0);
45
+ },
46
+ onPause: () => {
47
+ v(), a(!1);
48
+ },
41
49
  onEnded: () => {
42
- u(!1), p();
50
+ v(), a(!1), P();
43
51
  },
44
- style: { visibility: f ? "hidden" : "visible" },
52
+ style: { visibility: b ? "hidden" : "visible" },
45
53
  playsInline: !0
46
54
  }
47
55
  ),
48
- /* @__PURE__ */ o(E, { src: r, style: { visibility: f ? "visible" : "hidden" } }),
49
- /* @__PURE__ */ o(I, { children: !l && /* @__PURE__ */ o(h, { name: "icon-play" }) })
56
+ /* @__PURE__ */ o(x, { src: t, style: { visibility: b ? "visible" : "hidden" } }),
57
+ /* @__PURE__ */ o(C, { children: !l && /* @__PURE__ */ o(E, { name: "icon-play" }) })
50
58
  ] });
51
59
  };
52
60
  export {
53
- H as VideoPlayer
61
+ q as VideoPlayer
54
62
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/react-ui",
3
- "version": "0.95.1",
3
+ "version": "0.96.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -37,23 +37,24 @@
37
37
  "peerDependencies": {
38
38
  "@lottiefiles/react-lottie-player": "*",
39
39
  "@streamlayer/sl-eslib": "^5.67.0",
40
+ "nanoid": "3.3.7",
40
41
  "@types/lodash.throttle": "^4.1.9",
41
42
  "lodash.throttle": "^4.1.1",
42
43
  "react-infinite-scroller": "^1.2.6",
43
44
  "react-virtualized-auto-sizer": "^1.0.21",
44
45
  "react-window": "^1.8.10",
45
46
  "react-window-infinite-loader": "^1.0.9",
46
- "@streamlayer/feature-gamification": "^0.37.1",
47
- "@streamlayer/sdk-web": "^0.31.2",
48
- "@streamlayer/sdk-web-anonymous-auth": "^0.11.37",
49
- "@streamlayer/sdk-web-api": "^0.21.2",
50
- "@streamlayer/sdk-web-core": "^0.20.1",
51
- "@streamlayer/sdk-web-features": "^0.11.19",
52
- "@streamlayer/sdk-web-interfaces": "^0.20.4",
53
- "@streamlayer/sdk-web-logger": "^0.5.15",
54
- "@streamlayer/sdk-web-notifications": "^0.13.10",
55
- "@streamlayer/sdk-web-storage": "^0.4.2",
56
- "@streamlayer/sdk-web-types": "^0.22.2"
47
+ "@streamlayer/feature-gamification": "^0.37.2",
48
+ "@streamlayer/sdk-web": "^0.32.0",
49
+ "@streamlayer/sdk-web-anonymous-auth": "^0.11.38",
50
+ "@streamlayer/sdk-web-api": "^0.22.0",
51
+ "@streamlayer/sdk-web-features": "^0.11.20",
52
+ "@streamlayer/sdk-web-core": "^0.21.0",
53
+ "@streamlayer/sdk-web-interfaces": "^0.20.5",
54
+ "@streamlayer/sdk-web-logger": "^0.5.16",
55
+ "@streamlayer/sdk-web-notifications": "^0.14.0",
56
+ "@streamlayer/sdk-web-storage": "^0.4.3",
57
+ "@streamlayer/sdk-web-types": "^0.22.3"
57
58
  },
58
59
  "nx": {
59
60
  "implicitDependencies": [
@@ -94,6 +95,6 @@
94
95
  "vite-plugin-svgr": "^4.2.0",
95
96
  "vite-svg-loader": "^5.1.0",
96
97
  "vite-tsconfig-paths": "^4.3.1",
97
- "@streamlayer/react": "^0.39.1"
98
+ "@streamlayer/react": "^0.40.0"
98
99
  }
99
100
  }