@streamlayer/react 1.23.1 → 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 (159) hide show
  1. package/lib/cjs/Question.js +1 -1
  2. package/lib/cjs/advertisement.js +28 -223
  3. package/lib/cjs/analytics.js +1 -1
  4. package/lib/cjs/auth.js +1 -1
  5. package/lib/cjs/bet-pack.js +1 -1
  6. package/lib/cjs/feature.js +1 -1
  7. package/lib/cjs/gamification-feature.js +1 -1
  8. package/lib/cjs/gamification-feature2.js +1 -1
  9. package/lib/cjs/hooks-WfHlJH12.js +1 -1
  10. package/lib/cjs/index-eShKGO10.js +1 -5
  11. package/lib/cjs/index.js +1 -1
  12. package/lib/cjs/index10.js +1 -1
  13. package/lib/cjs/index11.js +3 -4
  14. package/lib/cjs/index12.js +1 -1
  15. package/lib/cjs/index13.js +3 -1
  16. package/lib/cjs/index14.js +1 -1
  17. package/lib/cjs/index15.js +1 -1
  18. package/lib/cjs/index16.js +3 -5
  19. package/lib/cjs/index2.js +1 -1
  20. package/lib/cjs/index3.js +1 -1
  21. package/lib/cjs/index4.js +3 -5
  22. package/lib/cjs/index5.js +1 -1
  23. package/lib/cjs/index6.js +1 -1
  24. package/lib/cjs/index7.js +1 -1
  25. package/lib/cjs/index8.js +1 -1
  26. package/lib/cjs/index9.js +1 -1
  27. package/lib/cjs/insight.js +1 -1
  28. package/lib/cjs/masters.js +1 -1
  29. package/lib/cjs/masters2.js +1 -13
  30. package/lib/cjs/notification.js +1 -1
  31. package/lib/cjs/pause-ad.js +1 -1
  32. package/lib/cjs/points.js +1 -1
  33. package/lib/cjs/polymarket.js +5 -15
  34. package/lib/cjs/sl-types.js +1 -15
  35. package/lib/cjs/storage.js +1 -1
  36. package/lib/cjs/style.css +1 -0
  37. package/lib/cjs/theme.js +1 -17
  38. package/lib/cjs/useStreamLayerApp.js +1 -1
  39. package/lib/cjs/useStreamLayerApp2.js +3 -17
  40. package/lib/cjs/utils.js +1 -47
  41. package/lib/classic/cjs/Question.js +1 -1
  42. package/lib/classic/cjs/advertisement.js +28 -223
  43. package/lib/classic/cjs/analytics.js +1 -1
  44. package/lib/classic/cjs/auth.js +1 -1
  45. package/lib/classic/cjs/bet-pack.js +3 -5
  46. package/lib/classic/cjs/feature.js +1 -1
  47. package/lib/classic/cjs/gamification-feature.js +1 -1
  48. package/lib/classic/cjs/hooks-WfHlJH12.js +1 -1
  49. package/lib/classic/cjs/index-eShKGO10.js +1 -5
  50. package/lib/classic/cjs/index.js +1 -1
  51. package/lib/classic/cjs/index10.js +1 -1
  52. package/lib/classic/cjs/index11.js +1 -1
  53. package/lib/classic/cjs/index12.js +1 -1
  54. package/lib/classic/cjs/index13.js +3 -4
  55. package/lib/classic/cjs/index2.js +3 -5
  56. package/lib/classic/cjs/index3.js +1 -1
  57. package/lib/classic/cjs/index4.js +1 -1
  58. package/lib/classic/cjs/index5.js +1 -1
  59. package/lib/classic/cjs/index6.js +1 -1
  60. package/lib/classic/cjs/index7.js +1 -1
  61. package/lib/classic/cjs/index8.js +1 -1
  62. package/lib/classic/cjs/index9.js +3 -1
  63. package/lib/classic/cjs/insight.js +1 -1
  64. package/lib/classic/cjs/notification.js +1 -1
  65. package/lib/classic/cjs/notification2.js +1 -1
  66. package/lib/classic/cjs/pause-ad.js +1 -1
  67. package/lib/classic/cjs/points.js +1 -1
  68. package/lib/classic/cjs/polymarket.js +5 -15
  69. package/lib/classic/cjs/sl-types.js +1 -15
  70. package/lib/classic/cjs/style.css +1 -0
  71. package/lib/classic/cjs/useStreamLayerApp.js +1 -1
  72. package/lib/classic/cjs/useStreamLayerApp2.js +3 -17
  73. package/lib/classic/cjs/utils.js +1 -47
  74. package/lib/classic/es/Question.js +277 -264
  75. package/lib/classic/es/advertisement.js +34990 -18881
  76. package/lib/classic/es/analytics.js +58 -56
  77. package/lib/classic/es/auth.js +14 -8
  78. package/lib/classic/es/bet-pack.js +2448 -2419
  79. package/lib/classic/es/feature.js +93 -48
  80. package/lib/classic/es/gamification-feature.js +2 -2
  81. package/lib/classic/es/hooks-WfHlJH12.js +78 -78
  82. package/lib/classic/es/index-eShKGO10.js +948 -948
  83. package/lib/classic/es/index.js +13 -13
  84. package/lib/classic/es/index10.js +68 -67
  85. package/lib/classic/es/index11.js +2903 -2159
  86. package/lib/classic/es/index12.js +124 -119
  87. package/lib/classic/es/index13.js +581 -566
  88. package/lib/classic/es/index2.js +2098 -1763
  89. package/lib/classic/es/index3.js +11 -11
  90. package/lib/classic/es/index4.js +127 -127
  91. package/lib/classic/es/index5.js +3 -4
  92. package/lib/classic/es/index6.js +8 -3
  93. package/lib/classic/es/index7.js +6 -5
  94. package/lib/classic/es/index8.js +8 -7
  95. package/lib/classic/es/index9.js +225 -223
  96. package/lib/classic/es/insight.js +58 -53
  97. package/lib/classic/es/notification.js +3 -3
  98. package/lib/classic/es/notification2.js +764 -722
  99. package/lib/classic/es/pause-ad.js +190 -167
  100. package/lib/classic/es/points.js +55 -48
  101. package/lib/classic/es/polymarket.js +4209 -4031
  102. package/lib/classic/es/sl-types.js +193 -125
  103. package/lib/classic/es/useStreamLayerApp.js +2 -2
  104. package/lib/classic/es/useStreamLayerApp2.js +9714 -7603
  105. package/lib/classic/es/utils.js +28 -28
  106. package/lib/classic/index.d.ts +1 -0
  107. package/lib/classic/style.css +1 -0
  108. package/lib/dist/cjs/gamification-feature.js +1 -1
  109. package/lib/dist/cjs/index-eShKGO10.js +1 -5
  110. package/lib/dist/cjs/index.js +1 -1
  111. package/lib/dist/cjs/masters.js +3 -77
  112. package/lib/dist/es/gamification-feature.js +2 -2
  113. package/lib/dist/es/index-eShKGO10.js +948 -948
  114. package/lib/dist/es/index.js +7 -8
  115. package/lib/dist/es/masters.js +18197 -14750
  116. package/lib/dist/index.d.ts +12 -2
  117. package/lib/dist/style.css +1 -1
  118. package/lib/es/Question.js +108 -106
  119. package/lib/es/advertisement.js +34990 -18881
  120. package/lib/es/analytics.js +58 -56
  121. package/lib/es/auth.js +14 -8
  122. package/lib/es/bet-pack.js +29 -17
  123. package/lib/es/feature.js +93 -48
  124. package/lib/es/gamification-feature.js +2 -2
  125. package/lib/es/gamification-feature2.js +2 -2
  126. package/lib/es/hooks-WfHlJH12.js +78 -78
  127. package/lib/es/index-eShKGO10.js +948 -948
  128. package/lib/es/index.js +14 -13
  129. package/lib/es/index10.js +176 -166
  130. package/lib/es/index11.js +581 -566
  131. package/lib/es/index12.js +124 -119
  132. package/lib/es/index13.js +225 -223
  133. package/lib/es/index14.js +68 -67
  134. package/lib/es/index15.js +2903 -2159
  135. package/lib/es/index16.js +1005 -806
  136. package/lib/es/index2.js +1117 -984
  137. package/lib/es/index3.js +3 -4
  138. package/lib/es/index4.js +2424 -2407
  139. package/lib/es/index5.js +11 -11
  140. package/lib/es/index6.js +127 -127
  141. package/lib/es/index7.js +8 -3
  142. package/lib/es/index8.js +5 -5
  143. package/lib/es/index9.js +8 -7
  144. package/lib/es/insight.js +58 -53
  145. package/lib/es/masters.js +6 -5
  146. package/lib/es/masters2.js +696 -559
  147. package/lib/es/notification.js +696 -655
  148. package/lib/es/pause-ad.js +190 -167
  149. package/lib/es/points.js +56 -49
  150. package/lib/es/polymarket.js +4209 -4031
  151. package/lib/es/sl-types.js +200 -132
  152. package/lib/es/storage.js +75 -74
  153. package/lib/es/theme.js +177 -31
  154. package/lib/es/useStreamLayerApp.js +2 -2
  155. package/lib/es/useStreamLayerApp2.js +9714 -7603
  156. package/lib/es/utils.js +28 -28
  157. package/lib/index.d.ts +1 -0
  158. package/lib/style.css +1 -1
  159. package/package.json +23 -20
