@streamlayer/react-ui 1.5.0 → 1.6.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,20 +1,29 @@
1
- import { jsxs as o, jsx as i } from "react/jsx-runtime";
2
- import { useStore as n } from "@nanostores/react";
3
- import { PromotionType as d } from "@streamlayer/sdk-web-types";
4
- import { Banner as u } from "./banner/index.js";
5
- import { Overlay as t } from "./overlay/index.js";
6
- import { Sidebar as s } from "./sidebar/index.js";
7
- import { OverlayContainer as f } from "./overlay/styles.js";
8
- const y = (r) => (r == null ? void 0 : r.type) === d.INGAME_IAB11_LBAR || (r == null ? void 0 : r.type) === d.INGAME_IAB21_LBAR, I = (r) => (r == null ? void 0 : r.type) === d.INGAME_IAB11 || (r == null ? void 0 : r.type) === d.INGAME_IAB21, E = ({ advertisement: r, skipTypeCheck: c, layoutMode: A = "side-by-side", sidebar: e, banner: a }) => {
9
- const l = n(r.data);
10
- return !l.data && l.loading ? null : l.error ? /* @__PURE__ */ o("div", { children: [
1
+ import { jsxs as a, jsx as i } from "react/jsx-runtime";
2
+ import { useStore as f } from "@nanostores/react";
3
+ import { PromotionType as t } from "@streamlayer/sdk-web-types";
4
+ import { Banner as s } from "./banner/index.js";
5
+ import { Notification as u } from "./notification/index.js";
6
+ import { Overlay as c } from "./overlay/index.js";
7
+ import { Sidebar as I } from "./sidebar/index.js";
8
+ import { OverlayContainer as y } from "./overlay/styles.js";
9
+ const A = (r) => (r == null ? void 0 : r.type) === t.INGAME_IAB11_LBAR || (r == null ? void 0 : r.type) === t.INGAME_IAB21_LBAR, h = (r) => (r == null ? void 0 : r.type) === t.INGAME_IAB11 || (r == null ? void 0 : r.type) === t.INGAME_IAB21, G = ({ advertisement: r, skipTypeCheck: d, layoutMode: m = "side-by-side", sidebar: n, isNotification: e, banner: l }) => {
10
+ const o = f(r.data);
11
+ return !o.data && o.loading ? null : o.error ? /* @__PURE__ */ a("div", { children: [
11
12
  "error ",
12
13
  /* @__PURE__ */ i("button", { onClick: r.close, children: "close" })
13
- ] }) : l.data ? !e && !a && (c || I(l.data)) ? /* @__PURE__ */ i(f, { className: "PromoOverlayContainer", children: /* @__PURE__ */ i(t, { promotionId: r.id, promotion: l.data, onClose: r.close }) }) : e && (c || y(l.data)) ? /* @__PURE__ */ i(s, { className: "PromoSidebarContainer", direction: e, hiding: r.hiding, children: /* @__PURE__ */ i(t, { promotionId: r.id, promotion: l.data, onClose: r.close }) }) : a ? /* @__PURE__ */ i(u, { promotionId: r.id, hiding: r.hiding, promotion: l.data, direction: a }) : null : /* @__PURE__ */ o("div", { children: [
14
+ ] }) : o.data ? e ? /* @__PURE__ */ i(u, { notification: o.data.notification, promotionId: r.id }) : !n && !l && (d || h(o.data.promotions)) ? /* @__PURE__ */ i(y, { className: "PromoOverlayContainer", children: /* @__PURE__ */ i(c, { promotionId: r.id, promotion: o.data.promotions, onClose: r.close }) }) : n && (d || A(o.data.promotions)) ? /* @__PURE__ */ i(I, { className: "PromoSidebarContainer", direction: n, hiding: r.hiding, children: /* @__PURE__ */ i(c, { promotionId: r.id, promotion: o.data.promotions, onClose: r.close }) }) : l ? /* @__PURE__ */ i(
15
+ s,
16
+ {
17
+ promotionId: r.id,
18
+ hiding: r.hiding,
19
+ promotion: o.data.promotions,
20
+ direction: l
21
+ }
22
+ ) : null : /* @__PURE__ */ a("div", { children: [
14
23
  "empty promo ",
15
24
  /* @__PURE__ */ i("button", { onClick: r.close, children: "close" })
16
25
  ] });
17
26
  };
18
27
  export {
19
- E as AdvertisementUI
28
+ G as AdvertisementUI
20
29
  };
@@ -0,0 +1,7 @@
1
+ import { QuestionNotification } from '@streamlayer/sdk-web-types';
2
+ export declare const Notification: React.FC<{
3
+ notification?: QuestionNotification;
4
+ promotionId: string;
5
+ direction?: 'left' | 'right';
6
+ hiding?: boolean;
7
+ }>;
@@ -0,0 +1,31 @@
1
+ import { jsx as i, jsxs as t } from "react/jsx-runtime";
2
+ import { NotificationPromotionImagePosition as e, NotificationEnabled as h, NotificationSponsorLogoMode as O } from "@streamlayer/sdk-web-types";
3
+ import { SlideIn as M } from "../../slide-in/index.js";
4
+ import { MediaImgFit as l, MediaImgCentered as T, MediaImgBottom as C, MediaImgSolid as f, MediaImgMiddle as E, NotificationContainer as L, Logo as S, NotificationContent as b, Body as x, Title as D, Text as P, Button as _, StyledChevronRight as y } from "./styles.js";
5
+ const F = {
6
+ [e.UNSET]: l,
7
+ [e.FIT]: l,
8
+ [e.CENTERED]: T,
9
+ [e.BOTTOM]: C,
10
+ [e.SOLID]: f,
11
+ [e.MIDDLE]: E
12
+ }, u = ({ notification: r, promotionId: R, hiding: m, direction: s = "left" }) => {
13
+ if (!r || !r.promotion || r.enabled !== h.NOTIFICATION_ENABLED)
14
+ return null;
15
+ const { title: n, body: d, image: c, promotion: I } = r, { sponsorLogo: a, sponsorLogoMode: g, imagePosition: N, ctaButton: o } = I, p = F[N];
16
+ return /* @__PURE__ */ i(M, { direction: s, hiding: m, children: /* @__PURE__ */ t(L, { children: [
17
+ g !== O.NOTIFICATION_SPONSOR_LOGO_NONE && /* @__PURE__ */ i(S, { children: /* @__PURE__ */ i("img", { src: a, alt: n }) }),
18
+ /* @__PURE__ */ t(b, { children: [
19
+ /* @__PURE__ */ i(p, { children: /* @__PURE__ */ i("img", { src: c, alt: "" }) }),
20
+ /* @__PURE__ */ t(x, { children: [
21
+ n && /* @__PURE__ */ i(D, { children: n }),
22
+ d && /* @__PURE__ */ i(P, { children: d })
23
+ ] }),
24
+ /* @__PURE__ */ i(_, { name: "promo-button", style: { color: o == null ? void 0 : o.textColor, backgroundColor: o == null ? void 0 : o.color }, children: (o == null ? void 0 : o.label) || "Open" }),
25
+ /* @__PURE__ */ i(y, { name: "chevronRight" })
26
+ ] })
27
+ ] }) });
28
+ };
29
+ export {
30
+ u as Notification
31
+ };
@@ -0,0 +1,35 @@
1
+ export declare const CardContainer: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
2
+ export declare const NotificationContent: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
3
+ export declare const NotificationContainer: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
4
+ export declare const Body: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
5
+ export declare const Title: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
6
+ export declare const Text: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
7
+ export declare const Media: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
8
+ export declare const MediaImgFit: {
9
+ __wyw_meta: unknown;
10
+ } & import('react').FunctionComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
11
+ as?: React.ElementType;
12
+ }>;
13
+ export declare const MediaImgCentered: {
14
+ __wyw_meta: unknown;
15
+ } & import('react').FunctionComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
16
+ as?: React.ElementType;
17
+ }>;
18
+ export declare const MediaImgBottom: {
19
+ __wyw_meta: unknown;
20
+ } & import('react').FunctionComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
21
+ as?: React.ElementType;
22
+ }>;
23
+ export declare const MediaImgSolid: {
24
+ __wyw_meta: unknown;
25
+ } & import('react').FunctionComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
26
+ as?: React.ElementType;
27
+ }>;
28
+ export declare const MediaImgMiddle: {
29
+ __wyw_meta: unknown;
30
+ } & import('react').FunctionComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
31
+ as?: React.ElementType;
32
+ }>;
33
+ export declare const Button: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLButtonElement> & import('react').ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown>>;
34
+ export declare const StyledChevronRight: any;
35
+ export declare const Logo: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
@@ -0,0 +1,80 @@
1
+ import { styled as s } from "@linaria/react";
2
+ import { SvgIcon as t } from "../../icons/index.js";
3
+ const d = /* @__PURE__ */ s("div")({
4
+ name: "CardContainer",
5
+ class: "cghcyv4",
6
+ propsAsIs: !1
7
+ }), I = /* @__PURE__ */ s("div")({
8
+ name: "NotificationContent",
9
+ class: "n1ku6hz",
10
+ propsAsIs: !1
11
+ }), g = /* @__PURE__ */ s("div")({
12
+ name: "NotificationContainer",
13
+ class: "nbxqmol",
14
+ propsAsIs: !1
15
+ }), v = /* @__PURE__ */ s("div")({
16
+ name: "Body",
17
+ class: "b1gu3eml",
18
+ propsAsIs: !1
19
+ }), f = /* @__PURE__ */ s("div")({
20
+ name: "Title",
21
+ class: "t1u17zva",
22
+ propsAsIs: !1
23
+ }), A = /* @__PURE__ */ s("div")({
24
+ name: "Text",
25
+ class: "t10ko1g",
26
+ propsAsIs: !1
27
+ }), e = /* @__PURE__ */ s("div")({
28
+ name: "Media",
29
+ class: "mntc42e",
30
+ propsAsIs: !1
31
+ }), n = () => e, M = /* @__PURE__ */ s(n())({
32
+ name: "MediaImgFit",
33
+ class: "ml060eo",
34
+ propsAsIs: !0
35
+ }), a = () => e, o = /* @__PURE__ */ s(a())({
36
+ name: "MediaImgCentered",
37
+ class: "m1vqlvig",
38
+ propsAsIs: !0
39
+ }), i = () => o, u = /* @__PURE__ */ s(i())({
40
+ name: "MediaImgBottom",
41
+ class: "m1e7tvi5",
42
+ propsAsIs: !0
43
+ }), c = () => e, C = /* @__PURE__ */ s(c())({
44
+ name: "MediaImgSolid",
45
+ class: "mqvntt2",
46
+ propsAsIs: !0
47
+ }), m = () => o, x = /* @__PURE__ */ s(m())({
48
+ name: "MediaImgMiddle",
49
+ class: "m12jtj3u",
50
+ propsAsIs: !0
51
+ }), h = /* @__PURE__ */ s("button")({
52
+ name: "Button",
53
+ class: "bkq1frv",
54
+ propsAsIs: !1
55
+ }), p = () => t, y = /* @__PURE__ */ s(p())({
56
+ name: "StyledChevronRight",
57
+ class: "sis90pl",
58
+ propsAsIs: !0
59
+ }), B = /* @__PURE__ */ s("div")({
60
+ name: "Logo",
61
+ class: "l9mjmz3",
62
+ propsAsIs: !1
63
+ });
64
+ export {
65
+ v as Body,
66
+ h as Button,
67
+ d as CardContainer,
68
+ B as Logo,
69
+ e as Media,
70
+ u as MediaImgBottom,
71
+ o as MediaImgCentered,
72
+ M as MediaImgFit,
73
+ x as MediaImgMiddle,
74
+ C as MediaImgSolid,
75
+ g as NotificationContainer,
76
+ I as NotificationContent,
77
+ y as StyledChevronRight,
78
+ A as Text,
79
+ f as Title
80
+ };
@@ -1,26 +1,26 @@
1
1
  import { jsxs as a, jsx as r } from "react/jsx-runtime";
