@streamlayer/react 1.23.2 → 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 (174) 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 +203 -28
  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/gamification-feature.js +1 -1
  9. package/lib/cjs/gamification-feature2.js +1 -1
  10. package/lib/cjs/hooks-n9ax4LRT.js +1 -0
  11. package/lib/cjs/index-ByUNFvMk.js +5 -0
  12. package/lib/cjs/index.js +1 -1
  13. package/lib/cjs/index10.js +1 -1
  14. package/lib/cjs/index11.js +1 -3
  15. package/lib/cjs/index12.js +1 -1
  16. package/lib/cjs/index13.js +1 -3
  17. package/lib/cjs/index14.js +4 -1
  18. package/lib/cjs/index15.js +1 -1
  19. package/lib/cjs/index16.js +5 -3
  20. package/lib/cjs/index2.js +1 -1
  21. package/lib/cjs/index3.js +1 -1
  22. package/lib/cjs/index4.js +5 -3
  23. package/lib/cjs/index5.js +1 -1
  24. package/lib/cjs/index6.js +1 -1
  25. package/lib/cjs/index7.js +1 -1
  26. package/lib/cjs/index8.js +1 -1
  27. package/lib/cjs/index9.js +7 -1
  28. package/lib/cjs/insight.js +1 -1
  29. package/lib/cjs/masters.js +1 -1
  30. package/lib/cjs/masters2.js +8 -1
  31. package/lib/cjs/notification.js +1 -1
  32. package/lib/cjs/pause-ad.js +1 -1
  33. package/lib/cjs/points.js +1 -1
  34. package/lib/cjs/polymarket.js +14 -9
  35. package/lib/cjs/sl-types.js +1 -1
  36. package/lib/cjs/storage.js +1 -1
  37. package/lib/cjs/theme.js +1 -1
  38. package/lib/cjs/useStreamLayerApp.js +1 -1
  39. package/lib/cjs/useStreamLayerApp2.js +17 -3
  40. package/lib/cjs/utils.js +47 -1
  41. package/lib/classic/app/masters.d.ts +0 -1
  42. package/lib/classic/cjs/Question.js +1 -1
  43. package/lib/classic/cjs/advertisement.js +203 -28
  44. package/lib/classic/cjs/analytics.js +1 -1
  45. package/lib/classic/cjs/auth.js +1 -1
  46. package/lib/classic/cjs/bet-pack.js +5 -3
  47. package/lib/classic/cjs/feature.js +1 -1
  48. package/lib/classic/cjs/gamification-feature.js +1 -1
  49. package/lib/classic/cjs/hooks-n9ax4LRT.js +1 -0
  50. package/lib/classic/cjs/index-ByUNFvMk.js +5 -0
  51. package/lib/classic/cjs/index.js +1 -1
  52. package/lib/classic/cjs/index10.js +1 -1
  53. package/lib/classic/cjs/index11.js +1 -1
  54. package/lib/classic/cjs/index12.js +1 -1
  55. package/lib/classic/cjs/index13.js +4 -3
  56. package/lib/classic/cjs/index2.js +5 -3
  57. package/lib/classic/cjs/index3.js +1 -1
  58. package/lib/classic/cjs/index4.js +1 -1
  59. package/lib/classic/cjs/index5.js +1 -1
  60. package/lib/classic/cjs/index6.js +1 -1
  61. package/lib/classic/cjs/index7.js +7 -1
  62. package/lib/classic/cjs/index8.js +1 -1
  63. package/lib/classic/cjs/index9.js +1 -3
  64. package/lib/classic/cjs/insight.js +1 -1
  65. package/lib/classic/cjs/notification.js +1 -1
  66. package/lib/classic/cjs/notification2.js +1 -1
  67. package/lib/classic/cjs/pause-ad.js +1 -1
  68. package/lib/classic/cjs/points.js +1 -1
  69. package/lib/classic/cjs/polymarket.js +14 -9
  70. package/lib/classic/cjs/sl-types.js +1 -1
  71. package/lib/classic/cjs/useStreamLayerApp.js +1 -1
  72. package/lib/classic/cjs/useStreamLayerApp2.js +17 -3
  73. package/lib/classic/cjs/utils.js +47 -1
  74. package/lib/classic/es/Question.js +258 -275
  75. package/lib/classic/es/advertisement.js +22128 -38694
  76. package/lib/classic/es/analytics.js +55 -57
  77. package/lib/classic/es/auth.js +8 -14
  78. package/lib/classic/es/bet-pack.js +2413 -2455
  79. package/lib/classic/es/feature.js +46 -95
  80. package/lib/classic/es/gamification-feature.js +2 -2
  81. package/lib/classic/es/hooks-n9ax4LRT.js +97 -0
  82. package/lib/classic/es/index-ByUNFvMk.js +3775 -0
  83. package/lib/classic/es/index.js +13 -16
  84. package/lib/classic/es/index10.js +2587 -83
  85. package/lib/classic/es/index11.js +305 -3087
  86. package/lib/classic/es/index12.js +121 -124
  87. package/lib/classic/es/index13.js +559 -589
  88. package/lib/classic/es/index2.js +1755 -2114
  89. package/lib/classic/es/index3.js +13 -13
  90. package/lib/classic/es/index4.js +4 -283
  91. package/lib/classic/es/index5.js +5 -5
  92. package/lib/classic/es/index6.js +285 -10
  93. package/lib/classic/es/index7.js +179 -6
  94. package/lib/classic/es/index8.js +5 -10
  95. package/lib/classic/es/index9.js +8 -318
  96. package/lib/classic/es/insight.js +54 -61
  97. package/lib/classic/es/notification.js +5 -5
  98. package/lib/classic/es/notification2.js +730 -787
  99. package/lib/classic/es/pause-ad.js +168 -191
  100. package/lib/classic/es/points.js +47 -55
  101. package/lib/classic/es/polymarket.js +4058 -4289
  102. package/lib/classic/es/sl-types.js +128 -298
  103. package/lib/classic/es/useStreamLayerApp.js +2 -2
  104. package/lib/classic/es/useStreamLayerApp2.js +9090 -11121
  105. package/lib/classic/es/utils.js +28 -28
  106. package/lib/classic/index.d.ts +0 -1
  107. package/lib/classic/source.css +110 -0
  108. package/lib/dist/cjs/gamification-feature.js +1 -1
  109. package/lib/dist/cjs/index-ByUNFvMk.js +5 -0
  110. package/lib/dist/cjs/index.js +1 -1
  111. package/lib/dist/cjs/masters.js +69 -3
  112. package/lib/dist/es/gamification-feature.js +2 -2
  113. package/lib/dist/es/index-ByUNFvMk.js +3775 -0
  114. package/lib/dist/es/index.js +7 -10
  115. package/lib/dist/es/masters.js +16944 -19645
  116. package/lib/dist/index.d.ts +7 -17
  117. package/lib/dist/source.css +64 -0
  118. package/lib/es/Question.js +101 -105
  119. package/lib/es/advertisement.js +22128 -38694
  120. package/lib/es/analytics.js +55 -57
  121. package/lib/es/auth.js +8 -14
  122. package/lib/es/bet-pack.js +18 -29
  123. package/lib/es/feature.js +46 -95
  124. package/lib/es/gamification-feature.js +2 -2
  125. package/lib/es/gamification-feature2.js +2 -2
  126. package/lib/es/hooks-n9ax4LRT.js +97 -0
  127. package/lib/es/index-ByUNFvMk.js +3775 -0
  128. package/lib/es/index.js +13 -17
  129. package/lib/es/index10.js +8 -274
  130. package/lib/es/index11.js +172 -837
  131. package/lib/es/index12.js +2587 -183
  132. package/lib/es/index13.js +258 -314
  133. package/lib/es/index14.js +813 -81
  134. package/lib/es/index15.js +305 -3087
  135. package/lib/es/index16.js +803 -1005
  136. package/lib/es/index2.js +980 -1133
  137. package/lib/es/index3.js +4 -3
  138. package/lib/es/index4.js +2401 -2431
  139. package/lib/es/index5.js +13 -13
  140. package/lib/es/index6.js +5 -285
  141. package/lib/es/index7.js +7 -10
  142. package/lib/es/index8.js +283 -5
  143. package/lib/es/index9.js +180 -10
  144. package/lib/es/insight.js +54 -61
  145. package/lib/es/masters.js +5 -7
  146. package/lib/es/masters2.js +538 -708
  147. package/lib/es/notification.js +663 -719
  148. package/lib/es/pause-ad.js +168 -191
  149. package/lib/es/points.js +48 -56
  150. package/lib/es/polymarket.js +4058 -4289
  151. package/lib/es/sl-types.js +128 -317
  152. package/lib/es/storage.js +74 -75
  153. package/lib/es/theme.js +3 -190
  154. package/lib/es/useStreamLayerApp.js +2 -2
  155. package/lib/es/useStreamLayerApp2.js +9090 -11121
  156. package/lib/es/utils.js +28 -28
  157. package/lib/index.d.ts +0 -1
  158. package/lib/source.css +120 -0
  159. package/lib/style.css +1 -1
  160. package/package.json +21 -24
  161. package/lib/cjs/hooks-WfHlJH12.js +0 -1
  162. package/lib/cjs/index-eShKGO10.js +0 -1
  163. package/lib/cjs/style.css +0 -1
  164. package/lib/classic/cjs/hooks-WfHlJH12.js +0 -1
  165. package/lib/classic/cjs/index-eShKGO10.js +0 -1
  166. package/lib/classic/cjs/style.css +0 -1
  167. package/lib/classic/es/hooks-WfHlJH12.js +0 -98
  168. package/lib/classic/es/index-eShKGO10.js +0 -3757
  169. package/lib/classic/style.css +0 -1
  170. package/lib/dist/cjs/index-eShKGO10.js +0 -1
  171. package/lib/dist/es/index-eShKGO10.js +0 -3757
  172. package/lib/dist/style.css +0 -1
  173. package/lib/es/hooks-WfHlJH12.js +0 -98
  174. package/lib/es/index-eShKGO10.js +0 -3757