@@ -1,63 +1,108 @@
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
+ 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);
5
4
  import "./sl-types.js";
6
- import "nanostores";
7
- import { S as o } from "./useStreamLayerApp2.js";
8
- const v = c({
9
- level: "trace",
10
- enabled: typeof window < "u" && !!window.localStorage.getItem("SL_DEBUG"),
11
- browser: {
12
- write: (t) => {
13
- console.log(t);
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);
14
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 });
37
+ }
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);
15
43
  }
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;
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;
22
53
  }
23
54
  }
24
- const m = w("event-bus");
25
- class T {
26
- 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);
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);
32
64
  });
33
- n(this, "destroy", () => {
34
- this.listeners.forEach((e) => {
35
- window.removeEventListener(this.name, e), this.listeners.delete(e);
36
- }), this.listeners.clear();
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();
37
71
  });
38
- this.name = e, this.listeners = /* @__PURE__ */ new Set();
72
+ this.name = name;
73
+ this.listeners = /* @__PURE__ */ new Set();
39
74
  }
40
- listen(e) {
41
- return window.addEventListener(this.name, e), this.listeners.add(e), () => {
42
- this.off(e);
75
+ listen(listener) {
76
+ window.addEventListener(this.name, listener);
77
+ this.listeners.add(listener);
78
+ return () => {
79
+ this.off(listener);
43
80
  };
44
81
  }
45
- off(e) {
46
- window.removeEventListener(this.name, e), this.listeners.delete(e);
82
+ off(listener) {
83
+ window.removeEventListener(this.name, listener);
84
+ this.listeners.delete(listener);
47
85
  }
48
86
  }
49
87
  window.slStore = /* @__PURE__ */ Object.create(null);
50
- var r;
51
- (function(t) {
52
- t.ORGANIZATION = "ORGANIZATION", t.STREAM = "STREAM";
53
- })(r || (r = {}));
54
- o.BETTING + "", o.GAMES + "", o.PUBLIC_CHAT + "", o.TWITTER + "";
55
- var a;
56
- (function(t) {
57
- t.Ready = "ready", t.Suspended = "suspended";
58
- })(a || (a = {}));
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 = {}));
59
104
  export {
60
- T as E,
61
- a as F,
62
- w as c
105
+ EventBus as E,
106
+ FeatureStatus as F,
107
+ createLogger as c
63
108
  };
