@streamlayer/react-ui 0.96.3 → 0.97.1

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,31 +1,35 @@
1
- import { jsx as m, jsxs as f } from "react/jsx-runtime";
1
+ import { jsx as m, jsxs as v } from "react/jsx-runtime";
2
2
  import { useStore as C } from "@nanostores/react";
3
- import { useRef as v, useEffect as F, useMemo as x } from "react";
4
- import { resetCss as d } from "../theme/theme.js";
5
- import { ActiveFeature as A, StandaloneFeature as I } from "./Features/index.js";
6
- import { MastersNavigation as M } from "./Navigation/MastersNavigation/index.js";
7
- import { SDKNotifications as B } from "./Notifications/index.js";
8
- import { SDKContainer as L, SDKScrollContainer as j } from "./styles.js";
9
- import { useMastersApp as D } from "./useMastersApp.js";
10
- import { MastersContext as E } from "./useMastersContext.js";
11
- import { useSdkFeature as K } from "./useSdkFeature.js";
12
- import { useSdkResponsive as O } from "./useSdkResponsive.js";
13
- import { useSdkScroll as R } from "./useSdkScroll.js";
14
- import { ChannelsButtonId as T } from "../navigation/button/Channels.js";
15
- import { LeaderBoardButtonId as b } from "../navigation/button/LeaderBoard.js";
16
- import { FeaturedGroupsButtonId as w } from "../navigation/button/FeaturedGroups.js";
17
- import "../theme/breakpoints.js";
3
+ import { useAnalyticsListener as d, newTabLinkListener as A, appScrollListener as F, appClickListener as x } from "../../hooks/analytics.js";
4
+ import { useRef as S, useEffect as b, useMemo as D } from "react";
5
+ import { resetCss as f } from "../theme/theme.js";
6
+ import { ActiveFeature as I, StandaloneFeature as M } from "./Features/index.js";
7
+ import { MastersNavigation as B } from "./Navigation/MastersNavigation/index.js";
8
+ import { SDKNotifications as j } from "./Notifications/index.js";
9
+ import { SDKContainer as k, SDKScrollContainer as E } from "./styles.js";
10
+ import { useMastersApp as K } from "./useMastersApp.js";
11
+ import { MastersContext as O } from "./useMastersContext.js";
12
+ import { useSdkFeature as R } from "./useSdkFeature.js";
13
+ import { useSdkResponsive as T } from "./useSdkResponsive.js";
14
+ import { useSdkScroll as w } from "./useSdkScroll.js";
15
+ import { ChannelsButtonId as G } from "../navigation/button/Channels.js";
16
+ import { LeaderBoardButtonId as P } from "../navigation/button/LeaderBoard.js";
17
+ import { FeaturedGroupsButtonId as V } from "../navigation/button/FeaturedGroups.js";
18
+ import "lodash.throttle";
19
+ import "@streamlayer/sdk-web-interfaces";
18
20
  import "../theme/constants.js";
21
+ import "../theme/breakpoints.js";
19
22
  import "@streamlayer/sdk-web-types";
20
23
  import "./Features/FeatureProvider.js";
21
24
  import "@linaria/react";
22
- import "@streamlayer/sdk-web-interfaces";
23
25
  import "./Features/Gamification/index.js";
24
26
  import "../gamification/detail/header/index.js";
25
27
  import "../gamification/constants.js";
26
28
  import "../gamification/detail/header/styles.js";
27
29
  import "../icons/index.js";
28
30
  import "../gamification/user-statistics/index.js";
31
+ import "../skeleton/index.js";
32
+ import "../skeleton/styles.js";
29
33
  import "../../utils/common.js";
30
34
  import "../gamification/user-statistics/components/rank/index.js";
31
35
  import "../gamification/user-statistics/components/rank/styles.js";
@@ -115,8 +119,6 @@ import "../gamification/question/notification/prediction-result/styles.js";
115
119
  import "./Notifications/Onboarding/index.js";
116
120
  import "./useImagesPreload.js";
117
121
  import "../gamification/onboarding/index.js";
118
- import "../skeleton/index.js";
119
- import "../skeleton/styles.js";
120
122
  import "../gamification/onboarding/slides/onboarding-instructions/index.js";
121
123
  import "../gamification/onboarding/invitingUser/index.js";
122
124
  import "../gamification/onboarding/invitingUser/styles.js";
@@ -131,90 +133,99 @@ import "./Notifications/Onboarding/Notification/styles.js";
131
133
  import "./Notifications/styles.js";
132
134
  import "../gamification/question/notification/pill/index.js";
133
135
  import "../gamification/question/notification/pill/styles.js";
