@streamlayer/react 1.23.0 → 1.23.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 (167) hide show
  1. package/lib/app/pause-ad.d.ts +2 -4
  2. package/lib/app/polymarket.d.ts +7 -0
  3. package/lib/cjs/Question.js +1 -1
  4. package/lib/cjs/advertisement.js +28 -223
  5. package/lib/cjs/analytics.js +1 -1
  6. package/lib/cjs/auth.js +1 -1
  7. package/lib/cjs/bet-pack.js +1 -1
  8. package/lib/cjs/feature.js +1 -0
  9. package/lib/cjs/gamification-feature.js +1 -1
  10. package/lib/cjs/gamification-feature2.js +1 -1
  11. package/lib/cjs/hooks-WfHlJH12.js +1 -0
  12. package/lib/cjs/index-eShKGO10.js +1 -5
  13. package/lib/cjs/index.js +1 -1
  14. package/lib/cjs/index10.js +1 -4
  15. package/lib/cjs/index11.js +3 -1
  16. package/lib/cjs/index12.js +1 -1
  17. package/lib/cjs/index13.js +3 -1
  18. package/lib/cjs/index14.js +1 -1
  19. package/lib/cjs/index15.js +1 -5
  20. package/lib/cjs/index16.js +3 -0
  21. package/lib/cjs/index2.js +1 -1
  22. package/lib/cjs/index3.js +1 -1
  23. package/lib/cjs/index4.js +3 -5
  24. package/lib/cjs/index5.js +1 -1
  25. package/lib/cjs/index6.js +1 -1
  26. package/lib/cjs/index7.js +1 -1
  27. package/lib/cjs/index8.js +1 -1
  28. package/lib/cjs/index9.js +1 -1
  29. package/lib/cjs/insight.js +1 -1
  30. package/lib/cjs/masters.js +1 -1
  31. package/lib/cjs/masters2.js +1 -13
  32. package/lib/cjs/notification.js +1 -1
  33. package/lib/cjs/pause-ad.js +1 -1
  34. package/lib/cjs/points.js +1 -1
  35. package/lib/cjs/polymarket.js +9 -0
  36. package/lib/cjs/sl-types.js +1 -15
  37. package/lib/cjs/storage.js +1 -1
  38. package/lib/cjs/style.css +1 -0
  39. package/lib/cjs/theme.js +1 -17
  40. package/lib/cjs/useStreamLayerApp.js +1 -1
  41. package/lib/cjs/useStreamLayerApp2.js +3 -17
  42. package/lib/cjs/utils.js +1 -47
  43. package/lib/classic/app/pause-ad.d.ts +2 -4
  44. package/lib/classic/app/polymarket.d.ts +7 -0
  45. package/lib/classic/cjs/Question.js +1 -1
  46. package/lib/classic/cjs/advertisement.js +28 -223
  47. package/lib/classic/cjs/analytics.js +1 -1
  48. package/lib/classic/cjs/auth.js +1 -1
  49. package/lib/classic/cjs/bet-pack.js +3 -5
  50. package/lib/classic/cjs/feature.js +1 -0
  51. package/lib/classic/cjs/gamification-feature.js +1 -1
  52. package/lib/classic/cjs/hooks-WfHlJH12.js +1 -0
  53. package/lib/classic/cjs/index-eShKGO10.js +1 -5
  54. package/lib/classic/cjs/index.js +1 -1
  55. package/lib/classic/cjs/index10.js +1 -1
  56. package/lib/classic/cjs/index11.js +1 -1
  57. package/lib/classic/cjs/index12.js +1 -4
  58. package/lib/classic/cjs/index13.js +3 -0
  59. package/lib/classic/cjs/index2.js +3 -5
  60. package/lib/classic/cjs/index3.js +1 -1
  61. package/lib/classic/cjs/index4.js +1 -1
  62. package/lib/classic/cjs/index5.js +1 -1
  63. package/lib/classic/cjs/index6.js +1 -1
  64. package/lib/classic/cjs/index7.js +1 -1
  65. package/lib/classic/cjs/index8.js +1 -1
  66. package/lib/classic/cjs/index9.js +3 -1
  67. package/lib/classic/cjs/insight.js +1 -1
  68. package/lib/classic/cjs/notification.js +1 -1
  69. package/lib/classic/cjs/notification2.js +1 -1
  70. package/lib/classic/cjs/pause-ad.js +1 -1
  71. package/lib/classic/cjs/points.js +1 -1
  72. package/lib/classic/cjs/polymarket.js +9 -0
  73. package/lib/classic/cjs/sl-types.js +1 -15
  74. package/lib/classic/cjs/style.css +1 -0
  75. package/lib/classic/cjs/useStreamLayerApp.js +1 -1
  76. package/lib/classic/cjs/useStreamLayerApp2.js +3 -17
  77. package/lib/classic/cjs/utils.js +1 -47
  78. package/lib/classic/es/Question.js +277 -264
  79. package/lib/classic/es/advertisement.js +34990 -18881
  80. package/lib/classic/es/analytics.js +58 -56
  81. package/lib/classic/es/auth.js +14 -8
  82. package/lib/classic/es/bet-pack.js +2448 -2418
  83. package/lib/classic/es/feature.js +108 -0
  84. package/lib/classic/es/gamification-feature.js +2 -2
  85. package/lib/classic/es/hooks-WfHlJH12.js +98 -0
  86. package/lib/classic/es/index-eShKGO10.js +948 -948
  87. package/lib/classic/es/index.js +13 -13
  88. package/lib/classic/es/index10.js +83 -2295
  89. package/lib/classic/es/index11.js +3095 -179
  90. package/lib/classic/es/index12.js +174 -821
  91. package/lib/classic/es/index13.js +850 -0
  92. package/lib/classic/es/index2.js +2099 -1763
  93. package/lib/classic/es/index3.js +11 -11
  94. package/lib/classic/es/index4.js +127 -127
  95. package/lib/classic/es/index5.js +3 -5
  96. package/lib/classic/es/index6.js +10 -11
  97. package/lib/classic/es/index7.js +6 -62
  98. package/lib/classic/es/index8.js +9 -316
  99. package/lib/classic/es/index9.js +316 -82
  100. package/lib/classic/es/insight.js +58 -53
  101. package/lib/classic/es/notification.js +5 -5
  102. package/lib/classic/es/notification2.js +765 -722
  103. package/lib/classic/es/pause-ad.js +190 -167
  104. package/lib/classic/es/points.js +55 -47
  105. package/lib/classic/es/polymarket.js +6848 -0
  106. package/lib/classic/es/sl-types.js +193 -125
  107. package/lib/classic/es/useStreamLayerApp.js +2 -2
  108. package/lib/classic/es/useStreamLayerApp2.js +9727 -7592
  109. package/lib/classic/es/utils.js +28 -28
  110. package/lib/classic/index.d.ts +1 -0
  111. package/lib/classic/style.css +1 -0
  112. package/lib/dist/cjs/gamification-feature.js +1 -1
  113. package/lib/dist/cjs/index-eShKGO10.js +1 -5
  114. package/lib/dist/cjs/index.js +1 -1
  115. package/lib/dist/cjs/masters.js +3 -77
  116. package/lib/dist/es/gamification-feature.js +2 -2
  117. package/lib/dist/es/index-eShKGO10.js +948 -948
  118. package/lib/dist/es/index.js +7 -8
  119. package/lib/dist/es/masters.js +18212 -14741
  120. package/lib/dist/index.d.ts +29 -8
  121. package/lib/dist/style.css +1 -1
  122. package/lib/es/Question.js +108 -106
  123. package/lib/es/advertisement.js +34990 -18881
  124. package/lib/es/analytics.js +58 -56
  125. package/lib/es/auth.js +14 -8
  126. package/lib/es/bet-pack.js +29 -17
  127. package/lib/es/feature.js +108 -0
  128. package/lib/es/gamification-feature.js +2 -2
  129. package/lib/es/gamification-feature2.js +2 -2
  130. package/lib/es/hooks-WfHlJH12.js +98 -0
  131. package/lib/es/index-eShKGO10.js +948 -948
  132. package/lib/es/index.js +14 -13
  133. package/lib/es/index10.js +258 -816
  134. package/lib/es/index11.js +837 -170
  135. package/lib/es/index12.js +181 -312
  136. package/lib/es/index13.js +316 -82
  137. package/lib/es/index14.js +83 -2350
  138. package/lib/es/index15.js +3069 -1224
  139. package/lib/es/index16.js +1453 -0
  140. package/lib/es/index2.js +1118 -984
  141. package/lib/es/index3.js +3 -62
  142. package/lib/es/index4.js +2424 -2407
  143. package/lib/es/index5.js +11 -11
  144. package/lib/es/index6.js +127 -127
  145. package/lib/es/index7.js +10 -7
  146. package/lib/es/index8.js +5 -9
  147. package/lib/es/index9.js +10 -265
  148. package/lib/es/insight.js +58 -53
  149. package/lib/es/masters.js +6 -5
  150. package/lib/es/masters2.js +696 -558
  151. package/lib/es/notification.js +697 -655
  152. package/lib/es/pause-ad.js +190 -167
  153. package/lib/es/points.js +56 -48
  154. package/lib/es/polymarket.js +6848 -0
  155. package/lib/es/sl-types.js +200 -132
  156. package/lib/es/storage.js +75 -74
  157. package/lib/es/theme.js +177 -31
  158. package/lib/es/useStreamLayerApp.js +2 -2
  159. package/lib/es/useStreamLayerApp2.js +9727 -7592
  160. package/lib/es/utils.js +28 -28
  161. package/lib/index.d.ts +1 -0
  162. package/lib/style.css +1 -1
  163. package/package.json +33 -20
  164. package/lib/cjs/hooks-B0Qttldg.js +0 -1
  165. package/lib/classic/cjs/hooks-B0Qttldg.js +0 -1
  166. package/lib/classic/es/hooks-B0Qttldg.js +0 -98
  167. package/lib/es/hooks-B0Qttldg.js +0 -98
