@streamlayer/react 1.23.1 → 1.24.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.
Files changed (159) hide show
  1. package/lib/app/masters.d.ts +0 -1
  2. package/lib/cjs/Question.js +1 -1
  3. package/lib/cjs/advertisement.js +33 -53
  4. package/lib/cjs/analytics.js +1 -1
  5. package/lib/cjs/auth.js +1 -1
  6. package/lib/cjs/bet-pack.js +1 -1
  7. package/lib/cjs/feature.js +1 -1
  8. package/lib/cjs/hooks-n9ax4LRT.js +1 -0
  9. package/lib/cjs/index-ByUNFvMk.js +5 -0
  10. package/lib/cjs/index.js +1 -1
  11. package/lib/cjs/index10.js +1 -1
  12. package/lib/cjs/index11.js +1 -4
  13. package/lib/cjs/index12.js +1 -1
  14. package/lib/cjs/index13.js +1 -1
  15. package/lib/cjs/index14.js +4 -1
  16. package/lib/cjs/index15.js +1 -1
  17. package/lib/cjs/index16.js +2 -2
  18. package/lib/cjs/index2.js +1 -1
  19. package/lib/cjs/index4.js +3 -3
  20. package/lib/cjs/index5.js +1 -1
  21. package/lib/cjs/index6.js +1 -1
  22. package/lib/cjs/index7.js +1 -1
  23. package/lib/cjs/index8.js +1 -1
  24. package/lib/cjs/index9.js +7 -1
  25. package/lib/cjs/insight.js +1 -1
  26. package/lib/cjs/masters.js +1 -1
  27. package/lib/cjs/masters2.js +5 -10
  28. package/lib/cjs/notification.js +1 -1
  29. package/lib/cjs/pause-ad.js +1 -1
  30. package/lib/cjs/points.js +1 -1
  31. package/lib/cjs/polymarket.js +4 -9
  32. package/lib/cjs/sl-types.js +1 -15
  33. package/lib/cjs/storage.js +1 -1
  34. package/lib/cjs/theme.js +1 -17
  35. package/lib/cjs/useStreamLayerApp.js +1 -1
  36. package/lib/cjs/useStreamLayerApp2.js +15 -15
  37. package/lib/cjs/utils.js +8 -8
  38. package/lib/classic/app/masters.d.ts +0 -1
  39. package/lib/classic/cjs/Question.js +1 -1
  40. package/lib/classic/cjs/advertisement.js +33 -53
  41. package/lib/classic/cjs/analytics.js +1 -1
  42. package/lib/classic/cjs/auth.js +1 -1
  43. package/lib/classic/cjs/bet-pack.js +3 -3
  44. package/lib/classic/cjs/feature.js +1 -1
  45. package/lib/classic/cjs/hooks-n9ax4LRT.js +1 -0
  46. package/lib/classic/cjs/index-ByUNFvMk.js +5 -0
  47. package/lib/classic/cjs/index.js +1 -1
  48. package/lib/classic/cjs/index10.js +1 -1
  49. package/lib/classic/cjs/index11.js +1 -1
  50. package/lib/classic/cjs/index12.js +1 -1
  51. package/lib/classic/cjs/index13.js +3 -3
  52. package/lib/classic/cjs/index2.js +2 -2
  53. package/lib/classic/cjs/index3.js +1 -1
  54. package/lib/classic/cjs/index4.js +1 -1
  55. package/lib/classic/cjs/index5.js +1 -1
  56. package/lib/classic/cjs/index6.js +1 -1
  57. package/lib/classic/cjs/index7.js +7 -1
  58. package/lib/classic/cjs/index8.js +1 -1
  59. package/lib/classic/cjs/index9.js +1 -1
  60. package/lib/classic/cjs/insight.js +1 -1
  61. package/lib/classic/cjs/notification.js +1 -1
  62. package/lib/classic/cjs/notification2.js +1 -1
  63. package/lib/classic/cjs/pause-ad.js +1 -1
  64. package/lib/classic/cjs/points.js +1 -1
  65. package/lib/classic/cjs/polymarket.js +4 -9
  66. package/lib/classic/cjs/sl-types.js +1 -15
  67. package/lib/classic/cjs/useStreamLayerApp.js +1 -1
  68. package/lib/classic/cjs/useStreamLayerApp2.js +15 -15
  69. package/lib/classic/cjs/utils.js +8 -8
  70. package/lib/classic/es/Question.js +216 -220
  71. package/lib/classic/es/advertisement.js +14665 -15122
  72. package/lib/classic/es/analytics.js +9 -9
  73. package/lib/classic/es/auth.js +1 -1
  74. package/lib/classic/es/bet-pack.js +637 -650
  75. package/lib/classic/es/feature.js +29 -33
  76. package/lib/classic/es/hooks-n9ax4LRT.js +97 -0
  77. package/lib/classic/es/index-ByUNFvMk.js +3775 -0
  78. package/lib/classic/es/index.js +13 -16
  79. package/lib/classic/es/index10.js +2587 -82
  80. package/lib/classic/es/index11.js +306 -2344
  81. package/lib/classic/es/index12.js +103 -101
  82. package/lib/classic/es/index13.js +449 -464
  83. package/lib/classic/es/index2.js +1244 -1268
  84. package/lib/classic/es/index3.js +10 -10
  85. package/lib/classic/es/index4.js +4 -283
  86. package/lib/classic/es/index5.js +4 -5
  87. package/lib/classic/es/index6.js +285 -5
  88. package/lib/classic/es/index7.js +179 -5
  89. package/lib/classic/es/index8.js +5 -9
  90. package/lib/classic/es/index9.js +7 -315
  91. package/lib/classic/es/insight.js +39 -41
  92. package/lib/classic/es/notification.js +3 -3
  93. package/lib/classic/es/notification2.js +513 -528
  94. package/lib/classic/es/pause-ad.js +116 -116
  95. package/lib/classic/es/points.js +33 -34
  96. package/lib/classic/es/polymarket.js +1049 -1102
  97. package/lib/classic/es/sl-types.js +115 -217
  98. package/lib/classic/es/useStreamLayerApp.js +1 -1
  99. package/lib/classic/es/useStreamLayerApp2.js +6485 -6405
  100. package/lib/classic/es/utils.js +6 -6
  101. package/lib/classic/source.css +110 -0
  102. package/lib/dist/cjs/index-ByUNFvMk.js +5 -0
  103. package/lib/dist/cjs/index.js +1 -1
  104. package/lib/dist/cjs/masters.js +34 -42
  105. package/lib/dist/es/index-ByUNFvMk.js +3775 -0
  106. package/lib/dist/es/index.js +7 -11
  107. package/lib/dist/es/masters.js +13506 -12760
  108. package/lib/dist/index.d.ts +5 -5
  109. package/lib/dist/source.css +64 -0
  110. package/lib/es/Question.js +99 -101
  111. package/lib/es/advertisement.js +14665 -15122
  112. package/lib/es/analytics.js +29 -29
  113. package/lib/es/auth.js +1 -1
  114. package/lib/es/bet-pack.js +12 -11
  115. package/lib/es/feature.js +29 -33
  116. package/lib/es/hooks-n9ax4LRT.js +97 -0
  117. package/lib/es/index-ByUNFvMk.js +3775 -0
  118. package/lib/es/index.js +13 -16
  119. package/lib/es/index10.js +7 -263
  120. package/lib/es/index11.js +172 -822
  121. package/lib/es/index12.js +2587 -178
  122. package/lib/es/index13.js +248 -302
  123. package/lib/es/index14.js +815 -82
  124. package/lib/es/index15.js +306 -2344
  125. package/lib/es/index16.js +451 -454
  126. package/lib/es/index2.js +737 -757
  127. package/lib/es/index4.js +626 -639
  128. package/lib/es/index5.js +10 -10
  129. package/lib/es/index6.js +5 -285
  130. package/lib/es/index7.js +7 -5
  131. package/lib/es/index8.js +283 -5
  132. package/lib/es/index9.js +179 -8
  133. package/lib/es/insight.js +39 -41
  134. package/lib/es/masters.js +4 -5
  135. package/lib/es/masters2.js +408 -441
  136. package/lib/es/notification.js +469 -484
  137. package/lib/es/pause-ad.js +116 -116
  138. package/lib/es/points.js +42 -43
  139. package/lib/es/polymarket.js +1049 -1102
  140. package/lib/es/sl-types.js +114 -235
  141. package/lib/es/storage.js +22 -22
  142. package/lib/es/theme.js +3 -44
  143. package/lib/es/useStreamLayerApp.js +1 -1
  144. package/lib/es/useStreamLayerApp2.js +6485 -6405
  145. package/lib/es/utils.js +6 -6
  146. package/lib/source.css +120 -0
  147. package/lib/style.css +1 -1
  148. package/package.json +15 -15
  149. package/lib/cjs/hooks-WfHlJH12.js +0 -1
  150. package/lib/cjs/index-eShKGO10.js +0 -5
  151. package/lib/classic/cjs/hooks-WfHlJH12.js +0 -1
  152. package/lib/classic/cjs/index-eShKGO10.js +0 -5
  153. package/lib/classic/es/hooks-WfHlJH12.js +0 -98
  154. package/lib/classic/es/index-eShKGO10.js +0 -3757
  155. package/lib/dist/cjs/index-eShKGO10.js +0 -5
  156. package/lib/dist/es/index-eShKGO10.js +0 -3757
  157. package/lib/dist/style.css +0 -1
  158. package/lib/es/hooks-WfHlJH12.js +0 -98
  159. package/lib/es/index-eShKGO10.js +0 -3757