@@ -1,108 +1,59 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1
+ import { pino as a } from "pino";
4
2
  import "./sl-types.js";
5
- import { S as SdkOverlayType } from "./useStreamLayerApp2.js";
6
- const LEVELS = ["trace", "debug", "info", "warn", "error", "fatal"];
7
- const LEVEL_MAP = {
8
- trace: "debug",
9
- debug: "debug",
10
- info: "info",
11
- warn: "warn",
12
- error: "error",
13
- fatal: "error"
14
- };
15
- const enabled = typeof window !== "undefined" && !!window.localStorage.getItem("SL_DEBUG");
16
- function createLogFn(consoleFn, prefix) {
17
- if (!enabled)
18
- return () => {
19
- };
20
- return (...args) => {
21
- if (args.length === 0)
22
- return;
23
- if (typeof args[0] === "string") {
24
- consoleFn(`[${prefix}]`, ...args);
25
- } else {
26
- const [obj, ...rest] = args;
27
- consoleFn(`[${prefix}]`, ...rest, obj);
28
- }
29
- };
30
- }
31
- function createLoggerInstance(bindings) {
32
- const prefix = bindings.name || "app";
33
- const instance = {
34
- level: "trace",
35
- child(childBindings, _options) {
36
- return createLoggerInstance({ ...bindings, ...childBindings });
3
+ import "nanostores";
4
+ import { S as s } from "./useStreamLayerApp2.js";
5
+ const d = a({
6
+ level: "trace",
7
+ enabled: typeof window < "u" && !!window.localStorage.getItem("SL_DEBUG"),
8
+ browser: {
9
+ write: (t) => {
10
+ console.log(t);
37
11
  }
38
- };
39
- for (const level of LEVELS) {
40
- const method = LEVEL_MAP[level];
41
- const consoleFn = (...a) => console[method](...a);
42
- instance[level] = createLogFn(consoleFn, prefix);
43
12
  }
44
- return instance;
45
- }
46
- const rootLogger = createLoggerInstance({});
47
- const createLogger = (name, options) => rootLogger.child({ name }, options);
48
- class EventBusEvent extends Event {
49
- constructor(name, payload) {
50
- super(name);
51
- __publicField(this, "slEventBus");
52
- this.slEventBus = payload;
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;
53
18
  }
54
19
  }
55
- const logger = createLogger("event-bus");
56
- class EventBus {
57
- constructor(name = "sl-event-bus") {
58
- __publicField(this, "name");
59
- __publicField(this, "listeners");
60
- __publicField(this, "emit", (type, payload) => {
61
- const event = new EventBusEvent(this.name, { ...payload, type });
62
- logger.debug(event, "Emitting event");
63
- window.dispatchEvent(event);
64
- });
65
- __publicField(this, "destroy", () => {
66
- this.listeners.forEach((listener) => {
67
- window.removeEventListener(this.name, listener);
68
- this.listeners.delete(listener);
69
- });
70
- this.listeners.clear();
71
- });
72
- this.name = name;
73
- this.listeners = /* @__PURE__ */ new Set();
20
+ const v = l("event-bus");
21
+ class h {
22
+ name;
23
+ listeners;
24
+ constructor(e = "sl-event-bus") {
25
+ this.name = e, this.listeners = /* @__PURE__ */ new Set();
74
26
  }
75
- listen(listener) {
76
- window.addEventListener(this.name, listener);
77
- this.listeners.add(listener);
78
- return () => {
79
- this.off(listener);
27
+ emit = (e, n) => {
28
+ const i = new c(this.name, { ...n, type: e });
29
+ v.debug(i, "Emitting event"), window.dispatchEvent(i);
30
+ };
31
+ listen(e) {
32
+ return window.addEventListener(this.name, e), this.listeners.add(e), () => {
33
+ this.off(e);
80
34
  };
81
35
  }
82
- off(listener) {
83
- window.removeEventListener(this.name, listener);
84
- this.listeners.delete(listener);
36
+ off(e) {
37
+ window.removeEventListener(this.name, e), this.listeners.delete(e);
85
38
  }
39
+ destroy = () => {
40
+ this.listeners.forEach((e) => {
41
+ window.removeEventListener(this.name, e), this.listeners.delete(e);
42
+ }), this.listeners.clear();
43
+ };
86
44
  }
87
45
  window.slStore = /* @__PURE__ */ Object.create(null);
88
- var FeatureSource;
89
- (function(FeatureSource2) {
90
- FeatureSource2["ORGANIZATION"] = "ORGANIZATION";
91
- FeatureSource2["STREAM"] = "STREAM";
92
- })(FeatureSource || (FeatureSource = {}));
93
- ({
94
- [SdkOverlayType.BETTING]: "betting",
95
- [SdkOverlayType.GAMES]: "games",
96
- [SdkOverlayType.PUBLIC_CHAT]: "publicChat",
97
- [SdkOverlayType.TWITTER]: "twitter"
98
- });
99
- var FeatureStatus;
100
- (function(FeatureStatus2) {
101
- FeatureStatus2["Ready"] = "ready";
102
- FeatureStatus2["Suspended"] = "suspended";
103
- })(FeatureStatus || (FeatureStatus = {}));
46
+ var o;
47
+ (function(t) {
48
+ t.ORGANIZATION = "ORGANIZATION", t.STREAM = "STREAM";
49
+ })(o || (o = {}));
50
+ s.BETTING + "", s.GAMES + "", s.PUBLIC_CHAT + "", s.TWITTER + "";
51
+ var r;
52
+ (function(t) {
53
+ t.Ready = "ready", t.Suspended = "suspended";
54
+ })(r || (r = {}));
104
55
  export {
105
- EventBus as E,
106
- FeatureStatus as F,
107
- createLogger as c
56
+ h as E,
57
+ r as F,
58
+ l as c
108
59
  };
@@ -1,4 +1,4 @@
1
- import { B } from "./index2.js";
1
+ import { B as f } from "./index2.js";
2
2
  export {
3
- B as default
3
+ f as default
4
4
  };
@@ -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
+ };