2
- import { cx as R } from "@linaria/core";
2
+ import { cx as D } from "@linaria/core";
3
3
  import { eventBus as U } from "@streamlayer/sdk-web-interfaces";
4
- import { PromotionType as D, PromotionLogoMode as n } from "@streamlayer/sdk-web-types";
4
+ import { PromotionType as R, PromotionLogoMode as l } from "@streamlayer/sdk-web-types";
5
5
  import { VideoPlayer as j } from "../../video-player/index.js";
6
- import { PromoOverlay as G, Header as H, HeaderContent as W, headerContentShift as V, SponsorLogo as F, Sponsor as q, SponsorName as w, SponsorText as z, ADLogo as J, SponsoredText as K, CloseIconWrap as Q, CloseIcon as X, Media as Y, shiftMedia as Z, Content as _, PromoImg as $, Title as ee, hideOnMobile as re, Description as ae, ActionBtnWrap as ne, ActionButton as le } from "./styles.js";
6
+ import { PromoOverlay as G, Header as H, HeaderContent as W, headerContentShift as V, SponsorLogo as F, Sponsor as q, SponsorName as w, SponsorText as z, ADLogo as J, SponsoredText as K, CloseIconWrap as Q, CloseIcon as X, Media as Y, shiftMedia as Z, Content as _, PromoImg as $, Title as ee, hideOnMobile as re, Description as ae, ActionBtnWrap as le, ActionButton as ne } from "./styles.js";
7
7
  import { OverlayContainer as ge } from "./styles.js";
