@streamlayer/react 1.20.5 → 1.20.6
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/cjs/pause-ad.js +1 -1
- package/lib/cjs/provider.js +21 -21
- package/lib/cjs/useStreamLayerApp2.js +1 -1
- package/lib/classic/cjs/pause-ad.js +1 -1
- package/lib/classic/cjs/provider.js +20 -20
- package/lib/classic/cjs/useStreamLayerApp2.js +1 -1
- package/lib/classic/es/pause-ad.js +75 -76
- package/lib/classic/es/provider.js +6461 -6117
- package/lib/classic/es/useStreamLayerApp2.js +1 -1
- package/lib/dist/cjs/masters.js +1 -1
- package/lib/dist/es/masters.js +1 -1
- package/lib/dist/style.css +1 -1
- package/lib/es/pause-ad.js +75 -76
- package/lib/es/provider.js +2840 -2852
- package/lib/es/useStreamLayerApp2.js +1 -1
- package/lib/style.css +1 -1
- package/package.json +14 -14
package/lib/es/pause-ad.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as K, i as V, s as p, e as
|
|
3
|
-
import { useRef as
|
|
1
|
+
import { jsx as a, jsxs as I } from "react/jsx-runtime";
|
|
2
|
+
import { c as K, i as V, s as p, e as L, f as F, j as M, a as _, u as $, b as j, h as q } from "./provider.js";
|
|
3
|
+
import { useRef as x, useCallback as C, useState as R, useEffect as b, Component as z } from "react";
|
|
4
4
|
import { c as N } from "./vast-client.min-B0NUra1B.js";
|
|
5
|
-
const
|
|
5
|
+
const G = {}, H = new N(), w = V(G), E = K("ui:gam-static"), U = (r) => new Promise((e, t) => {
|
|
6
6
|
const s = new Image();
|
|
7
|
-
s.onload = () => e(r), s.onerror = () =>
|
|
7
|
+
s.onload = () => e(r), s.onerror = () => t(), s.src = r;
|
|
8
8
|
}), D = () => {
|
|
9
|
-
const r =
|
|
9
|
+
const r = x(0);
|
|
10
10
|
return [C(async (e) => {
|
|
11
|
-
var
|
|
12
|
-
if ((
|
|
11
|
+
var t, s, c, o, l, n, u, i, h, m, f;
|
|
12
|
+
if ((t = w.get()[e]) != null && t.imageSrc)
|
|
13
13
|
return { success: !0 };
|
|
14
14
|
const v = Date.now();
|
|
15
15
|
r.current = v, w.setKey(e, { url: e });
|
|
16
16
|
try {
|
|
17
|
-
const d = await
|
|
17
|
+
const d = await H.get(e);
|
|
18
18
|
if (E.debug(d, "parsedVAST"), r.current === v && w.get()[e].url) {
|
|
19
19
|
const y = d.ads.find((g) => g.creatives.length > 0);
|
|
20
20
|
if (y) {
|
|
@@ -28,7 +28,7 @@ const H = {}, O = new N(), w = V(H), E = K("ui:gam-static"), U = (r) => new Prom
|
|
|
28
28
|
}
|
|
29
29
|
const A = y.creatives.find((S) => S.type === "companion");
|
|
30
30
|
E.debug(A, "companion");
|
|
31
|
-
const T = (
|
|
31
|
+
const T = (h = (i = (u = (n = A == null ? void 0 : A.variations) == null ? void 0 : n[0]) == null ? void 0 : u.staticResources) == null ? void 0 : i[0]) == null ? void 0 : h.url, P = (f = (m = A == null ? void 0 : A.variations) == null ? void 0 : m[0]) == null ? void 0 : f.companionClickThroughURLTemplate;
|
|
32
32
|
if (T)
|
|
33
33
|
return await U(T), w.setKey(e, { url: e, imageSrc: T, adUrl: P }), { success: !0 };
|
|
34
34
|
}
|
|
@@ -38,60 +38,60 @@ const H = {}, O = new N(), w = V(H), E = K("ui:gam-static"), U = (r) => new Prom
|
|
|
38
38
|
}
|
|
39
39
|
return { success: !1 };
|
|
40
40
|
}, []), w];
|
|
41
|
-
},
|
|
41
|
+
}, O = /* @__PURE__ */ p("div")({
|
|
42
42
|
name: "PauseAdOverlay",
|
|
43
43
|
class: "pw9gih8",
|
|
44
44
|
propsAsIs: !1
|
|
45
|
-
}),
|
|
45
|
+
}), J = /* @__PURE__ */ p("div")({
|
|
46
46
|
name: "PauseAdContent",
|
|
47
47
|
class: "p8lpomy",
|
|
48
48
|
propsAsIs: !1
|
|
49
|
-
}),
|
|
50
|
-
name: "
|
|
49
|
+
}), Q = /* @__PURE__ */ p("div")({
|
|
50
|
+
name: "PauseAdGradientRight",
|
|
51
51
|
class: "pv7u167",
|
|
52
52
|
propsAsIs: !1
|
|
53
|
-
}),
|
|
54
|
-
name: "
|
|
53
|
+
}), W = /* @__PURE__ */ p("div")({
|
|
54
|
+
name: "PauseAdGradientBottom",
|
|
55
55
|
class: "p1kh2yb0",
|
|
56
56
|
propsAsIs: !1
|
|
57
|
-
}),
|
|
58
|
-
name: "
|
|
57
|
+
}), X = /* @__PURE__ */ p("div")({
|
|
58
|
+
name: "PauseAdTopLeft",
|
|
59
59
|
class: "pl8f94x",
|
|
60
60
|
propsAsIs: !1
|
|
61
|
-
}),
|
|
62
|
-
name: "
|
|
61
|
+
}), Y = /* @__PURE__ */ p("h2")({
|
|
62
|
+
name: "PauseAdTitle",
|
|
63
63
|
class: "p1m6zmrt",
|
|
64
64
|
propsAsIs: !1
|
|
65
|
-
}),
|
|
66
|
-
name: "
|
|
65
|
+
}), Z = /* @__PURE__ */ p("p")({
|
|
66
|
+
name: "PauseAdCaption",
|
|
67
67
|
class: "pm3vwfa",
|
|
68
68
|
propsAsIs: !1
|
|
69
|
-
}), ee = /* @__PURE__ */ p("
|
|
70
|
-
name: "
|
|
69
|
+
}), ee = /* @__PURE__ */ p("div")({
|
|
70
|
+
name: "PauseAdBottomLeft",
|
|
71
71
|
class: "p1tibuhw",
|
|
72
72
|
propsAsIs: !1
|
|
73
|
-
}), re = /* @__PURE__ */ p("
|
|
74
|
-
name: "
|
|
73
|
+
}), re = /* @__PURE__ */ p("button")({
|
|
74
|
+
name: "PauseAdPlayButton",
|
|
75
75
|
class: "ptqqrqd",
|
|
76
76
|
propsAsIs: !1
|
|
77
|
-
}), se = /* @__PURE__ */ p("
|
|
78
|
-
name: "
|
|
77
|
+
}), se = /* @__PURE__ */ p("div")({
|
|
78
|
+
name: "PauseAdSidebar",
|
|
79
79
|
class: "p14estxv",
|
|
80
80
|
propsAsIs: !1
|
|
81
|
-
}),
|
|
82
|
-
name: "
|
|
81
|
+
}), ne = /* @__PURE__ */ p("span")({
|
|
82
|
+
name: "PauseAdTitleDescription",
|
|
83
83
|
class: "p1dpvfl1",
|
|
84
84
|
propsAsIs: !1
|
|
85
85
|
}), k = /* @__PURE__ */ p("img")({
|
|
86
86
|
name: "ExternalAdContainer",
|
|
87
87
|
class: "ezfmabr",
|
|
88
88
|
propsAsIs: !1
|
|
89
|
-
}),
|
|
89
|
+
}), te = ({ vastUrl: r }) => {
|
|
90
90
|
var e;
|
|
91
|
-
const [,
|
|
92
|
-
return (e = s == null ? void 0 : s[r]) != null && e.imageSrc ? s[r].adUrl ? /* @__PURE__ */
|
|
93
|
-
}, ae = ({ isClosing: r, title: e, caption:
|
|
94
|
-
const
|
|
91
|
+
const [, t] = D(), s = _(t, { keys: [r] });
|
|
92
|
+
return (e = s == null ? void 0 : s[r]) != null && e.imageSrc ? s[r].adUrl ? /* @__PURE__ */ a("a", { href: s[r].adUrl, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ a(k, { src: s[r].imageSrc }) }) : /* @__PURE__ */ a(k, { src: s[r].imageSrc }) : null;
|
|
93
|
+
}, ae = ({ isClosing: r, title: e, caption: t, onPlay: s, onClose: c, vastUrl: o, options: l }) => {
|
|
94
|
+
const n = (l == null ? void 0 : l.showPauseButton) ?? !0, { ref: u, focusSelf: i } = F.useFocusable({
|
|
95
95
|
focusKey: "sl-pause-ad-play",
|
|
96
96
|
onEnterRelease: s,
|
|
97
97
|
isFocusBoundary: !0,
|
|
@@ -100,24 +100,23 @@ const H = {}, O = new N(), w = V(H), E = K("ui:gam-static"), U = (r) => new Prom
|
|
|
100
100
|
return b(() => {
|
|
101
101
|
u.current && i();
|
|
102
102
|
}, [u, i]), b(() => {
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
103
|
+
const h = (m) => {
|
|
104
|
+
const f = m.keyCode;
|
|
105
|
+
if (f === 461 || f === 10009 || f === 27 || f === 8) {
|
|
106
106
|
m.preventDefault(), m.stopPropagation(), m.stopImmediatePropagation(), c == null || c();
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
|
-
return window.addEventListener("keydown",
|
|
111
|
-
}, [c]), /* @__PURE__ */
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
/* @__PURE__ */
|
|
115
|
-
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
/* @__PURE__ */ n(ee, { children: a })
|
|
110
|
+
return window.addEventListener("keydown", h, { capture: !0 }), () => window.removeEventListener("keydown", h, { capture: !0 });
|
|
111
|
+
}, [c]), /* @__PURE__ */ a(O, { className: M(r && "pause-ad-closing"), children: /* @__PURE__ */ I(J, { children: [
|
|
112
|
+
/* @__PURE__ */ a(Q, {}),
|
|
113
|
+
/* @__PURE__ */ a(W, {}),
|
|
114
|
+
/* @__PURE__ */ I(X, { children: [
|
|
115
|
+
/* @__PURE__ */ a(Y, { children: e }),
|
|
116
|
+
/* @__PURE__ */ a(Z, { children: t })
|
|
118
117
|
] }),
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
n && /* @__PURE__ */ a(ee, { children: /* @__PURE__ */ a(
|
|
119
|
+
re,
|
|
121
120
|
{
|
|
122
121
|
ref: u,
|
|
123
122
|
onClick: s,
|
|
@@ -125,27 +124,27 @@ const H = {}, O = new N(), w = V(H), E = K("ui:gam-static"), U = (r) => new Prom
|
|
|
125
124
|
"aria-label": "Resume playback"
|
|
126
125
|
}
|
|
127
126
|
) }),
|
|
128
|
-
/* @__PURE__ */ I(
|
|
129
|
-
o && /* @__PURE__ */
|
|
130
|
-
/* @__PURE__ */
|
|
127
|
+
/* @__PURE__ */ I(se, { children: [
|
|
128
|
+
o && /* @__PURE__ */ a(te, { vastUrl: o }),
|
|
129
|
+
/* @__PURE__ */ a(ne, { children: "ADVERTISEMENT" })
|
|
131
130
|
] })
|
|
132
131
|
] }) });
|
|
133
132
|
}, oe = ({
|
|
134
133
|
showPauseAd: r,
|
|
135
134
|
vastUrls: e,
|
|
136
|
-
title:
|
|
135
|
+
title: t,
|
|
137
136
|
caption: s,
|
|
138
137
|
onPlay: c,
|
|
139
138
|
onClose: o,
|
|
140
139
|
onRender: l,
|
|
141
|
-
options:
|
|
140
|
+
options: n
|
|
142
141
|
}) => {
|
|
143
|
-
const u = (
|
|
142
|
+
const u = (n == null ? void 0 : n.pauseAdDelay) ?? 5e3, [i, h] = R(!1), [m, f] = R(!1), v = x(), d = e == null ? void 0 : e[0].url, y = x(d);
|
|
144
143
|
y.current = d;
|
|
145
144
|
const [g, A] = D();
|
|
146
145
|
return b(() => {
|
|
147
146
|
if (r && d) {
|
|
148
|
-
|
|
147
|
+
L.emit("exposedPauseAd", {
|
|
149
148
|
action: "enabled",
|
|
150
149
|
payload: {}
|
|
151
150
|
}), g(d).then((P) => {
|
|
@@ -155,7 +154,7 @@ const H = {}, O = new N(), w = V(H), E = K("ui:gam-static"), U = (r) => new Prom
|
|
|
155
154
|
});
|
|
156
155
|
const T = () => {
|
|
157
156
|
var P;
|
|
158
|
-
(P = A.get()[y.current]) != null && P.imageSrc ? (clearTimeout(v.current),
|
|
157
|
+
(P = A.get()[y.current]) != null && P.imageSrc ? (clearTimeout(v.current), f(!1), h(!0), L.emit("exposedPauseAd", {
|
|
159
158
|
action: "rendered",
|
|
160
159
|
payload: {}
|
|
161
160
|
})) : v.current = setTimeout(() => {
|
|
@@ -166,11 +165,11 @@ const H = {}, O = new N(), w = V(H), E = K("ui:gam-static"), U = (r) => new Prom
|
|
|
166
165
|
T();
|
|
167
166
|
}, u);
|
|
168
167
|
} else
|
|
169
|
-
|
|
168
|
+
L.emit("exposedPauseAd", {
|
|
170
169
|
action: "disabled",
|
|
171
170
|
payload: {}
|
|
172
|
-
}),
|
|
173
|
-
|
|
171
|
+
}), f(!0), v.current = setTimeout(() => {
|
|
172
|
+
h(!1);
|
|
174
173
|
}, 400);
|
|
175
174
|
return () => {
|
|
176
175
|
v.current && clearTimeout(v.current);
|
|
@@ -179,49 +178,49 @@ const H = {}, O = new N(), w = V(H), E = K("ui:gam-static"), U = (r) => new Prom
|
|
|
179
178
|
l == null || l({ rendered: i });
|
|
180
179
|
}, [i, l]), b(() => () => {
|
|
181
180
|
l == null || l({ rendered: !1 });
|
|
182
|
-
}, [l]), i ? /* @__PURE__ */
|
|
181
|
+
}, [l]), i ? /* @__PURE__ */ a(
|
|
183
182
|
ae,
|
|
184
183
|
{
|
|
185
184
|
onClose: o,
|
|
186
185
|
isClosing: m,
|
|
187
|
-
title:
|
|
186
|
+
title: t,
|
|
188
187
|
caption: s,
|
|
189
188
|
onPlay: c,
|
|
190
189
|
vastUrl: d,
|
|
191
|
-
options:
|
|
190
|
+
options: n
|
|
192
191
|
}
|
|
193
192
|
) : null;
|
|
194
193
|
}, le = ({
|
|
195
194
|
showPauseAd: r,
|
|
196
195
|
pauseAdVastUrl: e,
|
|
197
|
-
videoPlayerController:
|
|
196
|
+
videoPlayerController: t,
|
|
198
197
|
onRenderPauseAd: s,
|
|
199
198
|
onClosePauseAd: c,
|
|
200
199
|
children: o,
|
|
201
200
|
options: l
|
|
202
201
|
}) => {
|
|
203
|
-
const
|
|
202
|
+
const n = $(), u = j(), i = x(), h = C(() => {
|
|
204
203
|
c == null || c();
|
|
205
204
|
}, [c]), m = C(() => {
|
|
206
|
-
|
|
207
|
-
}, [
|
|
208
|
-
return b(() =>
|
|
209
|
-
i.current &&
|
|
205
|
+
n == null || n.controlVideoPlayer({ play: !0 });
|
|
206
|
+
}, [n]);
|
|
207
|
+
return b(() => n ? (t && (i.current = t, n.addVideoPlayerController(i.current)), () => {
|
|
208
|
+
i.current && n.removeVideoPlayerController(i.current);
|
|
210
209
|
}) : () => {
|
|
211
|
-
}, [
|
|
212
|
-
|
|
210
|
+
}, [n, t]), n ? /* @__PURE__ */ a("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ I(
|
|
211
|
+
q,
|
|
213
212
|
{
|
|
214
213
|
style: { position: "relative" },
|
|
215
214
|
customTheme: u.theme,
|
|
216
215
|
themeMode: u.themeMode,
|
|
217
216
|
children: [
|
|
218
217
|
o,
|
|
219
|
-
e && /* @__PURE__ */
|
|
218
|
+
e && /* @__PURE__ */ a(
|
|
220
219
|
oe,
|
|
221
220
|
{
|
|
222
221
|
showPauseAd: r,
|
|
223
222
|
vastUrls: e,
|
|
224
|
-
onClose:
|
|
223
|
+
onClose: h,
|
|
225
224
|
onRender: s,
|
|
226
225
|
onPlay: m,
|
|
227
226
|
options: l
|
|
@@ -231,18 +230,18 @@ const H = {}, O = new N(), w = V(H), E = K("ui:gam-static"), U = (r) => new Prom
|
|
|
231
230
|
}
|
|
232
231
|
) }) : o;
|
|
233
232
|
};
|
|
234
|
-
class pe extends
|
|
233
|
+
class pe extends z {
|
|
235
234
|
constructor(e) {
|
|
236
235
|
super(e), this.state = { hasError: !1 };
|
|
237
236
|
}
|
|
238
237
|
static getDerivedStateFromError() {
|
|
239
238
|
return { hasError: !0 };
|
|
240
239
|
}
|
|
241
|
-
componentDidCatch(e,
|
|
242
|
-
console.error(e,
|
|
240
|
+
componentDidCatch(e, t) {
|
|
241
|
+
console.error(e, t.componentStack);
|
|
243
242
|
}
|
|
244
243
|
render() {
|
|
245
|
-
return this.state.hasError ? this.props.children : /* @__PURE__ */
|
|
244
|
+
return this.state.hasError ? this.props.children : /* @__PURE__ */ a(le, { ...this.props });
|
|
246
245
|
}
|
|
247
246
|
}
|
|
248
247
|
export {
|