@streamlayer/react-ui 1.32.4 → 1.33.2

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.
Files changed (67) hide show
  1. package/lib/app/app/Advertisement/index.js +14 -15
  2. package/lib/app/app/Features/Gamification/Leaderboard.js +46 -36
  3. package/lib/app/app/Features/Gamification/Question.js +42 -42
  4. package/lib/app/app/Features/Gamification/QuestionAdvertisement.js +19 -25
  5. package/lib/app/app/Features/Gamification/index.js +29 -28
  6. package/lib/app/app/Notifications/Onboarding/index.js +45 -42
  7. package/lib/app/app/story/index.js +24 -24
  8. package/lib/app/app/story/insight/index.js +14 -15
  9. package/lib/app/app/story/insight/video.js +3 -3
  10. package/lib/app/app/story/promotion/content.js +5 -5
  11. package/lib/app/app/story/promotion/index.d.ts +1 -0
  12. package/lib/app/app/story/promotion/index.js +24 -25
  13. package/lib/app/app/story/promotion/video.d.ts +0 -1
  14. package/lib/app/app/story/promotion/video.js +41 -43
  15. package/lib/app/app/story/promotion-notification/index.js +15 -16
  16. package/lib/app/app/story/promotion-notification/video.d.ts +0 -1
  17. package/lib/app/app/story/promotion-notification/video.js +22 -30
  18. package/lib/app/app/story/settings/index.js +6 -6
  19. package/lib/app/app/story/settings/login.js +1 -1
  20. package/lib/app/app/story/video.js +28 -28
  21. package/lib/app/login/demo.js +19 -18
  22. package/lib/app/masters/BetPack/BetPackContent/EndScreen/index.d.ts +0 -1
  23. package/lib/app/masters/BetPack/BetPackContent/EndScreen/index.js +17 -17
  24. package/lib/app/masters/Notifications/Onboarding/index.js +42 -39
  25. package/lib/app/masters/masters.d.ts +1 -0
  26. package/lib/app/masters/masters.js +34 -32
  27. package/lib/app/masters/provider.d.ts +4 -0
  28. package/lib/app/masters/provider.js +23 -0
  29. package/lib/app/masters/story/components.js +48 -52
  30. package/lib/app/masters/story/index.js +16 -15
  31. package/lib/app/tgl/index.d.ts +1 -0
  32. package/lib/app/tgl/index.js +19 -20
  33. package/lib/app/tgl/video.d.ts +0 -1
  34. package/lib/app/tgl/video.js +40 -42
  35. package/lib/app/webos/ExposedPauseAd/PauseAd.js +68 -68
  36. package/lib/app/webos/story.js +26 -26
  37. package/lib/app/webos/ui/Sidebar/styles.js +82 -888
  38. package/lib/assets/style.css +1 -1
  39. package/lib/core/app.d.ts +7 -0
  40. package/lib/core/app.js +14 -0
  41. package/lib/core/event.d.ts +6 -0
  42. package/lib/core/event.js +5 -0
  43. package/lib/core/hooks.d.ts +16 -0
  44. package/lib/core/hooks.js +8 -0
  45. package/lib/core/provider.d.ts +49 -0
  46. package/lib/core/provider.js +9 -0
  47. package/lib/hooks-B0Qttldg.js +99 -0
  48. package/lib/index.d.ts +0 -1
  49. package/lib/index.js +2 -4
  50. package/lib/ui/advertisement/banner/index.d.ts +2 -2
  51. package/lib/ui/advertisement/notification/lower-third/index.js +34 -30
  52. package/lib/ui/advertisement/overlay/externalAd/vast-player/useGAMPlayer.js +100 -33212
  53. package/lib/ui/advertisement/overlay/externalAd/vast-player/useGAMStatic.js +13 -13
  54. package/lib/ui/advertisement/overlay/externalAd/vast-player/useVastAds.js +63 -204
  55. package/lib/ui/gamification/leaderboard/static.d.ts +1 -1
  56. package/lib/ui/gamification/question/inapp/notification/AdNotification/NotificationMedia/index.d.ts +1 -1
  57. package/lib/ui/gamification/question/inapp/notification/AdNotification/NotificationMedia/index.js +1 -1
  58. package/lib/ui/icons/index.d.ts +198 -66
  59. package/lib/ui/video-player/index.js +26 -23
  60. package/lib/useStreamLayerApp.d.ts +23 -0
  61. package/lib/useStreamLayerApp.js +167 -0
  62. package/lib/utils/debug/index.js +8 -8
  63. package/package.json +42 -35
  64. package/lib/index-l-eyvmpL.js +0 -3758
  65. package/lib/utils/createDemo.d.ts +0 -12
  66. package/lib/utils/createDemo.js +0 -49
  67. package/lib/vast-client.min-B0NUra1B.js +0 -1060