@@ -1,4 +1,4 @@
1
- import { B as f } from "./index2.js";
1
+ import { B } from "./index2.js";
2
2
  export {
3
- f as default
3
+ B as default
4
4
  };
@@ -1,98 +1,98 @@
1
- import { createContext as g, useEffect as i, useRef as w, useMemo as A, useContext as u, useState as h } from "react";
2
- import { jsxs as N, jsx as O } from "react/jsx-runtime";
3
- import { $ as T } from "./useStreamLayerApp2.js";
4
- const L = ({
1
+ import { createContext, useEffect, useRef, useMemo, useContext, useState } from "react";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
+ import { $ } from "./useStreamLayerApp2.js";
4
+ const j = ({
5
5
  event: e,
6
- internal: r
6
+ internal: o
7
7
  }) => {
8
- const o = H(), n = j();
9
- return i(() => {
10
- o && (e && (o.createEventSession(e, r), n && (n.current = e)), !e && n != null && n.current && (o.createEventSession("", r), n.current = ""));
11
- }, [e, r, n, o]), null;
8
+ const r = B(), s = G();
9
+ return useEffect(() => {
10
+ r && (e && (r.createEventSession(e, o), s && (s.current = e)), !e && (s != null && s.current) && (r.createEventSession("", o), s.current = ""));
11
+ }, [e, o, s, r]), null;
12
12
  };
13
- var x = /* @__PURE__ */ ((e) => (e[e.UNSET = 0] = "UNSET", e[e.CONNECTED = 1] = "CONNECTED", e[e.READY = 2] = "READY", e))(x || {});
14
- const M = {
13
+ var Y = /* @__PURE__ */ ((e) => (e[e.UNSET = 0] = "UNSET", e[e.CONNECTED = 1] = "CONNECTED", e[e.READY = 2] = "READY", e))(Y || {});
14
+ const w = {
15
15
  status: 0,
16
16
  sdk: null
17
- }, d = g(M), U = ({
17
+ }, i = createContext(w), q = ({
18
18
  sdkKey: e,
19
- theme: r,
20
- themeMode: o,
21
- plugins: n,
22
- children: a,
23
- event: m,
24
- production: y = !0,
25
- autoEnable: C = !0,
26
- withAdNotification: E,
27
- withAd: S = !0,
28
- betPack: c = !1,
29
- hideFriends: f,
30
- skipOnboarding: v,
31
- friendsTab: p = "enabled",
32
- onDeepLinkHandled: s,
33
- videoPlayerController: l,
34
- onContentActivate: D,
35
- containerId: k,
36
- webOS: K
19
+ theme: o,
20
+ themeMode: r,
21
+ plugins: s,
22
+ children: f,
23
+ event: p,
24
+ production: x = true,
25
+ autoEnable: K = true,
26
+ withAdNotification: N,
27
+ withAd: C = true,
28
+ betPack: a = false,
29
+ hideFriends: T,
30
+ skipOnboarding: S,
31
+ friendsTab: E = "enabled",
32
+ onDeepLinkHandled: u,
33
+ videoPlayerController: c,
34
+ onContentActivate: U,
35
+ containerId: h,
36
+ webOS: y
37
37
  }) => {
38
- const t = T({
38
+ const t = $({
39
39
  sdkKey: e,
40
- plugins: n,
41
- production: y,
42
- autoEnable: C,
43
- onDeepLinkHandled: s,
44
- videoPlayerController: l,
45
- onContentActivate: D,
46
- hideFriends: f,
47
- skipOnboarding: v,
48
- withAdNotification: E,
49
- withAd: S,
50
- friendsTab: p,
51
- betPack: c,
52
- webOS: K
53
- }), b = w(""), P = A(() => t ? { sdk: t, status: 2, event: b } : { status: 1, sdk: null, event: b }, [t]);
54
- return i(() => {
55
- t && (t.options.setKey("friendsTab", p), t.options.setKey("theme", r), t.options.setKey("themeMode", o), t.options.setKey("skipOnboarding", v), t.options.setKey("betPack", c), t.options.setKey("containerId", k));
56
- }, [t, p, r, o, v, c, k]), i(() => () => {
57
- s && (t == null || t.removeDeepLinkHandler(s)), l && (t == null || t.removeVideoPlayerController(l));
58
- }, [t]), i(() => {
40
+ plugins: s,
41
+ production: x,
42
+ autoEnable: K,
43
+ onDeepLinkHandled: u,
44
+ videoPlayerController: c,
45
+ onContentActivate: U,
46
+ hideFriends: T,
47
+ skipOnboarding: S,
48
+ withAdNotification: N,
49
+ withAd: C,
50
+ friendsTab: E,
51
+ betPack: a,
52
+ webOS: y
53
+ }), l = useRef(""), D = useMemo(() => t ? { sdk: t, status: 2, event: l } : { status: 1, sdk: null, event: l }, [t]);
54
+ return useEffect(() => {
55
+ t && (t.options.setKey("friendsTab", E), t.options.setKey("theme", o), t.options.setKey("themeMode", r), t.options.setKey("skipOnboarding", S), t.options.setKey("betPack", a), t.options.setKey("containerId", h));
56
+ }, [t, E, o, r, S, a, h]), useEffect(() => () => {
57
+ u && (t == null || t.removeDeepLinkHandler(u)), c && (t == null || t.removeVideoPlayerController(c));
58
+ }, [t]), useEffect(() => {
59
59
  localStorage.getItem("SL_DEBUG") && console.log("StreamLayerProvider mounted with props:", {
60
60
  sdkKey: !!e,
61
- onDeepLinkHandled: !!s,
62
- videoPlayerController: !!l
61
+ onDeepLinkHandled: !!u,
62
+ videoPlayerController: !!c
63
63
  });
64
- }, [e, s, l]), /* @__PURE__ */ N(d.Provider, { value: P, children: [
65
- m !== void 0 && /* @__PURE__ */ O(L, { event: m }),
66
- a
64
+ }, [e, u, c]), /* @__PURE__ */ jsxs(i.Provider, { value: D, children: [
65
+ p !== void 0 && /* @__PURE__ */ jsx(j, { event: p }),
66
+ f
67
67
  ] });
68
- }, H = () => {
69
- const { sdk: e } = u(d);
68
+ }, B = () => {
69
+ const { sdk: e } = useContext(i);
70
70
  return e;
71
- }, j = () => {
72
- const { event: e } = u(d);
71
+ }, G = () => {
72
+ const { event: e } = useContext(i);
73
73
  return e;
74
- }, Y = () => {
75
- const { sdk: e } = u(d), [r, o] = h({});
76
- return i(() => {
77
- var n;
78
- return e != null && e.options ? (n = e == null ? void 0 : e.options) == null ? void 0 : n.subscribe((a) => {
79
- o({ theme: a.theme, themeMode: a.themeMode });
74
+ }, z = () => {
75
+ const { sdk: e } = useContext(i), [o, r] = useState({});
76
+ return useEffect(() => {
77
+ var s;
78
+ return e != null && e.options ? (s = e == null ? void 0 : e.options) == null ? void 0 : s.subscribe((f) => {
79
+ r({ theme: f.theme, themeMode: f.themeMode });
80
80
  }) : () => {
81
81
  };
82
- }, [e == null ? void 0 : e.options]), r;
83
- }, B = () => {
84
- const { sdk: e } = u(d), [r, o] = h({});
85
- return i(() => e != null && e.uiState ? e == null ? void 0 : e.uiState.subscribe((n) => {
86
- o({ ...n });
82
+ }, [e == null ? void 0 : e.options]), o;
83
+ }, F = () => {
84
+ const { sdk: e } = useContext(i), [o, r] = useState({});
85
+ return useEffect(() => e != null && e.uiState ? e == null ? void 0 : e.uiState.subscribe((s) => {
86
+ r({ ...s });
87
87
  }) : () => {
88
- }, [e == null ? void 0 : e.uiState]), r;
88
+ }, [e == null ? void 0 : e.uiState]), o;
89
89
  };
90
90
  export {
91
- H as B,
92
- B as F,
93
- x as Y,
94
- d as i,
95
- L as j,
96
- U as q,
97
- Y as z
91
+ B,
92
+ F,
93
+ Y,
94
+ i,
95
+ j,
96
+ q,
97
+ z
98
98
  };