@@ -1,257 +1,280 @@
1
- import { jsx as s, jsxs as w } from "react/jsx-runtime";
2
- import { h as N } from "./index5.js";
3
- import { s as d, u as q, c as V } from "./sl-types.js";
4
- import { d as j } from "./index10.js";
5
- import { useState as B, useRef as b, useCallback as _, useEffect as c, Component as z } from "react";
6
- import { e as E } from "./index7.js";
7
- import { B as K, z as O } from "./hooks-B0Qttldg.js";
8
- const G = /* @__PURE__ */ d("div")({
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { h } from "./index7.js";
3
+ import { s as styled_default, u as useStore, c as cx_default } from "./sl-types.js";
4
+ import { d as distExports } from "./index11.js";
5
+ import { useState, useRef, useCallback, useEffect, Component } from "react";
6
+ import { e as eventBus } from "./index5.js";
7
+ import { B, z } from "./hooks-WfHlJH12.js";
8
+ const e = /* @__PURE__ */ styled_default("div")({
9
9
  name: "PauseAdOverlay",
10
10
  class: "pw9gih8",
11
- propsAsIs: !1
12
- }), W = /* @__PURE__ */ d("div")({
11
+ propsAsIs: false
12
+ }), t = /* @__PURE__ */ styled_default("div")({
13
13
  name: "PauseAdContent",
14
14
  class: "p8lpomy",
15
- propsAsIs: !1
16
- }), X = /* @__PURE__ */ d("div")({
15
+ propsAsIs: false
16
+ }), p = /* @__PURE__ */ styled_default("div")({
17
17
  name: "PauseAdTopLeft",
18
18
  class: "pv7u167",
19
- propsAsIs: !1
20
- }), H = /* @__PURE__ */ d("h2")({
19
+ propsAsIs: false
20
+ }), o = /* @__PURE__ */ styled_default("h2")({
21
21
  name: "PauseAdTitle",
22
22
  class: "p1kh2yb0",
23
- propsAsIs: !1
24
- }), J = /* @__PURE__ */ d("p")({
23
+ propsAsIs: false
24
+ }), n = /* @__PURE__ */ styled_default("p")({
25
25
  name: "PauseAdCaption",
26
26
  class: "pl8f94x",
27
- propsAsIs: !1
28
- }), Q = /* @__PURE__ */ d("div")({
27
+ propsAsIs: false
28
+ }), d = /* @__PURE__ */ styled_default("div")({
29
29
  name: "PauseAdBottomLeft",
30
30
  class: "p1m6zmrt",
31
- propsAsIs: !1
32
- }), Y = /* @__PURE__ */ d("button")({
31
+ propsAsIs: false
32
+ }), l = /* @__PURE__ */ styled_default("button")({
33
33
  name: "PauseAdPlayButton",
34
34
  class: "pm3vwfa",
35
- propsAsIs: !1
36
- }), Z = /* @__PURE__ */ d("div")({
35
+ propsAsIs: false
36
+ }), A = /* @__PURE__ */ styled_default("div")({
37
37
  name: "PauseAdSidebarGradient",
38
38
  class: "p1tibuhw",
39
- propsAsIs: !1
40
- }), $ = /* @__PURE__ */ d("div")({
39
+ propsAsIs: false
40
+ }), r = /* @__PURE__ */ styled_default("div")({
41
41
  name: "PauseAdSidebar",
42
42
  class: "ptqqrqd",
43
- propsAsIs: !1
44
- }), ee = /* @__PURE__ */ d("span")({
43
+ propsAsIs: false
44
+ }), i = /* @__PURE__ */ styled_default("span")({
45
45
  name: "PauseAdTitleDescription",
46
46
  class: "p14estxv",
47
- propsAsIs: !1
48
- }), F = /* @__PURE__ */ d("img")({
47
+ propsAsIs: false
48
+ }), u = /* @__PURE__ */ styled_default("img")({
49
49
  name: "ExternalAdContainer",
50
50
  class: "e1dpvfl1",
51
- propsAsIs: !1
52
- }), re = ({
53
- vastUrl: i,
54
- isDesktop: n,
55
- content: e
56
- }) => (c(() => {
57
- e.imageSrc && e.id && E.emit("exposedPauseAd", {
51
+ propsAsIs: false
52
+ });
53
+ const W = ({
54
+ vastUrl: l2,
55
+ isDesktop: o2,
56
+ content: r2
57
+ }) => (useEffect(() => {
58
+ r2.imageSrc && r2.id && eventBus.emit("exposedPauseAd", {
58
59
  action: "rendered",
59
60
  payload: {
60
- id: e.id,
61
- parentId: e.parentId
61
+ id: r2.id,
62
+ parentId: r2.parentId
62
63
  }
63
64
  });
64
- }, [e, i]), e != null && e.imageSrc ? !e.adUrl || !n ? /* @__PURE__ */ s(F, { src: e.imageSrc }) : /* @__PURE__ */ s(
65
+ }, [r2, l2]), r2 != null && r2.imageSrc ? !r2.adUrl || !o2 ? /* @__PURE__ */ jsx(u, { src: r2.imageSrc }) : /* @__PURE__ */ jsx(
65
66
  "a",
66
67
  {
67
68
  onClick: () => {
68
- E.emit("exposedPauseAd", {
69
+ eventBus.emit("exposedPauseAd", {
69
70
  action: "navigated",
70
71
  payload: {
71
- id: e.id,
72
- parentId: e.parentId
72
+ id: r2.id,
73
+ parentId: r2.parentId
73
74
  }
74
75
  });
75
76
  },
76
- href: e.adUrl,
77
+ href: r2.adUrl,
77
78
  target: "_blank",
78
79
  rel: "noopener noreferrer",
79
- children: /* @__PURE__ */ s(F, { src: e.imageSrc })
80
+ children: /* @__PURE__ */ jsx(u, { src: r2.imageSrc })
80
81
  }
81
- ) : null), te = ({ isClosing: i, content: n, externalPauseAdStore: e, title: I, caption: v, onPlay: u, onClose: a, vastUrl: t, options: f, isDesktop: l }) => {
82
- const C = (f == null ? void 0 : f.showPauseButton) ?? !0, { ref: p, focusSelf: g } = j.useFocusable({
82
+ ) : null), X = ({ isClosing: l$1, content: o$1, externalPauseAdStore: r$1, title: k, caption: y, onPlay: f, onClose: a, vastUrl: c, options: A$1, isDesktop: m }) => {
83
+ const v = (A$1 == null ? void 0 : A$1.showPauseButton) ?? true, { ref: s, focusSelf: I } = distExports.useFocusable({
83
84
  focusKey: "sl-pause-ad-play",
84
- onEnterRelease: u,
85
- isFocusBoundary: !0,
86
- forceFocus: !0
85
+ onEnterRelease: f,
86
+ isFocusBoundary: true,
87
+ forceFocus: true
87
88
  });
88
- return c(() => () => {
89
- e.revalidate();
90
- }, [e]), c(() => {
91
- p.current && g();
92
- }, [p, g]), c(() => {
89
+ return useEffect(() => () => {
90
+ r$1.revalidate();
91
+ }, [r$1]), useEffect(() => {
92
+ s.current && I();
93
+ }, [s, I]), useEffect(() => {
93
94
  if (!a)
94
95
  return () => {
95
96
  };
96
- const T = (A) => {
97
- const o = A.keyCode;
98
- if (o === 461 || o === 10009 || o === 27 || o === 8) {
99
- A.preventDefault(), A.stopPropagation(), A.stopImmediatePropagation(), a();
97
+ const E = (d2) => {
98
+ const t2 = d2.keyCode;
99
+ if (t2 === 461 || t2 === 10009 || t2 === 27 || t2 === 8) {
100
+ d2.preventDefault(), d2.stopPropagation(), d2.stopImmediatePropagation(), a();
100
101
  return;
101
102
  }
102
103
  };
103
- return window.addEventListener("keydown", T, { capture: !0 }), () => window.removeEventListener("keydown", T, { capture: !0 });
104
- }, [a]), /* @__PURE__ */ s(G, { className: V("SL_PauseAdOverlay", i && "pause-ad-closing"), children: /* @__PURE__ */ w(W, { children: [
105
- /* @__PURE__ */ w(X, { children: [
106
- /* @__PURE__ */ s(H, { children: I }),
107
- /* @__PURE__ */ s(J, { children: v })
104
+ return window.addEventListener("keydown", E, { capture: true }), () => window.removeEventListener("keydown", E, { capture: true });
105
+ }, [a]), /* @__PURE__ */ jsx(e, { className: cx_default("SL_PauseAd", l$1 && "pause-ad-closing"), children: /* @__PURE__ */ jsxs(t, { children: [
106
+ /* @__PURE__ */ jsxs(p, { children: [
107
+ /* @__PURE__ */ jsx(o, { children: k }),
108
+ /* @__PURE__ */ jsx(n, { children: y })
108
109
  ] }),
109
- C && /* @__PURE__ */ s(Q, { children: /* @__PURE__ */ s(
110
- Y,
110
+ v && /* @__PURE__ */ jsx(d, { children: /* @__PURE__ */ jsx(
111
+ l,
111
112
  {
112
- ref: p,
113
- onClick: u,
114
- onMouseEnter: () => p.current.focus(),
113
+ ref: s,
114
+ onClick: f,
115
+ onMouseEnter: () => s.current.focus(),
115
116
  "aria-label": "Resume playback"
116
117
  }
117
118
  ) }),
118
- /* @__PURE__ */ s(Z, { className: "SL_PauseAdSidebar", children: /* @__PURE__ */ w($, { children: [
119
- t && /* @__PURE__ */ s(re, { content: n, isDesktop: l, vastUrl: t }),
120
- /* @__PURE__ */ s(ee, { children: "ADVERTISEMENT" })
119
+ /* @__PURE__ */ jsx(A, { className: "SL_PauseAdSidebar", children: /* @__PURE__ */ jsxs(r, { children: [
120
+ c && /* @__PURE__ */ jsx(W, { content: o$1, isDesktop: m, vastUrl: c }),
121
+ /* @__PURE__ */ jsx(i, { children: "ADVERTISEMENT" })
121
122
  ] }) })
122
123
  ] }) });
123
- }, se = ({ showPauseAd: i, vastUrls: n, title: e, caption: I, sdk: v, onClose: u, onRender: a, options: t, isDesktop: f }) => {
124
- const l = (t == null ? void 0 : t.pauseAdDelay) ?? 0, C = (t == null ? void 0 : t.pauseAdRefetchInterval) ?? 1e3 * 60 * 50, [p, g] = B(!1), [T, A] = B(!1), o = b(), h = n == null ? void 0 : n[0].url, P = b(h), y = b(""), S = b("");
125
- P.current = h;
126
- const [m, R] = v.advertisement.getExternalPauseAd(h, {
127
- refetchInterval: C,
128
- $enabled: l === 0 || !!i,
129
- prefetch: l === 0 && C > 0
130
- }), k = q(m), x = _(() => {
131
- if (u) {
132
- S.current = P.current;
133
- const r = m.get().data;
134
- E.emit("exposedPauseAd", {
124
+ }, se = ({ showPauseAd: l2, vastUrls: o2, title: r2, caption: k, sdk: y, onClose: f, onRender: a, options: c, isDesktop: A2 }) => {
125
+ const m = (c == null ? void 0 : c.pauseAdDelay) ?? 0, v = (c == null ? void 0 : c.pauseAdRefetchInterval) ?? 1e3 * 60 * 50, [s, I] = useState(false), [E, d2] = useState(false), t2 = useRef(), p2 = o2 == null ? void 0 : o2[0].url, P = useRef(p2), S = useRef(""), T = useRef("");
126
+ P.current = p2;
127
+ const [i2, D] = y.advertisement.getExternalPauseAd(p2, {
128
+ refetchInterval: v,
129
+ $enabled: m === 0 || !!l2,
130
+ prefetch: m === 0 && v > 0
131
+ }), x = useStore(i2), g = useCallback(() => {
132
+ if (f) {
133
+ T.current = P.current;
134
+ const e2 = i2.get().data;
135
+ eventBus.emit("exposedPauseAd", {
135
136
  action: "closed",
136
- payload: (r == null ? void 0 : r.url) === S.current ? {
137
- id: r == null ? void 0 : r.id,
138
- parentId: r == null ? void 0 : r.parentId
137
+ payload: (e2 == null ? void 0 : e2.url) === T.current ? {
138
+ id: e2 == null ? void 0 : e2.id,
139
+ parentId: e2 == null ? void 0 : e2.parentId
139
140
  } : {}
140
- }), u();
141
+ }), f();
141
142
  }
142
- }, [u, m]), M = _(() => {
143
- v.controlVideoPlayer({ play: !0 });
144
- }, [v]);
145
- return c(() => {
146
- R === P.current && k.error && (console.log("error", k.error), clearTimeout(o.current), x == null || x());
147
- }, [k, x, R]), c(() => {
148
- if (i && h) {
149
- y.current = P.current, S.current = "";
150
- const r = m.get().data;
151
- E.emit("exposedPauseAd", {
143
+ }, [f, i2]), j = useCallback(() => {
144
+ y.controlVideoPlayer({ play: true });
145
+ }, [y]);
146
+ return useEffect(() => {
147
+ D === P.current && x.error && (console.log("error", x.error), clearTimeout(t2.current), g == null || g());
148
+ }, [x, g, D]), useEffect(() => {
149
+ if (l2 && p2) {
150
+ S.current = P.current, T.current = "";
151
+ const e2 = i2.get().data;
152
+ eventBus.emit("exposedPauseAd", {
152
153
  action: "enabled",
153
- payload: (r == null ? void 0 : r.url) === y.current ? {
154
- id: r == null ? void 0 : r.id,
155
- parentId: r == null ? void 0 : r.parentId
154
+ payload: (e2 == null ? void 0 : e2.url) === S.current ? {
155
+ id: e2 == null ? void 0 : e2.id,
156
+ parentId: e2 == null ? void 0 : e2.parentId
156
157
  } : {}
157
158
  });
158
- const U = () => {
159
- const L = m.get(), D = L.data;
160
- (D == null ? void 0 : D.url) === P.current && (!L.loading && D != null && D.imageSrc ? (clearTimeout(o.current), A(!1), g(!0)) : L.loading && (o.current = setTimeout(() => {
161
- console.log("checkAndAllowRender timeout"), U();
159
+ const L = () => {
160
+ const C = i2.get(), h2 = C.data;
161
+ (h2 == null ? void 0 : h2.url) === P.current && (!C.loading && (h2 != null && h2.imageSrc) ? (clearTimeout(t2.current), d2(false), I(true)) : C.loading && (t2.current = setTimeout(() => {
162
+ console.log("checkAndAllowRender timeout"), L();
162
163
  }, 200)));
163
164
  };
164
- clearTimeout(o.current), o.current = setTimeout(() => {
165
- U();
166
- }, l);
165
+ clearTimeout(t2.current), t2.current = setTimeout(() => {
166
+ L();
167
+ }, m);
167
168
  } else {
168
- if (S.current !== P.current) {
169
- const r = m.get().data;
170
- S.current = "", y.current !== "" && (E.emit("exposedPauseAd", {
169
+ if (T.current !== P.current) {
170
+ const e2 = i2.get().data;
171
+ T.current = "", S.current !== "" && (eventBus.emit("exposedPauseAd", {
171
172
  action: "disabled",
172
- payload: y.current === (r == null ? void 0 : r.url) ? {
173
- id: r == null ? void 0 : r.id,
174
- parentId: r == null ? void 0 : r.parentId
173
+ payload: S.current === (e2 == null ? void 0 : e2.url) ? {
174
+ id: e2 == null ? void 0 : e2.id,
175
+ parentId: e2 == null ? void 0 : e2.parentId
175
176
  } : {}
176
- }), y.current = "");
177
+ }), S.current = "");
177
178
  }
178
- A(!0), o.current = setTimeout(() => {
179
- g(!1);
179
+ d2(true), t2.current = setTimeout(() => {
180
+ I(false);
180
181
  }, 400);
181
182
  }
182
183
  return () => {
183
- o.current && clearTimeout(o.current);
184
+ t2.current && clearTimeout(t2.current);
184
185
  };
185
- }, [m, x, l, i, h]), c(() => {
186
- a == null || a({ rendered: p });
187
- }, [p, a]), c(() => () => {
188
- a == null || a({ rendered: !1 });
189
- }, [a]), !p || !k.data ? null : /* @__PURE__ */ s(
190
- te,
186
+ }, [i2, g, m, l2, p2]), useEffect(() => {
187
+ a == null || a({ rendered: s });
188
+ }, [s, a]), useEffect(() => () => {
189
+ a == null || a({ rendered: false });
190
+ }, [a]), !s || !x.data ? null : /* @__PURE__ */ jsx(
191
+ X,
191
192
  {
192
- onClose: x,
193
- isClosing: T,
194
- title: e,
195
- caption: I,
196
- onPlay: M,
197
- vastUrl: h,
198
- options: t,
199
- isDesktop: f,
200
- externalPauseAdStore: m,
201
- content: k.data
193
+ onClose: g,
194
+ isClosing: E,
195
+ title: r2,
196
+ caption: k,
197
+ onPlay: j,
198
+ vastUrl: p2,
199
+ options: c,
200
+ isDesktop: A2,
201
+ externalPauseAdStore: i2,
202
+ content: x.data
202
203
  }
203
204
  );
204
- }, ne = ({
205
- showPauseAd: i,
206
- pauseAdVastUrl: n,
207
- videoPlayerController: e,
208
- onRenderPauseAd: I,
209
- onClosePauseAd: v,
210
- children: u,
211
- options: a
205
+ };
206
+ const PureStreamLayerPauseAd = ({
207
+ showPauseAd,
208
+ pauseAdVastUrl,
209
+ videoPlayerController,
210
+ onRenderPauseAd,
211
+ onClosePauseAd,
212
+ children,
213
+ options
212
214
  }) => {
213
- const t = K(), f = O(), l = b();
214
- return c(() => t ? (e && (l.current = e, t.addVideoPlayerController(l.current)), () => {
215
- l.current && t.removeVideoPlayerController(l.current);
216
- }) : () => {
217
- }, [t, e]), t ? /* @__PURE__ */ s("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ w(
218
- N,
215
+ const sdk = B();
216
+ const baseTheme = z();
217
+ const ref = useRef();
218
+ useEffect(() => {
219
+ if (sdk) {
220
+ if (videoPlayerController) {
221
+ ref.current = videoPlayerController;
222
+ sdk.addVideoPlayerController(ref.current);
223
+ }
224
+ return () => {
225
+ if (ref.current) {
226
+ sdk.removeVideoPlayerController(ref.current);
227
+ }
228
+ };
229
+ }
230
+ return () => {
231
+ };
232
+ }, [sdk, videoPlayerController]);
233
+ if (!sdk) {
234
+ return children;
235
+ }
236
+ return /* @__PURE__ */ jsx("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ jsxs(
237
+ h,
219
238
  {
220
- style: u ? { position: "relative" } : {},
221
- customTheme: f.theme,
222
- themeMode: f.themeMode,
239
+ style: children ? { position: "relative" } : {},
240
+ customTheme: baseTheme.theme,
241
+ themeMode: baseTheme.themeMode,
223
242
  children: [
224
- u,
225
- n && /* @__PURE__ */ s(
243
+ children,
244
+ pauseAdVastUrl && /* @__PURE__ */ jsx(
226
245
  se,
227
246
  {
228
- sdk: t,
229
- showPauseAd: i,
230
- vastUrls: n,
231
- onClose: v,
232
- onRender: I,
233
- options: a,
234
- isDesktop: !0
247
+ sdk,
248
+ showPauseAd,
249
+ vastUrls: pauseAdVastUrl,
250
+ onClose: onClosePauseAd,
251
+ onRender: onRenderPauseAd,
252
+ options,
253
+ isDesktop: true
235
254
  }
236
255
  )
237
256
  ]
238
257
  }
239
- ) }) : u;
258
+ ) });
240
259
  };
241
- class pe extends z {
242
- constructor(n) {
243
- super(n), this.state = { hasError: !1 };
260
+ class StreamLayerPauseAd extends Component {
261
+ constructor(props) {
262
+ super(props);
263
+ this.state = { hasError: false };
244
264
  }
245
265
  static getDerivedStateFromError() {
246
- return { hasError: !0 };
266
+ return { hasError: true };
247
267
  }
248
- componentDidCatch(n, e) {
249
- console.error(n, e.componentStack);
268
+ componentDidCatch(error, info) {
269
+ console.error(error, info.componentStack);
250
270
  }
251
271
  render() {
252
- return this.state.hasError ? this.props.children : /* @__PURE__ */ s(ne, { ...this.props });
272
+ if (this.state.hasError) {
273
+ return this.props.children;
274
+ }
275
+ return /* @__PURE__ */ jsx(PureStreamLayerPauseAd, { ...this.props });
253
276
  }
254
277
  }
255
278
  export {
256
- pe as StreamLayerPauseAd
279
+ StreamLayerPauseAd
257
280
  };
@@ -1,77 +1,85 @@
1
- import { jsxs as p, jsx as e } from "react/jsx-runtime";
2
- import { m as u, h as d } from "./index5.js";
3
- import { useState as f, useEffect as y } from "react";
4
- import { s as o, u as h } from "./sl-types.js";
5
- import { F as c, e as a } from "./index7.js";
6
- import { d as S } from "./index3.js";
7
- import { B as v } from "./index4.js";
8
- import { S as g } from "./useStreamLayerApp2.js";
9
- import { B as k, z as A } from "./hooks-B0Qttldg.js";
10
- const I = /* @__PURE__ */ o("div")({
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { m, h } from "./index7.js";
3
+ import { useState, useEffect } from "react";
4
+ import { s as styled_default, u as useStore } from "./sl-types.js";
5
+ import { e as eventBus } from "./index5.js";
6
+ import { d } from "./index3.js";
7
+ import { B as B1 } from "./index4.js";
8
+ import { F as FeatureStatus } from "./feature.js";
9
+ import { S as SdkOverlayType } from "./useStreamLayerApp2.js";
10
+ import { B, z } from "./hooks-WfHlJH12.js";
11
+ const e = /* @__PURE__ */ styled_default("div")({
11
12
  name: "PointsContainer",
12
13
  class: "psiob9b",
13
- propsAsIs: !1
14
- }), P = /* @__PURE__ */ o("div")({
14
+ propsAsIs: false
15
+ }), p = /* @__PURE__ */ styled_default("div")({
15
16
  name: "PointsIcon",
16
17
  class: "p1gqe4lh",
17
- propsAsIs: !1
18
- }), b = () => v, B = /* @__PURE__ */ o(b())({
18
+ propsAsIs: false
19
+ }), n = () => B1, a = /* @__PURE__ */ styled_default(n())({
19
20
  name: "PointsSvg",
20
21
  class: "p15syg2y",
21
- propsAsIs: !0
22
- }), F = /* @__PURE__ */ o("div")({
22
+ propsAsIs: true
23
+ }), l = /* @__PURE__ */ styled_default("div")({
23
24
  name: "PointsBody",
24
25
  class: "p12n4f2h",
25
- propsAsIs: !1
26
- }), T = /* @__PURE__ */ o("div")({
26
+ propsAsIs: false
27
+ }), c = /* @__PURE__ */ styled_default("div")({
27
28
  name: "PointsTitle",
28
29
  class: "poqmx89",
29
- propsAsIs: !1
30
- }), x = /* @__PURE__ */ o("div")({
30
+ propsAsIs: false
31
+ }), r = /* @__PURE__ */ styled_default("div")({
31
32
  name: "PointsValue",
32
33
  class: "prj9b3v",
33
- propsAsIs: !1
34
- }), C = ({ points: s, onClick: t }) => /* @__PURE__ */ p(I, { className: u, onClick: t, children: [
35
- /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(B, { name: "icon-trophy-solid" }) }),
36
- /* @__PURE__ */ p(F, { children: [
37
- /* @__PURE__ */ e(T, { children: "Total points" }),
38
- /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(S, { value: s }) })
34
+ propsAsIs: false
35
+ });
36
+ const u = ({ points: n2, onClick: t }) => /* @__PURE__ */ jsxs(e, { className: m, onClick: t, children: [
37
+ /* @__PURE__ */ jsx(p, { children: /* @__PURE__ */ jsx(a, { name: "icon-trophy-solid" }) }),
38
+ /* @__PURE__ */ jsxs(l, { children: [
39
+ /* @__PURE__ */ jsx(c, { children: "Total points" }),
40
+ /* @__PURE__ */ jsx(r, { children: /* @__PURE__ */ jsx(d, { value: n2 }) })
39
41
  ] })
40
- ] }), j = ({ gamification: s }) => {
41
- const t = s.userSummary.$store, [n, l] = f(0);
42
- return y(() => {
43
- const r = t.subscribe((i) => {
44
- var m;
45
- (m = i == null ? void 0 : i.summary) != null && m.points && l(i.summary.points);
42
+ ] });
43
+ const S = ({ gamification: e2 }) => {
44
+ const n2 = e2.userSummary.$store, [t, m2] = useState(0);
45
+ return useEffect(() => {
46
+ const r2 = n2.subscribe((o) => {
47
+ var i;
48
+ (i = o == null ? void 0 : o.summary) != null && i.points && m2(o.summary.points);
46
49
  });
47
50
  return () => {
48
- r();
51
+ r2();
49
52
  };
50
- }, [t]), /* @__PURE__ */ e(C, { points: n, onClick: () => {
51
- const r = s.status.get();
52
- r === c.Suspended ? (s.openFeature(), a.emit("app", {
53
+ }, [n2]), /* @__PURE__ */ jsx(u, { points: t, onClick: () => {
54
+ const r2 = e2.status.get();
55
+ r2 === FeatureStatus.Suspended ? (e2.openFeature(), eventBus.emit("app", {
53
56
  action: "open",
54
57
  payload: {}
55
- }), a.emit("interactions", {
58
+ }), eventBus.emit("interactions", {
56
59
  action: "tap",
57
60
  payload: {}
58
- })) : r === c.Ready && (s.closeFeature(!1), a.emit("app", {
61
+ })) : r2 === FeatureStatus.Ready && (e2.closeFeature(false), eventBus.emit("app", {
59
62
  action: "close",
60
63
  payload: {}
61
- }), a.emit("interactions", {
64
+ }), eventBus.emit("interactions", {
62
65
  action: "tap",
63
66
  payload: {}
64
67
  }));
65
68
  } });
66
- }, L = ({ sdk: s }) => {
67
- if (!h(s.featuresList.getStore()))
69
+ }, k = ({ sdk: e2 }) => {
70
+ if (!useStore(e2.featuresList.getStore()))
68
71
  return null;
69
- const t = s.getFeature(g.GAMES);
70
- return t ? /* @__PURE__ */ e(j, { gamification: t }) : null;
71
- }, R = ({ theme: s }) => {
72
- const t = k(), n = A();
73
- return t ? /* @__PURE__ */ e("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ e(d, { customTheme: s ?? n.theme, themeMode: n.themeMode, children: /* @__PURE__ */ e(L, { sdk: t }) }) }) : null;
72
+ const t = e2.getFeature(SdkOverlayType.GAMES);
73
+ return t ? /* @__PURE__ */ jsx(S, { gamification: t }) : null;
74
+ };
75
+ const StreamLayerSDKPoints = ({ theme }) => {
76
+ const sdk = B();
77
+ const baseTheme = z();
78
+ if (!sdk) {
79
+ return null;
80
+ }
81
+ return /* @__PURE__ */ jsx("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ jsx(h, { customTheme: theme ?? baseTheme.theme, themeMode: baseTheme.themeMode, children: /* @__PURE__ */ jsx(k, { sdk }) }) });
74
82
  };
75
83
  export {
76
- R as StreamLayerSDKPoints
84
+ StreamLayerSDKPoints
77
85
  };