@@ -1,11 +1,8 @@
1
- var d = Object.defineProperty;
2
- var l = (t, e, s) => e in t ? d(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
- var n = (t, e, s) => l(t, typeof e != "symbol" ? e + "" : e, s);
4
- import { pino as c } from "pino";
1
+ import { pino as a } from "pino";
5
2
  import "./sl-types.js";
6
3
  import "nanostores";
7
- import { S as o } from "./useStreamLayerApp2.js";
8
- const v = c({
4
+ import { S as s } from "./useStreamLayerApp2.js";
5
+ const d = a({
9
6
  level: "trace",
10
7
  enabled: typeof window < "u" && !!window.localStorage.getItem("SL_DEBUG"),
11
8
  browser: {
@@ -13,30 +10,24 @@ const v = c({
13
10
  console.log(t);
14
11
  }
15
12
  }
16
- }), w = (t, e) => v.child({ name: t }, e);
17
- class E extends Event {
18
- constructor(s, i) {
19
- super(s);
20
- n(this, "slEventBus");
21
- this.slEventBus = i;
13
+ }), l = (t, e) => d.child({ name: t }, e);
14
+ class c extends Event {
15
+ slEventBus;
16
+ constructor(e, n) {
17
+ super(e), this.slEventBus = n;
22
18
  }
23
19
  }
24
- const m = w("event-bus");
25
- class T {
20
+ const v = l("event-bus");
21
+ class h {
22
+ name;
23
+ listeners;
26
24
  constructor(e = "sl-event-bus") {
27
- n(this, "name");
28
- n(this, "listeners");
29
- n(this, "emit", (e, s) => {
30
- const i = new E(this.name, { ...s, type: e });
31
- m.debug(i, "Emitting event"), window.dispatchEvent(i);
32
- });
33
- n(this, "destroy", () => {
34
- this.listeners.forEach((e) => {
35
- window.removeEventListener(this.name, e), this.listeners.delete(e);
36
- }), this.listeners.clear();
37
- });
38
25
  this.name = e, this.listeners = /* @__PURE__ */ new Set();
39
26
  }
27
+ emit = (e, n) => {
28
+ const i = new c(this.name, { ...n, type: e });
29
+ v.debug(i, "Emitting event"), window.dispatchEvent(i);
30
+ };
40
31
  listen(e) {
41
32
  return window.addEventListener(this.name, e), this.listeners.add(e), () => {
42
33
  this.off(e);
@@ -45,19 +36,24 @@ class T {
45
36
  off(e) {
46
37
  window.removeEventListener(this.name, e), this.listeners.delete(e);
47
38
  }
39
+ destroy = () => {
40
+ this.listeners.forEach((e) => {
41
+ window.removeEventListener(this.name, e), this.listeners.delete(e);
42
+ }), this.listeners.clear();
43
+ };
48
44
  }
49
45
  window.slStore = /* @__PURE__ */ Object.create(null);
50
- var r;
46
+ var o;
51
47
  (function(t) {
52
48
  t.ORGANIZATION = "ORGANIZATION", t.STREAM = "STREAM";
53
- })(r || (r = {}));
54
- o.BETTING + "", o.GAMES + "", o.PUBLIC_CHAT + "", o.TWITTER + "";
55
- var a;
49
+ })(o || (o = {}));
50
+ s.BETTING + "", s.GAMES + "", s.PUBLIC_CHAT + "", s.TWITTER + "";
51
+ var r;
56
52
  (function(t) {
57
53
  t.Ready = "ready", t.Suspended = "suspended";
58
- })(a || (a = {}));
54
+ })(r || (r = {}));
59
55
  export {
60
- T as E,
61
- a as F,
62
- w as c
56
+ h as E,
57
+ r as F,
58
+ l as c
63
59
  };
@@ -0,0 +1,97 @@
1
+ import { useRef as w, useMemo as A, useEffect as r, useContext as l, useState as b, createContext as N } from "react";
2
+ import { jsxs as O, jsx as T } from "react/jsx-runtime";
3
+ import { z as L } from "./useStreamLayerApp2.js";
4
+ const x = ({
5
+ event: e,
6
+ internal: i
7
+ }) => {
8
+ const o = j(), n = I();
9
+ return r(() => {
10
+ o && (e && (o.createEventSession(e, i), n && (n.current = e)), !e && n?.current && (o.createEventSession("", i), n.current = ""));
11
+ }, [e, i, n, o]), null;
12
+ };
13
+ var M = /* @__PURE__ */ ((e) => (e[e.UNSET = 0] = "UNSET", e[e.CONNECTED = 1] = "CONNECTED", e[e.READY = 2] = "READY", e))(M || {});
14
+ const H = {
15
+ status: 0,
16
+ sdk: null
17
+ }, d = N(H), F = ({
18
+ sdkKey: e,
19
+ theme: i,
20
+ themeMode: o,
21
+ plugins: n,
22
+ children: h,
23
+ event: v,
24
+ production: y = !0,
25
+ autoEnable: f = !0,
26
+ withAdNotification: C,
27
+ withAd: E = !0,
28
+ betPack: u = !1,
29
+ hideFriends: S,
30
+ skipOnboarding: c,
31
+ friendsTab: p = "enabled",
32
+ onDeepLinkHandled: s,
33
+ videoPlayerController: a,
34
+ onContentActivate: g,
35
+ containerId: k,
36
+ webOS: D,
37
+ gamification: K
38
+ }) => {
39
+ const t = L({
40
+ sdkKey: e,
41
+ plugins: n,
42
+ production: y,
43
+ autoEnable: f,
44
+ onDeepLinkHandled: s,
45
+ videoPlayerController: a,
46
+ onContentActivate: g,
47
+ hideFriends: S,
48
+ skipOnboarding: c,
49
+ withAdNotification: C,
50
+ withAd: E,
51
+ friendsTab: p,
52
+ betPack: u,
53
+ webOS: D,
54
+ gamification: K
55
+ }), m = w(""), P = A(() => t ? { sdk: t, status: 2, event: m } : { status: 1, sdk: null, event: m }, [t]);
56
+ return r(() => {
57
+ t && (t.options.setKey("friendsTab", p), t.options.setKey("theme", i), t.options.setKey("themeMode", o), t.options.setKey("skipOnboarding", c), t.options.setKey("betPack", u), t.options.setKey("containerId", k));
58
+ }, [t, p, i, o, c, u, k]), r(() => () => {
59
+ s && t?.removeDeepLinkHandler(s), a && t?.removeVideoPlayerController(a);
60
+ }, [t]), r(() => {
61
+ localStorage.getItem("SL_DEBUG") && console.log("StreamLayerProvider mounted with props:", {
62
+ sdkKey: !!e,
63
+ onDeepLinkHandled: !!s,
64
+ videoPlayerController: !!a
65
+ });
66
+ }, [e, s, a]), /* @__PURE__ */ O(d.Provider, { value: P, children: [
67
+ v !== void 0 && /* @__PURE__ */ T(x, { event: v }),
68
+ h
69
+ ] });
70
+ }, j = () => {
71
+ const { sdk: e } = l(d);
72
+ return e;
73
+ }, I = () => {
74
+ const { event: e } = l(d);
75
+ return e;
76
+ }, V = () => {
77
+ const { sdk: e } = l(d), [i, o] = b({});
78
+ return r(() => e?.options ? e?.options?.subscribe((n) => {
79
+ o({ theme: n.theme, themeMode: n.themeMode });
80
+ }) : () => {
81
+ }, [e?.options]), i;
82
+ }, _ = () => {
83
+ const { sdk: e } = l(d), [i, o] = b({});
84
+ return r(() => e?.uiState ? e?.uiState.subscribe((n) => {
85
+ o({ ...n });
86
+ }) : () => {
87
+ }, [e?.uiState]), i;
88
+ };
89
+ export {
90
+ F as V,
91
+ j as Y,
92
+ V as _,
93
+ x as g,
94
+ d as i,
95
+ M as j,
96
+ _ as q
97
+ };