@streamlayer/react-ui 1.24.0 → 1.25.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 (31) hide show
  1. package/lib/app/app/story/promotion-notification/index.d.ts +7 -0
  2. package/lib/app/app/story/promotion-notification/index.js +44 -0
  3. package/lib/app/app/story/promotion-notification/styles.d.ts +4 -0
  4. package/lib/app/app/story/promotion-notification/styles.js +25 -0
  5. package/lib/app/app/story/promotion-notification/video.d.ts +5 -0
  6. package/lib/app/app/story/promotion-notification/video.js +52 -0
  7. package/lib/app/tvos/Advertisement.d.ts +10 -0
  8. package/lib/app/tvos/Advertisement.js +88 -0
  9. package/lib/app/tvos/AdvertisementUI.d.ts +16 -0
  10. package/lib/app/tvos/AdvertisementUI.js +40 -0
  11. package/lib/app/tvos/index.d.ts +16 -0
  12. package/lib/app/tvos/index.js +23 -0
  13. package/lib/app/tvos/story.d.ts +6 -0
  14. package/lib/app/tvos/story.js +34 -0
  15. package/lib/app/tvos/styles.d.ts +1 -0
  16. package/lib/app/tvos/styles.js +4 -0
  17. package/lib/app/tvos/ui/Layout/index.d.ts +21 -0
  18. package/lib/app/tvos/ui/Layout/index.js +76 -0
  19. package/lib/app/tvos/ui/Layout/styles.d.ts +11 -0
  20. package/lib/app/tvos/ui/Layout/styles.js +59 -0
  21. package/lib/app/tvos/ui/Sidebar/PromoAction.d.ts +2 -0
  22. package/lib/app/tvos/ui/Sidebar/PromoAction.js +62 -0
  23. package/lib/app/tvos/ui/Sidebar/index.d.ts +15 -0
  24. package/lib/app/tvos/ui/Sidebar/index.js +114 -0
  25. package/lib/app/tvos/ui/Sidebar/styles.d.ts +42 -0
  26. package/lib/app/tvos/ui/Sidebar/styles.js +1005 -0
  27. package/lib/assets/style.css +1 -1
  28. package/lib/ui/advertisement/index.js +44 -44
  29. package/lib/ui/advertisement/overlay/index.js +72 -70
  30. package/lib/ui/theme/theme.js +5 -3
  31. package/package.json +22 -16
