@streamlayer/react-ui 0.96.3 → 0.97.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 (71) hide show
  1. package/lib/assets/style.css +1 -1
  2. package/lib/hooks/analytics.js +50 -0
  3. package/lib/index-z0QjLiEL.js +75 -0
  4. package/lib/ui/app/Features/Gamification/Friends.d.ts +0 -2
  5. package/lib/ui/app/Features/Gamification/Friends.js +16 -22
  6. package/lib/ui/app/Features/Gamification/Leaderboard.js +31 -25
  7. package/lib/ui/app/Features/Gamification/Question.js +4 -2
  8. package/lib/ui/app/Features/Gamification/QuestionsList.js +11 -8
  9. package/lib/ui/app/Features/Gamification/Tabs.js +30 -25
  10. package/lib/ui/app/Features/Gamification/UserSummary.js +14 -12
  11. package/lib/ui/app/Features/Gamification/gamification-feature.js +5 -1
  12. package/lib/ui/app/Features/Gamification/index.js +9 -5
  13. package/lib/ui/app/Features/index.js +24 -21
  14. package/lib/ui/app/Notifications/Onboarding/index.d.ts +2 -0
  15. package/lib/ui/app/Notifications/Onboarding/index.js +76 -78
  16. package/lib/ui/app/Notifications/index.js +98 -91
  17. package/lib/ui/app/Points/index.js +20 -17
  18. package/lib/ui/app/masters.js +76 -65
  19. package/lib/ui/app/useMastersApp.js +9 -9
  20. package/lib/ui/app/useSdkFeature.js +13 -16
  21. package/lib/ui/app/useSdkResponsive.js +1 -1
  22. package/lib/ui/app/useSdkScroll.d.ts +1 -1
  23. package/lib/ui/app/useSdkScroll.js +28 -25
  24. package/lib/ui/gamification/invite-link/index.js +26 -12
  25. package/lib/ui/gamification/onboarding/index.d.ts +0 -2
  26. package/lib/ui/gamification/onboarding/index.js +46 -46
  27. package/lib/ui/gamification/onboarding/slides/onboarding-instructions/index.d.ts +2 -2
  28. package/lib/ui/gamification/onboarding/slides/onboarding-instructions/index.js +21 -20
  29. package/lib/ui/gamification/onboarding/slides/onboarding-instructions/styles.d.ts +1 -0
  30. package/lib/ui/gamification/onboarding/slides/onboarding-instructions/styles.js +20 -15
  31. package/lib/ui/gamification/onboarding/slides/onboarding-invite-card/index.d.ts +0 -3
  32. package/lib/ui/gamification/onboarding/slides/onboarding-invite-card/index.js +34 -29
  33. package/lib/ui/gamification/onboarding/slides/onboarding-invite-card/styles.d.ts +0 -3
  34. package/lib/ui/gamification/onboarding/slides/onboarding-invite-card/styles.js +17 -32
  35. package/lib/ui/gamification/points/index.d.ts +1 -0
  36. package/lib/ui/gamification/points/index.js +9 -9
  37. package/lib/ui/gamification/question/index.d.ts +1 -0
  38. package/lib/ui/gamification/question/index.js +31 -24
  39. package/lib/ui/gamification/question/insight/index.js +3 -2
  40. package/lib/ui/gamification/question/list/index.d.ts +3 -1
  41. package/lib/ui/gamification/question/list/index.js +22 -19
  42. package/lib/ui/gamification/question/notification/index.js +3 -2
  43. package/lib/ui/gamification/question/notification/insight/index.js +10 -9
  44. package/lib/ui/gamification/question/notification/tweet/index.js +3 -2
  45. package/lib/ui/gamification/question/styles.d.ts +2 -0
  46. package/lib/ui/gamification/question/styles.js +39 -28
  47. package/lib/ui/gamification/question/twitter/index.js +3 -2
  48. package/lib/ui/gamification/user-statistics/index.d.ts +3 -2
  49. package/lib/ui/gamification/user-statistics/index.js +48 -45
  50. package/lib/ui/gamification/vote/feedback/index.d.ts +3 -2
  51. package/lib/ui/gamification/vote/feedback/index.js +76 -63
  52. package/lib/ui/gamification/vote/feedback/styles.d.ts +1 -0
  53. package/lib/ui/gamification/vote/feedback/styles.js +31 -24
  54. package/lib/ui/gamification/vote/index.js +93 -89
  55. package/lib/ui/gamification/vote/insight-details/index.js +7 -6
  56. package/lib/ui/gamification/vote/twitter-details/index.js +3 -2
  57. package/lib/ui/gamification/vote/vote-option/index.d.ts +2 -1
  58. package/lib/ui/gamification/vote/vote-option/index.js +47 -39
  59. package/lib/ui/icons/index.d.ts +1 -2
  60. package/lib/ui/icons/index.js +44 -36
  61. package/lib/ui/modal/index.js +27 -21
  62. package/lib/ui/questions/insight/index.js +3 -2
  63. package/lib/ui/questions/twitter/index.js +3 -2
  64. package/lib/ui/show-in/index.d.ts +2 -0
  65. package/lib/ui/show-in/index.js +24 -14
  66. package/lib/ui/timer/index.js +32 -28
  67. package/lib/ui/video-player/index.js +41 -39
  68. package/lib/ui/video-player/styles.d.ts +1 -0
  69. package/lib/ui/video-player/styles.js +10 -9
  70. package/package.json +22 -21
  71. package/lib/index-keh7OLCY.js +0 -67
