@streamlayer/react-ui 1.27.3 → 1.28.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.
- package/lib/app/webos/ExposedPauseAd/PauseAd.js +47 -45
- package/lib/app/webos/index.js +38 -37
- package/lib/ui/advertisement/overlay/externalAd/vast-player/useGAMPlayer.js +2642 -2596
- package/lib/ui/advertisement/overlay/externalAd/vast-player/useVastAds.d.ts +2 -0
- package/lib/ui/advertisement/overlay/externalAd/vast-player/useVastAds.js +1 -1
- package/lib/{useVastAds-Bu_IhLJ2.js → useVastAds-CakWRNKN.js} +83 -71
- package/package.json +15 -15
|
@@ -1,93 +1,95 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t, jsxs as p } from "react/jsx-runtime";
|
|
2
2
|
import { cx as E } from "@linaria/core";
|
|
3
3
|
import { useFocusable as x } from "@noriginmedia/norigin-spatial-navigation";
|
|
4
|
-
import { useState as A, useRef as y, useEffect as
|
|
4
|
+
import { useState as A, useRef as y, useEffect as d } from "react";
|
|
5
5
|
import { eventBus as P } from "@streamlayer/sdk-web-interfaces";
|
|
6
6
|
import { useGAMPlayer as T } from "../../../ui/advertisement/overlay/externalAd/vast-player/useGAMPlayer.js";
|
|
7
|
-
import { PauseAdOverlay as b, PauseAdContent as g, PauseAdGradientLeft as w, PauseAdGradientRight as k, PauseAdGradientBottom as B, PauseAdTopLeft as L, PauseAdTitle as S, PauseAdCaption as C, PauseAdBottomLeft as G, PauseAdPlayButton as
|
|
8
|
-
const
|
|
9
|
-
const r = y(null), [, , u] = T(r,
|
|
10
|
-
return
|
|
7
|
+
import { PauseAdOverlay as b, PauseAdContent as g, PauseAdGradientLeft as w, PauseAdGradientRight as k, PauseAdGradientBottom as B, PauseAdTopLeft as L, PauseAdTitle as S, PauseAdCaption as C, PauseAdBottomLeft as G, PauseAdPlayButton as D, PauseAdSidebar as F, ExternalAdContainer as I } from "./styles.js";
|
|
8
|
+
const M = ({ vastUrl: a }) => {
|
|
9
|
+
const r = y(null), [, , u] = T(r, a);
|
|
10
|
+
return d(() => {
|
|
11
11
|
u && u();
|
|
12
|
-
}, [u]), /* @__PURE__ */
|
|
13
|
-
},
|
|
14
|
-
const { ref:
|
|
12
|
+
}, [u]), /* @__PURE__ */ t(I, { ref: r });
|
|
13
|
+
}, j = ({ isClosing: a, title: r, caption: u, onPlay: f, onClose: s, vastUrl: m }) => {
|
|
14
|
+
const { ref: e, focusSelf: o } = x({
|
|
15
15
|
focusKey: "sl-pause-ad-play",
|
|
16
16
|
onEnterRelease: f,
|
|
17
17
|
isFocusBoundary: !0,
|
|
18
18
|
forceFocus: !0
|
|
19
19
|
});
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
}, [
|
|
23
|
-
const
|
|
24
|
-
const i =
|
|
20
|
+
return d(() => {
|
|
21
|
+
e.current && o();
|
|
22
|
+
}, [e, o]), d(() => {
|
|
23
|
+
const l = (n) => {
|
|
24
|
+
const i = n.keyCode;
|
|
25
25
|
if (i === 461 || i === 10009 || i === 27) {
|
|
26
|
-
|
|
26
|
+
n.preventDefault(), n.stopPropagation(), n.stopImmediatePropagation(), s == null || s();
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
return window.addEventListener("keydown",
|
|
31
|
-
}, [
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */
|
|
30
|
+
return window.addEventListener("keydown", l, { capture: !0 }), () => window.removeEventListener("keydown", l, { capture: !0 });
|
|
31
|
+
}, [s]), /* @__PURE__ */ t(b, { className: E(a && "pause-ad-closing"), children: /* @__PURE__ */ p(g, { children: [
|
|
32
|
+
/* @__PURE__ */ t(w, {}),
|
|
33
|
+
/* @__PURE__ */ t(k, {}),
|
|
34
|
+
/* @__PURE__ */ t(B, {}),
|
|
35
35
|
/* @__PURE__ */ p(L, { children: [
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ t(S, { children: r }),
|
|
37
|
+
/* @__PURE__ */ t(C, { children: u })
|
|
38
38
|
] }),
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
|
|
39
|
+
/* @__PURE__ */ t(G, { children: /* @__PURE__ */ t(
|
|
40
|
+
D,
|
|
41
41
|
{
|
|
42
|
-
ref:
|
|
42
|
+
ref: e,
|
|
43
43
|
onClick: f,
|
|
44
|
-
onMouseEnter: () =>
|
|
44
|
+
onMouseEnter: () => e.current.focus(),
|
|
45
45
|
"aria-label": "Resume playback"
|
|
46
46
|
}
|
|
47
47
|
) }),
|
|
48
|
-
/* @__PURE__ */ p(
|
|
49
|
-
m && /* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */ p(F, { children: [
|
|
49
|
+
m && /* @__PURE__ */ t(M, { vastUrl: m }),
|
|
50
|
+
/* @__PURE__ */ t("span", { children: "ADVERTISEMENT" })
|
|
51
51
|
] })
|
|
52
52
|
] }) });
|
|
53
|
-
},
|
|
54
|
-
showPauseAd:
|
|
53
|
+
}, H = ({
|
|
54
|
+
showPauseAd: a,
|
|
55
55
|
vastUrls: r,
|
|
56
56
|
title: u,
|
|
57
57
|
caption: f,
|
|
58
|
-
onPlay:
|
|
58
|
+
onPlay: s,
|
|
59
59
|
onClose: m,
|
|
60
|
-
onRender:
|
|
60
|
+
onRender: e
|
|
61
61
|
}) => {
|
|
62
|
-
const [
|
|
63
|
-
|
|
62
|
+
const [o, l] = A(!1), [n, i] = A(!1), c = y();
|
|
63
|
+
d(() => (c.current && clearTimeout(c.current), a ? (P.emit("exposedPauseAd", {
|
|
64
64
|
action: "enabled",
|
|
65
65
|
payload: {}
|
|
66
66
|
}), c.current = setTimeout(() => {
|
|
67
|
-
i(!1),
|
|
67
|
+
i(!1), l(!0);
|
|
68
68
|
}, 5e3)) : (P.emit("exposedPauseAd", {
|
|
69
69
|
action: "disabled",
|
|
70
70
|
payload: {}
|
|
71
71
|
}), i(!0), c.current = setTimeout(() => {
|
|
72
|
-
|
|
72
|
+
l(!1);
|
|
73
73
|
}, 400)), () => {
|
|
74
74
|
c.current && clearTimeout(c.current);
|
|
75
|
-
}), [
|
|
76
|
-
|
|
77
|
-
}, [
|
|
75
|
+
}), [a]), d(() => {
|
|
76
|
+
e == null || e({ rendered: o });
|
|
77
|
+
}, [o, e]), d(() => () => {
|
|
78
|
+
e == null || e({ rendered: !1 });
|
|
79
|
+
}, [e]);
|
|
78
80
|
const h = r == null ? void 0 : r[0].url;
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
+
return o ? /* @__PURE__ */ t(
|
|
82
|
+
j,
|
|
81
83
|
{
|
|
82
84
|
onClose: m,
|
|
83
|
-
isClosing:
|
|
85
|
+
isClosing: n,
|
|
84
86
|
title: u,
|
|
85
87
|
caption: f,
|
|
86
|
-
onPlay:
|
|
88
|
+
onPlay: s,
|
|
87
89
|
vastUrl: h
|
|
88
90
|
}
|
|
89
91
|
) : null;
|
|
90
92
|
};
|
|
91
93
|
export {
|
|
92
|
-
|
|
94
|
+
H as PauseAd
|
|
93
95
|
};
|
package/lib/app/webos/index.js
CHANGED
|
@@ -1,65 +1,66 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { init as
|
|
3
|
-
import { Layout as
|
|
4
|
-
import { Component as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import { jsx as t, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import { init as y } from "@noriginmedia/norigin-spatial-navigation";
|
|
3
|
+
import { Layout as v } from "../app/Layout/index.js";
|
|
4
|
+
import { Component as D, useCallback as u } from "react";
|
|
5
|
+
import { useStore as d } from "@streamlayer/react-polyfills";
|
|
6
|
+
import { StreamLayerSDKAdvertisementWebOS as m } from "./Advertisement/index.js";
|
|
7
|
+
import { PauseAd as L } from "./ExposedPauseAd/PauseAd.js";
|
|
8
|
+
import { StreamLayerSDKQuestionWebOS as S } from "./Question/index.js";
|
|
9
|
+
y({
|
|
9
10
|
shouldFocusDOMNode: !0
|
|
10
11
|
});
|
|
11
|
-
const
|
|
12
|
-
persistent:
|
|
13
|
-
children:
|
|
12
|
+
const K = ({
|
|
13
|
+
persistent: o,
|
|
14
|
+
children: e,
|
|
14
15
|
sdk: r,
|
|
15
|
-
showPauseAd:
|
|
16
|
-
pauseAdVastUrl:
|
|
16
|
+
showPauseAd: p,
|
|
17
|
+
pauseAdVastUrl: c,
|
|
17
18
|
onClosePauseAd: a,
|
|
18
|
-
onRenderPauseAd:
|
|
19
|
+
onRenderPauseAd: s
|
|
19
20
|
}) => {
|
|
20
|
-
const
|
|
21
|
+
const i = d(r.uiState), f = u(() => {
|
|
21
22
|
a == null || a();
|
|
22
|
-
}, [a]),
|
|
23
|
+
}, [a]), h = u(() => {
|
|
23
24
|
r.controlVideoPlayer({ play: !0 });
|
|
24
|
-
}, [r]);
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
25
|
+
}, [r]), l = i.appSidebar || i.promotionSidebar || i.promotionOverlay;
|
|
26
|
+
return /* @__PURE__ */ b(
|
|
27
|
+
v,
|
|
27
28
|
{
|
|
28
29
|
sdk: r,
|
|
29
|
-
sidebar: ({ promo: n }) => n ? /* @__PURE__ */ t(
|
|
30
|
-
notification: ({ promo: n }) => n ? /* @__PURE__ */ t(
|
|
31
|
-
banner: /* @__PURE__ */ t(
|
|
30
|
+
sidebar: ({ promo: n }) => n ? /* @__PURE__ */ t(m, { sdk: r, persistent: o, sidebar: "right" }) : /* @__PURE__ */ t(S, { sdk: r, persistent: o }),
|
|
31
|
+
notification: ({ promo: n }) => n ? /* @__PURE__ */ t(m, { sdk: r, notification: !0, persistent: o }) : /* @__PURE__ */ t(S, { notification: !0, sdk: r, persistent: o }),
|
|
32
|
+
banner: /* @__PURE__ */ t(m, { sdk: r, persistent: o, banner: "bottom" }),
|
|
32
33
|
webos: !0,
|
|
33
34
|
children: [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
e,
|
|
36
|
+
c && !l && /* @__PURE__ */ t(
|
|
37
|
+
L,
|
|
37
38
|
{
|
|
38
|
-
showPauseAd:
|
|
39
|
-
vastUrls:
|
|
40
|
-
onClose:
|
|
41
|
-
onRender:
|
|
42
|
-
onPlay:
|
|
39
|
+
showPauseAd: p,
|
|
40
|
+
vastUrls: c,
|
|
41
|
+
onClose: f,
|
|
42
|
+
onRender: s,
|
|
43
|
+
onPlay: h
|
|
43
44
|
}
|
|
44
45
|
)
|
|
45
46
|
]
|
|
46
47
|
}
|
|
47
48
|
);
|
|
48
49
|
};
|
|
49
|
-
class
|
|
50
|
-
constructor(
|
|
51
|
-
super(
|
|
50
|
+
class W extends D {
|
|
51
|
+
constructor(e) {
|
|
52
|
+
super(e), this.state = { hasError: !1 };
|
|
52
53
|
}
|
|
53
54
|
static getDerivedStateFromError() {
|
|
54
55
|
return { hasError: !0 };
|
|
55
56
|
}
|
|
56
|
-
componentDidCatch(
|
|
57
|
-
console.error("StreamLayerSDKTv error:",
|
|
57
|
+
componentDidCatch(e, r) {
|
|
58
|
+
console.error("StreamLayerSDKTv error:", e, r.componentStack);
|
|
58
59
|
}
|
|
59
60
|
render() {
|
|
60
|
-
return this.state.hasError ? this.props.children : /* @__PURE__ */ t(
|
|
61
|
+
return this.state.hasError ? this.props.children : /* @__PURE__ */ t(K, { ...this.props });
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
export {
|
|
64
|
-
|
|
65
|
+
W as StreamLayerSDKTv
|
|
65
66
|
};
|