134
- import "lodash.throttle";
135
- import "../../index-keh7OLCY.js";
136
- const G = ({ sdk: t, className: e, scrollStore: n, appNode: r, scrollNode: p, headerNode: o, responsiveStore: i }) => {
137
- const [, s] = K(t);
136
+ import "../../index-z0QjLiEL.js";
137
+ const W = ({ sdk: t, className: n, scrollStore: s, appNode: r, scrollNode: p, headerNode: i, responsiveStore: o }) => {
138
+ const [, l] = R(t);
138
139
  return /* @__PURE__ */ m(
139
- A,
140
+ I,
140
141
  {
141
- className: e,
142
+ className: n,
142
143
  scrollNode: p,
143
144
  appNode: r,
144
- scrollStore: n,
145
- feature: s,
146
- headerNode: o,
147
- responsiveStore: i,
145
+ scrollStore: s,
146
+ feature: l,
147
+ headerNode: i,
148
+ responsiveStore: o,
148
149
  sdk: t
149
150
  }
150
151
  );
151
- }, P = ({ sdk: t, className: e, appNode: n, responsiveStore: r }) => {
152
+ }, Y = ({ sdk: t, className: n, appNode: s, responsiveStore: r }) => {
152
153
  const p = C(t.featuresList.getStore());
153
- return p ? Array.from(p, (o) => {
154
- const i = t.getFeature(o);
155
- return i ? /* @__PURE__ */ m(
156
- I,
154
+ return p ? Array.from(p, (i) => {
155
+ const o = t.getFeature(i);
156
+ return o ? /* @__PURE__ */ m(
157
+ M,
157
158
  {
158
- className: e,
159
- appNode: n,
160
- feature: i,
159
+ className: n,
160
+ appNode: s,
161
+ feature: o,
161
162
  responsiveStore: r,
162
163
  sdk: t
163
164
  },
164
- o
165
+ i
165
166
  ) : null;
166
167
  }) : null;
167
- }, fo = ({ sdk: t, overlays: e, children: n }) => {
168
- const r = v(null), p = v(null), [o] = O(r), [i, s] = R(r, o), { sdkEnabled: l, sdkReady: c, activeOverlay: a, activateAndLoadOverlay: S, activateEventWithId: h, deactivate: g, isLogged: N } = D(t);
169
- F(() => {
168
+ }, go = ({ sdk: t, overlays: n, children: s }) => {
169
+ const r = S(null), p = S(null), [i] = T(r), [o, l] = w(r, i), { sdkEnabled: e, sdkReady: c, activeOverlay: a, activateAndLoadOverlay: h, activateEventWithId: N, deactivate: g, isLogged: y } = K(t);
170
+ d(r, { enabled: e, event: "click", listener: A }), d(o, {
171
+ enabled: e,
172
+ event: "scrollend",
173
+ listener: F,
174
+ useDomNode: !0
175
+ }), d(o, {
176
+ enabled: e,
177
+ event: "click",
178
+ listener: x,
179
+ useDomNode: !0
180
+ }), b(() => {
170
181
  import("./Features/Gamification/gamification-feature.js");
171
182
  }, []);
172
- const y = x(() => ({ sdk: t }), [t]);
173
- return /* @__PURE__ */ m(E.Provider, { value: y, children: /* @__PURE__ */ f(L, { ref: r, children: [
174
- l && /* @__PURE__ */ m(
175
- M,
183
+ const L = D(() => ({ sdk: t }), [t]);
184
+ return /* @__PURE__ */ m(O.Provider, { value: L, children: /* @__PURE__ */ v(k, { ref: r, children: [
185
+ e && /* @__PURE__ */ m(
186
+ B,
176
187
  {
177
188
  ref: p,
178
189
  sdkReady: c,
179
190
  activeOverlay: a,
180
- className: d,
181
- setActiveOverlay: (u) => S("", u),
191
+ className: f,
192
+ setActiveOverlay: (u) => h("", u),
182
193
  scrollToTop: () => {
183
194
  var u;
184
- return (u = i.current) == null ? void 0 : u.scrollTo(0, 0);
195
+ return (u = o.current) == null ? void 0 : u.scrollTo(0, 0);
185
196
  },
186
- responsiveStore: o
197
+ responsiveStore: i
187
198
  }
188
199
  ),
189
- /* @__PURE__ */ f(j, { className: "sl-hide-on-modal", ref: i, "data-nav": l.toString(), children: [
200
+ /* @__PURE__ */ v(E, { className: "sl-hide-on-modal", ref: o, "data-nav": e.toString(), children: [
190
201
  c && /* @__PURE__ */ m(
191
- B,
202
+ j,
192
203
  {
193
204
  sdk: t,
194
- scrollNode: i,
205
+ scrollNode: o,
195
206
  headerNode: p,
196
207
  appNode: r,
197
- scrollStore: s,
198
- responsiveStore: o
208
+ scrollStore: l,
209
+ responsiveStore: i
199
210
  }
200
211
  ),
201
- /* @__PURE__ */ m("div", { style: !l || a === T ? {} : { display: "none" }, children: n && n({ activateEventWithId: h, deactivate: g }) }),
202
- e && a === b && e[a],
203
- c && a === w && /* @__PURE__ */ m(
204
- G,
212
+ /* @__PURE__ */ m("div", { style: !e || a === G ? {} : { display: "none" }, children: s && s({ activateEventWithId: N, deactivate: g }) }),
213
+ n && a === P && n[a],
214
+ c && a === V && /* @__PURE__ */ m(
215
+ W,
205
216
  {
206
- scrollStore: s,
207
- responsiveStore: o,
208
- scrollNode: i,
217
+ scrollStore: l,
218
+ responsiveStore: i,
219
+ scrollNode: o,
209
220
  appNode: r,
210
221
  headerNode: p,
211
- className: d,
222
+ className: f,
212
223
  sdk: t
213
224
  }
214
225
  ),
215
- c && /* @__PURE__ */ m(P, { responsiveStore: o, appNode: r, className: d, sdk: t })
226
+ c && /* @__PURE__ */ m(Y, { responsiveStore: i, appNode: r, className: f, sdk: t })
216
227
  ] }),
217
- l && !N && /* @__PURE__ */ m(
228
+ e && !y && /* @__PURE__ */ m(
218
229
  "div",
219
230
  {
220
231
  style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "100%" },
@@ -224,5 +235,5 @@ const G = ({ sdk: t, className: e, scrollStore: n, appNode: r, scrollNode: p, he
224
235
  ] }) });
225
236
  };
226
237
  export {
227
- fo as MastersApp
238
+ go as MastersApp
228
239
  };
@@ -2,8 +2,8 @@ import { useStore as A } from "@nanostores/react";
2
2
  import { useRef as y, useState as d, useCallback as z, useEffect as u } from "react";
3
3
  import { FeatureType as v } from "@streamlayer/sdk-web-types";
4
4
  import "./Navigation/MastersNavigation/index.js";
5
- import { FeaturedGroupsButtonId as i } from "../navigation/button/FeaturedGroups.js";
6
- import { ChannelsButtonId as p } from "../navigation/button/Channels.js";
5
+ import { FeaturedGroupsButtonId as p } from "../navigation/button/FeaturedGroups.js";
6
+ import { ChannelsButtonId as i } from "../navigation/button/Channels.js";
7
7
  import "react/jsx-runtime";
8
8
  import "../navigation/button/LeaderBoard.js";
9
9
  import "@linaria/react";
@@ -15,23 +15,23 @@ import "../navigation/masters.js";
15
15
  import "../navigation/index.js";
16
16
  import "../theme/constants.js";
17
17
  const D = (e) => {
18
- const c = y(""), [S, o] = d(!1), E = A(e.status), a = A(e.userId()), f = A(e.getActiveFeature()), n = E === "ready", [l, r] = d(i), m = z(
18
+ const c = y(""), [S, o] = d(!1), E = A(e.status), a = A(e.userId()), f = A(e.getActiveFeature()), n = E === "ready", [l, r] = d(p), m = z(
19
19
  (t, s) => {
20
- r(s), s === i ? (t && e.createEventSession(t), window.requestAnimationFrame(() => {
20
+ r(s), t && e.createEventSession(t), s === p ? window.requestAnimationFrame(() => {
21
21
  e.openFeature(v.GAMES);
22
- })) : e.closeFeature(!1);
22
+ }) : e.closeFeature(!1);
23
23
  },
24
24
  [e]
25
25
  );
26
26
  u(() => {
27
- !n && l === i && (r(p), e.closeFeature(!0));
27
+ !n && l === p && (r(i), e.closeFeature(!0));
28
28
  }, [n, l, e]), u(() => {
29
- f === v.GAMES ? r(i) : f === v.UNSET && r(p);
29
+ f === v.GAMES ? r(p) : f === v.UNSET && r(i);
30
30
  }, [f]);
31
31
  const F = (t) => {
32
32
  c.current = t, o(!0), e.initializeApp({ skipOrganizationSettings: !0 }).then(({ enabled: s, err: g }) => {
33
33
  if (g) {
34
- m(t, p);
34
+ m(t, i);
35
35
  return;
36
36
  }
37
37
  if (s) {
@@ -50,7 +50,7 @@ const D = (e) => {
50
50
  };
51
51
  return u(() => {
52
52
  if (!a) {
53
- n && (r(p), e.disableApp());
53
+ n && (r(i), e.disableApp());
54
54
  return;
55
55
  }
56
56
  if (a && c.current && S) {
@@ -1,24 +1,21 @@
1
- import { useStore as o } from "@nanostores/react";
1
+ import { useStore as f } from "@nanostores/react";
2
2
  import { useState as c, useEffect as l } from "react";
3
3
  import { FeatureStatus as a } from "@streamlayer/sdk-web-interfaces";
4
- const d = (r) => {
5
- const s = o(r.getActiveFeature()), i = o(r.streamStore()), [n, f] = c(null);
4
+ const p = (t) => {
5
+ const r = f(t.getActiveFeature()), n = f(t.streamStore()), [i, u] = c(null);
6
6
  return l(() => {
7
- const u = r.getFeatures();
8
- if (s)
9
- for (const [e, t] of u)
10
- e === s ? (t.status.get() === a.Suspended && t.enable(), f(t)) : t.status.get() === a.Ready && t.disable();
11
- else {
12
- for (const [, e] of u)
13
- e.status.get() === a.Ready && e.disable();
14
- f(null);
15
- }
7
+ const o = t.getFeatures();
8
+ if (!r)
9
+ u(null);
10
+ else
11
+ for (const [s, e] of o)
12
+ s === r ? (e.status.get() === a.Suspended && e.enable(), u(e)) : e.status.get() === a.Ready && e.disable();
16
13
  return () => {
17
- for (const [, e] of u)
18
- e.status.get() === a.Ready && e.disable();
14
+ for (const [, s] of o)
15
+ s.status.get() === a.Ready && s.disable();
19
16
  };
20
- }, [s, r, i]), [s, n];
17
+ }, [r, t, n]), [r, i];
21
18
  };
22
19
  export {
23
- d as useSdkFeature
20
+ p as useSdkFeature
24
21
  };
@@ -1,7 +1,7 @@
1
1
  import c from "lodash.throttle";
2
2
  import { useState as m, useEffect as u } from "react";
3
3
  import { BREAKPOINTS as r } from "../theme/constants.js";
4
- import { m as p } from "../../index-keh7OLCY.js";
4
+ import { m as p } from "../../index-z0QjLiEL.js";
5
5
  import "../../index-uEuzH3jr.js";
6
6
  const d = Object.keys(r), i = () => {
7
7
  const t = window.innerWidth;
@@ -7,6 +7,6 @@ type ScrollData = {
7
7
  scrollDirection: 'forward' | 'backward';
8
8
  };
9
9
  export type ScrollStore = MapStore<ScrollData>;
10
- export declare const scrollIntoAppView: (appNode: AppNodeRef, options?: ScrollIntoViewOptions) => void;
10
+ export declare const scrollIntoAppView: (appNode: AppNodeRef, screenSize: number, options?: ScrollIntoViewOptions) => void;
11
11
  export declare const useSdkScroll: (appNode: AppNodeRef, responsiveStore: ResponsiveStore) => [ScrollNodeRef, ScrollStore];
12
12
  export {};
@@ -1,43 +1,46 @@
1
1
  import { useStore as p } from "@nanostores/react";
2
2
  import S from "lodash.throttle";
3
- import { useRef as f, useState as h, useEffect as b } from "react";
4
- import { BREAKPOINTS as m } from "../theme/constants.js";
5
- import { m as g } from "../../index-keh7OLCY.js";
3
+ import { useRef as m, useState as h, useEffect as g } from "react";
4
+ import { BREAKPOINTS as l } from "../theme/constants.js";
5
+ import { m as T } from "../../index-z0QjLiEL.js";
6
6
  import "../../index-uEuzH3jr.js";
7
- const C = (t, n) => {
8
- var r;
9
- (r = t.current) == null || r.scrollIntoView(n), window.scrollBy({ top: -52 });
10
- }, D = (t, n) => {
11
- const r = f(null), l = f(0), [e] = h(
12
- g({
7
+ const C = (o, t, e) => {
8
+ const n = t >= l.lg && t < l.xl ? 75 : 52;
9
+ o.current && window.scrollTo({
10
+ top: o.current.offsetTop - n,
11
+ ...e
12
+ });
13
+ }, D = (o, t) => {
14
+ const e = m(null), n = m(0), [s] = h(
15
+ T({
13
16
  scrollPosition: 0,
14
17
  tabsShown: !0,
15
18
  scrollDirection: "forward"
16
19
  })
17
- ), c = p(n);
18
- return b(() => {
19
- const s = window.innerWidth < m.xl ? window : r.current;
20
- if (!s)
20
+ ), i = p(t);
21
+ return g(() => {
22
+ const c = window.innerWidth < l.xl ? window : e.current;
23
+ if (!c)
21
24
  return () => {
22
25
  };
23
- const i = S((w) => {
26
+ const u = S((w) => {
24
27
  var a;
25
- const u = w.target;
26
- if (!u)
28
+ const f = w.target;
29
+ if (!f)
27
30
  return;
28
- let o = 0;
29
- c.screen.size < m.xl ? o = ((a = t.current) == null ? void 0 : a.getBoundingClientRect().y) || 0 : o = u.scrollTop;
30
- const d = l.current < o ? "forward" : "backward";
31
- l.current = o, e.set({
32
- scrollPosition: Math.round(o),
31
+ let r = 0;
32
+ i.screen.size < l.xl ? r = ((a = o.current) == null ? void 0 : a.getBoundingClientRect().y) || 0 : r = f.scrollTop;
33
+ const d = n.current < r ? "forward" : "backward";
34
+ n.current = r, s.set({
35
+ scrollPosition: Math.round(r),
33
36
  scrollDirection: d,
34
- tabsShown: e.get().tabsShown
37
+ tabsShown: s.get().tabsShown
35
38
  });
36
39
  }, 200);
37
- return s.addEventListener("scroll", i), () => {
38
- s.removeEventListener("scroll", i);
40
+ return c.addEventListener("scroll", u), () => {
41
+ c.removeEventListener("scroll", u);
39
42
  };
40
- }, [e, t, c.screen]), [r, e];
43
+ }, [s, o, i.screen]), [e, s];
41
44
  };
42
45
  export {
43
46
  C as scrollIntoAppView,
@@ -1,16 +1,30 @@
1
- import { jsxs as i, jsx as C } from "react/jsx-runtime";
2
- import { Container as o, FriendsIcon as c, Content as l, Title as s, Description as h, ArrowInviteIcon as d } from "./styles.js";
1
+ import { jsxs as C, jsx as i } from "react/jsx-runtime";
2
+ import { useAnalyticsHandle as c } from "../../../hooks/analytics.js";
3
+ import { InvitationFrom as l } from "@streamlayer/sdk-web-types";
4
+ import { Container as m, FriendsIcon as s, Content as p, Title as a, Description as d, ArrowInviteIcon as h } from "./styles.js";
5
+ import "lodash.throttle";
6
+ import "react";
7
+ import "@streamlayer/sdk-web-interfaces";
8
+ import "../../theme/constants.js";
3
9
  import "@linaria/react";
4
10
  import "../../icons/index.js";
5
- import "react";
6
- const p = "data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='32'%20height='32'%20rx='16'%20fill='white'/%3e%3cpath%20d='M10.4615%2012.6875C9.44231%2012.6875%208.61538%2013.4665%208.61538%2014.4266C8.61538%2015.3868%209.44231%2016.1658%2010.4615%2016.1658C11.4808%2016.1658%2012.3077%2015.3868%2012.3077%2014.4266C12.3077%2013.4665%2011.4808%2012.6875%2010.4615%2012.6875ZM10.4615%2016.1658C9.10817%2016.1658%208%2017.2097%208%2018.4846V19.7527C8%2019.7527%208.61538%2020.2237%2010.4615%2020.2237C12.3077%2020.2237%2012.9231%2019.7527%2012.9231%2019.7527V18.4846C12.9231%2017.2097%2011.8149%2016.1658%2010.4615%2016.1658ZM21.5385%2012.6875C20.5192%2012.6875%2019.6923%2013.4665%2019.6923%2014.4266C19.6923%2015.3868%2020.5192%2016.1658%2021.5385%2016.1658C22.5577%2016.1658%2023.3846%2015.3868%2023.3846%2014.4266C23.3846%2013.4665%2022.5577%2012.6875%2021.5385%2012.6875ZM21.5385%2016.1658C20.1851%2016.1658%2019.0769%2017.2097%2019.0769%2018.4846V19.7527C19.0769%2019.7527%2019.6923%2020.2237%2021.5385%2020.2237C23.3846%2020.2237%2024%2019.7527%2024%2019.7527V18.4846C24%2017.2097%2022.8918%2016.1658%2021.5385%2016.1658ZM16%2015.0063C14.9808%2015.0063%2014.1538%2015.7853%2014.1538%2016.7455C14.1538%2017.7056%2014.9808%2018.4846%2016%2018.4846C17.0192%2018.4846%2017.8462%2017.7056%2017.8462%2016.7455C17.8462%2015.7853%2017.0192%2015.0063%2016%2015.0063ZM16%2018.4846C14.6466%2018.4846%2013.5385%2019.5285%2013.5385%2020.8034V22.0715C13.5385%2022.0715%2014.1538%2022.5425%2016%2022.5425C17.8462%2022.5425%2018.4615%2022.0715%2018.4615%2022.0715V20.8034C18.4615%2019.5285%2017.3534%2018.4846%2016%2018.4846Z'%20fill='%23107D57'/%3e%3cpath%20opacity='0.5'%20d='M13.3908%209C12.3103%209%2011.4336%209.82584%2011.4336%2010.8437C11.4336%2011.8616%2012.3103%2012.6875%2013.3908%2012.6875C14.4713%2012.6875%2015.348%2011.8616%2015.348%2010.8437C15.348%209.82584%2014.4713%209%2013.3908%209ZM13.3908%2012.6875C13.1946%2012.6875%2012.9958%2012.6827%2012.7996%2012.7451C13.192%2013.2372%2013.3908%2013.8542%2013.3908%2014.5312C13.3908%2014.7761%2013.3296%2015.0161%2013.3296%2015.261C13.8521%2014.524%2014.6956%2014.0391%2015.6742%2013.9166C15.218%2013.1796%2014.3694%2012.6875%2013.3908%2012.6875ZM18.61%209C17.5295%209%2016.6528%209.82584%2016.6528%2010.8437C16.6528%2011.8616%2017.5295%2012.6875%2018.61%2012.6875C19.6905%2012.6875%2020.5672%2011.8616%2020.5672%2010.8437C20.5672%209.82584%2019.6905%209%2018.61%209ZM18.61%2012.6875C17.6314%2012.6875%2016.7828%2013.1796%2016.3266%2013.9166C17.3052%2014.0391%2018.1487%2014.524%2018.6712%2015.261C18.6712%2015.0161%2018.61%2014.7761%2018.61%2014.5312C18.61%2013.8542%2018.8088%2013.2372%2019.2012%2012.7451C19.005%2012.6827%2018.8062%2012.6875%2018.61%2012.6875Z'%20fill='%23107D57'/%3e%3c/svg%3e", f = ({ title: t, description: e, onClick: n, className: r }) => /* @__PURE__ */ i(o, { onClick: n, className: r, children: [
7
- /* @__PURE__ */ C(c, { alt: "friends-icon", src: p }),
8
- /* @__PURE__ */ i(l, { children: [
9
- /* @__PURE__ */ C(s, { children: t }),
10
- /* @__PURE__ */ C(h, { children: e })
11
- ] }),
12
- /* @__PURE__ */ C(d, { name: "icon-copy" })
13
- ] });
11
+ const f = "data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='32'%20height='32'%20rx='16'%20fill='white'/%3e%3cpath%20d='M10.4615%2012.6875C9.44231%2012.6875%208.61538%2013.4665%208.61538%2014.4266C8.61538%2015.3868%209.44231%2016.1658%2010.4615%2016.1658C11.4808%2016.1658%2012.3077%2015.3868%2012.3077%2014.4266C12.3077%2013.4665%2011.4808%2012.6875%2010.4615%2012.6875ZM10.4615%2016.1658C9.10817%2016.1658%208%2017.2097%208%2018.4846V19.7527C8%2019.7527%208.61538%2020.2237%2010.4615%2020.2237C12.3077%2020.2237%2012.9231%2019.7527%2012.9231%2019.7527V18.4846C12.9231%2017.2097%2011.8149%2016.1658%2010.4615%2016.1658ZM21.5385%2012.6875C20.5192%2012.6875%2019.6923%2013.4665%2019.6923%2014.4266C19.6923%2015.3868%2020.5192%2016.1658%2021.5385%2016.1658C22.5577%2016.1658%2023.3846%2015.3868%2023.3846%2014.4266C23.3846%2013.4665%2022.5577%2012.6875%2021.5385%2012.6875ZM21.5385%2016.1658C20.1851%2016.1658%2019.0769%2017.2097%2019.0769%2018.4846V19.7527C19.0769%2019.7527%2019.6923%2020.2237%2021.5385%2020.2237C23.3846%2020.2237%2024%2019.7527%2024%2019.7527V18.4846C24%2017.2097%2022.8918%2016.1658%2021.5385%2016.1658ZM16%2015.0063C14.9808%2015.0063%2014.1538%2015.7853%2014.1538%2016.7455C14.1538%2017.7056%2014.9808%2018.4846%2016%2018.4846C17.0192%2018.4846%2017.8462%2017.7056%2017.8462%2016.7455C17.8462%2015.7853%2017.0192%2015.0063%2016%2015.0063ZM16%2018.4846C14.6466%2018.4846%2013.5385%2019.5285%2013.5385%2020.8034V22.0715C13.5385%2022.0715%2014.1538%2022.5425%2016%2022.5425C17.8462%2022.5425%2018.4615%2022.0715%2018.4615%2022.0715V20.8034C18.4615%2019.5285%2017.3534%2018.4846%2016%2018.4846Z'%20fill='%23107D57'/%3e%3cpath%20opacity='0.5'%20d='M13.3908%209C12.3103%209%2011.4336%209.82584%2011.4336%2010.8437C11.4336%2011.8616%2012.3103%2012.6875%2013.3908%2012.6875C14.4713%2012.6875%2015.348%2011.8616%2015.348%2010.8437C15.348%209.82584%2014.4713%209%2013.3908%209ZM13.3908%2012.6875C13.1946%2012.6875%2012.9958%2012.6827%2012.7996%2012.7451C13.192%2013.2372%2013.3908%2013.8542%2013.3908%2014.5312C13.3908%2014.7761%2013.3296%2015.0161%2013.3296%2015.261C13.8521%2014.524%2014.6956%2014.0391%2015.6742%2013.9166C15.218%2013.1796%2014.3694%2012.6875%2013.3908%2012.6875ZM18.61%209C17.5295%209%2016.6528%209.82584%2016.6528%2010.8437C16.6528%2011.8616%2017.5295%2012.6875%2018.61%2012.6875C19.6905%2012.6875%2020.5672%2011.8616%2020.5672%2010.8437C20.5672%209.82584%2019.6905%209%2018.61%209ZM18.61%2012.6875C17.6314%2012.6875%2016.7828%2013.1796%2016.3266%2013.9166C17.3052%2014.0391%2018.1487%2014.524%2018.6712%2015.261C18.6712%2015.0161%2018.61%2014.7761%2018.61%2014.5312C18.61%2013.8542%2018.8088%2013.2372%2019.2012%2012.7451C19.005%2012.6827%2018.8062%2012.6875%2018.61%2012.6875Z'%20fill='%23107D57'/%3e%3c/svg%3e", D = ({ title: t, description: n, onClick: o, className: r }) => {
12
+ const [e] = c({
13
+ type: "invitation",
14
+ action: "sent",
15
+ payload: {
16
+ from: l.TITLE_CARD
17
+ }
18
+ });
19
+ return /* @__PURE__ */ C(m, { onClick: e(o), className: r, children: [
20
+ /* @__PURE__ */ i(s, { alt: "friends-icon", src: f }),
21
+ /* @__PURE__ */ C(p, { children: [
22
+ /* @__PURE__ */ i(a, { children: t }),
23
+ /* @__PURE__ */ i(d, { children: n })
24
+ ] }),
25
+ /* @__PURE__ */ i(h, { name: "icon-copy" })
26
+ ] });
27
+ };
14
28
  export {
15
- f as InviteLink
29
+ D as InviteLink
16
30
  };
@@ -1,7 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { Gamification } from '@streamlayer/feature-gamification';
3
3
  import { type StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
4
- import { HeaderNodeRef, type AppNodeRef } from '../../app/masters';
5
4
  import { OnboardingStep } from './slides/onboarding-instructions';
6
5
  import { OnboardingInviteCardProps } from './slides/onboarding-invite-card';
7
6
  import { OnboardingRule } from './slides/onboarding-rules';
@@ -17,7 +16,6 @@ type OnboardingType = OnboardingInviteCardProps & {
17
16
  primaryColor?: string;
18
17
  inviteCardBtnLabel?: string;
19
18
  loading: boolean;
20
- renderToNode?: AppNodeRef | HeaderNodeRef;
21
19
  inviterName?: string;
22
20
  onClose: () => void;
23
21
  };
@@ -1,18 +1,23 @@
1
1
  import { jsx as t, jsxs as y } from "react/jsx-runtime";
2
- import { useState as h, useEffect as s, useMemo as E, useCallback as F } from "react";
3
- import G from "react-virtualized-auto-sizer";
4
- import { Skeleton as M } from "../../skeleton/index.js";
5
- import { OnboardingInstructions as P } from "./slides/onboarding-instructions/index.js";
6
- import { OnboardingInviteCard as R } from "./slides/onboarding-invite-card/index.js";
7
- import { OnboardingRules as U } from "./slides/onboarding-rules/index.js";
8
- import { OnboardingTerms as q } from "./slides/onboarding-terms/index.js";
9
- import { Container as J, OnboardingHeader as K, CloseBtn as Q, IconClose as V, Content as W, OnboardingFooter as X, OnboardingActionBtn as Y } from "./styles.js";
2
+ import { useState as p, useEffect as s, useMemo as N, useCallback as z } from "react";
3
+ import E from "react-virtualized-auto-sizer";
4
+ import { Skeleton as F } from "../../skeleton/index.js";
5
+ import { OnboardingInstructions as G } from "./slides/onboarding-instructions/index.js";
6
+ import { OnboardingInviteCard as M } from "./slides/onboarding-invite-card/index.js";
7
+ import { OnboardingRules as P } from "./slides/onboarding-rules/index.js";
8
+ import { OnboardingTerms as R } from "./slides/onboarding-terms/index.js";
9
+ import { Container as U, OnboardingHeader as q, CloseBtn as J, IconClose as K, Content as Q, OnboardingFooter as V, OnboardingActionBtn as W } from "./styles.js";
10
10
  import "../../skeleton/styles.js";
11
11
  import "@linaria/react";
12
12
  import "./invitingUser/index.js";
13
13
  import "../../../utils/common.js";
14
14
  import "./invitingUser/styles.js";
15
15
  import "./slides/onboarding-instructions/styles.js";
16
+ import "../../../hooks/analytics.js";
17
+ import "lodash.throttle";
18
+ import "@streamlayer/sdk-web-interfaces";
19
+ import "../../theme/constants.js";
20
+ import "@streamlayer/sdk-web-types";
16
21
  import "../../app/useClipboardCopy.js";
17
22
  import "../../../index-jRXrW6ie.js";
18
23
  import "../../../index-uEuzH3jr.js";
@@ -24,80 +29,75 @@ import "./slides/onboarding-rules/styles.js";
24
29
  import "./slides/onboarding-terms/styles.js";
25
30
  import "../../button/index.js";
26
31
  import "../../button/styles.js";
27
- const m = {
32
+ const e = {
28
33
  steps: !1,
29
34
  rules: !1,
30
35
  inviteCard: !1
31
- }, si = ({
36
+ }, Ti = ({
32
37
  gamification: v,
33
38
  steps: i,
34
- rules: r,
39
+ rules: o,
35
40
  rulesBtnLabel: d,
36
41
  rulesTitle: I,
37
42
  termsTitle: T,
38
- termsText: p,
43
+ termsText: h,
39
44
  primaryColor: u,
40
45
  inviteLink: x,
41
- socialLinks: D,
42
- inviteCardTitle: k,
43
- inviteCardSubtext: w,
46
+ inviteCardTitle: D,
47
+ inviteCardSubtext: k,
44
48
  inviteCardBtnLabel: g,
45
49
  loading: a,
46
- renderToNode: A,
47
50
  inviterName: c,
48
51
  sdk: b,
49
- onClose: j
52
+ onClose: w
50
53
  }) => {
51
- const [o, C] = h(0), [l, O] = h(!1), [n, e] = h(m);
54
+ const [m, C] = p(0), [l, O] = p(!1), [r, n] = p(e);
52
55
  s(() => {
53
- i != null && i.length ? e({ ...m, steps: !0 }) : r != null && r.length ? e({ ...m, rules: !0 }) : e({ ...m, inviteCard: !0 });
56
+ i != null && i.length ? n({ ...e, steps: !0 }) : o != null && o.length ? n({ ...e, rules: !0 }) : n({ ...e, inviteCard: !0 });
54
57
  }, []);
55
- const H = E(() => n.steps && o === 0 ? "Continue" : n.rules ? l || !d ? "Got it" : d : n.inviteCard ? g || "Play Now" : "Next", [n, o, l, d, g]), N = F(() => {
56
- i != null && i.length && o < i.length - 1 ? C((f) => ++f) : r != null && r.length && n.steps ? e({ ...m, rules: !0 }) : n.rules && e({ ...m, inviteCard: !0 });
57
- }, [o, i == null ? void 0 : i.length, r == null ? void 0 : r.length, n, C, e]), z = async () => {
58
- n.inviteCard ? await v.onboardingStatus.submitInplay() : n.rules && l ? O(!1) : N();
58
+ const A = N(() => r.steps && m === 0 ? "Continue" : r.rules ? l || !d ? "Got it" : d : r.inviteCard ? g || "Play Now" : "Next", [r, m, l, d, g]), j = z(() => {
59
+ i != null && i.length && m < i.length - 1 ? C((f) => ++f) : o != null && o.length && r.steps ? n({ ...e, rules: !0 }) : r.rules && n({ ...e, inviteCard: !0 });
60
+ }, [m, i == null ? void 0 : i.length, o == null ? void 0 : o.length, r, C, n]), H = async () => {
61
+ r.inviteCard ? await v.onboardingStatus.submitInplay() : r.rules && l ? O(!1) : j();
59
62
  };
60
63
  return s(() => {
61
64
  !a && c && b.inviteDisplayed();
62
- }, [a, c, b]), /* @__PURE__ */ t(G, { children: ({ width: f, height: S }) => /* @__PURE__ */ y(J, { style: { width: f, height: S, maxHeight: S }, children: [
63
- /* @__PURE__ */ t(K, { children: /* @__PURE__ */ t(Q, { onClick: j, children: /* @__PURE__ */ t(V, { name: "icon-close-btn-gray" }) }) }),
64
- /* @__PURE__ */ y(W, { children: [
65
- n.steps && (i == null ? void 0 : i.length) && /* @__PURE__ */ t(
66
- P,
65
+ }, [a, c, b]), /* @__PURE__ */ t(E, { children: ({ width: f, height: S }) => /* @__PURE__ */ y(U, { style: { width: f, height: S, maxHeight: S }, children: [
66
+ /* @__PURE__ */ t(q, { children: /* @__PURE__ */ t(J, { onClick: w, children: /* @__PURE__ */ t(K, { name: "icon-close-btn-gray" }) }) }),
67
+ /* @__PURE__ */ y(Q, { children: [
68
+ r.steps && (i == null ? void 0 : i.length) && /* @__PURE__ */ t(
69
+ G,
67
70
  {
68
71
  loading: a,
69
- stepsCount: i.length,
70
- currentStep: o,
71
- inviterName: c,
72
- ...i[o]
72
+ steps: i,
73
+ currentStep: m,
74
+ inviterName: c
73
75
  }
74
76
  ),
75
- n.rules && !l && /* @__PURE__ */ t(
76
- U,
77
+ r.rules && !l && /* @__PURE__ */ t(
78
+ P,
77
79
  {
78
- rules: r,
80
+ rules: o,
79
81
  rulesTitle: I,
80
- termsText: p,
82
+ termsText: h,
81
83
  primaryColor: u,
82
84
  openTerms: () => O(!0)
83
85
  }
84
86
  ),
85
- n.rules && l && /* @__PURE__ */ t(q, { termsTitle: T, termsText: p }),
86
- n.inviteCard && /* @__PURE__ */ t(
87
- R,
87
+ r.rules && l && /* @__PURE__ */ t(R, { termsTitle: T, termsText: h }),
88
+ r.inviteCard && /* @__PURE__ */ t(
89
+ M,
88
90
  {
89
91
  inviteLink: x,
90
- inviteCardTitle: k,
91
- inviteCardSubtext: w,
92
- primaryColor: u,
93
- socialLinks: D,
94
- renderToNode: A
92
+ inviteCardTitle: D,
93
+ inviteCardSubtext: k,
94
+ primaryColor: u
95
95
  }
96
96
  )
97
97
  ] }),
98
- /* @__PURE__ */ t(X, { children: /* @__PURE__ */ t(M, { loading: a, style: { width: "100%" }, children: /* @__PURE__ */ t(Y, { onClick: z, children: H }) }) })
98
+ /* @__PURE__ */ t(V, { children: /* @__PURE__ */ t(F, { loading: a, style: { width: "100%" }, children: /* @__PURE__ */ t(W, { onClick: H, children: A }) }) })
99
99
  ] }) });
100
100
  };
101
101
  export {
102
- si as OnboardingUI
102
+ Ti as OnboardingUI
103
103
  };
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- type OnboardingInstructionsProps = OnboardingStep & {
2
+ type OnboardingInstructionsProps = {
3
3
  loading: boolean;
4
- stepsCount: number;
4
+ steps: OnboardingStep[];
5
5
  currentStep: number;
6
6
  inviterName?: string;
7
7
  };