@@ -1,41 +1,45 @@
1
1
  import { jsx as R } from "react/jsx-runtime";
2
- import { styled as E } from "@linaria/react";
3
- import { useState as S, useCallback as n } from "react";
4
- import { CountdownCircleTimer as A } from "react-countdown-circle-timer";
5
- import { COLORS as o } from "../theme/constants.js";
6
- const O = [o.PRIMARY_GREEN1, o.SECONDARY_RED1, o.SECONDARY_RED1, o.NEUTRALS_GRAY3], _ = [10, 10, 1, 0], N = /* @__PURE__ */ E("div")({
2
+ import { styled as _ } from "@linaria/react";
3
+ import { useState as c, useEffect as a, useCallback as n } from "react";
4
+ import { CountdownCircleTimer as N } from "react-countdown-circle-timer";
5
+ import { COLORS as t } from "../theme/constants.js";
6
+ const D = [t.PRIMARY_GREEN1, t.SECONDARY_RED1, t.SECONDARY_RED1, t.NEUTRALS_GRAY3], T = [10, 10, 1, 0], Y = /* @__PURE__ */ _("div")({
7
7
  name: "RemainingTime",
8
8
  class: "r165427",
9
9
  propsAsIs: !1
10
- }), f = o.SECONDARY_GREEN6, c = o.SECONDARY_RED3, D = o.NEUTRALS_GRAY3, d = ({
11
- isPlaying: l = !0,
12
- duration: e = 30,
13
- onTimerExpired: t
10
+ }), h = t.SECONDARY_GREEN6, l = t.SECONDARY_RED3, m = t.NEUTRALS_GRAY3, G = ({
11
+ isPlaying: i = !0,
12
+ duration: o = 30,
13
+ onTimerExpired: e
14
14
  }) => {
15
- const [i, s] = S(e > 10 ? f : c), m = ({
15
+ const [C, s] = c(o > 10 ? h : l), [E, S] = c(2);
16
+ a(() => {
17
+ o === 0 && (S(0), s(m));
18
+ }, [o]);
19
+ const f = ({
16
20
  remainingTime: r
17
- }) => /* @__PURE__ */ R(N, {
18
- children: r
19
- }), C = n(() => {
20
- t == null || t(), s(D);
21
- }, [t, s]), a = n((r) => {
22
- r === 10 && s(c);
21
+ }) => /* @__PURE__ */ R(Y, {
22
+ children: o === 0 ? 0 : r
23
+ }), A = n(() => {
24
+ e == null || e(), s(m);
25
+ }, [e, s]), O = n((r) => {
26
+ r === 10 && s(l);
23
27
  }, [s]);
24
- return /* @__PURE__ */ R(A, {
25
- isPlaying: l,
26
- duration: e,
27
- colors: O,
28
- colorsTime: _,
28
+ return /* @__PURE__ */ R(N, {
29
+ isPlaying: i,
30
+ duration: o,
31
+ colors: D,
32
+ colorsTime: T,
29
33
  size: 32,
30
- strokeWidth: 2,
34
+ strokeWidth: E,
31
35
  trailStrokeWidth: 2,
32
- trailColor: i,
33
- onComplete: C,
34
- onUpdate: a,
35
- children: m
36
+ trailColor: C,
37
+ onComplete: A,
38
+ onUpdate: O,
39
+ children: f
36
40
  });
37
41
  };
38
42
  export {
39
- N as RemainingTime,
40
- d as Timer
43
+ Y as RemainingTime,
44
+ G as Timer
41
45
  };
@@ -1,69 +1,71 @@
1
- import { jsxs as w, jsx as i } from "react/jsx-runtime";
2
- import { useRef as C, useState as v, useCallback as p, useEffect as d } from "react";
3
- import { SvgIcon as E } from "../icons/index.js";
4
- import { Container as I, Player as S, Poster as x, Control as L } from "./styles.js";
1
+ import { jsxs as w, jsx as n } from "react/jsx-runtime";
2
+ import { cx as x } from "@linaria/core";
3
+ import { useRef as C, useState as p, useCallback as g, useEffect as v } from "react";
4
+ import { SvgIcon as d } from "../icons/index.js";
5
+ import { Container as E, ToggleIconPause as S, Player as T, Poster as L, Control as j } from "./styles.js";
5
6
  import "@linaria/react";
6
- const T = (s, c) => {
7
+ const k = (s, o) => {
7
8
  for (const t of s)
8
- t.isIntersecting || t.target instanceof HTMLVideoElement && !t.target.paused && (c.unobserve(t.target), t.target.pause());
9
- }, g = new IntersectionObserver(T, { threshold: 0.5 }), f = /* @__PURE__ */ new Set(), j = (s) => {
10
- g.observe(s), f.add(s);
11
- }, n = (s) => {
12
- g.unobserve(s), f.delete(s);
13
- }, k = () => {
9
+ t.isIntersecting || t.target instanceof HTMLVideoElement && !t.target.paused && (o.unobserve(t.target), t.target.pause());
10
+ }, y = new IntersectionObserver(k, { threshold: 0.5 }), f = /* @__PURE__ */ new Set(), H = (s) => {
11
+ y.observe(s), f.add(s);
12
+ }, u = (s) => {
13
+ y.unobserve(s), f.delete(s);
14
+ }, M = () => {
14
15
  for (const s of f)
15
- s instanceof HTMLVideoElement && !s.paused && (s.pause(), n(s));
16
- }, z = ({ poster: s, source: c, controlVideo: t }) => {
17
- const e = C(null), [l, o] = v(!1), [b, m] = v(!0), y = p(() => {
16
+ s instanceof HTMLVideoElement && !s.paused && (s.pause(), u(s));
17
+ }, D = ({ poster: s, source: o, controlVideo: t }) => {
18
+ const e = C(null), [a, c] = p(!1), [m, b] = p(!0), P = g(() => {
18
19
  t == null || t({ muted: !0 });
19
- }, [t]), u = p(() => {
20
+ }, [t]), i = g(() => {
20
21
  t == null || t({ muted: !1 });
21
- }, [t]), P = () => {
22
+ }, [t]), h = () => {
22
23
  const r = e == null ? void 0 : e.current;
23
24
  if (r)
24
- if (l)
25
- r.pause(), e.current && n(e.current);
25
+ if (a)
26
+ r.pause(), e.current && u(e.current);
26
27
  else {
27
- const a = e == null ? void 0 : e.current;
28
- if (!a)
28
+ const l = e == null ? void 0 : e.current;
29
+ if (!l)
29
30
  return;
30
- k(), j(a), a.play().catch((O) => console.log(O)), m(!1);
31
+ M(), H(l), l.play().catch((O) => console.log(O)), b(!1);
31
32
  }
32
- }, h = () => {
33
+ }, I = () => {
33
34
  var r;
34
- e.current && n(e.current), (r = e == null ? void 0 : e.current) == null || r.load(), m(!0);
35
+ e.current && u(e.current), (r = e == null ? void 0 : e.current) == null || r.load(), b(!0);
35
36
  };
36
- return d(() => {
37
- e.current && n(e.current);
38
- }, []), d(() => {
37
+ return v(() => {
38
+ e.current && u(e.current);
39
+ }, []), v(() => {
39
40
  const r = e == null ? void 0 : e.current;
40
41
  return () => {
41
- r && (r.paused || u(), n(r));
42
+ r && (r.paused || i(), u(r));
42
43
  };
43
- }, [u]), /* @__PURE__ */ w(I, { onClick: P, children: [
44
- /* @__PURE__ */ i(
45
- S,
44
+ }, [i]), /* @__PURE__ */ w(E, { onClick: h, className: x(a && S), children: [
45
+ /* @__PURE__ */ n(
46
+ T,
46
47
  {
47
48
  ref: e,
48
- src: c,
49
+ src: o,
49
50
  onPlay: () => {
50
- y(), o(!0);
51
+ P(), c(!0);
51
52
  },
52
53
  onPause: () => {
53
- u(), o(!1);
54
+ i(), c(!1);
54
55
  },
55
56
  onEnded: () => {
56
- u(), o(!1), h();
57
+ i(), c(!1), I();
57
58
  },
58
- style: { visibility: b ? "hidden" : "visible" },
59
+ style: { visibility: m ? "hidden" : "visible" },
60
+ controls: !1,
59
61
  playsInline: !0
60
62
  }
61
63
  ),
62
- /* @__PURE__ */ i(x, { src: s, style: { visibility: b ? "visible" : "hidden" } }),
63
- /* @__PURE__ */ i(L, { children: !l && /* @__PURE__ */ i(E, { name: "icon-play" }) })
64
+ /* @__PURE__ */ n(L, { src: s, style: { visibility: m ? "visible" : "hidden" } }),
65
+ /* @__PURE__ */ n(j, { children: a ? /* @__PURE__ */ n(d, { name: "icon-pause" }) : /* @__PURE__ */ n(d, { name: "icon-play" }) })
64
66
  ] });
65
67
  };
66
68
  export {
67
- z as VideoPlayer,
68
- k as pauseAllVideos
69
+ D as VideoPlayer,
70
+ M as pauseAllVideos
69
71
  };
@@ -3,3 +3,4 @@ export declare const Container: import("@linaria/react").StyledComponent<import(
3
3
  export declare const Player: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLVideoElement> & import("react").VideoHTMLAttributes<HTMLVideoElement> & Record<never, unknown>>;
4
4
  export declare const Poster: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLImageElement> & import("react").ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown>>;
5
5
  export declare const Control: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
6
+ export declare const ToggleIconPause: import("@linaria/core").LinariaClassName;
@@ -1,24 +1,25 @@
1
1
  import { styled as s } from "@linaria/react";
2
- const a = /* @__PURE__ */ s("div")({
2
+ const e = /* @__PURE__ */ s("div")({
3
3
  name: "Container",
4
4
  class: "c1bgb86j",
5
5
  propsAsIs: !1
6
- }), e = /* @__PURE__ */ s("video")({
6
+ }), a = /* @__PURE__ */ s("video")({
7
7
  name: "Player",
8
8
  class: "p6703cq",
9
9
  propsAsIs: !1
10
- }), r = /* @__PURE__ */ s("img")({
10
+ }), l = /* @__PURE__ */ s("img")({
11
11
  name: "Poster",
12
12
  class: "p12ow7zo",
13
13
  propsAsIs: !1
14
- }), l = /* @__PURE__ */ s("div")({
14
+ }), n = /* @__PURE__ */ s("div")({
15
15
  name: "Control",
16
16
  class: "cdpal9o",
17
17
  propsAsIs: !1
18
- });
18
+ }), r = "t1xke4ml";
19
19
  export {
20
- a as Container,
21
- l as Control,
22
- e as Player,
23
- r as Poster
20
+ e as Container,
21
+ n as Control,
22
+ a as Player,
23
+ l as Poster,
24
+ r as ToggleIconPause
24
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/react-ui",
3
- "version": "0.96.3",
3
+ "version": "0.97.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -35,26 +35,27 @@
35
35
  "package.json"
36
36
  ],
37
37
  "peerDependencies": {
38
- "@lottiefiles/react-lottie-player": "*",
39
- "@streamlayer/sl-eslib": "^5.79.3",
40
- "nanoid": "3.3.7",
38
+ "@lottiefiles/react-lottie-player": "^3.5.3",
39
+ "@streamlayer/sl-eslib": "^5.83.1",
41
40
  "@types/lodash.throttle": "^4.1.9",
42
41
  "lodash.throttle": "^4.1.1",
42
+ "nanoid": "3.3.7",
43
43
  "react-infinite-scroller": "^1.2.6",
44
44
  "react-virtualized-auto-sizer": "^1.0.21",
45
45
  "react-window": "^1.8.10",
46
46
  "react-window-infinite-loader": "^1.0.9",
47
- "@streamlayer/feature-gamification": "^0.38.0",
48
- "@streamlayer/sdk-web": "^0.32.3",
49
- "@streamlayer/sdk-web-anonymous-auth": "^0.11.41",
50
- "@streamlayer/sdk-web-api": "^0.23.0",
51
- "@streamlayer/sdk-web-core": "^0.21.3",
52
- "@streamlayer/sdk-web-features": "^0.11.23",
53
- "@streamlayer/sdk-web-interfaces": "^0.20.6",
54
- "@streamlayer/sdk-web-notifications": "^0.14.2",
55
- "@streamlayer/sdk-web-logger": "^0.5.17",
56
- "@streamlayer/sdk-web-storage": "^0.4.4",
57
- "@streamlayer/sdk-web-types": "^0.22.4"
47
+ "@streamlayer/feature-gamification": "^0.39.0",
48
+ "@streamlayer/sdk-web-analytics": "^0.1.0",
49
+ "@streamlayer/sdk-web": "^0.33.0",
50
+ "@streamlayer/sdk-web-anonymous-auth": "^0.11.42",
51
+ "@streamlayer/sdk-web-api": "^0.24.0",
52
+ "@streamlayer/sdk-web-features": "^0.11.24",
53
+ "@streamlayer/sdk-web-logger": "^0.5.18",
54
+ "@streamlayer/sdk-web-core": "^0.22.0",
55
+ "@streamlayer/sdk-web-interfaces": "^0.21.0",
56
+ "@streamlayer/sdk-web-notifications": "^0.15.0",
57
+ "@streamlayer/sdk-web-storage": "^0.4.5",
58
+ "@streamlayer/sdk-web-types": "^0.23.0"
58
59
  },
59
60
  "nx": {
60
61
  "implicitDependencies": [
@@ -69,32 +70,32 @@
69
70
  "@linaria/babel-preset": "^5.0.4",
70
71
  "@linaria/core": "^6.0.0",
71
72
  "@linaria/react": "^6.0.0",
72
- "@nanostores/react": "^0.7.1",
73
+ "@nanostores/react": "^0.7.2",
73
74
  "@storybook/addon-docs": "^7.6.11",
74
75
  "@storybook/addon-styling": "^1.3.7",
75
76
  "@storybook/addon-viewport": "^7.6.11",
76
77
  "@storybook/blocks": "^7.6.11",
77
- "@storybook/jest": "^0.2.3",
78
+ "@storybook/jest": "~0.2.3",
78
79
  "@storybook/react": "^7.6.11",
79
- "@storybook/testing-library": "^0.2.2",
80
+ "@storybook/testing-library": "~0.2.2",
80
81
  "@types/react-infinite-scroller": "^1.2.5",
81
82
  "@types/react-window": "^1.8.8",
82
83
  "@types/react-window-infinite-loader": "^1.0.9",
83
84
  "@wyw-in-js/vite": "^0.2.2",
84
85
  "esbuild-plugin-babel": "^0.2.3",
85
86
  "glob": "^10.3.10",
86
- "react": "^18.2.0",
87
+ "react": "18.2.0",
87
88
  "react-auth-code-input": "^3.2.1",
88
89
  "react-countdown-circle-timer": "^3.2.1",
89
90
  "react-countup": "^6.5.0",
90
91
  "react-phone-number-input": "^3.3.9",
91
92
  "rollup-plugin-node-polyfills": "^0.2.1",
92
93
  "tslib": "^2.6.2",
93
- "vite": "^5.0.12",
94
+ "vite": "5.0.12",
94
95
  "vite-plugin-node-polyfills": "^0.19.0",
95
96
  "vite-plugin-svgr": "^4.2.0",
96
97
  "vite-svg-loader": "^5.1.0",
97
98
  "vite-tsconfig-paths": "^4.3.1",
98
- "@streamlayer/react": "^0.40.3"
99
+ "@streamlayer/react": "^0.41.0"
99
100
  }
100
101
  }
@@ -1,67 +0,0 @@
1
- import { p as a } from "./index-uEuzH3jr.js";
2
- let v = Symbol("clean"), t = [], p = (o, n) => {
3
- let i = [], e = {
4
- get() {
5
- return e.lc || e.listen(() => {
6
- })(), e.value;
7
- },
8
- l: n || 0,
9
- lc: 0,
10
- listen(f, u) {
11
- return e.lc = i.push(f, u || e.l) / 2, () => {
12
- let l = i.indexOf(f);
13
- ~l && (i.splice(l, 2), --e.lc || e.off());
14
- };
15
- },
16
- notify(f) {
17
- let u = !t.length;
18
- for (let l = 0; l < i.length; l += 2)
19
- t.push(
20
- i[l],
21
- i[l + 1],
22
- e.value,
23
- f
24
- );
25
- if (u) {
26
- for (let l = 0; l < t.length; l += 4) {
27
- let r;
28
- for (let s = l + 1; !r && (s += 4) < t.length; )
29
- t[s] < t[l + 1] && (r = t.push(
30
- t[l],
31
- t[l + 1],
32
- t[l + 2],
33
- t[l + 3]
34
- ));
35
- r || t[l](t[l + 2], t[l + 3]);
36
- }
37
- t.length = 0;
38
- }
39
- },
40
- off() {
41
- },
42
- /* It will be called on last listener unsubscribing.
43
- We will redefine it in onMount and onStop. */
44
- set(f) {
45
- e.value !== f && (e.value = f, e.notify());
46
- },
47
- subscribe(f, u) {
48
- let l = e.listen(f, u);
49
- return f(e.value), l;
50
- },
51
- value: o
52
- };
53
- return a.env.NODE_ENV !== "production" && (e[v] = () => {
54
- i = [], e.lc = 0, e.off();
55
- }), e;
56
- }, h = (o = {}) => {
57
- let n = p(o);
58
- return n.setKey = function(i, e) {
59
- typeof e > "u" ? i in n.value && (n.value = { ...n.value }, delete n.value[i], n.notify(i)) : n.value[i] !== e && (n.value = {
60
- ...n.value,
61
- [i]: e
62
- }, n.notify(i));
63
- }, n;
64
- };
65
- export {
66
- h as m
67
- };