@streamlayer/react 1.22.3 → 1.23.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 (122) 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 +44 -40
  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/hooks-WfHlJH12.js +1 -0
  10. package/lib/cjs/index-eShKGO10.js +5 -0
  11. package/lib/cjs/index.js +1 -1
  12. package/lib/cjs/index10.js +1 -1
  13. package/lib/cjs/index16.js +2 -2
  14. package/lib/cjs/index2.js +1 -1
  15. package/lib/cjs/index3.js +1 -1
  16. package/lib/cjs/index4.js +1 -1
  17. package/lib/cjs/index7.js +1 -5
  18. package/lib/cjs/insight.js +1 -1
  19. package/lib/cjs/masters.js +1 -1
  20. package/lib/cjs/masters2.js +5 -5
  21. package/lib/cjs/notification.js +1 -1
  22. package/lib/cjs/pause-ad.js +1 -1
  23. package/lib/cjs/points.js +1 -1
  24. package/lib/cjs/polymarket.js +19 -0
  25. package/lib/cjs/useStreamLayerApp2.js +17 -17
  26. package/lib/classic/app/pause-ad.d.ts +2 -4
  27. package/lib/classic/app/polymarket.d.ts +7 -0
  28. package/lib/classic/cjs/Question.js +1 -1
  29. package/lib/classic/cjs/advertisement.js +44 -40
  30. package/lib/classic/cjs/analytics.js +1 -1
  31. package/lib/classic/cjs/auth.js +1 -1
  32. package/lib/classic/cjs/bet-pack.js +3 -3
  33. package/lib/classic/cjs/feature.js +1 -0
  34. package/lib/classic/cjs/hooks-WfHlJH12.js +1 -0
  35. package/lib/classic/cjs/index-eShKGO10.js +5 -0
  36. package/lib/classic/cjs/index.js +1 -1
  37. package/lib/classic/cjs/index10.js +1 -1
  38. package/lib/classic/cjs/index11.js +1 -1
  39. package/lib/classic/cjs/index12.js +1 -1
  40. package/lib/classic/cjs/index13.js +1 -1
  41. package/lib/classic/cjs/index2.js +2 -2
  42. package/lib/classic/cjs/index3.js +1 -1
  43. package/lib/classic/cjs/index4.js +1 -1
  44. package/lib/classic/cjs/index5.js +1 -1
  45. package/lib/classic/cjs/index6.js +1 -5
  46. package/lib/classic/cjs/index9.js +1 -1
  47. package/lib/classic/cjs/insight.js +1 -1
  48. package/lib/classic/cjs/notification.js +1 -1
  49. package/lib/classic/cjs/notification2.js +1 -1
  50. package/lib/classic/cjs/pause-ad.js +1 -1
  51. package/lib/classic/cjs/points.js +1 -1
  52. package/lib/classic/cjs/polymarket.js +19 -0
  53. package/lib/classic/cjs/useStreamLayerApp2.js +17 -17
  54. package/lib/classic/es/Question.js +50 -50
  55. package/lib/classic/es/advertisement.js +15547 -10742
  56. package/lib/classic/es/analytics.js +74 -18
  57. package/lib/classic/es/auth.js +1 -1
  58. package/lib/classic/es/bet-pack.js +19 -18
  59. package/lib/classic/es/feature.js +63 -0
  60. package/lib/classic/es/hooks-WfHlJH12.js +98 -0
  61. package/lib/classic/es/index-eShKGO10.js +3757 -0
  62. package/lib/classic/es/index.js +1 -1
  63. package/lib/classic/es/index10.js +1 -1
  64. package/lib/classic/es/index11.js +767 -755
  65. package/lib/classic/es/index12.js +1 -1
  66. package/lib/classic/es/index13.js +2 -2
  67. package/lib/classic/es/index2.js +125 -125
  68. package/lib/classic/es/index3.js +16 -61
  69. package/lib/classic/es/index4.js +282 -16
  70. package/lib/classic/es/index5.js +4 -283
  71. package/lib/classic/es/index6.js +5 -3758
  72. package/lib/classic/es/index9.js +1 -1
  73. package/lib/classic/es/insight.js +1 -1
  74. package/lib/classic/es/notification.js +1 -1
  75. package/lib/classic/es/notification2.js +476 -451
  76. package/lib/classic/es/pause-ad.js +174 -208
  77. package/lib/classic/es/points.js +16 -15
  78. package/lib/classic/es/polymarket.js +6670 -0
  79. package/lib/classic/es/useStreamLayerApp2.js +5088 -4030
  80. package/lib/dist/cjs/index-eShKGO10.js +5 -0
  81. package/lib/dist/cjs/masters.js +36 -36
  82. package/lib/dist/es/index-eShKGO10.js +3757 -0
  83. package/lib/dist/es/masters.js +9243 -8192
  84. package/lib/dist/index.d.ts +30 -7
  85. package/lib/dist/style.css +1 -1
  86. package/lib/es/Question.js +3 -3
  87. package/lib/es/advertisement.js +15547 -10742
  88. package/lib/es/analytics.js +74 -18
  89. package/lib/es/auth.js +1 -1
  90. package/lib/es/bet-pack.js +1 -1
  91. package/lib/es/feature.js +63 -0
  92. package/lib/es/hooks-WfHlJH12.js +98 -0
  93. package/lib/es/index-eShKGO10.js +3757 -0
  94. package/lib/es/index.js +1 -1
  95. package/lib/es/index10.js +9 -9
  96. package/lib/es/index16.js +2 -2
  97. package/lib/es/index2.js +118 -118
  98. package/lib/es/index3.js +3 -61
  99. package/lib/es/index4.js +1 -1
  100. package/lib/es/index7.js +5 -3758
  101. package/lib/es/insight.js +1 -1
  102. package/lib/es/masters.js +1 -1
  103. package/lib/es/masters2.js +23 -23
  104. package/lib/es/notification.js +450 -425
  105. package/lib/es/pause-ad.js +174 -208
  106. package/lib/es/points.js +5 -4
  107. package/lib/es/polymarket.js +6670 -0
  108. package/lib/es/useStreamLayerApp2.js +5088 -4030
  109. package/lib/style.css +1 -1
  110. package/package.json +27 -17
  111. package/lib/cjs/hooks-B0Qttldg.js +0 -1
  112. package/lib/cjs/index-DSi8Qgfs.js +0 -1
  113. package/lib/cjs/vast-client.min.js +0 -1
  114. package/lib/classic/cjs/hooks-B0Qttldg.js +0 -1
  115. package/lib/classic/cjs/index-DSi8Qgfs.js +0 -1
  116. package/lib/classic/cjs/vast-client.min.js +0 -1
  117. package/lib/classic/es/hooks-B0Qttldg.js +0 -98
  118. package/lib/classic/es/index-DSi8Qgfs.js +0 -65
  119. package/lib/classic/es/vast-client.min.js +0 -1060
  120. package/lib/es/hooks-B0Qttldg.js +0 -98
  121. package/lib/es/index-DSi8Qgfs.js +0 -65
  122. package/lib/es/vast-client.min.js +0 -1060
