@streamlayer/react-ui 1.31.6 → 1.32.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.
- package/lib/app/app/Notifications/index.js +34 -34
- package/lib/app/masters/Notifications/index.js +40 -40
- package/lib/app/useClipboardCopy.js +8 -8
- package/lib/app/webos/ExposedPauseAd/PauseAd.d.ts +6 -3
- package/lib/app/webos/ExposedPauseAd/PauseAd.js +99 -77
- package/lib/app/webos/index.d.ts +5 -2
- package/lib/app/webos/index.js +22 -21
- package/lib/assets/style.css +1 -1
- package/lib/ui/advertisement/overlay/externalAd/vast-player/useGAMPlayer.js +6 -6
- package/lib/ui/advertisement/overlay/externalAd/vast-player/useGAMStatic.d.ts +1 -0
- package/lib/ui/advertisement/overlay/externalAd/vast-player/useGAMStatic.js +56 -31
- package/lib/ui/modal/index.js +16 -16
- package/package.json +17 -16
- package/lib/index-DALxy-8N.js +0 -5437
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
import { jsxs as w, Fragment as b, jsx as u } from "react/jsx-runtime";
|
|
2
|
-
import { cx as
|
|
2
|
+
import { cx as D } from "@linaria/core";
|
|
3
3
|
import { useAppContext as O } from "../useAppContext.js";
|
|
4
4
|
import { scrollIntoAppView as T } from "../../useSdkScroll.js";
|
|
5
|
-
import { useState as k, useMemo as
|
|
6
|
-
import {
|
|
5
|
+
import { useState as k, useMemo as V, useEffect as h, useRef as q, useCallback as I } from "react";
|
|
6
|
+
import { createPortal as E } from "react-dom";
|
|
7
7
|
import { useStore as y } from "@streamlayer/react-polyfills";
|
|
8
8
|
import { eventBus as R } from "@streamlayer/sdk-web-interfaces";
|
|
9
9
|
import { NotificationType as p } from "@streamlayer/sdk-web-notifications";
|
|
10
10
|
import { QuestionTypeData as A } from "../../../ui/gamification/constants.js";
|
|
11
11
|
import { Notification as N } from "../../../ui/gamification/question/notification/index.js";
|
|
12
12
|
import { PredictionResult as C } from "../../../ui/gamification/question/notification/prediction-result/index.js";
|
|
13
|
-
import { Onboarding as
|
|
14
|
-
import { HiddenContainer as
|
|
15
|
-
const v = (
|
|
16
|
-
const [e, d] = k(0), i =
|
|
13
|
+
import { Onboarding as P } from "./Onboarding/index.js";
|
|
14
|
+
import { HiddenContainer as x, Container as z, InnerContainer as B, NotificationRefreshing as H, Pill as S } from "./styles.js";
|
|
15
|
+
const v = (r) => {
|
|
16
|
+
const [e, d] = k(0), i = q(null), l = V(() => new ResizeObserver((n) => {
|
|
17
17
|
window.requestAnimationFrame(() => {
|
|
18
18
|
var f;
|
|
19
|
-
if (Array.isArray(
|
|
20
|
-
for (const c of
|
|
19
|
+
if (Array.isArray(n)) {
|
|
20
|
+
for (const c of n)
|
|
21
21
|
if (c.contentBoxSize) {
|
|
22
22
|
const o = (f = i.current) == null ? void 0 : f.getBoundingClientRect();
|
|
23
23
|
o && d(o.height);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
-
}), []), s = I((
|
|
28
|
-
i.current =
|
|
29
|
-
}, []), a = I((
|
|
30
|
-
d(
|
|
27
|
+
}), []), s = I((n) => {
|
|
28
|
+
i.current = n;
|
|
29
|
+
}, []), a = I((n) => {
|
|
30
|
+
d(n);
|
|
31
31
|
}, []);
|
|
32
32
|
return h(() => {
|
|
33
|
-
const
|
|
34
|
-
return
|
|
35
|
-
l.unobserve(
|
|
33
|
+
const n = i.current;
|
|
34
|
+
return n ? (l.observe(n), () => {
|
|
35
|
+
l.unobserve(n);
|
|
36
36
|
}) : () => {
|
|
37
37
|
};
|
|
38
|
-
}, [
|
|
38
|
+
}, [r]), h(() => () => {
|
|
39
39
|
l.disconnect();
|
|
40
40
|
}), [s, e, a];
|
|
41
41
|
}, Q = ({
|
|
42
|
-
sdk:
|
|
42
|
+
sdk: r,
|
|
43
43
|
notification: e,
|
|
44
44
|
appNode: d,
|
|
45
45
|
responsiveStore: i,
|
|
@@ -52,11 +52,11 @@ const v = (n) => {
|
|
|
52
52
|
keys: ["sdkInDesktopView"]
|
|
53
53
|
}), {
|
|
54
54
|
sdk: a
|
|
55
|
-
} = O(), [
|
|
55
|
+
} = O(), [n, f, c] = v(e.id);
|
|
56
56
|
let o = f;
|
|
57
57
|
return l || (o = "auto"), e.type === p.QUESTION ? /* @__PURE__ */ w(b, {
|
|
58
|
-
children: [/* @__PURE__ */ u(
|
|
59
|
-
ref:
|
|
58
|
+
children: [/* @__PURE__ */ u(x, {
|
|
59
|
+
ref: n,
|
|
60
60
|
children: /* @__PURE__ */ u(N, {
|
|
61
61
|
...e
|
|
62
62
|
})
|
|
@@ -83,19 +83,19 @@ const v = (n) => {
|
|
|
83
83
|
close: e.close,
|
|
84
84
|
hiding: e.hiding,
|
|
85
85
|
...e.data.question
|
|
86
|
-
}) : e.type === p.ONBOARDING ? /* @__PURE__ */ u(
|
|
86
|
+
}) : e.type === p.ONBOARDING ? /* @__PURE__ */ u(P, {
|
|
87
87
|
style: {
|
|
88
88
|
height: e.hiding ? 0 : o
|
|
89
89
|
},
|
|
90
90
|
saveHeight: c,
|
|
91
|
-
sdk:
|
|
91
|
+
sdk: r,
|
|
92
92
|
notification: e,
|
|
93
93
|
sdkInDesktopView: s,
|
|
94
94
|
appNode: d,
|
|
95
95
|
responsiveStore: i
|
|
96
96
|
}) : null;
|
|
97
97
|
}, F = "p7vfi6t", U = ({
|
|
98
|
-
pill:
|
|
98
|
+
pill: r,
|
|
99
99
|
setPill: e,
|
|
100
100
|
appNode: d,
|
|
101
101
|
headerNode: i,
|
|
@@ -105,7 +105,7 @@ const v = (n) => {
|
|
|
105
105
|
}) => {
|
|
106
106
|
var t, m;
|
|
107
107
|
const {
|
|
108
|
-
screen:
|
|
108
|
+
screen: n
|
|
109
109
|
} = y(s, {
|
|
110
110
|
keys: ["screen"]
|
|
111
111
|
}), {
|
|
@@ -118,22 +118,22 @@ const v = (n) => {
|
|
|
118
118
|
s.get().sdkInDesktopView ? c < 50 && e(null) : c > -50 && e(null);
|
|
119
119
|
}, [c, s, e]);
|
|
120
120
|
const o = s.get().sdkInDesktopView ? d : i;
|
|
121
|
-
return !
|
|
122
|
-
title:
|
|
121
|
+
return !r || !o.current ? null : E(/* @__PURE__ */ u(S, {
|
|
122
|
+
title: r.type === p.QUESTION_RESOLVED ? "Prediction result" : `New ${((m = A[(t = r.data) == null ? void 0 : t.questionType]) == null ? void 0 : m.label) || "notification"}`,
|
|
123
123
|
"data-a": "intr",
|
|
124
124
|
onClick: () => {
|
|
125
125
|
var g;
|
|
126
126
|
s.get().sdkInDesktopView ? (g = l.current) == null || g.scrollTo({
|
|
127
127
|
top: 0,
|
|
128
128
|
behavior: "smooth"
|
|
129
|
-
}) : T(d,
|
|
129
|
+
}) : T(d, n.size, {
|
|
130
130
|
behavior: "smooth"
|
|
131
131
|
}), e(null);
|
|
132
132
|
},
|
|
133
|
-
className:
|
|
133
|
+
className: D(f && F, "sl-pill-button")
|
|
134
134
|
}), o.current);
|
|
135
|
-
},
|
|
136
|
-
sdk:
|
|
135
|
+
}, ne = ({
|
|
136
|
+
sdk: r,
|
|
137
137
|
headerNode: e,
|
|
138
138
|
scrollNode: d,
|
|
139
139
|
responsiveStore: i,
|
|
@@ -141,7 +141,7 @@ const v = (n) => {
|
|
|
141
141
|
scrollStore: s,
|
|
142
142
|
hasActiveFeature: a
|
|
143
143
|
}) => {
|
|
144
|
-
const [
|
|
144
|
+
const [n] = k(r.getNotificationsStore()), f = y(n), [c, o] = k(null), t = V(() => r.getActiveNotification(), [r, f]);
|
|
145
145
|
return h(() => {
|
|
146
146
|
t && R.emit("notification", {
|
|
147
147
|
action: "rendered",
|
|
@@ -163,7 +163,7 @@ const v = (n) => {
|
|
|
163
163
|
}, [t]), /* @__PURE__ */ w(b, {
|
|
164
164
|
children: [!c && t && /* @__PURE__ */ u(Q, {
|
|
165
165
|
appNode: l,
|
|
166
|
-
sdk:
|
|
166
|
+
sdk: r,
|
|
167
167
|
hasActiveFeature: a,
|
|
168
168
|
notification: t,
|
|
169
169
|
responsiveStore: i
|
|
@@ -180,5 +180,5 @@ const v = (n) => {
|
|
|
180
180
|
});
|
|
181
181
|
};
|
|
182
182
|
export {
|
|
183
|
-
|
|
183
|
+
ne as SDKNotifications
|
|
184
184
|
};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { jsxs as f, Fragment as D, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { cx as T } from "@linaria/core";
|
|
3
3
|
import { useMastersContext as q } from "../useMastersContext.js";
|
|
4
|
-
import { scrollIntoAppView as
|
|
5
|
-
import { useState as p, useMemo as
|
|
6
|
-
import {
|
|
4
|
+
import { scrollIntoAppView as O } from "../useSdkScroll.js";
|
|
5
|
+
import { useState as p, useMemo as b, useEffect as g, useRef as E, useCallback as N } from "react";
|
|
6
|
+
import { createPortal as R } from "react-dom";
|
|
7
7
|
import { useStore as y } from "@streamlayer/react-polyfills";
|
|
8
8
|
import { eventBus as C } from "@streamlayer/sdk-web-interfaces";
|
|
9
|
-
import { NotificationType as
|
|
9
|
+
import { NotificationType as a } from "@streamlayer/sdk-web-notifications";
|
|
10
10
|
import { QuestionTypeData as P } from "../../../ui/gamification/constants.js";
|
|
11
11
|
import { Notification as V } from "../../../ui/gamification/question/notification/index.js";
|
|
12
12
|
import { PredictionResult as x } from "../../../ui/gamification/question/notification/prediction-result/index.js";
|
|
13
13
|
import { Onboarding as A } from "./Onboarding/index.js";
|
|
14
14
|
import { HiddenContainer as B, Container as H, InnerContainer as Q, NotificationRefreshing as U, Pill as j } from "./styles.js";
|
|
15
|
-
const z = (
|
|
16
|
-
const [t, c] = p(0), u =
|
|
17
|
-
u.current =
|
|
15
|
+
const z = (o) => {
|
|
16
|
+
const [t, c] = p(0), u = E(null), e = N((n) => {
|
|
17
|
+
u.current = n;
|
|
18
18
|
}, []);
|
|
19
|
-
|
|
19
|
+
g(() => {
|
|
20
20
|
var s;
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
}, [
|
|
24
|
-
const r = N((
|
|
25
|
-
c(
|
|
21
|
+
const n = (s = u.current) == null ? void 0 : s.getBoundingClientRect();
|
|
22
|
+
n && c(n.height);
|
|
23
|
+
}, [o]);
|
|
24
|
+
const r = N((n) => {
|
|
25
|
+
c(n);
|
|
26
26
|
}, []);
|
|
27
27
|
return [e, t, r];
|
|
28
28
|
}, F = ({
|
|
29
|
-
sdk:
|
|
29
|
+
sdk: o,
|
|
30
30
|
notification: t,
|
|
31
31
|
appNode: c,
|
|
32
32
|
responsiveStore: u
|
|
@@ -34,8 +34,8 @@ const z = (n) => {
|
|
|
34
34
|
var h, d;
|
|
35
35
|
const {
|
|
36
36
|
sdk: e
|
|
37
|
-
} = q(), [r,
|
|
38
|
-
return t.type ===
|
|
37
|
+
} = q(), [r, n, s] = z(t.id);
|
|
38
|
+
return t.type === a.QUESTION ? /* @__PURE__ */ f(D, {
|
|
39
39
|
children: [/* @__PURE__ */ l(B, {
|
|
40
40
|
ref: r,
|
|
41
41
|
children: /* @__PURE__ */ l(V, {
|
|
@@ -43,7 +43,7 @@ const z = (n) => {
|
|
|
43
43
|
})
|
|
44
44
|
}), /* @__PURE__ */ f(H, {
|
|
45
45
|
style: {
|
|
46
|
-
height: t.hiding ? 0 :
|
|
46
|
+
height: t.hiding ? 0 : n
|
|
47
47
|
},
|
|
48
48
|
hiding: t.hiding,
|
|
49
49
|
children: [/* @__PURE__ */ l(Q, {
|
|
@@ -56,33 +56,33 @@ const z = (n) => {
|
|
|
56
56
|
})
|
|
57
57
|
}), /* @__PURE__ */ l(U, {}, t.id)]
|
|
58
58
|
})]
|
|
59
|
-
}) : t.type ===
|
|
59
|
+
}) : t.type === a.QUESTION_RESOLVED && ((d = (h = t.data) == null ? void 0 : h.question) != null && d.predictionResult) ? /* @__PURE__ */ l(x, {
|
|
60
60
|
style: {
|
|
61
|
-
height: t.hiding ? 0 :
|
|
61
|
+
height: t.hiding ? 0 : n
|
|
62
62
|
},
|
|
63
63
|
saveHeight: s,
|
|
64
64
|
close: t.close,
|
|
65
65
|
hiding: t.hiding,
|
|
66
66
|
...t.data.question,
|
|
67
67
|
mastersApp: !0
|
|
68
|
-
}) : t.type ===
|
|
68
|
+
}) : t.type === a.ONBOARDING ? /* @__PURE__ */ l(A, {
|
|
69
69
|
style: {
|
|
70
|
-
height: t.hiding ? 0 :
|
|
70
|
+
height: t.hiding ? 0 : n
|
|
71
71
|
},
|
|
72
72
|
saveHeight: s,
|
|
73
|
-
sdk:
|
|
73
|
+
sdk: o,
|
|
74
74
|
notification: t,
|
|
75
75
|
appNode: c,
|
|
76
76
|
responsiveStore: u
|
|
77
77
|
}) : null;
|
|
78
78
|
}, L = "p1co32q0", M = ({
|
|
79
|
-
pill:
|
|
79
|
+
pill: o,
|
|
80
80
|
setPill: t,
|
|
81
81
|
appNode: c,
|
|
82
82
|
headerNode: u,
|
|
83
83
|
scrollNode: e,
|
|
84
84
|
responsiveStore: r,
|
|
85
|
-
scrollStore:
|
|
85
|
+
scrollStore: n,
|
|
86
86
|
useContainer: s
|
|
87
87
|
}) => {
|
|
88
88
|
var I, k;
|
|
@@ -93,37 +93,37 @@ const z = (n) => {
|
|
|
93
93
|
}), {
|
|
94
94
|
tabsShown: d,
|
|
95
95
|
scrollPosition: m
|
|
96
|
-
} = y(
|
|
96
|
+
} = y(n, {
|
|
97
97
|
keys: ["tabsShown", "scrollPosition"]
|
|
98
98
|
});
|
|
99
|
-
|
|
99
|
+
g(() => {
|
|
100
100
|
r.get().sdkInDesktopView || s ? m < 50 && t(null) : m > -50 && t(null);
|
|
101
101
|
}, [m, r, t, s]);
|
|
102
102
|
const i = r.get().sdkInDesktopView ? c : u;
|
|
103
|
-
return !
|
|
104
|
-
title:
|
|
103
|
+
return !o || !i.current ? null : R(/* @__PURE__ */ l(j, {
|
|
104
|
+
title: o.type === a.QUESTION_RESOLVED ? "Prediction result" : `New ${((k = P[(I = o.data) == null ? void 0 : I.questionType]) == null ? void 0 : k.label) || "notification"}`,
|
|
105
105
|
onClick: () => {
|
|
106
106
|
var w;
|
|
107
107
|
r.get().sdkInDesktopView ? (w = e.current) == null || w.scrollTo({
|
|
108
108
|
top: 0,
|
|
109
109
|
behavior: "smooth"
|
|
110
|
-
}) :
|
|
110
|
+
}) : O(e, h.size, {
|
|
111
111
|
behavior: "smooth"
|
|
112
112
|
}), t(null);
|
|
113
113
|
},
|
|
114
114
|
className: T(d && L, "sl-pill-button")
|
|
115
115
|
}), i.current);
|
|
116
|
-
},
|
|
117
|
-
sdk:
|
|
116
|
+
}, nt = ({
|
|
117
|
+
sdk: o,
|
|
118
118
|
headerNode: t,
|
|
119
119
|
scrollNode: c,
|
|
120
120
|
useContainer: u,
|
|
121
121
|
responsiveStore: e,
|
|
122
122
|
appNode: r,
|
|
123
|
-
scrollStore:
|
|
123
|
+
scrollStore: n
|
|
124
124
|
}) => {
|
|
125
|
-
const [s] = p(
|
|
126
|
-
return
|
|
125
|
+
const [s] = p(o.getNotificationsStore()), h = y(s), [d, m] = p(null), i = b(() => o.getActiveNotification(), [o, h]);
|
|
126
|
+
return g(() => {
|
|
127
127
|
i && C.emit("notification", {
|
|
128
128
|
action: "rendered",
|
|
129
129
|
payload: {
|
|
@@ -131,17 +131,17 @@ const z = (n) => {
|
|
|
131
131
|
questionType: i.data.questionType
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
|
-
}, [i]),
|
|
134
|
+
}, [i]), g(() => {
|
|
135
135
|
i && (e.get().sdkInDesktopView || e.get().sdkInView) && (!e.get().sdkInDesktopView && e.get().sdkInView && m(i), e.get().sdkInDesktopView && window.requestAnimationFrame(() => {
|
|
136
|
-
|
|
136
|
+
n.get().scrollPosition !== 0 && m(i);
|
|
137
137
|
}));
|
|
138
|
-
}, [i]),
|
|
138
|
+
}, [i]), g(() => {
|
|
139
139
|
i || m(null);
|
|
140
140
|
}, [i]), /* @__PURE__ */ f(D, {
|
|
141
141
|
children: [!d && i && /* @__PURE__ */ l(F, {
|
|
142
142
|
headerNode: t,
|
|
143
143
|
appNode: r,
|
|
144
|
-
sdk:
|
|
144
|
+
sdk: o,
|
|
145
145
|
notification: i,
|
|
146
146
|
responsiveStore: e
|
|
147
147
|
}), d && /* @__PURE__ */ l(M, {
|
|
@@ -151,12 +151,12 @@ const z = (n) => {
|
|
|
151
151
|
notification: i,
|
|
152
152
|
headerNode: t,
|
|
153
153
|
scrollNode: c,
|
|
154
|
-
scrollStore:
|
|
154
|
+
scrollStore: n,
|
|
155
155
|
useContainer: u,
|
|
156
156
|
responsiveStore: e
|
|
157
157
|
})]
|
|
158
158
|
});
|
|
159
159
|
};
|
|
160
160
|
export {
|
|
161
|
-
|
|
161
|
+
nt as SDKNotifications
|
|
162
162
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as l, useState as s, useCallback as
|
|
3
|
-
import {
|
|
2
|
+
import { useRef as l, useState as s, useCallback as f, useEffect as p } from "react";
|
|
3
|
+
import { createPortal as m } from "react-dom";
|
|
4
4
|
import { CopyNotification as b } from "../ui/gamification/copyNotification/index.js";
|
|
5
5
|
const T = (r) => {
|
|
6
|
-
const t = l(), [
|
|
6
|
+
const t = l(), [c, o] = s(null), a = f(
|
|
7
7
|
async (e) => {
|
|
8
|
-
var
|
|
9
|
-
if (e && ((
|
|
8
|
+
var i;
|
|
9
|
+
if (e && ((i = navigator == null ? void 0 : navigator.clipboard) != null && i.writeText)) {
|
|
10
10
|
t.current && (clearTimeout(t.current), o(null));
|
|
11
11
|
try {
|
|
12
|
-
await navigator.clipboard.writeText(e), r.current && (o(m
|
|
12
|
+
await navigator.clipboard.writeText(e), r.current && (o(m(/* @__PURE__ */ u(b, {}), r.current)), t.current = setTimeout(() => {
|
|
13
13
|
o(null);
|
|
14
14
|
}, 1e3));
|
|
15
15
|
} catch (n) {
|
|
@@ -19,9 +19,9 @@ const T = (r) => {
|
|
|
19
19
|
},
|
|
20
20
|
[r]
|
|
21
21
|
);
|
|
22
|
-
return
|
|
22
|
+
return p(() => () => {
|
|
23
23
|
clearTimeout(t.current);
|
|
24
|
-
}, []), [a,
|
|
24
|
+
}, []), [a, c];
|
|
25
25
|
};
|
|
26
26
|
export {
|
|
27
27
|
T as useClipboardCopy
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import { StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
|
|
1
2
|
import { StreamLayerSDKTvOptions } from '..';
|
|
2
3
|
export interface PauseAdProps {
|
|
3
4
|
vastUrls: Array<{
|
|
4
5
|
template?: 'default';
|
|
5
6
|
url: string;
|
|
6
7
|
}>;
|
|
7
|
-
onClose
|
|
8
|
+
onClose?: () => void;
|
|
8
9
|
title?: string;
|
|
9
10
|
caption?: string;
|
|
10
|
-
onPlay?: () => void;
|
|
11
11
|
showPauseAd?: boolean;
|
|
12
12
|
onRender?: (params: {
|
|
13
13
|
rendered: boolean;
|
|
14
14
|
}) => void;
|
|
15
15
|
options?: StreamLayerSDKTvOptions;
|
|
16
|
+
isDesktop?: boolean;
|
|
16
17
|
}
|
|
17
|
-
export declare const PauseAd: React.FC<PauseAdProps
|
|
18
|
+
export declare const PauseAd: React.FC<PauseAdProps & {
|
|
19
|
+
sdk: StreamLayerSDK;
|
|
20
|
+
}>;
|
|
@@ -1,116 +1,138 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { cx as
|
|
3
|
-
import { useFocusable as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useStore as
|
|
6
|
-
import { eventBus as
|
|
7
|
-
import { useLoadGAMStatic as
|
|
8
|
-
import { PauseAdOverlay as
|
|
9
|
-
const
|
|
10
|
-
var
|
|
11
|
-
const [,
|
|
12
|
-
return (
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { jsx as r, jsxs as x } from "react/jsx-runtime";
|
|
2
|
+
import { cx as M } from "@linaria/core";
|
|
3
|
+
import { useFocusable as F } from "@noriginmedia/norigin-spatial-navigation";
|
|
4
|
+
import { useState as b, useRef as B, useCallback as D, useEffect as P } from "react";
|
|
5
|
+
import { useStore as I } from "@streamlayer/react-polyfills";
|
|
6
|
+
import { eventBus as g } from "@streamlayer/sdk-web-interfaces";
|
|
7
|
+
import { useLoadGAMStatic as C } from "../../../ui/advertisement/overlay/externalAd/vast-player/useGAMStatic.js";
|
|
8
|
+
import { PauseAdOverlay as j, PauseAdContent as K, PauseAdGradientRight as N, PauseAdGradientBottom as O, PauseAdTopLeft as V, PauseAdTitle as $, PauseAdCaption as q, PauseAdBottomLeft as z, PauseAdPlayButton as H, PauseAdSidebar as J, PauseAdTitleDescription as Q, ExternalAdContainer as L } from "./styles.js";
|
|
9
|
+
const W = ({ vastUrl: t, isDesktop: n }) => {
|
|
10
|
+
var u;
|
|
11
|
+
const [, y] = C(), e = I(y, { keys: [t] });
|
|
12
|
+
return P(() => {
|
|
13
|
+
e && e[t] && e[t].imageSrc && e[t].id && g.emit("exposedPauseAd", {
|
|
14
|
+
action: "rendered",
|
|
15
|
+
payload: {
|
|
16
|
+
id: e[t].id
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}, [e, t]), (u = e == null ? void 0 : e[t]) != null && u.imageSrc ? !e[t].adUrl || !n ? /* @__PURE__ */ r(L, { src: e[t].imageSrc }) : /* @__PURE__ */ r(
|
|
20
|
+
"a",
|
|
21
|
+
{
|
|
22
|
+
onClick: () => {
|
|
23
|
+
g.emit("exposedPauseAd", {
|
|
24
|
+
action: "navigated",
|
|
25
|
+
payload: {
|
|
26
|
+
id: e[t].id
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
href: e[t].adUrl,
|
|
31
|
+
target: "_blank",
|
|
32
|
+
rel: "noopener noreferrer",
|
|
33
|
+
children: /* @__PURE__ */ r(L, { src: e[t].imageSrc })
|
|
34
|
+
}
|
|
35
|
+
) : null;
|
|
36
|
+
}, X = ({ isClosing: t, title: n, caption: y, onPlay: e, onClose: u, vastUrl: f, options: a, isDesktop: m }) => {
|
|
37
|
+
const T = (a == null ? void 0 : a.showPauseButton) ?? !0, { ref: d, focusSelf: p } = F({
|
|
15
38
|
focusKey: "sl-pause-ad-play",
|
|
16
|
-
onEnterRelease:
|
|
39
|
+
onEnterRelease: e,
|
|
17
40
|
isFocusBoundary: !0,
|
|
18
41
|
forceFocus: !0
|
|
19
42
|
});
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
}, [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
43
|
+
return P(() => {
|
|
44
|
+
d.current && p();
|
|
45
|
+
}, [d, p]), P(() => {
|
|
46
|
+
if (!u)
|
|
47
|
+
return () => {
|
|
48
|
+
};
|
|
49
|
+
const h = (A) => {
|
|
50
|
+
const s = A.keyCode;
|
|
51
|
+
if (s === 461 || s === 10009 || s === 27 || s === 8) {
|
|
52
|
+
A.preventDefault(), A.stopPropagation(), A.stopImmediatePropagation(), u();
|
|
27
53
|
return;
|
|
28
54
|
}
|
|
29
55
|
};
|
|
30
|
-
return window.addEventListener("keydown",
|
|
31
|
-
}, [
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
/* @__PURE__ */
|
|
56
|
+
return window.addEventListener("keydown", h, { capture: !0 }), () => window.removeEventListener("keydown", h, { capture: !0 });
|
|
57
|
+
}, [u]), /* @__PURE__ */ r(j, { className: M("SL_PauseAdOverlay", t && "pause-ad-closing"), children: /* @__PURE__ */ x(K, { children: [
|
|
58
|
+
/* @__PURE__ */ r(N, {}),
|
|
59
|
+
/* @__PURE__ */ r(O, {}),
|
|
60
|
+
/* @__PURE__ */ x(V, { children: [
|
|
61
|
+
/* @__PURE__ */ r($, { children: n }),
|
|
62
|
+
/* @__PURE__ */ r(q, { children: y })
|
|
37
63
|
] }),
|
|
38
|
-
|
|
39
|
-
|
|
64
|
+
T && /* @__PURE__ */ r(z, { children: /* @__PURE__ */ r(
|
|
65
|
+
H,
|
|
40
66
|
{
|
|
41
|
-
ref:
|
|
42
|
-
onClick:
|
|
43
|
-
onMouseEnter: () =>
|
|
67
|
+
ref: d,
|
|
68
|
+
onClick: e,
|
|
69
|
+
onMouseEnter: () => d.current.focus(),
|
|
44
70
|
"aria-label": "Resume playback"
|
|
45
71
|
}
|
|
46
72
|
) }),
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
|
|
49
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ x(J, { children: [
|
|
74
|
+
f && /* @__PURE__ */ r(W, { isDesktop: m, vastUrl: f }),
|
|
75
|
+
/* @__PURE__ */ r(Q, { children: "ADVERTISEMENT" })
|
|
50
76
|
] })
|
|
51
77
|
] }) });
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const [T, E] = B();
|
|
65
|
-
return h(() => {
|
|
78
|
+
}, re = ({ showPauseAd: t, vastUrls: n, title: y, caption: e, sdk: u, onClose: f, onRender: a, options: m, isDesktop: T }) => {
|
|
79
|
+
const d = (m == null ? void 0 : m.pauseAdDelay) ?? 5e3, [p, h] = b(!1), [A, s] = b(!1), c = B(), i = n == null ? void 0 : n[0].url, S = B(i);
|
|
80
|
+
S.current = i;
|
|
81
|
+
const [E, k] = C(), o = D(() => {
|
|
82
|
+
f && (g.emit("exposedPauseAd", {
|
|
83
|
+
action: "closed",
|
|
84
|
+
payload: {}
|
|
85
|
+
}), f());
|
|
86
|
+
}, [f]), G = D(() => {
|
|
87
|
+
u.controlVideoPlayer({ play: !0 });
|
|
88
|
+
}, [u]);
|
|
89
|
+
return P(() => {
|
|
66
90
|
if (t && i) {
|
|
67
|
-
|
|
91
|
+
g.emit("exposedPauseAd", {
|
|
68
92
|
action: "enabled",
|
|
69
93
|
payload: {}
|
|
70
|
-
}),
|
|
71
|
-
|
|
94
|
+
}), E(i).then((l) => {
|
|
95
|
+
S.current === i && (l == null ? void 0 : l.success) !== !0 && (clearTimeout(c.current), o == null || o());
|
|
72
96
|
}).catch(() => {
|
|
73
|
-
|
|
97
|
+
S.current === i && (clearTimeout(c.current), o == null || o());
|
|
74
98
|
});
|
|
75
99
|
const w = () => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
action: "rendered",
|
|
79
|
-
payload: {}
|
|
80
|
-
})) : c.current = setTimeout(() => {
|
|
100
|
+
const l = k.get()[S.current];
|
|
101
|
+
l != null && l.imageSrc ? (clearTimeout(c.current), s(!1), h(!0)) : c.current = setTimeout(() => {
|
|
81
102
|
w();
|
|
82
103
|
}, 200);
|
|
83
104
|
};
|
|
84
105
|
c.current = setTimeout(() => {
|
|
85
106
|
w();
|
|
86
|
-
},
|
|
107
|
+
}, d);
|
|
87
108
|
} else
|
|
88
|
-
|
|
109
|
+
g.emit("exposedPauseAd", {
|
|
89
110
|
action: "disabled",
|
|
90
111
|
payload: {}
|
|
91
|
-
}),
|
|
92
|
-
|
|
112
|
+
}), s(!0), c.current = setTimeout(() => {
|
|
113
|
+
h(!1);
|
|
93
114
|
}, 400);
|
|
94
115
|
return () => {
|
|
95
116
|
c.current && clearTimeout(c.current);
|
|
96
117
|
};
|
|
97
|
-
}, [
|
|
98
|
-
|
|
99
|
-
}, [
|
|
100
|
-
|
|
101
|
-
}, [
|
|
102
|
-
|
|
118
|
+
}, [k, E, o, d, t, i]), P(() => {
|
|
119
|
+
a == null || a({ rendered: p });
|
|
120
|
+
}, [p, a]), P(() => () => {
|
|
121
|
+
a == null || a({ rendered: !1 });
|
|
122
|
+
}, [a]), p ? /* @__PURE__ */ r(
|
|
123
|
+
X,
|
|
103
124
|
{
|
|
104
|
-
onClose:
|
|
105
|
-
isClosing:
|
|
106
|
-
title:
|
|
107
|
-
caption:
|
|
108
|
-
onPlay:
|
|
125
|
+
onClose: o,
|
|
126
|
+
isClosing: A,
|
|
127
|
+
title: y,
|
|
128
|
+
caption: e,
|
|
129
|
+
onPlay: G,
|
|
109
130
|
vastUrl: i,
|
|
110
|
-
options: m
|
|
131
|
+
options: m,
|
|
132
|
+
isDesktop: T
|
|
111
133
|
}
|
|
112
134
|
) : null;
|
|
113
135
|
};
|
|
114
136
|
export {
|
|
115
|
-
|
|
137
|
+
re as PauseAd
|
|
116
138
|
};
|
package/lib/app/webos/index.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
2
|
import { StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
|
|
3
|
-
import {
|
|
3
|
+
import { StreamLayerSDKAdvertisementWebOS } from './Advertisement';
|
|
4
|
+
import { PauseAd, PauseAdProps } from './ExposedPauseAd/PauseAd';
|
|
5
|
+
import { StreamLayerSDKQuestionWebOS } from './Question';
|
|
6
|
+
export { StreamLayerSDKAdvertisementWebOS, StreamLayerSDKQuestionWebOS, PauseAd, type PauseAdProps };
|
|
4
7
|
export type StreamLayerSDKTvOptions = {
|
|
5
8
|
showPauseButton?: boolean;
|
|
6
9
|
pauseAdDelay?: number;
|
|
7
10
|
};
|
|
8
11
|
export type StreamLayerSDKTvProps = {
|
|
9
12
|
persistent?: boolean;
|
|
10
|
-
children
|
|
13
|
+
children?: React.ReactNode;
|
|
11
14
|
sdk: StreamLayerSDK;
|
|
12
15
|
showPauseAd?: boolean;
|
|
13
16
|
pauseAdVastUrl?: PauseAdProps['vastUrls'];
|