@streamlayer/react-ui 1.12.1 → 1.13.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.
@@ -1,20 +1,20 @@
1
1
  import { jsx as s } from "react/jsx-runtime";
2
- import { cx as g } from "@linaria/core";
2
+ import { cx as b } from "@linaria/core";
3
3
  import { styled as L } from "@linaria/react";
4
- import { useStore as h } from "@nanostores/react";
5
- import { useAnalyticsListener as w } from "../../../hooks/analytics.js";
6
- import { useEffect as I, useRef as E } from "react";
4
+ import { useStore as g } from "@nanostores/react";
5
+ import { useAnalyticsListener as P } from "../../../hooks/analytics.js";
6
+ import { useEffect as w, useRef as I } from "react";
7
7
  import { eventBus as A } from "@streamlayer/sdk-web-interfaces";
8
- import { FeatureType as T, NotificationPromotionMode as U, PromotionType as N } from "@streamlayer/sdk-web-types";
9
- import { AdvertisementUI as V } from "../../../ui/advertisement/index.js";
10
- const W = /* @__PURE__ */ L("div")({
8
+ import { FeatureType as E, NotificationPromotionMode as T, PromotionType as U } from "@streamlayer/sdk-web-types";
9
+ import { AdvertisementUI as N } from "../../../ui/advertisement/index.js";
10
+ const V = /* @__PURE__ */ L("div")({
11
11
  name: "AdvertisementUIWrap",
12
12
  class: "aa6pjif",
13
13
  propsAsIs: !1
14
- }), j = (r) => {
14
+ }), W = (r) => {
15
15
  const t = r.target;
16
16
  if (t instanceof HTMLAnchorElement && t.target === "_blank") {
17
- const o = t.getAttribute("data-promo-id") || "", i = t.getAttribute("data-promo-type") || N.UNSET;
17
+ const o = t.getAttribute("data-promo-id") || "", i = t.getAttribute("data-promo-type") || U.UNSET;
18
18
  t.getAttribute("data-analytics") === "button" && A.emit("advertisement", {
19
19
  action: "buttonSelect",
20
20
  payload: {
@@ -29,7 +29,7 @@ const W = /* @__PURE__ */ L("div")({
29
29
  }
30
30
  });
31
31
  }
32
- }, k = ({
32
+ }, j = ({
33
33
  gamification: r,
34
34
  layoutMode: t,
35
35
  skipAutoClose: o,
@@ -37,41 +37,43 @@ const W = /* @__PURE__ */ L("div")({
37
37
  sidebar: a,
38
38
  banner: d,
39
39
  notification: m,
40
- isMobileScreen: c,
41
- persistent: l,
42
- externalAd: p,
43
- controlVideo: u
40
+ isMobileScreen: l,
41
+ persistent: c,
42
+ externalAd: u,
43
+ controlVideo: p
44
44
  }) => {
45
45
  var f, v, y;
46
- const n = E(null), e = h(r.advertisement.$store);
47
- w(n, {
46
+ const n = I(null), e = g(r.advertisement.$store);
47
+ P(n, {
48
48
  enabled: !!e.data,
49
49
  event: "click",
50
- listener: j
50
+ listener: W
51
51
  });
52
- const S = !d && !a;
53
- if (e.data === void 0 || !l && e.isViewed)
52
+ const h = !d && !a;
53
+ if (e.data === void 0 || !c && e.isViewed)
54
54
  return null;
55
- const b = ((y = (v = (f = e == null ? void 0 : e.data) == null ? void 0 : f.notification) == null ? void 0 : v.promotion) == null ? void 0 : y.mode) === U.LOWER_THIRD;
56
- return /* @__PURE__ */ s(W, {
55
+ const S = ((y = (v = (f = e == null ? void 0 : e.data) == null ? void 0 : f.notification) == null ? void 0 : v.promotion) == null ? void 0 : y.mode) === T.LOWER_THIRD;
56
+ return /* @__PURE__ */ s(V, {
57
57
  ref: n,
58
58
  style: {
59
- height: S ? "auto" : "100%"
59
+ height: h ? "auto" : "100%"
60
60
  },
61
- className: g("SL-AdvertisementUIWrap", c && "mobile-view", b && "SL-AdvertisementUIWrap--lower-third"),
62
- children: /* @__PURE__ */ s(V, {
61
+ className: b("SL-AdvertisementUIWrap", l && "mobile-view", S && "SL-AdvertisementUIWrap--lower-third"),
62
+ children: /* @__PURE__ */ s(N, {
63
63
  skipTypeCheck: i,
64
64
  sidebar: a,
65
65
  banner: d,
66
66
  advertisement: e.data,
67
+ advertisementPaused: e.isPaused,
68
+ togglePause: e.togglePause,
67
69
  close: e.close,
68
- externalAd: p ? e.externalAd : void 0,
70
+ externalAd: u ? e.externalAd : void 0,
69
71
  markAsViewed: r.advertisement.markAsViewed,
70
72
  open: r.advertisement.open,
71
73
  layoutMode: t,
72
74
  isNotification: m,
73
75
  skipAutoClose: o,
74
- controlVideo: u
76
+ controlVideo: p
75
77
  })
76
78
  });
77
79
  }, _ = ({
@@ -82,12 +84,12 @@ const W = /* @__PURE__ */ L("div")({
82
84
  skipAutoClose: a,
83
85
  skipTypeCheck: d,
84
86
  layoutMode: m,
85
- isMobileScreen: c,
86
- persistent: l,
87
- notification: p
87
+ isMobileScreen: l,
88
+ persistent: c,
89
+ notification: u
88
90
  }) => {
89
- const u = h(r.featuresList.getStore());
90
- if (I(() => {
91
+ const p = g(r.featuresList.getStore());
92
+ if (w(() => {
91
93
  if (o) {
92
94
  const e = document.createElement("script");
93
95
  e.async = !0, e.src = "https://imasdk.googleapis.com/js/sdkloader/ima3.js", document.body.appendChild(e);
@@ -106,17 +108,17 @@ const W = /* @__PURE__ */ L("div")({
106
108
  },
107
109
  children: "externalAd is not supported with banner"
108
110
  });
109
- if (!u)
111
+ if (!p)
110
112
  return null;
111
- const n = r.getFeature(T.GAMES);
112
- return n ? /* @__PURE__ */ s(k, {
113
+ const n = r.getFeature(E.GAMES);
114
+ return n ? /* @__PURE__ */ s(j, {
113
115
  gamification: n,
114
116
  sidebar: t,
115
117
  banner: i,
116
118
  layoutMode: m,
117
- isMobileScreen: c,
118
- persistent: l,
119
- notification: p,
119
+ isMobileScreen: l,
120
+ persistent: c,
121
+ notification: u,
120
122
  skipTypeCheck: d,
121
123
  skipAutoClose: a,
122
124
  externalAd: o,
@@ -124,6 +126,6 @@ const W = /* @__PURE__ */ L("div")({
124
126
  }) : null;
125
127
  };
126
128
  export {
127
- W as AdvertisementUIWrap,
129
+ V as AdvertisementUIWrap,
128
130
  _ as StreamLayerSDKAdvertisement
129
131
  };
@@ -1,45 +1,47 @@
1
- import { jsxs as p, jsx as e, Fragment as x } from "react/jsx-runtime";
2
- import { cx as D } from "@linaria/core";
3
- import { useStore as h } from "@nanostores/react";
4
- import { TabsContainer as T, TabsNavContainer as C, SDKSummaryContainer as S, UserSummaryContainer as v, SDKContentContainer as A, LeaderboardContainer as I } from "../../styles.js";
5
- import { scrollIntoAppView as L } from "../../../useSdkScroll.js";
6
- import { useState as P, useTransition as V, useEffect as E } from "react";
7
- import { ActivePages as a, Tabs as K } from "../../../../ui/gamification/tabs/index.js";
8
- import { Leaderboard as F } from "./Leaderboard.js";
9
- import { QuestionsList as O } from "./QuestionsList.js";
10
- import { UserSummary as Q } from "./UserSummary.js";
11
- const J = ({ gamification: r, className: b, scrollStore: t, scrollNode: f, appNode: m, style: l, responsiveStore: n }) => {
12
- const { tabsShown: c } = h(t, { keys: ["tabsShown"] }), [i, w] = P(a.HOME), [, y] = V(), { sdkInDesktopView: u, screen: k } = h(n, { keys: ["sdkInDesktopView"] }), g = (s) => {
13
- y(() => {
14
- var d;
15
- w(s), u === !1 && (((d = m.current) == null ? void 0 : d.getBoundingClientRect().y) || 0) < 0 && L(m, k.size, { behavior: "instant" });
1
+ import { jsxs as f, jsx as e, Fragment as D } from "react/jsx-runtime";
2
+ import { cx as C } from "@linaria/core";
3
+ import { useStore as c } from "@nanostores/react";
4
+ import { TabsContainer as S, TabsNavContainer as E, SDKSummaryContainer as v, UserSummaryContainer as A, SDKContentContainer as I, LeaderboardContainer as L } from "../../styles.js";
5
+ import { scrollIntoAppView as P } from "../../../useSdkScroll.js";
6
+ import { useState as V, useTransition as K, useEffect as l } from "react";
7
+ import { ActivePages as n, Tabs as F } from "../../../../ui/gamification/tabs/index.js";
8
+ import { Leaderboard as O } from "./Leaderboard.js";
9
+ import { QuestionsList as H } from "./QuestionsList.js";
10
+ import { UserSummary as M } from "./UserSummary.js";
11
+ const W = ({ gamification: s, className: w, scrollStore: t, scrollNode: y, appNode: d, style: k, responsiveStore: i }) => {
12
+ const { tabsShown: u } = c(t, { keys: ["tabsShown"] }), o = c(s.friendsTabEnabled), [a, b] = V(n.HOME), [, T] = K(), { sdkInDesktopView: h, screen: g } = c(i, { keys: ["sdkInDesktopView"] }), x = (r) => {
13
+ T(() => {
14
+ var p;
15
+ b(r), h === !1 && (((p = d.current) == null ? void 0 : p.getBoundingClientRect().y) || 0) < 0 && P(d, g.size, { behavior: "instant" });
16
16
  });
17
17
  };
18
- E(() => t.subscribe((s) => {
19
- if (s.scrollPosition === 0) {
18
+ l(() => t.subscribe((r) => {
19
+ if (r.scrollPosition === 0) {
20
20
  t.setKey("tabsShown", !0);
21
21
  return;
22
22
  }
23
- n.get().sdkInDesktopView ? t.setKey("tabsShown", s.scrollDirection === "backward") : t.setKey("tabsShown", s.scrollDirection === "forward");
24
- }), [t, n]);
25
- let o = "0px";
26
- return u ? o = c ? "0px" : "calc(0px - var(--header-height))" : o = c ? "var(--header-height)" : "0px", /* @__PURE__ */ p(T, { className: D(b, "SL-Tabs"), style: l, children: [
27
- /* @__PURE__ */ e(
28
- C,
23
+ i.get().sdkInDesktopView ? t.setKey("tabsShown", r.scrollDirection === "backward") : t.setKey("tabsShown", r.scrollDirection === "forward");
24
+ }), [t, i]), l(() => {
25
+ o || b(n.HOME);
26
+ }, [o]);
27
+ let m = "0px";
28
+ return h ? m = u ? "0px" : "calc(0px - var(--header-height))" : m = u ? "var(--header-height)" : "0px", /* @__PURE__ */ f(S, { className: C(w, "SL-Tabs"), style: k, children: [
29
+ o && /* @__PURE__ */ e(
30
+ E,
29
31
  {
30
32
  style: {
31
- top: o
33
+ top: m
32
34
  },
33
- children: /* @__PURE__ */ e(K, { activePage: i, toggleActivePage: g })
35
+ children: /* @__PURE__ */ e(F, { activePage: a, toggleActivePage: x })
34
36
  }
35
37
  ),
36
- i === a.HOME && /* @__PURE__ */ p(x, { children: [
37
- /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(v, { children: /* @__PURE__ */ e(Q, { userSummary: r.userSummary }) }) }),
38
- /* @__PURE__ */ e(A, { style: { flex: 1 }, children: /* @__PURE__ */ e(O, { openQuestion: r.openQuestion, store: r.feedList.getStore() }) })
38
+ a === n.HOME && /* @__PURE__ */ f(D, { children: [
39
+ /* @__PURE__ */ e(v, { children: /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(M, { userSummary: s.userSummary }) }) }),
40
+ /* @__PURE__ */ e(I, { style: { flex: 1 }, children: /* @__PURE__ */ e(H, { openQuestion: s.openQuestion, store: s.feedList.getStore() }) })
39
41
  ] }),
40
- i === a.LEADERBOARD && /* @__PURE__ */ e(I, { children: /* @__PURE__ */ e(F, { scrollStore: t, scrollNode: f, gamification: r }) })
42
+ a === n.LEADERBOARD && /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(O, { scrollStore: t, scrollNode: y, gamification: s }) })
41
43
  ] });
42
44
  };
43
45
  export {
44
- J as Tabs
46
+ W as Tabs
45
47
  };
@@ -1,4 +1,5 @@
1
1
  import { DebugProps } from '../../../utils/debug';
2
2
  export declare const AppStory: React.FC<DebugProps & {
3
3
  darkMode?: boolean;
4
+ friendsTab?: 'enabled' | 'disabled' | 'activatedGame';
4
5
  }>;
@@ -1,67 +1,69 @@
1
1
  import { jsx as r, jsxs as t } from "react/jsx-runtime";
2
2
  import { styled as s } from "@linaria/react";
3
- import { useEffect as l } from "react";
4
- import { StreamLayerProvider as p, useStreamLayer as m, StreamLayerSDKEvent as c } from "@streamlayer/react";
5
- import { App as f } from "../index.js";
6
- import { StreamLayerThemeProvider as u } from "../../../ui/theme/index.js";
7
- import { useStreamLayerDebug as y } from "../../../utils/debug/index.js";
8
- import { Video as h } from "./video.js";
3
+ import { useEffect as p } from "react";
4
+ import { StreamLayerProvider as m, useStreamLayer as c, StreamLayerSDKEvent as f } from "@streamlayer/react";
5
+ import { App as u } from "../index.js";
6
+ import { StreamLayerThemeProvider as y } from "../../../ui/theme/index.js";
7
+ import { useStreamLayerDebug as h } from "../../../utils/debug/index.js";
8
+ import { Video as k } from "./video.js";
9
9
  const a = () => {
10
10
  console.log("deep link handled cb");
11
- }, k = () => {
11
+ }, v = () => {
12
12
  console.log("video player handled cb");
13
- }, v = ({
13
+ }, A = ({
14
14
  event: o
15
15
  }) => {
16
- const e = m();
17
- return l(() => {
16
+ const e = c();
17
+ return p(() => {
18
18
  e && e.openFeature(12);
19
- }, [e, o]), e ? /* @__PURE__ */ t(u, {
19
+ }, [e, o]), e ? /* @__PURE__ */ t(y, {
20
20
  customTheme: "dark",
21
- children: [/* @__PURE__ */ r(c, {
21
+ children: [/* @__PURE__ */ r(f, {
22
22
  event: o
23
- }), /* @__PURE__ */ r(f, {
23
+ }), /* @__PURE__ */ r(u, {
24
24
  sdk: e,
25
25
  event: o,
26
26
  onDeepLinkHandled: a
27
27
  })]
28
28
  }) : null;
29
- }, A = /* @__PURE__ */ s("div")({
29
+ }, S = /* @__PURE__ */ s("div")({
30
30
  name: "Container",
31
31
  class: "c1a4qh28",
32
32
  propsAsIs: !1
33
- }), S = /* @__PURE__ */ s("div")({
33
+ }), C = /* @__PURE__ */ s("div")({
34
34
  name: "Body",
35
35
  class: "b9h8kuk",
36
36
  propsAsIs: !1
37
- }), C = /* @__PURE__ */ s("div")({
37
+ }), L = /* @__PURE__ */ s("div")({
38
38
  name: "AppContainer",
39
39
  class: "a1wkro2j",
40
40
  propsAsIs: !1
41
- }), E = ({
41
+ }), I = ({
42
42
  sdkKey: o,
43
43
  eventId: e,
44
44
  production: d,
45
- darkMode: i
45
+ darkMode: i,
46
+ friendsTab: l
46
47
  }) => {
47
- const n = y({
48
+ const n = h({
48
49
  sdkKey: o,
49
50
  eventId: e,
50
51
  production: d
51
52
  });
52
- return /* @__PURE__ */ r(p, {
53
+ return /* @__PURE__ */ r(m, {
53
54
  sdkKey: n.sdkKey,
54
55
  production: n.env === "production",
55
56
  autoEnable: !0,
56
57
  onDeepLinkHandled: a,
57
- videoPlayerController: k,
58
+ videoPlayerController: v,
58
59
  withAd: !1,
59
- children: /* @__PURE__ */ t(S, {
60
+ friendsTab: l,
61
+ children: /* @__PURE__ */ t(C, {
60
62
  className: i ? "dark" : "",
61
- children: [/* @__PURE__ */ r(h, {}), /* @__PURE__ */ r(A, {
62
- children: /* @__PURE__ */ r(C, {
63
+ children: [/* @__PURE__ */ r(k, {}), /* @__PURE__ */ r(S, {
64
+ children: /* @__PURE__ */ r(L, {
63
65
  className: "StreamLayerSDK",
64
- children: /* @__PURE__ */ r(v, {
66
+ children: /* @__PURE__ */ r(A, {
65
67
  event: n.event
66
68
  })
67
69
  })
@@ -70,5 +72,5 @@ const a = () => {
70
72
  });
71
73
  };
72
74
  export {
73
- E as AppStory
75
+ I as AppStory
74
76
  };