@streamlayer/react 1.20.6 → 1.20.7

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 (47) hide show
  1. package/lib/cjs/advertisement.js +29 -29
  2. package/lib/cjs/index.js +1 -1
  3. package/lib/cjs/index2.js +4 -4
  4. package/lib/cjs/insight.js +1 -1
  5. package/lib/cjs/masters2.js +7 -7
  6. package/lib/cjs/notification.js +1 -1
  7. package/lib/cjs/pause-ad.js +1 -1
  8. package/lib/cjs/points.js +1 -1
  9. package/lib/cjs/provider.js +15 -39
  10. package/lib/cjs/useStreamLayerApp2.js +16 -17
  11. package/lib/classic/cjs/advertisement.js +29 -29
  12. package/lib/classic/cjs/bet-pack.js +4 -4
  13. package/lib/classic/cjs/index.js +1 -1
  14. package/lib/classic/cjs/insight.js +1 -1
  15. package/lib/classic/cjs/notification.js +1 -1
  16. package/lib/classic/cjs/pause-ad.js +1 -1
  17. package/lib/classic/cjs/points.js +1 -1
  18. package/lib/classic/cjs/provider.js +10 -34
  19. package/lib/classic/cjs/useStreamLayerApp2.js +16 -17
  20. package/lib/classic/es/advertisement.js +2193 -2265
  21. package/lib/classic/es/bet-pack.js +14 -12
  22. package/lib/classic/es/index.js +16 -11
  23. package/lib/classic/es/insight.js +35 -30
  24. package/lib/classic/es/notification.js +108 -103
  25. package/lib/classic/es/pause-ad.js +63 -58
  26. package/lib/classic/es/points.js +28 -23
  27. package/lib/classic/es/provider.js +4290 -10434
  28. package/lib/classic/es/useStreamLayerApp.js +1 -1
  29. package/lib/classic/es/useStreamLayerApp2.js +3111 -5772
  30. package/lib/dist/cjs/gamification-feature2.js +1 -1
  31. package/lib/dist/cjs/index.js +1 -1
  32. package/lib/dist/cjs/masters.js +35 -60
  33. package/lib/dist/es/gamification-feature2.js +112 -105
  34. package/lib/dist/es/index.js +12 -7
  35. package/lib/dist/es/masters.js +9909 -18734
  36. package/lib/es/advertisement.js +2193 -2265
  37. package/lib/es/index.js +16 -11
  38. package/lib/es/index2.js +12 -10
  39. package/lib/es/insight.js +35 -30
  40. package/lib/es/masters2.js +28 -25
  41. package/lib/es/notification.js +135 -130
  42. package/lib/es/pause-ad.js +63 -58
  43. package/lib/es/points.js +28 -23
  44. package/lib/es/provider.js +4317 -10469
  45. package/lib/es/useStreamLayerApp.js +1 -1
  46. package/lib/es/useStreamLayerApp2.js +3111 -5772
  47. package/package.json +15 -15
@@ -1,15 +1,20 @@
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";
1
+ import { jsx as o, jsxs as I } from "react/jsx-runtime";
2
+ import { j as K, k as V, s as p, e as L, l as F, n as M, f as _, u as $, d as j, h as q } from "./provider.js";
3
+ import "nanostores";
4
+ import { useRef as x, useCallback as k, useState as C, useEffect as b, Component as z } from "react";
5
+ import "@nanostores/react";
6
+ import "lodash.throttle";
7
+ import "react-dom";
8
+ import "react-countup";
4
9
  import { c as N } from "./vast-client.min-B0NUra1B.js";