@@ -0,0 +1,114 @@
1
+ import { jsxs as l, jsx as r, Fragment as $ } from "react/jsx-runtime";
2
+ import { useRef as d, useState as G, useEffect as a } from "react";
3
+ import { AutoPlayVideo as J } from "@streamlayer/sdk-web-types";
4
+ import { PromoAction as Q } from "./PromoAction.js";
5
+ import { Container as X, Header as Y, BrandBlock as Z, LogoIcon as _, BrandText as ee, BrandNameContainer as re, BrandName as te, Sponsored as ne, CloseButton as oe, CloseIcon as ie, VideoBlock as ce, VideoWrapper as se, FocusableVideo as le, Paused as de, Title as ae, Description as ue } from "./styles.js";
6
+ const we = (M) => {
7
+ var E, B, R, I, P, S, C, L, N, T, U, O;
8
+ const { promotion: e, open: u, togglePause: p, controlVideo: f, promotionId: A, onClose: H, markAsViewed: b } = M, i = d(null), g = d(null), v = d(null), k = d(null), [V, q] = G(0), n = d(0), z = e.type === 4 ? V : V / 2, x = !!((B = (E = e.banner) == null ? void 0 : E.video) != null && B.url), D = e.autoPlayVideo === J.ENABLED;
9
+ let h = (R = e.banner) == null ? void 0 : R.url;
10
+ return h && !h.startsWith("http") && (h = `https://${h}`), a(() => {
11
+ if (!k.current) return;
12
+ const c = new ResizeObserver(([o]) => {
13
+ const m = o.contentRect.width;
14
+ q(m);
15
+ });
16
+ return c.observe(k.current), () => {
17
+ c.disconnect();
18
+ };
19
+ }, []), a(() => {
20
+ var F;
21
+ p == null || p(x || D), u == null || u();
22
+ const c = () => {
23
+ const t = [];
24
+ return v.current && t.push(v.current), e.type === 5 && i.current && t.push(i.current), g.current && t.push(g.current), t;
25
+ };
26
+ let o = c();
27
+ n.current = 0, (F = o[n.current]) == null || F.focus();
28
+ const m = (t) => {
29
+ var W, j;
30
+ o = c();
31
+ const y = o.length;
32
+ if (y !== 0) {
33
+ if (["ArrowDown", "ArrowRight"].includes(t.key)) {
34
+ n.current = (n.current + 1) % y, (W = o[n.current]) == null || W.focus(), t.preventDefault();
35
+ return;
36
+ }
37
+ if (["ArrowUp", "ArrowLeft"].includes(t.key)) {
38
+ n.current = (n.current - 1 + y) % y, (j = o[n.current]) == null || j.focus(), t.preventDefault();
39
+ return;
40
+ }
41
+ if (t.key === "Enter" || t.key === " ") {
42
+ const s = o[n.current];
43
+ if (!s) return;
44
+ switch (s.tagName) {
45
+ case "A":
46
+ s.click();
47
+ break;
48
+ case "BUTTON":
49
+ s.click();
50
+ break;
51
+ case "VIDEO":
52
+ setTimeout(() => {
53
+ const w = s;
54
+ w.paused || w.ended ? w.play().then(() => {
55
+ }).catch((K) => console.warn("⛔ start failed:", K)) : w.pause();
56
+ }, 0);
57
+ break;
58
+ }
59
+ t.preventDefault();
60
+ }
61
+ }
62
+ };
63
+ return window.addEventListener("keydown", m), () => window.removeEventListener("keydown", m);
64
+ }, [e.type, x, D, u, p]), a(() => {
65
+ A && e.type && b && b();
66
+ }, [A, e.type, b]), a(() => () => {
67
+ f == null || f({ muted: !1 });
68
+ }, [f]), a(() => {
69
+ e.type === 5 && i.current && i.current.focus();
70
+ }, [e.type]), /* @__PURE__ */ l(X, { ref: k, tabIndex: 0, children: [
71
+ /* @__PURE__ */ l(Y, { children: [
72
+ e.logoMode === 1 && /* @__PURE__ */ l(Z, { children: [
73
+ /* @__PURE__ */ r(_, { src: (I = e.sponsor) == null ? void 0 : I.logo, alt: "Logo" }),
74
+ /* @__PURE__ */ l(ee, { children: [
75
+ /* @__PURE__ */ r(re, { children: /* @__PURE__ */ r(te, { children: (P = e.sponsor) == null ? void 0 : P.name }) }),
76
+ /* @__PURE__ */ r(ne, { children: "SPONSORED" })
77
+ ] })
78
+ ] }),
79
+ e.logoMode === 2 && e.type === 4 && /* @__PURE__ */ r("img", { src: (S = e.sponsor) == null ? void 0 : S.logo, alt: "Video paused preview", style: { height: "56px" } }),
80
+ /* @__PURE__ */ r(oe, { ref: g, onClick: H, children: /* @__PURE__ */ r(ie, {}) })
81
+ ] }),
82
+ e.logoMode === 2 && e.type !== 4 && /* @__PURE__ */ r(
83
+ "img",
84
+ {
85
+ src: (C = e.sponsor) == null ? void 0 : C.logo,
86
+ alt: "Video paused preview",
87
+ style: {
88
+ display: "block",
89
+ alignSelf: "center",
90
+ maxHeight: "72px",
91
+ width: "auto"
92
+ }
93
+ }
94
+ ),
95
+ ((L = e.banner) == null ? void 0 : L.imageUrl) && /* @__PURE__ */ r(ce, { style: { height: z }, children: /* @__PURE__ */ r(
96
+ "img",
97
+ {
98
+ src: (N = e.banner) == null ? void 0 : N.imageUrl,
99
+ alt: "Video paused preview",
100
+ style: { width: "100%", height: "100%", objectFit: "cover" }
101
+ }
102
+ ) }),
103
+ ((T = e.banner) == null ? void 0 : T.video) && /* @__PURE__ */ r(se, { children: /* @__PURE__ */ r(le, { ref: v, tabIndex: 0, muted: !1, autoPlay: !1, loop: !0, playsInline: !0, controls: !0, children: /* @__PURE__ */ r("source", { src: e.banner.video.url, type: "video/mp4" }) }) }),
104
+ /* @__PURE__ */ r(de, { children: "PAUSED" }),
105
+ e.type === 5 && /* @__PURE__ */ l($, { children: [
106
+ /* @__PURE__ */ r(ae, { children: (U = e.banner) == null ? void 0 : U.title }),
107
+ /* @__PURE__ */ r(ue, { children: (O = e.banner) == null ? void 0 : O.body })
108
+ ] }),
109
+ /* @__PURE__ */ r(Q, { promotion: e, ref: i })
110
+ ] });
111
+ };
112
+ export {
113
+ we as TVSidebar
114
+ };
@@ -0,0 +1,42 @@
1
+ import { default as React } from 'react';
2
+ export declare const Container: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
3
+ export declare const Header: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
4
+ export declare const BrandBlock: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
5
+ export declare const LogoIcon: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLImageElement> & React.ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown>>;
6
+ export declare const BrandText: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
7
+ export declare const BrandNameContainer: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
8
+ export declare const BrandName: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLSpanElement> & React.HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
9
+ export declare const Sponsored: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLSpanElement> & React.HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
10
+ export declare const CloseIcon: (props: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const CloseButton: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown>>;
12
+ export declare const FocusableVideo: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLVideoElement> & React.VideoHTMLAttributes<HTMLVideoElement> & Record<never, unknown>>;
13
+ export declare const VideoWrapper: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
14
+ export declare const PlayPauseButton: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement> & {
15
+ isPlaying: boolean;
16
+ }>;
17
+ export declare const CenterIndicator: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
18
+ visible: boolean;
19
+ }>;
20
+ export declare const VideoBlock: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
21
+ interface SendToUserButtonProps {
22
+ focusColor?: string;
23
+ }
24
+ export declare const SendToUserButton: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & SendToUserButtonProps>;
25
+ export declare const EnvelopeIcon: () => import("react/jsx-runtime").JSX.Element;
26
+ export declare const SendToUserText: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
27
+ export declare const Paused: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
28
+ export declare const Title: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLHeadingElement> & React.HTMLAttributes<HTMLHeadingElement> & Record<never, unknown>>;
29
+ export declare const Description: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLParagraphElement> & React.HTMLAttributes<HTMLParagraphElement> & Record<never, unknown>>;
30
+ export declare const QRBlock: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
31
+ export declare const QRDescBlock: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
32
+ export declare const LearnMore: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
33
+ export declare const QRHint: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
34
+ interface QRProps {
35
+ value: string;
36
+ size?: number;
37
+ fgColor?: string;
38
+ bgColor?: string;
39
+ level?: 'L' | 'M' | 'Q' | 'H';
40
+ }
41
+ export declare const QR: React.ForwardRefExoticComponent<QRProps & React.RefAttributes<HTMLAnchorElement>>;
42
+ export {};