@@ -1,28 +1,84 @@
1
- import { useEffect as l } from "react";
2
- import { e as i } from "./index3.js";
3
- import { A as s } from "./sl-types.js";
4
- const u = (e) => [(t) => (...n) => (e && i.emit(e == null ? void 0 : e.type, e), t ? t(n) : null)], p = (e) => {
5
- const t = e.target;
6
- t instanceof HTMLAnchorElement && t.target === "_blank" && t.getAttribute("data-a") === "web-link" && i.emit("poll", {
1
+ import { useEffect as c } from "react";
2
+ import { e as s } from "./index3.js";
3
+ import { A as v } from "./sl-types.js";
4
+ let o = [], r = 0;
5
+ const u = 4, d = /* @__NO_SIDE_EFFECTS__ */ (i) => {
6
+ let e = [], t = {
7
+ get() {
8
+ return t.lc || t.listen(() => {
9
+ })(), t.value;
10
+ },
11
+ lc: 0,
12
+ listen(n) {
13
+ return t.lc = e.push(n), () => {
14
+ for (let a = r + u; a < o.length; )
15
+ o[a] === n ? o.splice(a, u) : a += u;
16
+ let l = e.indexOf(n);
17
+ ~l && (e.splice(l, 1), --t.lc || t.off());
18
+ };
19
+ },
20
+ notify(n, l) {
21
+ let a = !o.length;
22
+ for (let f of e)
23
+ o.push(f, t.value, n, l);
24
+ if (a) {
25
+ for (r = 0; r < o.length; r += u)
26
+ o[r](
27
+ o[r + 1],
28
+ o[r + 2],
29
+ o[r + 3]
30
+ );
31
+ o.length = 0;
32
+ }
33
+ },
34
+ /* It will be called on last listener unsubscribing.
35
+ We will redefine it in onMount and onStop. */
36
+ off() {
37
+ },
38
+ set(n) {
39
+ let l = t.value;
40
+ l !== n && (t.value = n, t.notify(l));
41
+ },
42
+ subscribe(n) {
43
+ let l = t.listen(n);
44
+ return n(t.value), l;
45
+ },
46
+ value: i
47
+ };
48
+ return t;
49
+ }, b = /* @__NO_SIDE_EFFECTS__ */ (i = {}) => {
50
+ let e = /* @__PURE__ */ d(i);
51
+ return e.setKey = function(t, n) {
52
+ let l = e.value;
53
+ typeof n > "u" && t in e.value ? (e.value = { ...e.value }, delete e.value[t], e.notify(l, t)) : e.value[t] !== n && (e.value = {
54
+ ...e.value,
55
+ [t]: n
56
+ }, e.notify(l, t));
57
+ }, e;
58
+ }, y = (i) => [(e) => (...t) => (i && s.emit(i == null ? void 0 : i.type, i), e ? e(t) : null)], h = (i) => {
59
+ const e = i.target;
60
+ e instanceof HTMLAnchorElement && e.target === "_blank" && e.getAttribute("data-a") === "web-link" && s.emit("poll", {
7
61
  action: "navigated",
8
62
  payload: {}
9
- }), t instanceof Element && t.getAttribute("data-a") === "intr" && i.emit("interactions", {
63
+ }), e instanceof Element && e.getAttribute("data-a") === "intr" && s.emit("interactions", {
10
64
  action: "tap",
11
65
  payload: {}
12
66
  });
13
- }, f = (e, t) => {
14
- const n = window.innerWidth < s.xl;
15
- l(() => {
16
- const a = n && t.useDomNode ? document : e.current, o = (r) => {
17
- t.listener(r, e);
67
+ }, A = (i, e) => {
68
+ const t = window.innerWidth < v.xl;
69
+ c(() => {
70
+ const n = t && e.useDomNode ? document : i.current, l = (a) => {
71
+ e.listener(a, i);
18
72
  };
19
- return t.enabled && (a == null || a.addEventListener(t.event, o)), () => {
20
- a == null || a.removeEventListener(t.event, o);
73
+ return e.enabled && (n == null || n.addEventListener(e.event, l)), () => {
74
+ n == null || n.removeEventListener(e.event, l);
21
75
  };
22
- }, [n, t.enabled, t.listener]);
76
+ }, [t, e.enabled, e.listener]);
23
77
  };
24
78
  export {
25
- p as A,
26
- f as b,
27
- u as f
79
+ h as A,
80
+ y as a,
81
+ A as b,
82
+ d as c,
83
+ b as f
28
84
  };
package/lib/es/auth.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { useEffect as o } from "react";
2
- import { B as f } from "./hooks-B0Qttldg.js";
2
+ import { B as f } from "./hooks-WfHlJH12.js";
3
3
  const p = ({ token: t, schema: i }) => {
4
4
  const r = f();
5
5
  return o(() => {
@@ -2,7 +2,7 @@ import { jsx as n } from "react/jsx-runtime";
2
2
  import { e as o } from "./index3.js";
3
3
  import { Q as i } from "./index4.js";
4
4
  import { useEffect as c } from "react";
5
- import { B as m } from "./hooks-B0Qttldg.js";
5
+ import { B as m } from "./hooks-WfHlJH12.js";
6
6
  const r = (t) => {
7
7
  const e = t.target;
8
8
  e instanceof Element && e.getAttribute("data-a") === "intr" && o.emit("interactions", {
@@ -0,0 +1,63 @@
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";
5
+ 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);
14
+ }
15
+ }
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;
22
+ }
23
+ }
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);
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
+ this.name = e, this.listeners = /* @__PURE__ */ new Set();
39
+ }
40
+ listen(e) {
41
+ return window.addEventListener(this.name, e), this.listeners.add(e), () => {
42
+ this.off(e);
43
+ };
44
+ }
45
+ off(e) {
46
+ window.removeEventListener(this.name, e), this.listeners.delete(e);
47
+ }
48
+ }
49
+ 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 = {}));
59
+ export {
60
+ T as E,
61
+ a as F,
62
+ w as c
63
+ };
@@ -0,0 +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 = ({
5
+ event: e,
6
+ internal: r
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;
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 = {
15
+ status: 0,
16
+ sdk: null
17
+ }, d = g(M), U = ({
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
37
+ }) => {
38
+ const t = T({
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(() => {
59
+ localStorage.getItem("SL_DEBUG") && console.log("StreamLayerProvider mounted with props:", {
60
+ sdkKey: !!e,
61
+ onDeepLinkHandled: !!s,
62
+ videoPlayerController: !!l
63
+ });
64
+ }, [e, s, l]), /* @__PURE__ */ N(d.Provider, { value: P, children: [
65
+ m !== void 0 && /* @__PURE__ */ O(L, { event: m }),
66
+ a
67
+ ] });
68
+ }, H = () => {
69
+ const { sdk: e } = u(d);
70
+ return e;
71
+ }, j = () => {
72
+ const { event: e } = u(d);
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 });
80
+ }) : () => {
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 });
87
+ }) : () => {
88
+ }, [e == null ? void 0 : e.uiState]), r;
89
+ };
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
98
+ };