@@ -1,15 +1,15 @@
1
- import { _ as C } from "../../../../../vast-client.min-B0NUra1B.js";
2
- import { useRef as P, useCallback as k } from "react";
1
+ import { VASTClient as x } from "@dailymotion/vast-client";
2
+ import { useRef as P, useCallback as V } from "react";
3
3
  import { eventBus as l } from "@streamlayer/sdk-web-interfaces";
4
- import { createLogger as I } from "@streamlayer/sdk-web-logger";
5
- import { m as K } from "../../../../../index-DSi8Qgfs.js";
6
- const V = {}, B = new C(), i = K(V), d = I("ui:gam-static"), b = (n) => new Promise((m, e) => {
4
+ import { createLogger as k } from "@streamlayer/sdk-web-logger";
5
+ import { m as I } from "../../../../../index-DSi8Qgfs.js";
6
+ const K = {}, B = new x(), i = I(K), d = k("ui:gam-static"), b = (n) => new Promise((m, e) => {
7
7
  const r = new Image();
8
8
  r.onload = () => m(n), r.onerror = () => e(), r.src = n;
9
- }), $ = () => {
9
+ }), j = () => {
10
10
  const n = P(0);
11
- return [k(async (e) => {
12
- var p, g, f, v, y, A, T, R, S, w, h;
11
+ return [V(async (e) => {
12
+ var p, g, f, v, y, A, T, S, R, w, h;
13
13
  if ((p = i.get()[e]) != null && p.imageSrc)
14
14
  return { success: !0 };
15
15
  const r = Date.now();
@@ -27,13 +27,13 @@ const V = {}, B = new C(), i = K(V), d = I("ui:gam-static"), b = (n) => new Prom
27
27
  const s = t.creatives.find((o) => o.type === "nonlinear");
28
28
  if (s) {
29
29
  d.debug(s, "nonlinear");
30
- const o = (f = (g = s.variations) == null ? void 0 : g[0]) == null ? void 0 : f.staticResource, x = (y = (v = s.variations) == null ? void 0 : v[0]) == null ? void 0 : y.nonlinearClickThroughURLTemplate;
30
+ const o = (f = (g = s.variations) == null ? void 0 : g[0]) == null ? void 0 : f.staticResource, L = (y = (v = s.variations) == null ? void 0 : v[0]) == null ? void 0 : y.nonlinearClickThroughURLTemplate;
31
31
  if (o)
32
32
  return await b(o), i.setKey(e, {
33
33
  id: t.id || "",
34
34
  url: e,
35
35
  imageSrc: o,
36
- adUrl: x
36
+ adUrl: L
37
37
  }), l.emit("exposedPauseAd", {
38
38
  action: "loaded",
39
39
  payload: {
@@ -43,13 +43,13 @@ const V = {}, B = new C(), i = K(V), d = I("ui:gam-static"), b = (n) => new Prom
43
43
  }
44
44
  const a = t.creatives.find((o) => o.type === "companion");
45
45
  d.debug(a, "companion");
46
- const u = (S = (R = (T = (A = a == null ? void 0 : a.variations) == null ? void 0 : A[0]) == null ? void 0 : T.staticResources) == null ? void 0 : R[0]) == null ? void 0 : S.url, L = (h = (w = a == null ? void 0 : a.variations) == null ? void 0 : w[0]) == null ? void 0 : h.companionClickThroughURLTemplate;
46
+ const u = (R = (S = (T = (A = a == null ? void 0 : a.variations) == null ? void 0 : A[0]) == null ? void 0 : T.staticResources) == null ? void 0 : S[0]) == null ? void 0 : R.url, C = (h = (w = a == null ? void 0 : a.variations) == null ? void 0 : w[0]) == null ? void 0 : h.companionClickThroughURLTemplate;
47
47
  if (u)
48
48
  return await b(u), i.setKey(e, {
49
49
  id: t.id || "",
50
50
  url: e,
51
51
  imageSrc: u,
52
- adUrl: L
52
+ adUrl: C
53
53
  }), l.emit("exposedPauseAd", {
54
54
  action: "loaded",
55
55
  payload: {
@@ -65,5 +65,5 @@ const V = {}, B = new C(), i = K(V), d = I("ui:gam-static"), b = (n) => new Prom
65
65
  }, []), i];
66
66
  };
67
67
  export {
68
- $ as useLoadGAMStatic
68
+ j as useLoadGAMStatic
69
69
  };
@@ -1,242 +1,101 @@
1
- import { _ as D } from "../../../../../vast-client.min-B0NUra1B.js";
2
- import { useState as M, useRef as A, useEffect as w } from "react";
3
- import { v4 as b, validate as R, v5 as k } from "uuid";
4
- import { a as I } from "../../../../../index-tnt2CtQe.js";
5
- class U {
6
- constructor(e) {
7
- this.id = e.getAttribute("id"), this.allowMultipleAds = e.getAttribute("allowMultipleAds"), this.followRedirects = e.getAttribute("followRedirects"), this.vastAdData = null, this.adTagURI = null, this.customData = null;
8
- for (const s in e.childNodes) {
9
- const t = e.childNodes[s];
10
- switch (t.localName) {
11
- case "AdTagURI":
12
- this.adTagURI = {
13
- templateType: t.getAttribute("templateType"),
14
- uri: (t.textContent || t.text || "").trim()
15
- };
16
- break;
17
- case "VASTAdData":
18
- for (this.vastAdData = t.firstChild; this.vastAdData && this.vastAdData.nodeType !== 1; )
19
- this.vastAdData = this.vastAdData.nextSibling;
20
- break;
21
- case "CustomAdData":
22
- this.customData = t;
23
- break;
24
- }
25
- }
26
- }
27
- }
28
- function y(r, e) {
29
- const s = [];
30
- for (const t in r.childNodes) {
31
- const n = r.childNodes[t];
32
- (n.nodeName === e || e === `vmap:${n.nodeName}` || n.nodeName === `vmap:${e}`) && s.push(n);
33
- }
34
- return s;
35
- }
36
- function T(r) {
37
- if (!r || !r.childNodes)
38
- return {};
39
- const e = r.childNodes, s = [];
40
- for (const n in e) {
41
- const a = e[n];
42
- a.nodeName === "#cdata-section" && s.push(a);
43
- }
44
- if (s && s.length > 0)
45
- try {
46
- return JSON.parse(s[0].data);
47
- } catch {
48
- }
49
- let t = "";
50
- for (const n in e) {
51
- const a = e[n];
52
- switch (a.nodeName) {
53
- case "#text":
54
- t += a.textContent.trim();
55
- break;
56
- case "#cdata-section":
57
- t += a.data;
58
- break;
59
- }
60
- }
61
- return t;
62
- }
63
- function N(r) {
64
- const e = {
65
- attributes: {},
66
- children: {},
67
- value: {}
68
- };
69
- e.value = T(r);
70
- const s = r.attributes;
71
- if (s)
72
- for (const n in s) {
73
- const a = s[n];
74
- a.nodeName && a.nodeValue !== void 0 && a.nodeValue !== null && (e.attributes[a.nodeName] = a.nodeValue);
75
- }
76
- const t = r.childNodes;
77
- if (t)
78
- for (const n in t) {
79
- const a = t[n];
80
- a.nodeName && a.nodeName.substring(0, 1) !== "#" && (e.children[a.nodeName] = N(a));
81
- }
82
- return e;
83
- }
84
- class K {
85
- constructor(e) {
86
- this.timeOffset = e.getAttribute("timeOffset"), this.breakType = e.getAttribute("breakType"), this.breakId = e.getAttribute("breakId"), this.repeatAfter = e.getAttribute("repeatAfter"), this.adSource = null, this.trackingEvents = [], this.extensions = [];
87
- for (const s in e.childNodes) {
88
- const t = e.childNodes[s];
89
- switch (t.localName) {
90
- case "AdSource":
91
- this.adSource = new U(t);
92
- break;
93
- case "TrackingEvents":
94
- for (const n in t.childNodes) {
95
- const a = t.childNodes[n];
96
- a.localName === "Tracking" && this.trackingEvents.push({
97
- event: a.getAttribute("event"),
98
- uri: (a.textContent || a.text || "").trim()
99
- });
100
- }
101
- break;
102
- case "Extensions":
103
- this.extensions = y(t, "Extension").map(
104
- (n) => N(n)
105
- );
106
- break;
107
- }
108
- }
109
- }
110
- track(e, s) {
111
- for (const t in this.trackingEvents) {
112
- const n = this.trackingEvents[t];
113
- if (n.event === e) {
114
- let { uri: a } = n;
115
- n.event === "error" && (a = a.replace("[ERRORCODE]", s)), this.tracker(a);
116
- }
117
- }
118
- }
119
- // Easy to overwrite tracker client for unit testing
120
- tracker(e) {
121
- if (typeof window < "u" && window !== null) {
122
- const s = new Image();
123
- s.src = e;
124
- }
125
- }
126
- }
127
- class V {
128
- constructor(e) {
129
- if (!e || !e.documentElement || e.documentElement.localName !== "VMAP")
130
- throw new Error("Not a VMAP document");
131
- this.version = e.documentElement.getAttribute("version"), this.adBreaks = [], this.extensions = [];
132
- for (const s in e.documentElement.childNodes) {
133
- const t = e.documentElement.childNodes[s];
134
- switch (t.localName) {
135
- case "AdBreak":
136
- this.adBreaks.push(new K(t));
137
- break;
138
- case "Extensions":
139
- this.extensions = y(t, "Extension").map(
140
- (n) => N(n)
141
- );
142
- break;
143
- }
144
- }
145
- }
146
- }
147
- const C = (r, e) => {
148
- const s = goog.pal, t = new s.ConsentSettings();
149
- t.allowStorage = !1;
150
- const n = new s.NonceLoader(t);
1
+ import { VASTClient as R } from "@dailymotion/vast-client";
2
+ import { useState as A, useRef as P, useEffect as w } from "react";
3
+ import D from "vmap";
4
+ import { v4 as S, validate as L, v5 as y } from "uuid";
5
+ import { a as F } from "../../../../../index-tnt2CtQe.js";
6
+ const N = (a, s) => {
7
+ const o = goog.pal, c = new o.ConsentSettings();
8
+ c.allowStorage = !1;
9
+ const u = new o.NonceLoader(c);
151
10
  return async () => {
152
11
  try {
153
- const o = new URL(e), i = new s.NonceRequest();
154
- let c = localStorage.getItem("sl-device-id") || b(), d = sessionStorage.getItem("sl-ad-session-id");
155
- d || (d = b(), sessionStorage.setItem("sl-ad-session-id", d)), R(c) || (c = k(`https://${c}`, k.URL)), o.searchParams.get("url") || o.searchParams.set("url", "https://streamlayer.io"), o.searchParams.get("description_url") || o.searchParams.set("description_url", "https://streamlayer.io"), i.adWillAutoPlay = o.searchParams.get("vpa") === "auto", i.adWillPlayMuted = o.searchParams.get("vpmute") === "1", i.continuousPlayback = !0, i.descriptionUrl = o.searchParams.get("description_url"), i.iconsSupported = !0, i.sessionId = c, i.supportedApiFrameworks = "2,7,9", i.videoHeight = r.clientHeight, i.videoWidth = r.clientWidth;
156
- const m = await n.loadNonceManager(i);
157
- return o.searchParams.get("is_lat") === "[placeholder]" && o.searchParams.set("is_lat", "1"), o.searchParams.get("rdid") === "[placeholder]" && o.searchParams.set("rdid", c), o.searchParams.get("correlator") === "[placeholder]" && o.searchParams.set("correlator", d), o.searchParams.set("wta", "1"), o.searchParams.set("givn", m.getNonce()), {
158
- url: o,
12
+ const e = new URL(s), t = new o.NonceRequest();
13
+ let r = localStorage.getItem("sl-device-id") || S(), n = sessionStorage.getItem("sl-ad-session-id");
14
+ n || (n = S(), sessionStorage.setItem("sl-ad-session-id", n)), L(r) || (r = y(`https://${r}`, y.URL)), e.searchParams.get("url") || e.searchParams.set("url", "https://streamlayer.io"), e.searchParams.get("description_url") || e.searchParams.set("description_url", "https://streamlayer.io"), t.adWillAutoPlay = e.searchParams.get("vpa") === "auto", t.adWillPlayMuted = e.searchParams.get("vpmute") === "1", t.continuousPlayback = !0, t.descriptionUrl = e.searchParams.get("description_url"), t.iconsSupported = !0, t.sessionId = r, t.supportedApiFrameworks = "2,7,9", t.videoHeight = a.clientHeight, t.videoWidth = a.clientWidth;
15
+ const g = await u.loadNonceManager(t);
16
+ return e.searchParams.get("is_lat") === "[placeholder]" && e.searchParams.set("is_lat", "1"), e.searchParams.get("rdid") === "[placeholder]" && e.searchParams.set("rdid", r), e.searchParams.get("correlator") === "[placeholder]" && e.searchParams.set("correlator", n), e.searchParams.set("wta", "1"), e.searchParams.set("givn", g.getNonce()), {
17
+ url: e,
159
18
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
160
- manager: m
19
+ manager: g
161
20
  };
162
- } catch (o) {
163
- console.log("AdsManager could not be started", o);
21
+ } catch (e) {
22
+ console.log("AdsManager could not be started", e);
164
23
  return;
165
24
  }
166
25
  };
167
- }, L = new D(), x = (r) => r.creatives.find((e) => e.mediaFiles), B = (r) => {
168
- var s;
169
- const e = r == null ? void 0 : r.mediaFiles;
170
- return e != null && e.length && ((s = e.find((t) => t.fileURL)) == null ? void 0 : s.fileURL) || "";
171
- }, h = I({
26
+ }, _ = new R(), x = (a) => a.creatives.find((s) => s.mediaFiles), W = (a) => {
27
+ var o;
28
+ const s = a == null ? void 0 : a.mediaFiles;
29
+ return s != null && s.length && ((o = s.find((c) => c.fileURL)) == null ? void 0 : o.fileURL) || "";
30
+ }, d = F({
172
31
  ads: [],
173
32
  autoplay: !0,
174
33
  muted: !1,
175
34
  nonceManager: void 0
176
- }), $ = (r, e) => {
177
- const [s, t] = M(), n = A(Date.now()), a = A(Date.now());
35
+ }), H = (a, s) => {
36
+ const [o, c] = A(), u = P(Date.now()), m = P(Date.now());
178
37
  return w(() => {
179
- if (!e || !(r != null && r.current))
38
+ if (!s || !(a != null && a.current))
180
39
  return;
181
- const o = C(r.current, e), i = Date.now();
182
- n.current = i, h.set({
40
+ const e = N(a.current, s), t = Date.now();
41
+ u.current = t, d.set({
183
42
  ads: [],
184
43
  autoplay: !0,
185
44
  muted: !1,
186
45
  nonceManager: void 0
187
- }), o().then((c) => {
188
- n.current === i && c && (t(c.url), h.set({
46
+ }), e().then((r) => {
47
+ u.current === t && r && (c(r.url), d.set({
189
48
  ads: [],
190
49
  autoplay: !0,
191
50
  muted: !1,
192
- nonceManager: c.manager
51
+ nonceManager: r.manager
193
52
  }));
194
- }).catch((c) => {
195
- console.error(c);
53
+ }).catch((r) => {
54
+ console.error(r);
196
55
  });
197
- }, [r, e]), w(() => {
198
- const o = async (i, c) => {
199
- let d = [];
200
- if (i.searchParams.get("output") === "vmap") {
201
- const l = await fetch(i.toString()), g = new DOMParser(), f = await l.text(), u = g.parseFromString(f, "text/xml");
202
- d = new V(u).adBreaks.map((v) => v.adSource.adTagURI.uri);
56
+ }, [a, s]), w(() => {
57
+ const e = async (t, r) => {
58
+ let n = [];
59
+ if (t.searchParams.get("output") === "vmap") {
60
+ const i = await fetch(t.toString()), f = new DOMParser(), p = await i.text(), l = f.parseFromString(p, "text/xml");
61
+ n = new D(l).adBreaks.map((v) => v.adSource.adTagURI.uri);
203
62
  } else
204
- d = [i.toString()];
205
- const m = await Promise.all(
206
- d.map((l, g) => L.get(l).then((f) => {
207
- if (a.current === c) {
208
- const u = f.ads.find((S) => S.creatives.length > 0);
209
- if (!u)
63
+ n = [t.toString()];
64
+ const g = await Promise.all(
65
+ n.map((i, f) => _.get(i).then((p) => {
66
+ if (m.current === r) {
67
+ const l = p.ads.find((I) => I.creatives.length > 0);
68
+ if (!l)
210
69
  return;
211
- const p = x(u), v = B(p);
70
+ const h = x(l), v = W(h);
212
71
  return {
213
- creative: p,
214
- order: g,
72
+ creative: h,
73
+ order: f,
215
74
  mediaFileUrl: v,
216
- ad: u,
217
- raw: f
75
+ ad: l,
76
+ raw: p
218
77
  };
219
78
  }
220
79
  }))
221
- ), P = i.searchParams.get("vpa") !== "click", E = i.searchParams.get("vpmute") === "1";
222
- h.set({
223
- ...h.get(),
224
- ads: m.filter((l) => !!l),
225
- autoplay: P,
226
- muted: E
80
+ ), M = t.searchParams.get("vpa") !== "click", U = t.searchParams.get("vpmute") === "1";
81
+ d.set({
82
+ ...d.get(),
83
+ ads: g.filter((i) => !!i),
84
+ autoplay: M,
85
+ muted: U
227
86
  });
228
87
  };
229
- if (s) {
230
- const i = Date.now();
231
- a.current = i, o(s, i);
88
+ if (o) {
89
+ const t = Date.now();
90
+ m.current = t, e(o, t);
232
91
  }
233
92
  return () => {
234
- a.current = 0;
93
+ m.current = 0;
235
94
  };
236
- }, [s]), h;
95
+ }, [o]), d;
237
96
  };
238
97
  export {
239
98
  x as getCreative,
240
- B as getMediaFileUrl,
241
- $ as useVastAds
99
+ W as getMediaFileUrl,
100
+ H as useVastAds
242
101
  };
@@ -1,4 +1,4 @@
1
- import { ScrollNodeRef } from '../../../app/masters';
1
+ import { ScrollNodeRef } from '../../../app';
2
2
  import { ScrollStore } from '../../../app/useSdkScroll';
3
3
  import { LeaderboardItemProps } from './list-item';
4
4
  type LeaderboardListProps = {
@@ -1,6 +1,6 @@
1
1
  import { NotificationUseContentMedia, QuestionImages } from '@streamlayer/sdk-web-types';
2
2
  export declare const MediaComponentWrap: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & {
3
- color: string;
3
+ color?: string;
4
4
  }>;
5
5
  export declare const MediaImgBottom: {
6
6
  __wyw_meta: unknown;
@@ -4,7 +4,7 @@ import { QuestionImages as o, NotificationUseContentMedia as l } from "@streamla
4
4
  import { VideoPlayer as I } from "../../../../../../video-player/index.js";
5
5
  const N = () => ({
6
6
  color: n
7
- }) => n, m = /* @__PURE__ */ e("div")({
7
+ }) => n || "transparent", m = /* @__PURE__ */ e("div")({
8
8
  name: "MediaComponentWrap",
9
9
  class: "mek728j",
10
10
  propsAsIs: !1,