5
- const G = {}, H = new N(), w = V(G), E = K("ui:gam-static"), U = (r) => new Promise((e, t) => {
10
+ const G = {}, H = new N(), w = V(G), E = K("ui:gam-static"), R = (r) => new Promise((e, n) => {
6
11
  const s = new Image();
7
- s.onload = () => e(r), s.onerror = () => t(), s.src = r;
12
+ s.onload = () => e(r), s.onerror = () => n(), s.src = r;
8
13
  }), D = () => {
9
14
  const r = x(0);
10
- return [C(async (e) => {
11
- var t, s, c, o, l, n, u, i, h, m, f;
12
- if ((t = w.get()[e]) != null && t.imageSrc)
15
+ return [k(async (e) => {
16
+ var n, s, c, a, l, t, u, i, h, m, f;
17
+ if ((n = w.get()[e]) != null && n.imageSrc)
13
18
  return { success: !0 };
14
19
  const v = Date.now();
15
20
  r.current = v, w.setKey(e, { url: e });
@@ -22,15 +27,15 @@ const G = {}, H = new N(), w = V(G), E = K("ui:gam-static"), U = (r) => new Prom
22
27
  const g = y.creatives.find((S) => S.type === "nonlinear");
23
28
  if (g) {
24
29
  E.debug(g, "nonlinear");
25
- const S = (c = (s = g.variations) == null ? void 0 : s[0]) == null ? void 0 : c.staticResource, B = (l = (o = g.variations) == null ? void 0 : o[0]) == null ? void 0 : l.nonlinearClickThroughURLTemplate;
30
+ const S = (c = (s = g.variations) == null ? void 0 : s[0]) == null ? void 0 : c.staticResource, B = (l = (a = g.variations) == null ? void 0 : a[0]) == null ? void 0 : l.nonlinearClickThroughURLTemplate;
26
31
  if (S)
27
- return await U(S), w.setKey(e, { url: e, imageSrc: S, adUrl: B }), { success: !0 };
32
+ return await R(S), w.setKey(e, { url: e, imageSrc: S, adUrl: B }), { success: !0 };
28
33
  }
29
34
  const A = y.creatives.find((S) => S.type === "companion");
30
35
  E.debug(A, "companion");
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;
36
+ const T = (h = (i = (u = (t = A == null ? void 0 : A.variations) == null ? void 0 : t[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
37
  if (T)
33
- return await U(T), w.setKey(e, { url: e, imageSrc: T, adUrl: P }), { success: !0 };
38
+ return await R(T), w.setKey(e, { url: e, imageSrc: T, adUrl: P }), { success: !0 };
34
39
  }
35
40
  }
36
41
  } catch (d) {
@@ -78,20 +83,20 @@ const G = {}, H = new N(), w = V(G), E = K("ui:gam-static"), U = (r) => new Prom
78
83
  name: "PauseAdSidebar",
79
84
  class: "p14estxv",
80
85
  propsAsIs: !1
81
- }), ne = /* @__PURE__ */ p("span")({
86
+ }), te = /* @__PURE__ */ p("span")({
82
87
  name: "PauseAdTitleDescription",
83
88
  class: "p1dpvfl1",
84
89
  propsAsIs: !1
85
- }), k = /* @__PURE__ */ p("img")({
90
+ }), U = /* @__PURE__ */ p("img")({
86
91
  name: "ExternalAdContainer",
87
92
  class: "ezfmabr",
88
93
  propsAsIs: !1
89
- }), te = ({ vastUrl: r }) => {
94
+ }), ne = ({ vastUrl: r }) => {
90
95
  var e;
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({
96
+ const [, n] = D(), s = _(n, { keys: [r] });
97
+ return (e = s == null ? void 0 : s[r]) != null && e.imageSrc ? s[r].adUrl ? /* @__PURE__ */ o("a", { href: s[r].adUrl, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ o(U, { src: s[r].imageSrc }) }) : /* @__PURE__ */ o(U, { src: s[r].imageSrc }) : null;
98
+ }, oe = ({ isClosing: r, title: e, caption: n, onPlay: s, onClose: c, vastUrl: a, options: l }) => {
99
+ const t = (l == null ? void 0 : l.showPauseButton) ?? !0, { ref: u, focusSelf: i } = F.useFocusable({
95
100
  focusKey: "sl-pause-ad-play",
96
101
  onEnterRelease: s,
97
102
  isFocusBoundary: !0,
@@ -108,14 +113,14 @@ const G = {}, H = new N(), w = V(G), E = K("ui:gam-static"), U = (r) => new Prom
108
113
  }
109
114
  };
110
115
  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, {}),
116
+ }, [c]), /* @__PURE__ */ o(O, { className: M(r && "pause-ad-closing"), children: /* @__PURE__ */ I(J, { children: [
117
+ /* @__PURE__ */ o(Q, {}),
118
+ /* @__PURE__ */ o(W, {}),
114
119
  /* @__PURE__ */ I(X, { children: [
115
- /* @__PURE__ */ a(Y, { children: e }),
116
- /* @__PURE__ */ a(Z, { children: t })
120
+ /* @__PURE__ */ o(Y, { children: e }),
121
+ /* @__PURE__ */ o(Z, { children: n })
117
122
  ] }),
118
- n && /* @__PURE__ */ a(ee, { children: /* @__PURE__ */ a(
123
+ t && /* @__PURE__ */ o(ee, { children: /* @__PURE__ */ o(
119
124
  re,
120
125
  {
121
126
  ref: u,
@@ -125,21 +130,21 @@ const G = {}, H = new N(), w = V(G), E = K("ui:gam-static"), U = (r) => new Prom
125
130
  }
126
131
  ) }),
127
132
  /* @__PURE__ */ I(se, { children: [
128
- o && /* @__PURE__ */ a(te, { vastUrl: o }),
129
- /* @__PURE__ */ a(ne, { children: "ADVERTISEMENT" })
133
+ a && /* @__PURE__ */ o(ne, { vastUrl: a }),
134
+ /* @__PURE__ */ o(te, { children: "ADVERTISEMENT" })
130
135
  ] })
131
136
  ] }) });
132
- }, oe = ({
137
+ }, ae = ({
133
138
  showPauseAd: r,
134
139
  vastUrls: e,
135
- title: t,
140
+ title: n,
136
141
  caption: s,
137
142
  onPlay: c,
138
- onClose: o,
143
+ onClose: a,
139
144
  onRender: l,
140
- options: n
145
+ options: t
141
146
  }) => {
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);
147
+ const u = (t == null ? void 0 : t.pauseAdDelay) ?? 5e3, [i, h] = C(!1), [m, f] = C(!1), v = x(), d = e == null ? void 0 : e[0].url, y = x(d);
143
148
  y.current = d;
144
149
  const [g, A] = D();
145
150
  return b(() => {
@@ -148,9 +153,9 @@ const G = {}, H = new N(), w = V(G), E = K("ui:gam-static"), U = (r) => new Prom
148
153
  action: "enabled",
149
154
  payload: {}
150
155
  }), g(d).then((P) => {
151
- y.current === d && (P == null ? void 0 : P.success) !== !0 && (clearTimeout(v.current), o == null || o());
156
+ y.current === d && (P == null ? void 0 : P.success) !== !0 && (clearTimeout(v.current), a == null || a());
152
157
  }).catch(() => {
153
- y.current === d && (clearTimeout(v.current), o == null || o());
158
+ y.current === d && (clearTimeout(v.current), a == null || a());
154
159
  });
155
160
  const T = () => {
156
161
  var P;
@@ -174,49 +179,49 @@ const G = {}, H = new N(), w = V(G), E = K("ui:gam-static"), U = (r) => new Prom
174
179
  return () => {
175
180
  v.current && clearTimeout(v.current);
176
181
  };
177
- }, [A, g, o, u, r, d]), b(() => {
182
+ }, [A, g, a, u, r, d]), b(() => {
178
183
  l == null || l({ rendered: i });
179
184
  }, [i, l]), b(() => () => {
180
185
  l == null || l({ rendered: !1 });
181
- }, [l]), i ? /* @__PURE__ */ a(
182
- ae,
186
+ }, [l]), i ? /* @__PURE__ */ o(
187
+ oe,
183
188
  {
184
- onClose: o,
189
+ onClose: a,
185
190
  isClosing: m,
186
- title: t,
191
+ title: n,
187
192
  caption: s,
188
193
  onPlay: c,
189
194
  vastUrl: d,
190
- options: n
195
+ options: t
191
196
  }
192
197
  ) : null;
193
198
  }, le = ({
194
199
  showPauseAd: r,
195
200
  pauseAdVastUrl: e,
196
- videoPlayerController: t,
201
+ videoPlayerController: n,
197
202
  onRenderPauseAd: s,
198
203
  onClosePauseAd: c,
199
- children: o,
204
+ children: a,
200
205
  options: l
201
206
  }) => {
202
- const n = $(), u = j(), i = x(), h = C(() => {
207
+ const t = $(), u = j(), i = x(), h = k(() => {
203
208
  c == null || c();
204
- }, [c]), m = C(() => {
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);
209
+ }, [c]), m = k(() => {
210
+ t == null || t.controlVideoPlayer({ play: !0 });
211
+ }, [t]);
212
+ return b(() => t ? (n && (i.current = n, t.addVideoPlayerController(i.current)), () => {
213
+ i.current && t.removeVideoPlayerController(i.current);
209
214
  }) : () => {
210
- }, [n, t]), n ? /* @__PURE__ */ a("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ I(
215
+ }, [t, n]), t ? /* @__PURE__ */ o("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ I(
211
216
  q,
212
217
  {
213
218
  style: { position: "relative" },
214
219
  customTheme: u.theme,
215
220
  themeMode: u.themeMode,
216
221
  children: [
217
- o,
218
- e && /* @__PURE__ */ a(
219
- oe,
222
+ a,
223
+ e && /* @__PURE__ */ o(
224
+ ae,
220
225
  {
221
226
  showPauseAd: r,
222
227
  vastUrls: e,
@@ -228,22 +233,22 @@ const G = {}, H = new N(), w = V(G), E = K("ui:gam-static"), U = (r) => new Prom
228
233
  )
229
234
  ]
230
235
  }
231
- ) }) : o;
236
+ ) }) : a;
232
237
  };
233
- class pe extends z {
238
+ class ye extends z {
234
239
  constructor(e) {
235
240
  super(e), this.state = { hasError: !1 };
236
241
  }
237
242
  static getDerivedStateFromError() {
238
243
  return { hasError: !0 };
239
244
  }
240
- componentDidCatch(e, t) {
241
- console.error(e, t.componentStack);
245
+ componentDidCatch(e, n) {
246
+ console.error(e, n.componentStack);
242
247
  }
243
248
  render() {
244
- return this.state.hasError ? this.props.children : /* @__PURE__ */ a(le, { ...this.props });
249
+ return this.state.hasError ? this.props.children : /* @__PURE__ */ o(le, { ...this.props });
245
250
  }
246
251
  }
247
252
  export {
248
- pe as StreamLayerPauseAd
253
+ ye as StreamLayerPauseAd
249
254
  };
package/lib/es/points.js CHANGED
@@ -1,16 +1,21 @@
1
- import { jsxs as l, jsx as t } from "react/jsx-runtime";
1
+ import { jsxs as m, jsx as t } from "react/jsx-runtime";
2
2
  import { useState as u, useEffect as d } from "react";
3
- import { s as a, B as y, m as h, d as S, a as f, F as p, e as r, u as v, b as g, h as b } from "./provider.js";
4
- import { S as k } from "./useStreamLayerApp2.js";
5
- const A = /* @__PURE__ */ a("div")({
3
+ import "@nanostores/react";
4
+ import "nanostores";
5
+ import { s as a, B as y, m as h, i as S, f, F as c, e as r, u as v, d as g, h as k } from "./provider.js";
6
+ import "lodash.throttle";
7
+ import "react-dom";
8
+ import "react-countup";
9
+ import { S as A } from "./useStreamLayerApp2.js";
10
+ const I = /* @__PURE__ */ a("div")({
6
11
  name: "PointsContainer",
7
12
  class: "psiob9b",
8
13
  propsAsIs: !1
9
- }), I = /* @__PURE__ */ a("div")({
14
+ }), P = /* @__PURE__ */ a("div")({
10
15
  name: "PointsIcon",
11
16
  class: "p1gqe4lh",
12
17
  propsAsIs: !1
13
- }), P = () => y, T = /* @__PURE__ */ a(P())({
18
+ }), b = () => y, T = /* @__PURE__ */ a(b())({
14
19
  name: "PointsSvg",
15
20
  class: "p15syg2y",
16
21
  propsAsIs: !0
@@ -26,31 +31,31 @@ const A = /* @__PURE__ */ a("div")({
26
31
  name: "PointsValue",
27
32
  class: "prj9b3v",
28
33
  propsAsIs: !1
29
- }), B = ({ points: s, onClick: e }) => /* @__PURE__ */ l(A, { className: h, onClick: e, children: [
30
- /* @__PURE__ */ t(I, { children: /* @__PURE__ */ t(T, { name: "icon-trophy-solid" }) }),
31
- /* @__PURE__ */ l(F, { children: [
34
+ }), B = ({ points: s, onClick: e }) => /* @__PURE__ */ m(I, { className: h, onClick: e, children: [
35
+ /* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(T, { name: "icon-trophy-solid" }) }),
36
+ /* @__PURE__ */ m(F, { children: [
32
37
  /* @__PURE__ */ t(L, { children: "Total points" }),
33
38
  /* @__PURE__ */ t(x, { children: /* @__PURE__ */ t(S, { value: s }) })
34
39
  ] })
35
40
  ] }), C = ({ gamification: s }) => {
36
- const e = s.userSummary.$store, [n, m] = u(0);
41
+ const e = s.userSummary.$store, [o, l] = u(0);
37
42
  return d(() => {
38
- const o = e.subscribe((i) => {
39
- var c;
40
- (c = i == null ? void 0 : i.summary) != null && c.points && m(i.summary.points);
43
+ const n = e.subscribe((i) => {
44
+ var p;
45
+ (p = i == null ? void 0 : i.summary) != null && p.points && l(i.summary.points);
41
46
  });
42
47
  return () => {
43
- o();
48
+ n();
44
49
  };
45
- }, [e]), /* @__PURE__ */ t(B, { points: n, onClick: () => {
46
- const o = s.status.get();
47
- o === p.Suspended ? (s.openFeature(), r.emit("app", {
50
+ }, [e]), /* @__PURE__ */ t(B, { points: o, onClick: () => {
51
+ const n = s.status.get();
52
+ n === c.Suspended ? (s.openFeature(), r.emit("app", {
48
53
  action: "open",
49
54
  payload: {}
50
55
  }), r.emit("interactions", {
51
56
  action: "tap",
52
57
  payload: {}
53
- })) : o === p.Ready && (s.closeFeature(!1), r.emit("app", {
58
+ })) : n === c.Ready && (s.closeFeature(!1), r.emit("app", {
54
59
  action: "close",
55
60
  payload: {}
56
61
  }), r.emit("interactions", {
@@ -61,12 +66,12 @@ const A = /* @__PURE__ */ a("div")({
61
66
  }, j = ({ sdk: s }) => {
62
67
  if (!f(s.featuresList.getStore()))
63
68
  return null;
64
- const e = s.getFeature(k.GAMES);
69
+ const e = s.getFeature(A.GAMES);
65
70
  return e ? /* @__PURE__ */ t(C, { gamification: e }) : null;
66
- }, K = ({ theme: s }) => {
67
- const e = v(), n = g();
68
- return e ? /* @__PURE__ */ t("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ t(b, { customTheme: s ?? n.theme, themeMode: n.themeMode, children: /* @__PURE__ */ t(j, { sdk: e }) }) }) : null;
71
+ }, V = ({ theme: s }) => {
72
+ const e = v(), o = g();
73
+ return e ? /* @__PURE__ */ t("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ t(k, { customTheme: s ?? o.theme, themeMode: o.themeMode, children: /* @__PURE__ */ t(j, { sdk: e }) }) }) : null;
69
74
  };
70
75
  export {
71
- K as StreamLayerSDKPoints
76
+ V as StreamLayerSDKPoints
72
77
  };