@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.
@@ -1,45 +1,45 @@
1
1
  import { jsxs as w, Fragment as b, jsx as u } from "react/jsx-runtime";
2
- import { cx as V } from "@linaria/core";
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 D, useEffect as h, useRef as E, useCallback as I } from "react";
6
- import { r as q } from "../../../index-DALxy-8N.js";
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 x } from "./Onboarding/index.js";
14
- import { HiddenContainer as P, Container as z, InnerContainer as B, NotificationRefreshing as H, Pill as S } from "./styles.js";
15
- const v = (n) => {
16
- const [e, d] = k(0), i = E(null), l = D(() => new ResizeObserver((r) => {
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(r)) {
20
- for (const c of r)
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((r) => {
28
- i.current = r;
29
- }, []), a = I((r) => {
30
- d(r);
27
+ }), []), s = I((n) => {
28
+ i.current = n;
29
+ }, []), a = I((n) => {
30
+ d(n);
31
31
  }, []);
32
32
  return h(() => {
33
- const r = i.current;
34
- return r ? (l.observe(r), () => {
35
- l.unobserve(r);
33
+ const n = i.current;
34
+ return n ? (l.observe(n), () => {
35
+ l.unobserve(n);
36
36
  }) : () => {
37
37
  };
38
- }, [n]), h(() => () => {
38
+ }, [r]), h(() => () => {
39
39
  l.disconnect();
40
40
  }), [s, e, a];
41
41
  }, Q = ({
42
- sdk: n,
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(), [r, f, c] = v(e.id);
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(P, {
59
- ref: r,
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(x, {
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: n,
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: n,
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: r
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 !n || !o.current ? null : q.createPortal(/* @__PURE__ */ u(S, {
122
- title: n.type === p.QUESTION_RESOLVED ? "Prediction result" : `New ${((m = A[(t = n.data) == null ? void 0 : t.questionType]) == null ? void 0 : m.label) || "notification"}`,
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, r.size, {
129
+ }) : T(d, n.size, {
130
130
  behavior: "smooth"
131
131
  }), e(null);
132
132
  },
133
- className: V(f && F, "sl-pill-button")
133
+ className: D(f && F, "sl-pill-button")
134
134
  }), o.current);
135
- }, re = ({
136
- sdk: n,
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 [r] = k(n.getNotificationsStore()), f = y(r), [c, o] = k(null), t = D(() => n.getActiveNotification(), [n, f]);
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: n,
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
- re as SDKNotifications
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 E } from "../useSdkScroll.js";
5
- import { useState as p, useMemo as O, useEffect as a, useRef as b, useCallback as N } from "react";
6
- import { r as R } from "../../../index-DALxy-8N.js";
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 g } from "@streamlayer/sdk-web-notifications";
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 = (n) => {
16
- const [t, c] = p(0), u = b(null), e = N((o) => {
17
- u.current = o;
15
+ const z = (o) => {
16
+ const [t, c] = p(0), u = E(null), e = N((n) => {
17
+ u.current = n;
18
18
  }, []);
19
- a(() => {
19
+ g(() => {
20
20
  var s;
21
- const o = (s = u.current) == null ? void 0 : s.getBoundingClientRect();
22
- o && c(o.height);
23
- }, [n]);
24
- const r = N((o) => {
25
- c(o);
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: n,
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, o, s] = z(t.id);
38
- return t.type === g.QUESTION ? /* @__PURE__ */ f(D, {
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 : o
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 === g.QUESTION_RESOLVED && ((d = (h = t.data) == null ? void 0 : h.question) != null && d.predictionResult) ? /* @__PURE__ */ l(x, {
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 : o
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 === g.ONBOARDING ? /* @__PURE__ */ l(A, {
68
+ }) : t.type === a.ONBOARDING ? /* @__PURE__ */ l(A, {
69
69
  style: {
70
- height: t.hiding ? 0 : o
70
+ height: t.hiding ? 0 : n
71
71
  },
72
72
  saveHeight: s,
73
- sdk: n,
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: n,
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: o,
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(o, {
96
+ } = y(n, {
97
97
  keys: ["tabsShown", "scrollPosition"]
98
98
  });
99
- a(() => {
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 !n || !i.current ? null : R.createPortal(/* @__PURE__ */ l(j, {
104
- title: n.type === g.QUESTION_RESOLVED ? "Prediction result" : `New ${((k = P[(I = n.data) == null ? void 0 : I.questionType]) == null ? void 0 : k.label) || "notification"}`,
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
- }) : E(e, h.size, {
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
- }, ot = ({
117
- sdk: n,
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: o
123
+ scrollStore: n
124
124
  }) => {
125
- const [s] = p(n.getNotificationsStore()), h = y(s), [d, m] = p(null), i = O(() => n.getActiveNotification(), [n, h]);
126
- return a(() => {
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]), a(() => {
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
- o.get().scrollPosition !== 0 && m(i);
136
+ n.get().scrollPosition !== 0 && m(i);
137
137
  }));
138
- }, [i]), a(() => {
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: n,
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: o,
154
+ scrollStore: n,
155
155
  useContainer: u,
156
156
  responsiveStore: e
157
157
  })]
158
158
  });
159
159
  };
160
160
  export {
161
- ot as SDKNotifications
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 p, useEffect as f } from "react";
3
- import { r as m } from "../index-DALxy-8N.js";
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(), [i, o] = s(null), a = p(
6
+ const t = l(), [c, o] = s(null), a = f(
7
7
  async (e) => {
8
- var c;
9
- if (e && ((c = navigator == null ? void 0 : navigator.clipboard) != null && c.writeText)) {
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.createPortal(/* @__PURE__ */ u(b, {}), r.current)), t.current = setTimeout(() => {
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 f(() => () => {
22
+ return p(() => () => {
23
23
  clearTimeout(t.current);
24
- }, []), [a, i];
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: () => void;
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 e, jsxs as g } from "react/jsx-runtime";
2
- import { cx as D } from "@linaria/core";
3
- import { useFocusable as L } from "@noriginmedia/norigin-spatial-navigation";
4
- import { useState as x, useRef as k, useEffect as h } from "react";
5
- import { useStore as G } from "@streamlayer/react-polyfills";
6
- import { eventBus as S } from "@streamlayer/sdk-web-interfaces";
7
- import { useLoadGAMStatic as B } from "../../../ui/advertisement/overlay/externalAd/vast-player/useGAMStatic.js";
8
- import { PauseAdOverlay as M, PauseAdContent as F, PauseAdGradientRight as I, PauseAdGradientBottom as j, PauseAdTopLeft as K, PauseAdTitle as N, PauseAdCaption as $, PauseAdBottomLeft as O, PauseAdPlayButton as V, PauseAdSidebar as _, PauseAdTitleDescription as q, ExternalAdContainer as b } from "./styles.js";
9
- const z = ({ vastUrl: t }) => {
10
- var s;
11
- const [, d] = B(), u = G(d, { keys: [t] });
12
- return (s = u == null ? void 0 : u[t]) != null && s.imageSrc ? u[t].adUrl ? /* @__PURE__ */ e("a", { href: u[t].adUrl, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ e(b, { src: u[t].imageSrc }) }) : /* @__PURE__ */ e(b, { src: u[t].imageSrc }) : null;
13
- }, H = ({ isClosing: t, title: d, caption: u, onPlay: s, onClose: f, vastUrl: a, options: r }) => {
14
- const m = (r == null ? void 0 : r.showPauseButton) ?? !0, { ref: n, focusSelf: l } = L({
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: s,
39
+ onEnterRelease: e,
17
40
  isFocusBoundary: !0,
18
41
  forceFocus: !0
19
42
  });
20
- return h(() => {
21
- n.current && l();
22
- }, [n, l]), h(() => {
23
- const P = (p) => {
24
- const o = p.keyCode;
25
- if (o === 461 || o === 10009 || o === 27 || o === 8) {
26
- p.preventDefault(), p.stopPropagation(), p.stopImmediatePropagation(), f == null || f();
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", P, { capture: !0 }), () => window.removeEventListener("keydown", P, { capture: !0 });
31
- }, [f]), /* @__PURE__ */ e(M, { className: D(t && "pause-ad-closing"), children: /* @__PURE__ */ g(F, { children: [
32
- /* @__PURE__ */ e(I, {}),
33
- /* @__PURE__ */ e(j, {}),
34
- /* @__PURE__ */ g(K, { children: [
35
- /* @__PURE__ */ e(N, { children: d }),
36
- /* @__PURE__ */ e($, { children: u })
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
- m && /* @__PURE__ */ e(O, { children: /* @__PURE__ */ e(
39
- V,
64
+ T && /* @__PURE__ */ r(z, { children: /* @__PURE__ */ r(
65
+ H,
40
66
  {
41
- ref: n,
42
- onClick: s,
43
- onMouseEnter: () => n.current.focus(),
67
+ ref: d,
68
+ onClick: e,
69
+ onMouseEnter: () => d.current.focus(),
44
70
  "aria-label": "Resume playback"
45
71
  }
46
72
  ) }),
47
- /* @__PURE__ */ g(_, { children: [
48
- a && /* @__PURE__ */ e(z, { vastUrl: a }),
49
- /* @__PURE__ */ e(q, { children: "ADVERTISEMENT" })
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
- }, U = ({
53
- showPauseAd: t,
54
- vastUrls: d,
55
- title: u,
56
- caption: s,
57
- onPlay: f,
58
- onClose: a,
59
- onRender: r,
60
- options: m
61
- }) => {
62
- const n = (m == null ? void 0 : m.pauseAdDelay) ?? 5e3, [l, P] = x(!1), [p, o] = x(!1), c = k(), i = d == null ? void 0 : d[0].url, y = k(i);
63
- y.current = i;
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
- S.emit("exposedPauseAd", {
91
+ g.emit("exposedPauseAd", {
68
92
  action: "enabled",
69
93
  payload: {}
70
- }), T(i).then((A) => {
71
- y.current === i && (A == null ? void 0 : A.success) !== !0 && (clearTimeout(c.current), a == null || a());
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
- y.current === i && (clearTimeout(c.current), a == null || a());
97
+ S.current === i && (clearTimeout(c.current), o == null || o());
74
98
  });
75
99
  const w = () => {
76
- var A;
77
- (A = E.get()[y.current]) != null && A.imageSrc ? (clearTimeout(c.current), o(!1), P(!0), S.emit("exposedPauseAd", {
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
- }, n);
107
+ }, d);
87
108
  } else
88
- S.emit("exposedPauseAd", {
109
+ g.emit("exposedPauseAd", {
89
110
  action: "disabled",
90
111
  payload: {}
91
- }), o(!0), c.current = setTimeout(() => {
92
- P(!1);
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
- }, [E, T, a, n, t, i]), h(() => {
98
- r == null || r({ rendered: l });
99
- }, [l, r]), h(() => () => {
100
- r == null || r({ rendered: !1 });
101
- }, [r]), l ? /* @__PURE__ */ e(
102
- H,
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: a,
105
- isClosing: p,
106
- title: u,
107
- caption: s,
108
- onPlay: f,
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
- U as PauseAd
137
+ re as PauseAd
116
138
  };
@@ -1,13 +1,16 @@
1
1
  import { Component } from 'react';
2
2
  import { StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
3
- import { PauseAdProps } from './ExposedPauseAd/PauseAd';
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: React.ReactNode;
13
+ children?: React.ReactNode;
11
14
  sdk: StreamLayerSDK;
12
15
  showPauseAd?: boolean;
13
16
  pauseAdVastUrl?: PauseAdProps['vastUrls'];