@streamlayer/react-ui 1.32.0 → 1.32.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,40 +1,40 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { cx as
|
|
3
|
-
import { useFocusable as
|
|
4
|
-
import { useState as
|
|
1
|
+
import { jsx as a, jsxs as x } from "react/jsx-runtime";
|
|
2
|
+
import { cx as F } from "@linaria/core";
|
|
3
|
+
import { useFocusable as G } from "@noriginmedia/norigin-spatial-navigation";
|
|
4
|
+
import { useState as w, useRef as L, useCallback as B, useEffect as P } from "react";
|
|
5
5
|
import { useStore as I } from "@streamlayer/react-polyfills";
|
|
6
|
-
import { eventBus as
|
|
6
|
+
import { eventBus as S } from "@streamlayer/sdk-web-interfaces";
|
|
7
7
|
import { useLoadGAMStatic as C } from "../../../ui/advertisement/overlay/externalAd/vast-player/useGAMStatic.js";
|
|
8
|
-
import { PauseAdOverlay as
|
|
9
|
-
const
|
|
8
|
+
import { PauseAdOverlay as N, PauseAdContent as j, PauseAdTopLeft as K, PauseAdTitle as O, PauseAdCaption as V, PauseAdBottomLeft as $, PauseAdPlayButton as _, PauseAdSidebarGradient as q, PauseAdSidebar as z, PauseAdTitleDescription as H, ExternalAdContainer as D } from "./styles.js";
|
|
9
|
+
const J = ({ vastUrl: r, isDesktop: n }) => {
|
|
10
10
|
var u;
|
|
11
|
-
const [, y] = C(), e = I(y, { keys: [
|
|
11
|
+
const [, y] = C(), e = I(y, { keys: [r] });
|
|
12
12
|
return P(() => {
|
|
13
|
-
e && e[
|
|
13
|
+
e && e[r] && e[r].imageSrc && e[r].id && S.emit("exposedPauseAd", {
|
|
14
14
|
action: "rendered",
|
|
15
15
|
payload: {
|
|
16
|
-
id: e[
|
|
16
|
+
id: e[r].id
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
}, [e,
|
|
19
|
+
}, [e, r]), (u = e == null ? void 0 : e[r]) != null && u.imageSrc ? !e[r].adUrl || !n ? /* @__PURE__ */ a(D, { src: e[r].imageSrc }) : /* @__PURE__ */ a(
|
|
20
20
|
"a",
|
|
21
21
|
{
|
|
22
22
|
onClick: () => {
|
|
23
|
-
|
|
23
|
+
S.emit("exposedPauseAd", {
|
|
24
24
|
action: "navigated",
|
|
25
25
|
payload: {
|
|
26
|
-
id: e[
|
|
26
|
+
id: e[r].id
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
},
|
|
30
|
-
href: e[
|
|
30
|
+
href: e[r].adUrl,
|
|
31
31
|
target: "_blank",
|
|
32
32
|
rel: "noopener noreferrer",
|
|
33
|
-
children: /* @__PURE__ */
|
|
33
|
+
children: /* @__PURE__ */ a(D, { src: e[r].imageSrc })
|
|
34
34
|
}
|
|
35
35
|
) : null;
|
|
36
|
-
},
|
|
37
|
-
const T = (
|
|
36
|
+
}, Q = ({ isClosing: r, title: n, caption: y, onPlay: e, onClose: u, vastUrl: f, options: t, isDesktop: m }) => {
|
|
37
|
+
const T = (t == null ? void 0 : t.showPauseButton) ?? !0, { ref: d, focusSelf: p } = G({
|
|
38
38
|
focusKey: "sl-pause-ad-play",
|
|
39
39
|
onEnterRelease: e,
|
|
40
40
|
isFocusBoundary: !0,
|
|
@@ -54,15 +54,13 @@ const W = ({ vastUrl: t, isDesktop: n }) => {
|
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
return window.addEventListener("keydown", h, { capture: !0 }), () => window.removeEventListener("keydown", h, { capture: !0 });
|
|
57
|
-
}, [u]), /* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/* @__PURE__ */ r($, { children: n }),
|
|
62
|
-
/* @__PURE__ */ r(q, { children: y })
|
|
57
|
+
}, [u]), /* @__PURE__ */ a(N, { className: F("SL_PauseAdOverlay", r && "pause-ad-closing"), children: /* @__PURE__ */ x(j, { children: [
|
|
58
|
+
/* @__PURE__ */ x(K, { children: [
|
|
59
|
+
/* @__PURE__ */ a(O, { children: n }),
|
|
60
|
+
/* @__PURE__ */ a(V, { children: y })
|
|
63
61
|
] }),
|
|
64
|
-
T && /* @__PURE__ */
|
|
65
|
-
|
|
62
|
+
T && /* @__PURE__ */ a($, { children: /* @__PURE__ */ a(
|
|
63
|
+
_,
|
|
66
64
|
{
|
|
67
65
|
ref: d,
|
|
68
66
|
onClick: e,
|
|
@@ -70,43 +68,43 @@ const W = ({ vastUrl: t, isDesktop: n }) => {
|
|
|
70
68
|
"aria-label": "Resume playback"
|
|
71
69
|
}
|
|
72
70
|
) }),
|
|
73
|
-
/* @__PURE__ */ x(
|
|
74
|
-
f && /* @__PURE__ */
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
] })
|
|
71
|
+
/* @__PURE__ */ a(q, { className: "SL_PauseAdSidebar", children: /* @__PURE__ */ x(z, { children: [
|
|
72
|
+
f && /* @__PURE__ */ a(J, { isDesktop: m, vastUrl: f }),
|
|
73
|
+
/* @__PURE__ */ a(H, { children: "ADVERTISEMENT" })
|
|
74
|
+
] }) })
|
|
77
75
|
] }) });
|
|
78
|
-
}, re = ({ showPauseAd:
|
|
79
|
-
const d = (m == null ? void 0 : m.pauseAdDelay) ?? 5e3, [p, h] =
|
|
80
|
-
|
|
81
|
-
const [
|
|
82
|
-
f && (
|
|
76
|
+
}, re = ({ showPauseAd: r, vastUrls: n, title: y, caption: e, sdk: u, onClose: f, onRender: t, options: m, isDesktop: T }) => {
|
|
77
|
+
const d = (m == null ? void 0 : m.pauseAdDelay) ?? 5e3, [p, h] = w(!1), [A, s] = w(!1), c = L(), i = n == null ? void 0 : n[0].url, g = L(i);
|
|
78
|
+
g.current = i;
|
|
79
|
+
const [b, E] = C(), o = B(() => {
|
|
80
|
+
f && (S.emit("exposedPauseAd", {
|
|
83
81
|
action: "closed",
|
|
84
82
|
payload: {}
|
|
85
83
|
}), f());
|
|
86
|
-
}, [f]),
|
|
84
|
+
}, [f]), M = B(() => {
|
|
87
85
|
u.controlVideoPlayer({ play: !0 });
|
|
88
86
|
}, [u]);
|
|
89
87
|
return P(() => {
|
|
90
|
-
if (
|
|
91
|
-
|
|
88
|
+
if (r && i) {
|
|
89
|
+
S.emit("exposedPauseAd", {
|
|
92
90
|
action: "enabled",
|
|
93
91
|
payload: {}
|
|
94
|
-
}),
|
|
95
|
-
|
|
92
|
+
}), b(i).then((l) => {
|
|
93
|
+
g.current === i && (l == null ? void 0 : l.success) !== !0 && (clearTimeout(c.current), o == null || o());
|
|
96
94
|
}).catch(() => {
|
|
97
|
-
|
|
95
|
+
g.current === i && (clearTimeout(c.current), o == null || o());
|
|
98
96
|
});
|
|
99
|
-
const
|
|
100
|
-
const l =
|
|
97
|
+
const k = () => {
|
|
98
|
+
const l = E.get()[g.current];
|
|
101
99
|
l != null && l.imageSrc ? (clearTimeout(c.current), s(!1), h(!0)) : c.current = setTimeout(() => {
|
|
102
|
-
|
|
100
|
+
k();
|
|
103
101
|
}, 200);
|
|
104
102
|
};
|
|
105
103
|
c.current = setTimeout(() => {
|
|
106
|
-
|
|
104
|
+
k();
|
|
107
105
|
}, d);
|
|
108
106
|
} else
|
|
109
|
-
|
|
107
|
+
S.emit("exposedPauseAd", {
|
|
110
108
|
action: "disabled",
|
|
111
109
|
payload: {}
|
|
112
110
|
}), s(!0), c.current = setTimeout(() => {
|
|
@@ -115,18 +113,18 @@ const W = ({ vastUrl: t, isDesktop: n }) => {
|
|
|
115
113
|
return () => {
|
|
116
114
|
c.current && clearTimeout(c.current);
|
|
117
115
|
};
|
|
118
|
-
}, [
|
|
119
|
-
|
|
120
|
-
}, [p,
|
|
121
|
-
|
|
122
|
-
}, [
|
|
123
|
-
|
|
116
|
+
}, [E, b, o, d, r, i]), P(() => {
|
|
117
|
+
t == null || t({ rendered: p });
|
|
118
|
+
}, [p, t]), P(() => () => {
|
|
119
|
+
t == null || t({ rendered: !1 });
|
|
120
|
+
}, [t]), p ? /* @__PURE__ */ a(
|
|
121
|
+
Q,
|
|
124
122
|
{
|
|
125
123
|
onClose: o,
|
|
126
124
|
isClosing: A,
|
|
127
125
|
title: y,
|
|
128
126
|
caption: e,
|
|
129
|
-
onPlay:
|
|
127
|
+
onPlay: M,
|
|
130
128
|
vastUrl: i,
|
|
131
129
|
options: m,
|
|
132
130
|
isDesktop: T
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export declare const PauseAdOverlay: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
2
2
|
export declare const PauseAdContent: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
3
|
-
export declare const PauseAdGradientRight: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
4
|
-
export declare const PauseAdGradientBottom: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
5
3
|
export declare const PauseAdTopLeft: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
6
4
|
export declare const PauseAdTitle: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLHeadingElement> & import('react').HTMLAttributes<HTMLHeadingElement> & Record<never, unknown>>;
|
|
7
5
|
export declare const PauseAdCaption: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLParagraphElement> & import('react').HTMLAttributes<HTMLParagraphElement> & Record<never, unknown>>;
|
|
8
6
|
export declare const PauseAdBottomLeft: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
9
7
|
export declare const PauseAdPlayButton: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLButtonElement> & import('react').ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown>>;
|
|
8
|
+
export declare const PauseAdSidebarGradient: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
10
9
|
export declare const PauseAdSidebar: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
11
10
|
export declare const PauseAdTitleDescription: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLSpanElement> & import('react').HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
|
|
12
11
|
export declare const ExternalAdContainer: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLImageElement> & import('react').ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown>>;
|
|
@@ -7,58 +7,53 @@ const e = /* @__PURE__ */ s("div")({
|
|
|
7
7
|
name: "PauseAdContent",
|
|
8
8
|
class: "p8lpomy",
|
|
9
9
|
propsAsIs: !1
|
|
10
|
-
}),
|
|
11
|
-
name: "
|
|
10
|
+
}), p = /* @__PURE__ */ s("div")({
|
|
11
|
+
name: "PauseAdTopLeft",
|
|
12
12
|
class: "pv7u167",
|
|
13
13
|
propsAsIs: !1
|
|
14
|
-
}),
|
|
15
|
-
name: "
|
|
14
|
+
}), o = /* @__PURE__ */ s("h2")({
|
|
15
|
+
name: "PauseAdTitle",
|
|
16
16
|
class: "p1kh2yb0",
|
|
17
17
|
propsAsIs: !1
|
|
18
|
-
}), n = /* @__PURE__ */ s("
|
|
19
|
-
name: "
|
|
18
|
+
}), n = /* @__PURE__ */ s("p")({
|
|
19
|
+
name: "PauseAdCaption",
|
|
20
20
|
class: "pl8f94x",
|
|
21
21
|
propsAsIs: !1
|
|
22
|
-
}), d = /* @__PURE__ */ s("
|
|
23
|
-
name: "
|
|
22
|
+
}), d = /* @__PURE__ */ s("div")({
|
|
23
|
+
name: "PauseAdBottomLeft",
|
|
24
24
|
class: "p1m6zmrt",
|
|
25
25
|
propsAsIs: !1
|
|
26
|
-
}), l = /* @__PURE__ */ s("
|
|
27
|
-
name: "
|
|
26
|
+
}), l = /* @__PURE__ */ s("button")({
|
|
27
|
+
name: "PauseAdPlayButton",
|
|
28
28
|
class: "pm3vwfa",
|
|
29
29
|
propsAsIs: !1
|
|
30
30
|
}), A = /* @__PURE__ */ s("div")({
|
|
31
|
-
name: "
|
|
31
|
+
name: "PauseAdSidebarGradient",
|
|
32
32
|
class: "p1tibuhw",
|
|
33
33
|
propsAsIs: !1
|
|
34
|
-
}), r = /* @__PURE__ */ s("
|
|
35
|
-
name: "PauseAdPlayButton",
|
|
36
|
-
class: "ptqqrqd",
|
|
37
|
-
propsAsIs: !1
|
|
38
|
-
}), i = /* @__PURE__ */ s("div")({
|
|
34
|
+
}), r = /* @__PURE__ */ s("div")({
|
|
39
35
|
name: "PauseAdSidebar",
|
|
40
|
-
class: "
|
|
36
|
+
class: "ptqqrqd",
|
|
41
37
|
propsAsIs: !1
|
|
42
|
-
}),
|
|
38
|
+
}), i = /* @__PURE__ */ s("span")({
|
|
43
39
|
name: "PauseAdTitleDescription",
|
|
44
|
-
class: "
|
|
40
|
+
class: "p14estxv",
|
|
45
41
|
propsAsIs: !1
|
|
46
|
-
}),
|
|
42
|
+
}), u = /* @__PURE__ */ s("img")({
|
|
47
43
|
name: "ExternalAdContainer",
|
|
48
|
-
class: "
|
|
44
|
+
class: "e1dpvfl1",
|
|
49
45
|
propsAsIs: !1
|
|
50
46
|
});
|
|
51
47
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
u as ExternalAdContainer,
|
|
49
|
+
d as PauseAdBottomLeft,
|
|
50
|
+
n as PauseAdCaption,
|
|
55
51
|
t as PauseAdContent,
|
|
56
|
-
p as PauseAdGradientBottom,
|
|
57
|
-
o as PauseAdGradientRight,
|
|
58
52
|
e as PauseAdOverlay,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
l as PauseAdPlayButton,
|
|
54
|
+
r as PauseAdSidebar,
|
|
55
|
+
A as PauseAdSidebarGradient,
|
|
56
|
+
o as PauseAdTitle,
|
|
57
|
+
i as PauseAdTitleDescription,
|
|
58
|
+
p as PauseAdTopLeft
|
|
64
59
|
};
|