@streamlayer/react-ui 1.3.3 → 1.4.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.
@@ -1,4 +1,4 @@
1
- import { jsx as m } from "react/jsx-runtime";
1
+ import { jsx as c } from "react/jsx-runtime";
2
2
  import { styled as u } from "@linaria/react";
3
3
  import { useStore as f } from "@nanostores/react";
4
4
  import { useAnalyticsListener as p } from "../../../hooks/analytics.js";
@@ -34,7 +34,7 @@ const L = /* @__PURE__ */ u("div")({
34
34
  layoutMode: e,
35
35
  sidebar: i,
36
36
  banner: r,
37
- isMobileScreen: c,
37
+ isMobileScreen: l,
38
38
  persistent: o
39
39
  }) => {
40
40
  const a = A(null), s = f(t.advertisement.$list), n = y(
@@ -43,29 +43,31 @@ const L = /* @__PURE__ */ u("div")({
43
43
  // eslint-disable-next-line react-hooks/exhaustive-deps
44
44
  [s, o]
45
45
  );
46
- return p(a, {
46
+ p(a, {
47
47
  enabled: !!n,
48
48
  event: "click",
49
49
  listener: E
50
- }), n ? /* @__PURE__ */ m(L, {
50
+ });
51
+ const m = !r && !i;
52
+ return n ? /* @__PURE__ */ c(L, {
51
53
  ref: a,
52
54
  style: {
53
- height: !r && !i ? "auto" : "100%"
55
+ height: m ? "auto" : "100%"
54
56
  },
55
- className: c ? "mobile-view" : "",
56
- children: /* @__PURE__ */ m(h, {
57
+ className: l ? "mobile-view" : "",
58
+ children: /* @__PURE__ */ c(h, {
57
59
  sidebar: i,
58
60
  banner: r,
59
61
  advertisement: n,
60
62
  layoutMode: e
61
63
  })
62
64
  }) : null;
63
- }, O = ({
65
+ }, P = ({
64
66
  sdk: t,
65
67
  sidebar: e,
66
68
  banner: i,
67
69
  event: r,
68
- layoutMode: c,
70
+ layoutMode: l,
69
71
  isMobileScreen: o,
70
72
  persistent: a
71
73
  }) => {
@@ -77,7 +79,7 @@ const L = /* @__PURE__ */ u("div")({
77
79
  }, [r, s, t]);
78
80
  const n = f(t.featuresList.getStore());
79
81
  if (e && i)
80
- return /* @__PURE__ */ m("div", {
82
+ return /* @__PURE__ */ c("div", {
81
83
  style: {
82
84
  color: "red"
83
85
  },
@@ -85,17 +87,17 @@ const L = /* @__PURE__ */ u("div")({
85
87
  });
86
88
  if (!n)
87
89
  return null;
88
- const l = t.getFeature(g.GAMES);
89
- return l ? /* @__PURE__ */ m(I, {
90
- gamification: l,
90
+ const m = t.getFeature(g.GAMES);
91
+ return m ? /* @__PURE__ */ c(I, {
92
+ gamification: m,
91
93
  sidebar: e,
92
94
  banner: i,
93
- layoutMode: c,
95
+ layoutMode: l,
94
96
  isMobileScreen: o,
95
97
  persistent: a
96
98
  }) : null;
97
99
  };
98
100
  export {
99
101
  L as AdvertisementUIWrap,
100
- O as StreamLayerSDKAdvertisement
102
+ P as StreamLayerSDKAdvertisement
101
103
  };
@@ -15,4 +15,5 @@ export type StreamLayerSDKInsightProps = {
15
15
  };
16
16
  export declare const StreamLayerSDKInsight: React.FC<StreamLayerSDKInsightProps & {
17
17
  sdk: StreamLayerSDK;
18
+ insightId?: string;
18
19
  }>;
@@ -1,62 +1,69 @@
1
- import { jsx as p } from "react/jsx-runtime";
2
- import { styled as S } from "@linaria/react";
3
- import { useStore as m } from "@nanostores/react";
4
- import { useEffect as c } from "react";
5
- import { FeatureType as h, QuestionStatus as l } from "@streamlayer/sdk-web-types";
6
- import { Question as d } from "../Features/Gamification/Question.js";
7
- import { useAppApp as Q } from "../useApp.js";
8
- import { ShowIn as I } from "../../../ui/show-in/index.js";
9
- const a = () => d, y = /* @__PURE__ */ S(a())({
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { styled as d } from "@linaria/react";
3
+ import { useStore as S } from "@nanostores/react";
4
+ import { useEffect as l, useRef as Q } from "react";
5
+ import { FeatureType as h, QuestionStatus as w } from "@streamlayer/sdk-web-types";
6
+ import { Question as y } from "../Features/Gamification/Question.js";
7
+ import { useAppApp as A } from "../useApp.js";
8
+ import { ShowIn as V } from "../../../ui/show-in/index.js";
9
+ const v = () => y, x = /* @__PURE__ */ d(v())({
10
10
  name: "QuestionWrap",
11
11
  class: "q10hhsxv",
12
12
  propsAsIs: !0
13
- }), A = ({
13
+ }), E = ({
14
14
  gamification: e,
15
15
  persistent: t,
16
- hideHeader: n
16
+ hideHeader: f,
17
+ insightId: r
17
18
  }) => {
18
- const i = m(e.openedQuestion.$store);
19
- return c(() => e.feedList.getStore().subscribe(({
20
- data: o
19
+ const s = Q(""), n = S(e.openedQuestion.$store);
20
+ return l(() => r ? (!t || e.isOpenedQuestion(r) || (s.current = r, e.getFeedItem(r).then((o) => {
21
+ s.current === r && e.openQuestion(r, o);
22
+ })), () => {
23
+ s.current = "";
24
+ }) : e.feedList.getStore().subscribe(({
25
+ data: u
21
26
  }) => {
22
- if (o) {
23
- const s = o, r = s == null ? void 0 : s.find(({
24
- type: f,
25
- attributes: u
26
- }) => f === "insight" && (u == null ? void 0 : u.status) === l.ACTIVE);
27
- r && (!t || e.isOpenedQuestion(r.id) || e.openQuestion(r.id, r));
27
+ if (u) {
28
+ const o = u, p = o == null ? void 0 : o.find(({
29
+ type: m,
30
+ attributes: c
31
+ }) => m === "insight" && (c == null ? void 0 : c.status) === w.ACTIVE);
32
+ p && (!t || e.isOpenedQuestion(p.id) || e.openQuestion(p.id, p));
28
33
  }
29
- }), [e, t]), i ? /* @__PURE__ */ p(I, {
34
+ }), [e, t, r]), n ? /* @__PURE__ */ i(V, {
30
35
  style: {
31
36
  height: "100%"
32
37
  },
33
- children: /* @__PURE__ */ p(y, {
34
- hideHeader: n,
38
+ children: /* @__PURE__ */ i(x, {
39
+ hideHeader: f,
35
40
  gamification: e,
36
41
  hideSponsor: !0
37
42
  })
38
43
  }) : null;
39
- }, F = ({
44
+ }, j = ({
40
45
  sdk: e,
41
46
  event: t,
42
- persistent: n,
43
- hideHeader: i
47
+ persistent: f,
48
+ insightId: r,
49
+ hideHeader: s
44
50
  }) => {
45
51
  const {
46
- deactivate: o
47
- } = Q(e);
48
- if (c(() => {
49
- t ? e.createEventSession(t) : o();
50
- }, [t, o, e]), !m(e.featuresList.getStore()))
52
+ deactivate: n
53
+ } = A(e);
54
+ if (l(() => {
55
+ t ? e.createEventSession(t) : n();
56
+ }, [t, n, e]), !S(e.featuresList.getStore()))
51
57
  return null;
52
- const r = e.getFeature(h.GAMES);
53
- return r ? /* @__PURE__ */ p(A, {
54
- persistent: n,
55
- hideHeader: i,
56
- gamification: r
58
+ const o = e.getFeature(h.GAMES);
59
+ return o ? /* @__PURE__ */ i(E, {
60
+ insightId: r,
61
+ persistent: f,
62
+ hideHeader: s,
63
+ gamification: o
57
64
  }) : null;
58
65
  };
59
66
  export {
60
- y as QuestionWrap,
61
- F as StreamLayerSDKInsight
67
+ x as QuestionWrap,
68
+ j as StreamLayerSDKInsight
62
69
  };
@@ -1,6 +1,7 @@
1
1
  export declare const InsightStory: React.FC<{
2
2
  sdkKey?: string;
3
3
  eventId?: string;
4
+ insightId?: string;
4
5
  production?: boolean;
5
6
  onlyInsight?: boolean;
6
7
  hideHeader?: boolean;
@@ -1,57 +1,62 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import { styled as d } from "@linaria/react";
3
- import { StreamLayerProvider as a, useStreamLayer as u } from "@streamlayer/react";
4
- import { StreamLayerSDKInsight as p } from "../../Insight/index.js";
5
- import { StreamLayerThemeProvider as c } from "../../../../ui/theme/index.js";
6
- import { useStreamLayerDebug as y } from "../../../../utils/debug/index.js";
7
- import { customTheme as f } from "./styles.js";
8
- import { Video as h } from "./video.js";
9
- const l = /* @__PURE__ */ d("div")({
3
+ import { StreamLayerProvider as u, useStreamLayer as p } from "@streamlayer/react";
4
+ import { StreamLayerSDKInsight as c } from "../../Insight/index.js";
5
+ import { StreamLayerThemeProvider as y } from "../../../../ui/theme/index.js";
6
+ import { useStreamLayerDebug as f } from "../../../../utils/debug/index.js";
7
+ import { customTheme as l } from "./styles.js";
8
+ import { Video as v } from "./video.js";
9
+ const h = /* @__PURE__ */ d("div")({
10
10
  name: "Body",
11
11
  class: "buit6hv",
12
12
  propsAsIs: !1
13
- }), v = ({
13
+ }), S = ({
14
14
  event: o,
15
- hideHeader: m
15
+ hideHeader: m,
16
+ insightId: n
16
17
  }) => {
17
- const r = u();
18
- return r ? /* @__PURE__ */ e(c, {
19
- customTheme: f,
20
- children: /* @__PURE__ */ e(p, {
18
+ const r = p();
19
+ return r ? /* @__PURE__ */ e(y, {
20
+ customTheme: l,
21
+ children: /* @__PURE__ */ e(c, {
21
22
  hideHeader: m,
22
23
  event: o,
23
24
  sdk: r,
25
+ insightId: n,
24
26
  persistent: !0
25
27
  })
26
28
  }) : null;
27
- }, B = ({
29
+ }, D = ({
28
30
  sdkKey: o,
29
31
  eventId: m,
30
- layoutMode: r,
31
- production: n,
32
- onlyInsight: s,
33
- hideHeader: i
32
+ layoutMode: n,
33
+ insightId: r,
34
+ production: s,
35
+ onlyInsight: i,
36
+ hideHeader: a
34
37
  }) => {
35
- const t = y({
38
+ const t = f({
36
39
  sdkKey: o,
37
40
  eventId: m,
38
- production: n
41
+ production: s
39
42
  });
40
- return /* @__PURE__ */ e(a, {
43
+ return /* @__PURE__ */ e(u, {
41
44
  sdkKey: t.sdkKey,
42
45
  production: t.env === "production",
43
46
  autoEnable: !0,
44
- children: s ? /* @__PURE__ */ e(v, {
45
- hideHeader: i,
47
+ children: i ? /* @__PURE__ */ e(S, {
48
+ insightId: r,
49
+ hideHeader: a,
46
50
  event: t.event
47
- }) : /* @__PURE__ */ e(l, {
48
- children: /* @__PURE__ */ e(h, {
49
- layoutMode: r,
51
+ }) : /* @__PURE__ */ e(h, {
52
+ children: /* @__PURE__ */ e(v, {
53
+ insightId: r,
54
+ layoutMode: n,
50
55
  event: t.event
51
56
  })
52
57
  })
53
58
  });
54
59
  };
55
60
  export {
56
- B as InsightStory
61
+ D as InsightStory
57
62
  };
@@ -1,4 +1,5 @@
1
1
  export declare const Video: React.FC<{
2
2
  event?: string;
3
+ insightId?: string;
3
4
  layoutMode?: 'side-by-side' | 'cover';
4
5
  }>;
@@ -1,15 +1,15 @@
1
- import { jsxs as o, Fragment as d, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as i, Fragment as l, jsx as e } from "react/jsx-runtime";
2
2
  import { useRef as h } from "react";
3
- import { useStreamLayer as l } from "@streamlayer/react";
4
- import { StreamLayerSDKInsight as i } from "../../Insight/index.js";
5
- import { StreamLayerThemeProvider as n } from "../../../../ui/theme/index.js";
6
- import { VideoFrame as c, customTheme as s, VideoPlayerWrap as p, InsightContainerMobile as u, InsightContainerOverlay as g, InsightContainerLBar as f } from "./styles.js";
7
- const x = ({ event: t, layoutMode: a }) => {
8
- const r = l(), m = h(null);
9
- return /* @__PURE__ */ o(d, { children: [
10
- /* @__PURE__ */ o(c, { ref: m, "data-testid": "video-frame", children: [
11
- /* @__PURE__ */ e(a === "cover" ? g : f, { children: r && /* @__PURE__ */ e(n, { customTheme: s, children: /* @__PURE__ */ e(i, { event: t, sdk: r, persistent: !0 }) }) }),
12
- /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e("div", { className: "divAnchor", children: /* @__PURE__ */ e(
3
+ import { useStreamLayer as c } from "@streamlayer/react";
4
+ import { StreamLayerSDKInsight as n } from "../../Insight/index.js";
5
+ import { StreamLayerThemeProvider as s } from "../../../../ui/theme/index.js";
6
+ import { VideoFrame as p, customTheme as a, VideoPlayerWrap as u, InsightContainerMobile as f, InsightContainerOverlay as g, InsightContainerLBar as y } from "./styles.js";
7
+ const F = ({ event: t, insightId: o, layoutMode: m }) => {
8
+ const r = c(), d = h(null);
9
+ return /* @__PURE__ */ i(l, { children: [
10
+ /* @__PURE__ */ i(p, { ref: d, "data-testid": "video-frame", children: [
11
+ /* @__PURE__ */ e(m === "cover" ? g : y, { children: r && /* @__PURE__ */ e(s, { customTheme: a, children: /* @__PURE__ */ e(n, { event: t, sdk: r, insightId: o, persistent: !0 }) }) }),
12
+ /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e("div", { className: "divAnchor", children: /* @__PURE__ */ e(
13
13
  "video",
14
14
  {
15
15
  src: "https://storage.googleapis.com/cdn.streamlayer.io/assets/sdk-web/Own%20The%20Game%201080p%20RF18.mp4",
@@ -22,9 +22,9 @@ const x = ({ event: t, layoutMode: a }) => {
22
22
  }
23
23
  ) }) })
24
24
  ] }),
25
- /* @__PURE__ */ e(u, { children: r && /* @__PURE__ */ e(n, { customTheme: s, children: /* @__PURE__ */ e(i, { event: t, sdk: r, persistent: !0 }) }) })
25
+ /* @__PURE__ */ e(f, { children: r && /* @__PURE__ */ e(s, { customTheme: a, children: /* @__PURE__ */ e(n, { event: t, sdk: r, insightId: o, persistent: !0 }) }) })
26
26
  ] });
27
27
  };
28
28
  export {
29
- x as Video
29
+ F as Video
30
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/react-ui",
3
- "version": "1.3.3",
3
+ "version": "1.4.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -46,7 +46,7 @@
46
46
  ],
47
47
  "peerDependencies": {
48
48
  "@lottiefiles/react-lottie-player": "^3.5.4",
49
- "@streamlayer/sl-eslib": "^5.117.0",
49
+ "@streamlayer/sl-eslib": "^5.122.0",
50
50
  "@types/lodash.throttle": "^4.1.9",
51
51
  "lodash.throttle": "^4.1.1",
52
52
  "nanoid": "3.3.7",
@@ -54,18 +54,18 @@
54
54
  "react-virtualized-auto-sizer": "^1.0.24",
55
55
  "react-window": "^1.8.10",
56
56
  "react-window-infinite-loader": "^1.0.9",
57
- "@streamlayer/feature-gamification": "^1.3.3",
58
- "@streamlayer/sdk-web": "^1.1.3",
59
- "@streamlayer/sdk-web-analytics": "^1.1.3",
60
- "@streamlayer/sdk-web-anonymous-auth": "^1.0.8",
61
- "@streamlayer/sdk-web-api": "^1.2.3",
62
- "@streamlayer/sdk-web-core": "^1.1.3",
63
- "@streamlayer/sdk-web-features": "^1.0.8",
64
- "@streamlayer/sdk-web-interfaces": "^1.1.3",
65
- "@streamlayer/sdk-web-logger": "^1.0.8",
66
- "@streamlayer/sdk-web-notifications": "^1.1.3",
67
- "@streamlayer/sdk-web-storage": "^1.0.8",
68
- "@streamlayer/sdk-web-types": "^1.2.3"
57
+ "@streamlayer/sdk-web": "^1.2.0",
58
+ "@streamlayer/sdk-web-analytics": "^1.2.0",
59
+ "@streamlayer/feature-gamification": "^1.4.0",
60
+ "@streamlayer/sdk-web-anonymous-auth": "^1.0.9",
61
+ "@streamlayer/sdk-web-api": "^1.3.0",
62
+ "@streamlayer/sdk-web-features": "^1.0.9",
63
+ "@streamlayer/sdk-web-core": "^1.2.0",
64
+ "@streamlayer/sdk-web-interfaces": "^1.1.4",
65
+ "@streamlayer/sdk-web-logger": "^1.0.9",
66
+ "@streamlayer/sdk-web-notifications": "^1.1.4",
67
+ "@streamlayer/sdk-web-storage": "^1.0.9",
68
+ "@streamlayer/sdk-web-types": "^1.3.0"
69
69
  },
70
70
  "nx": {
71
71
  "implicitDependencies": [
@@ -106,6 +106,6 @@
106
106
  "vite-plugin-svgr": "^4.2.0",
107
107
  "vite-svg-loader": "^5.1.0",
108
108
  "vite-tsconfig-paths": "^5.0.1",
109
- "@streamlayer/react": "^1.1.7"
109
+ "@streamlayer/react": "^1.2.0"
110
110
  }
111
111
  }