@streamlayer/react 0.0.1-debug.1

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