8
- const he = ({ promotion: e, promotionId: t, onClose: k }) => {
9
- var s, c, d, i, h, b, y, g, f, p, u, v, m, C, x, M, A, B, N, P, T, E, I, L, S, O;
10
- const l = e.type === D.INGAME_IAB11_LBAR || e.type === D.INGAME_IAB11, o = ((s = e.sponsor) == null ? void 0 : s.logo) && e.logoMode === n.CENTER;
8
+ const he = ({ promotion: e, promotionId: s, onClose: k }) => {
9
+ var t, c, d, i, h, b, y, g, p, m, f, u, v, C, N, x, A, T, M, P, B, I, S, E, L, O;
10
+ const n = e.type === R.INGAME_IAB11_LBAR || e.type === R.INGAME_IAB11, o = ((t = e.sponsor) == null ? void 0 : t.logo) && e.logoMode === l.CENTER;
11
11
  return /* @__PURE__ */ a(G, { className: "PromoOverlay", children: [
12
12
  /* @__PURE__ */ a(H, { children: [
13
- /* @__PURE__ */ a(W, { className: R(!o && V), children: [
14
- ((c = e.sponsor) == null ? void 0 : c.logo) && e.logoMode === n.LEFT && /* @__PURE__ */ r(F, { src: (d = e.sponsor) == null ? void 0 : d.logo, alt: "promo" }),
13
+ /* @__PURE__ */ a(W, { className: D(!o && V), children: [
14
+ ((c = e.sponsor) == null ? void 0 : c.logo) && e.logoMode === l.LEFT && /* @__PURE__ */ r(F, { src: (d = e.sponsor) == null ? void 0 : d.logo, alt: "promo" }),
15
15
  /* @__PURE__ */ a(
16
16
  q,
17
17
  {
18
18
  style: {
19
- paddingLeft: (i = e.sponsor) != null && i.logo && e.logoMode === n.LEFT ? "0px" : "8px"
19
+ paddingLeft: (i = e.sponsor) != null && i.logo && e.logoMode === l.LEFT ? "0px" : "8px"
20
20
  },
21
21
  children: [
22
- ((h = e.sponsor) == null ? void 0 : h.logo) && e.logoMode === n.LEFT && /* @__PURE__ */ r(w, { children: (b = e.sponsor) == null ? void 0 : b.name }),
23
- /* @__PURE__ */ a(z, { children: [
22
+ ((h = e.sponsor) == null ? void 0 : h.logo) && e.logoMode === l.LEFT && /* @__PURE__ */ r(w, { children: (b = e.sponsor) == null ? void 0 : b.name }),
23
+ /* @__PURE__ */ a(z, { className: "SponsorText", children: [
24
24
  /* @__PURE__ */ r(J, { children: "AD" }),
25
25
  /* @__PURE__ */ r(K, { children: "SPONSORED" })
26
26
  ] })
@@ -28,45 +28,45 @@ const he = ({ promotion: e, promotionId: t, onClose: k }) => {
28
28
  }
29
29
  )
30
30
  ] }),
31
- /* @__PURE__ */ r(Q, { onClick: k, children: /* @__PURE__ */ r(X, { name: "icon-cross" }) })
31
+ /* @__PURE__ */ r(Q, { className: "ClosePromoIcon", onClick: k, children: /* @__PURE__ */ r(X, { name: "icon-cross" }) })
32
32
  ] }),
33
33
  /* @__PURE__ */ a(Y, { children: [
34
34
  o && /* @__PURE__ */ r(F, { className: Z, src: (y = e.sponsor) == null ? void 0 : y.logo, alt: "promo" }),
35
- /* @__PURE__ */ r(_, { children: (f = (g = e.banner) == null ? void 0 : g.video) != null && f.url ? /* @__PURE__ */ r(
35
+ /* @__PURE__ */ r(_, { children: (p = (g = e.banner) == null ? void 0 : g.video) != null && p.url ? /* @__PURE__ */ r(
36
36
  j,
37
37
  {
38
- source: (u = (p = e.banner) == null ? void 0 : p.video) == null ? void 0 : u.url,
39
- poster: (m = (v = e.banner) == null ? void 0 : v.video) == null ? void 0 : m.thumbnailUrl,
40
- aspectRatio: l ? "1/1" : "16/9",
38
+ source: (f = (m = e.banner) == null ? void 0 : m.video) == null ? void 0 : f.url,
39
+ poster: (v = (u = e.banner) == null ? void 0 : u.video) == null ? void 0 : v.thumbnailUrl,
40
+ aspectRatio: n ? "1/1" : "16/9",
41
41
  onPlay: () => {
42
42
  U.emit("advertisement", {
43
43
  action: "videoPlay",
44
44
  payload: {
45
- advertisementId: t,
45
+ advertisementId: s,
46
46
  advertisementType: e.type
47
47
  }
48
48
  });
49
49
  }
50
50
  }
51
- ) : (C = e.banner) != null && C.imageUrl ? /* @__PURE__ */ r($, { style: l ? { aspectRatio: "1/1" } : {}, src: (x = e.banner) == null ? void 0 : x.imageUrl, alt: "promo" }) : null }),
52
- !l && /* @__PURE__ */ a(_, { children: [
53
- ((M = e.banner) == null ? void 0 : M.title) && /* @__PURE__ */ r(ee, { className: R(o && re), children: (A = e.banner) == null ? void 0 : A.title }),
54
- ((B = e.banner) == null ? void 0 : B.body) && /* @__PURE__ */ r(ae, { children: (N = e.banner) == null ? void 0 : N.body })
51
+ ) : (C = e.banner) != null && C.imageUrl ? /* @__PURE__ */ r($, { style: n ? { aspectRatio: "1/1" } : {}, src: (N = e.banner) == null ? void 0 : N.imageUrl, alt: "promo" }) : null }),
52
+ !n && /* @__PURE__ */ a(_, { children: [
53
+ ((x = e.banner) == null ? void 0 : x.title) && /* @__PURE__ */ r(ee, { className: D("AdvTitle", o && re), children: (A = e.banner) == null ? void 0 : A.title }),
54
+ ((T = e.banner) == null ? void 0 : T.body) && /* @__PURE__ */ r(ae, { className: "AdvDescription", children: (M = e.banner) == null ? void 0 : M.body })
55
55
  ] })
56
56
  ] }),
57
- /* @__PURE__ */ r(ne, { children: /* @__PURE__ */ r(
58
- le,
57
+ /* @__PURE__ */ r(le, { children: /* @__PURE__ */ r(
58
+ ne,
59
59
  {
60
60
  href: (P = e.banner) == null ? void 0 : P.url,
61
61
  style: {
62
- backgroundColor: ((E = (T = e.banner) == null ? void 0 : T.ctaButton) == null ? void 0 : E.color) || "#009dc4",
63
- color: ((L = (I = e.banner) == null ? void 0 : I.ctaButton) == null ? void 0 : L.textColor) || "#fff"
62
+ backgroundColor: ((I = (B = e.banner) == null ? void 0 : B.ctaButton) == null ? void 0 : I.color) || "#009dc4",
63
+ color: ((E = (S = e.banner) == null ? void 0 : S.ctaButton) == null ? void 0 : E.textColor) || "#fff"
64
64
  },
65
65
  "data-analytics": "button",
66
- "data-promo-id": t,
66
+ "data-promo-id": s,
67
67
  "data-promo-type": e.type,
68
68
  target: "_blank",
69
- children: (O = (S = e.banner) == null ? void 0 : S.ctaButton) == null ? void 0 : O.label
69
+ children: (O = (L = e.banner) == null ? void 0 : L.ctaButton) == null ? void 0 : O.label
70
70
  }
71
71
  ) })
72
72
  ] });
@@ -48,6 +48,8 @@ export declare const icons: {
48
48
  twitter: any;
49
49
  iconUp: any;
50
50
  iconCopySuccess: any;
51
+ chevronRight: any;
52
+ noImageIcon: any;
51
53
  };
52
54
  export declare const Icon: React.FC<{
53
55
  name: keyof typeof icons;