@streamlayer/react-ui 1.8.0 → 1.8.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,58 +1,53 @@
1
- import { jsx as f } from "react/jsx-runtime";
2
- import { styled as m } from "@linaria/react";
3
- import { useStore as c } from "@nanostores/react";
4
- import { useRef as i, useEffect as d } from "react";
5
- import { FeatureType as l } from "@streamlayer/sdk-web-types";
6
- import { Question as Q } from "../Features/Gamification/Question.js";
7
- import { ShowIn as S } from "../../../ui/show-in/index.js";
8
- const y = () => Q, I = /* @__PURE__ */ m(y())({
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { styled as Q } from "@linaria/react";
3
+ import { useStore as d } from "@nanostores/react";
4
+ import { useRef as i, useEffect as l } from "react";
5
+ import { FeatureType as m } from "@streamlayer/sdk-web-types";
6
+ import { Question as S } from "../Features/Gamification/Question.js";
7
+ const y = () => S, I = /* @__PURE__ */ Q(y())({
9
8
  name: "QuestionWrap",
10
9
  class: "q10hhsxv",
11
10
  propsAsIs: !0
12
- }), h = ({
11
+ }), b = ({
13
12
  gamification: e,
14
- persistent: s,
13
+ persistent: o,
15
14
  hideHeader: p,
16
15
  insightId: r
17
16
  }) => {
18
- const t = i(""), u = c(e.openedQuestion.$store);
19
- return d(() => r ? (!s || e.isOpenedQuestion(r) || (t.current = r, e.getFeedItem(r).then((n) => {
20
- t.current === r && e.openQuestion(r, n);
17
+ const t = i(""), n = d(e.openedQuestion.$store);
18
+ return l(() => r ? (!o || e.isOpenedQuestion(r) || (t.current = r, e.getFeedItem(r).then((u) => {
19
+ var f;
20
+ t.current === r && ((f = u == null ? void 0 : u.attributes) == null ? void 0 : f.attributes.case) === "insight" && e.openQuestion(r, u);
21
21
  })), () => {
22
22
  t.current = "";
23
23
  }) : (e.activeQuestionId.subscribe(({
24
- data: o
24
+ data: s
25
25
  }) => {
26
- var n;
27
- o && ((n = o.feedItem) == null ? void 0 : n.type) === "insight" && (!s || e.isOpenedQuestion(o.feedItem.id) || (t.current = o.feedItem.id, e.openQuestion(o.feedItem.id, o.feedItem))), !o && t.current && (e.closeQuestion(t.current), t.current = "");
26
+ var u;
27
+ s && ((u = s.feedItem) == null ? void 0 : u.type) === "insight" && (!o || e.isOpenedQuestion(s.feedItem.id) || (t.current = s.feedItem.id, e.openQuestion(s.feedItem.id, s.feedItem))), !s && t.current && (e.closeQuestion(t.current), t.current = "");
28
28
  }), () => {
29
- }), [e, s, r]), u ? /* @__PURE__ */ f(S, {
30
- style: {
31
- height: "100%"
32
- },
33
- children: /* @__PURE__ */ f(I, {
34
- hideHeader: p,
35
- gamification: e,
36
- hideSponsor: !0
37
- })
29
+ }), [e, o, r]), n ? /* @__PURE__ */ c(I, {
30
+ hideHeader: p,
31
+ gamification: e,
32
+ hideSponsor: !0
38
33
  }) : null;
39
- }, D = ({
34
+ }, h = ({
40
35
  sdk: e,
41
- persistent: s,
36
+ persistent: o,
42
37
  insightId: p,
43
38
  hideHeader: r
44
39
  }) => {
45
- if (!c(e.featuresList.getStore()))
40
+ if (!d(e.featuresList.getStore()))
46
41
  return null;
47
- const u = e.getFeature(l.GAMES);
48
- return u ? /* @__PURE__ */ f(h, {
42
+ const n = e.getFeature(m.GAMES);
43
+ return n ? /* @__PURE__ */ c(b, {
49
44
  insightId: p,
50
- persistent: s,
45
+ persistent: o,
51
46
  hideHeader: r,
52
- gamification: u
47
+ gamification: n
53
48
  }) : null;
54
49
  };
55
50
  export {
56
51
  I as QuestionWrap,
57
- D as StreamLayerSDKInsight
52
+ h as StreamLayerSDKInsight
58
53
  };
@@ -1,11 +1,11 @@
1
1
  import { jsxs as o, Fragment as d, jsx as e } from "react/jsx-runtime";
2
- import { useRef as l } from "react";
3
- import { useStreamLayer as h } from "@streamlayer/react";
2
+ import { useRef as h } from "react";
3
+ import { useStreamLayer as l } from "@streamlayer/react";
4
4
  import { StreamLayerSDKInsight as i } from "../../Insight/index.js";
5
5
  import { StreamLayerThemeProvider as n } from "../../../../ui/theme/index.js";
6
6
  import { VideoFrame as c, customTheme as s, VideoPlayerWrap as p, InsightContainerMobile as u, InsightContainerOverlay as f, InsightContainerLBar as g } from "./styles.js";
7
7
  const x = ({ insightId: t, layoutMode: a }) => {
8
- const r = h(), m = l(null);
8
+ const r = l(), m = h(null);
9
9
  return /* @__PURE__ */ o(d, { children: [
10
10
  /* @__PURE__ */ o(c, { ref: m, "data-testid": "video-frame", children: [
11
11
  /* @__PURE__ */ e(a === "cover" ? f : g, { children: r && /* @__PURE__ */ e(n, { customTheme: s, children: /* @__PURE__ */ e(i, { sdk: r, insightId: t, persistent: !0 }) }) }),
@@ -15,7 +15,7 @@ const x = ({ insightId: t, layoutMode: a }) => {
15
15
  src: "https://storage.googleapis.com/cdn.streamlayer.io/assets/sdk-web/Own%20The%20Game%201080p%20RF18.mp4",
16
16
  width: "100%",
17
17
  height: "100%",
18
- autoplay: "autoplay",
18
+ autoPlay: !0,
19
19
  loop: !0,
20
20
  playsInline: !0,
21
21
  controls: !0
@@ -0,0 +1,11 @@
1
+ export declare const TGLStory: React.FC<{
2
+ isMobileScreen?: boolean;
3
+ promotionId?: string;
4
+ insightId?: string;
5
+ sdkKey?: string;
6
+ eventId?: string;
7
+ production?: boolean;
8
+ persistent?: boolean;
9
+ sidebar: 'left' | 'right';
10
+ banner: 'top' | 'bottom';
11
+ }>;
@@ -0,0 +1,54 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { styled as o } from "@linaria/react";
3
+ import { StreamLayerProvider as l } from "@streamlayer/react";
4
+ import { useStreamLayerDebug as u } from "../../utils/debug/index.js";
5
+ import { Video as v } from "./video.js";
6
+ const f = /* @__PURE__ */ o("div")({
7
+ name: "Body",
8
+ class: "b1ssmzei",
9
+ propsAsIs: !1
10
+ }), b = /* @__PURE__ */ o("div")({
11
+ name: "Main",
12
+ class: "me6bye3",
13
+ propsAsIs: !1
14
+ }), k = ({
15
+ isMobileScreen: s,
16
+ persistent: t,
17
+ insightId: n,
18
+ promotionId: i,
19
+ sdkKey: d,
20
+ eventId: m,
21
+ sidebar: a,
22
+ production: p,
23
+ banner: c,
24
+ layoutMode: y = "side-by-side"
25
+ }) => {
26
+ const e = u({
27
+ sdkKey: d,
28
+ eventId: m,
29
+ production: p
30
+ });
31
+ return /* @__PURE__ */ r(b, {
32
+ children: /* @__PURE__ */ r(l, {
33
+ sdkKey: e.sdkKey,
34
+ event: e.event,
35
+ production: e.env === "production",
36
+ autoEnable: !0,
37
+ children: /* @__PURE__ */ r(f, {
38
+ children: /* @__PURE__ */ r(v, {
39
+ event: e.event,
40
+ banner: c,
41
+ sidebar: a,
42
+ layoutMode: y,
43
+ promotionId: i,
44
+ isMobileScreen: s,
45
+ persistent: t,
46
+ insightId: n
47
+ })
48
+ })
49
+ })
50
+ });
51
+ };
52
+ export {
53
+ k as TGLStory
54
+ };
@@ -0,0 +1,7 @@
1
+ export declare const customTheme: import('@linaria/core').LinariaClassName;
2
+ export declare const VideoPlayerWrap: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
3
+ export declare const VideoFrame: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
4
+ export declare const AdvSidebar: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
5
+ export declare const AdvContent: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
6
+ export declare const AdvBanner: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
7
+ export declare const PromoButton: any;
@@ -0,0 +1,36 @@
1
+ import { styled as s } from "@linaria/react";
2
+ import { Button as o } from "../../ui/button/index.js";
3
+ const r = "c2zt16z", t = /* @__PURE__ */ s("div")({
4
+ name: "VideoPlayerWrap",
5
+ class: "v1a2i6l5",
6
+ propsAsIs: !1
7
+ }), p = /* @__PURE__ */ s("div")({
8
+ name: "VideoFrame",
9
+ class: "v11p2oa",
10
+ propsAsIs: !1
11
+ }), d = /* @__PURE__ */ s("div")({
12
+ name: "AdvSidebar",
13
+ class: "a4rnnox",
14
+ propsAsIs: !1
15
+ }), c = /* @__PURE__ */ s("div")({
16
+ name: "AdvContent",
17
+ class: "a1t6jakx",
18
+ propsAsIs: !1
19
+ }), m = /* @__PURE__ */ s("div")({
20
+ name: "AdvBanner",
21
+ class: "ah6jyrg",
22
+ propsAsIs: !1
23
+ }), a = () => o, i = /* @__PURE__ */ s(a())({
24
+ name: "PromoButton",
25
+ class: "p12yifsu",
26
+ propsAsIs: !0
27
+ });
28
+ export {
29
+ m as AdvBanner,
30
+ c as AdvContent,
31
+ d as AdvSidebar,
32
+ i as PromoButton,
33
+ p as VideoFrame,
34
+ t as VideoPlayerWrap,
35
+ r as customTheme
36
+ };
@@ -0,0 +1,10 @@
1
+ export declare const Video: React.FC<{
2
+ sidebar: 'left' | 'right';
3
+ banner: 'top' | 'bottom';
4
+ layoutMode: 'cover' | 'side-by-side';
5
+ isMobileScreen?: boolean;
6
+ persistent?: boolean;
7
+ event?: string;
8
+ promotionId?: string;
9
+ insightId?: string;
10
+ }>;
@@ -0,0 +1,105 @@
1
+ import { jsxs as o, Fragment as P, jsx as r } from "react/jsx-runtime";
2
+ import { useRef as V, useState as T, useCallback as w, useEffect as x } from "react";
3
+ import { useStreamLayer as A } from "@streamlayer/react";
4
+ import { StreamLayerSDKAdvertisement as s } from "../app/Advertisement/index.js";
5
+ import { StreamLayerSDKInsight as g } from "../app/Insight/index.js";
6
+ import { StreamLayerThemeProvider as h } from "../../ui/theme/index.js";
7
+ import { PromoButton as S, VideoFrame as F, AdvSidebar as L, customTheme as u, VideoPlayerWrap as k, AdvBanner as R, AdvContent as b } from "./styles.js";
8
+ const O = ({ isMobileScreen: m, sidebar: l, banner: p, event: n, persistent: t, insightId: f, promotionId: c, layoutMode: a }) => {
9
+ const e = A(), v = V(null), [y, C] = T(!0), d = w(({ muted: i }) => {
10
+ C(i);
11
+ }, []);
12
+ return x(() => (e == null || e.addVideoPlayerController(d), () => {
13
+ e == null || e.removeVideoPlayerController(d);
14
+ }), [e, d]), /* @__PURE__ */ o(P, { children: [
15
+ c && /* @__PURE__ */ o(S, { onClick: () => {
16
+ var i;
17
+ (i = v.current) == null || i.scrollIntoView({ behavior: "smooth" }), setTimeout(() => {
18
+ e == null || e.getFeature(12).background.advertisement.show(c);
19
+ }, 200);
20
+ }, children: [
21
+ "open promotion: ",
22
+ c
23
+ ] }),
24
+ /* @__PURE__ */ o(F, { ref: v, "data-testid": "video-frame", children: [
25
+ /* @__PURE__ */ r(
26
+ L,
27
+ {
28
+ style: {
29
+ ...a === "cover" ? { position: "absolute" } : {},
30
+ ...l === "left" ? { left: 0 } : { right: 0, order: 3 },
31
+ ...m ? { maxWidth: "calc(300px + env(safe-area-inset-left))" } : {}
32
+ },
33
+ children: e && /* @__PURE__ */ o(h, { customTheme: u, children: [
34
+ /* @__PURE__ */ r(
35
+ s,
36
+ {
37
+ isMobileScreen: m,
38
+ event: n,
39
+ sdk: e,
40
+ sidebar: l,
41
+ layoutMode: a,
42
+ persistent: t,
43
+ skipTypeCheck: !0
44
+ }
45
+ ),
46
+ /* @__PURE__ */ r(g, { insightId: f, sdk: e, persistent: t })
47
+ ] })
48
+ }
49
+ ),
50
+ /* @__PURE__ */ o(k, { children: [
51
+ /* @__PURE__ */ r("div", { className: "divAnchor", children: /* @__PURE__ */ r(
52
+ "video",
53
+ {
54
+ src: "https://storage.googleapis.com/cdn.streamlayer.io/assets/sdk-web/Own%20The%20Game%201080p%20RF18.mp4",
55
+ muted: y,
56
+ width: "100%",
57
+ height: "100%",
58
+ autoplay: "autoplay",
59
+ loop: !0,
60
+ playsInline: !0,
61
+ controls: !0
62
+ }
63
+ ) }),
64
+ /* @__PURE__ */ r(
65
+ R,
66
+ {
67
+ style: {
68
+ ...a === "cover" ? { position: "absolute" } : {},
69
+ ...p === "top" ? { top: 0, order: -1 } : { bottom: 0 }
70
+ },
71
+ children: e && /* @__PURE__ */ r(h, { customTheme: u, children: /* @__PURE__ */ r(
72
+ s,
73
+ {
74
+ isMobileScreen: m,
75
+ event: n,
76
+ sdk: e,
77
+ banner: p,
78
+ layoutMode: a,
79
+ persistent: t
80
+ }
81
+ ) })
82
+ }
83
+ )
84
+ ] })
85
+ ] }),
86
+ /* @__PURE__ */ r(b, { children: e && /* @__PURE__ */ o(h, { customTheme: u, children: [
87
+ /* @__PURE__ */ r(
88
+ s,
89
+ {
90
+ isMobileScreen: m,
91
+ event: n,
92
+ sdk: e,
93
+ sidebar: l,
94
+ layoutMode: a,
95
+ persistent: t,
96
+ skipTypeCheck: !0
97
+ }
98
+ ),
99
+ /* @__PURE__ */ r(g, { insightId: f, sdk: e, persistent: t })
100
+ ] }) })
101
+ ] });
102
+ };
103
+ export {
104
+ O as Video
105
+ };