@streamlayer/react 1.24.7 → 1.24.8-pre.84ab1b9

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 (50) hide show
  1. package/lib/app/advertisement.d.ts +4 -0
  2. package/lib/app/pause-ad.d.ts +17 -0
  3. package/lib/cjs/advertisement.js +1491 -1441
  4. package/lib/cjs/auth.js +80 -80
  5. package/lib/cjs/bet-pack.js +279 -242
  6. package/lib/cjs/index.js +1828 -1770
  7. package/lib/cjs/insight.js +682 -620
  8. package/lib/cjs/masters.js +1401 -1362
  9. package/lib/cjs/notification.js +292 -261
  10. package/lib/cjs/pause-ad.js +592 -362
  11. package/lib/cjs/points.js +179 -148
  12. package/lib/cjs/polymarket.js +153 -152
  13. package/lib/cjs/style.css +1 -1
  14. package/lib/cjs/useStreamLayerApp.js +142 -148
  15. package/lib/dist/cjs/index.js +1401 -1362
  16. package/lib/dist/es/index.js +1401 -1362
  17. package/lib/es/Question.js +75 -72
  18. package/lib/es/advertisement.js +9236 -8213
  19. package/lib/es/analytics.js +35 -31
  20. package/lib/es/auth.js +1 -1
  21. package/lib/es/bet-pack.js +1 -1
  22. package/lib/es/{hooks-n9ax4LRT.js → hooks-DHRXtbBc.js} +35 -33
  23. package/lib/es/{index-D8wyDNJD.js → index-BW1YFKTb.js} +35 -35
  24. package/lib/es/index.js +2 -2
  25. package/lib/es/index10.js +6 -6
  26. package/lib/es/index12.js +116 -128
  27. package/lib/es/index13.js +100 -96
  28. package/lib/es/index14.js +15 -15
  29. package/lib/es/index16.js +382 -383
  30. package/lib/es/index2.js +55 -56
  31. package/lib/es/index4.js +3 -3
  32. package/lib/es/index5.js +275 -3
  33. package/lib/es/index6.js +4 -7
  34. package/lib/es/index7.js +5 -284
  35. package/lib/es/index8.js +8 -237
  36. package/lib/es/index9.js +237 -8
  37. package/lib/es/insight.js +3 -3
  38. package/lib/es/masters.js +1 -1
  39. package/lib/es/masters2.js +29 -29
  40. package/lib/es/notification.js +28 -28
  41. package/lib/es/pause-ad.js +362 -153
  42. package/lib/es/points.js +9 -9
  43. package/lib/es/polymarket.js +40 -40
  44. package/lib/es/storage.js +18 -18
  45. package/lib/es/style.css +1 -1
  46. package/lib/es/useStreamLayerApp.js +1 -1
  47. package/lib/es/useStreamLayerApp2.js +5169 -4933
  48. package/lib/es/utils.js +86 -41
  49. package/lib/source.css +1 -1
  50. package/package.json +14 -14
package/lib/es/index2.js CHANGED
@@ -1,25 +1,24 @@
1
- import { h as ye } from "./index6.js";
1
+ import { h as ye } from "./index7.js";
2
2
  import { jsx as o, jsxs as v, Fragment as R } from "react/jsx-runtime";
3
3
  import { u as f, F as Ne, s as p, b as Se, c as w, a as T, N as M } from "./feature.js";
4
4
  import { l as we, S as $e, m as Ae, d as Ce, n as Ee, C as Re, y as xe, a as Le, f as V, p as De, c as Te } from "./index13.js";
5
- import { M as Oe, b as _e, Q as Me, z as me, c as he, T as fe, I as Be, n as Ue, f as Pe, w as Q, a as Fe, p as ze } from "./index16.js";
6
- import F from "lodash.throttle";
7
- import { useState as N, useEffect as I, useRef as E, PureComponent as Ve, useCallback as z, useMemo as $, Suspense as qe, lazy as je, forwardRef as ve, useLayoutEffect as Qe, useContext as K } from "react";
8
- import { A as L } from "./index8.js";
9
- import { f as ge, u as Ke, A as He, a as We } from "./analytics.js";
5
+ import { M as Oe, b as _e, Q as Me, z as me, T as he, I as Ue, n as Be, f as Pe, w as Q, a as ze, p as Fe } from "./index16.js";
6
+ import z from "lodash.throttle";
7
+ import { useState as N, useEffect as I, useRef as E, PureComponent as Ve, useCallback as F, useMemo as $, Suspense as qe, lazy as je, forwardRef as fe, useLayoutEffect as Qe, useContext as K } from "react";
8
+ import { A as L } from "./index9.js";
9
+ import { f as ve, u as Ke, c as ge, A as He, a as We } from "./analytics.js";
10
10
  import { m as O } from "./theme.js";
11
- import { p as q, _ as Ge, e as Je } from "./Question.js";
11
+ import { p as q, t as Ge, e as Je } from "./Question.js";
12
12
  import { O as Ze } from "./index12.js";
13
- import { B as x } from "./index7.js";
14
- import { I as Xe, S as y, g as C, j as H, Q as U } from "./useStreamLayerApp2.js";
15
- import "@storybook/blocks";
13
+ import { M as x } from "./index5.js";
14
+ import { j as Xe, S as y, h as C, k as H, Q as B } from "./useStreamLayerApp2.js";
16
15
  import Ye from "react-infinite-scroller";
17
16
  import { I as et, s as tt, e as st } from "./index10.js";
18
17
  import "./storage.js";
19
- import "./index5.js";
18
+ import "./index6.js";
20
19
  import { createPortal as nt } from "react-dom";
21
20
  import { e as ot } from "./index3.js";
22
- import { i as W, q as at, _ as rt, j as G } from "./hooks-n9ax4LRT.js";
21
+ import { i as W, z as at, q as rt, k as G } from "./hooks-DHRXtbBc.js";
23
22
  import "./notification.js";
24
23
  const J = Object.keys(L), Z = () => {
25
24
  const e = window.innerWidth;
@@ -35,18 +34,18 @@ const J = Object.keys(L), Z = () => {
35
34
  name: t,
36
35
  size: L[t]
37
36
  };
38
- }, X = (e) => (e.current?.getBoundingClientRect().y || 0) < -68, B = () => window.matchMedia("(orientation: landscape)").matches, it = (e) => {
39
- const [t] = N(() => ge({
37
+ }, X = (e) => (e.current?.getBoundingClientRect().y || 0) < -68, U = () => window.matchMedia("(orientation: landscape)").matches, it = (e) => {
38
+ const [t] = N(() => ve({
40
39
  screen: Z(),
41
40
  sdkInView: X(e),
42
- sdkInDesktopView: B()
41
+ sdkInDesktopView: U()
43
42
  }));
44
43
  return I(() => {
45
- const s = F(() => {
44
+ const s = z(() => {
46
45
  t.setKey("sdkInView", X(e));
47
- }, 200), a = F(() => {
46
+ }, 200), a = z(() => {
48
47
  const n = Z();
49
- t.setKey("screen", n), t.setKey("sdkInDesktopView", B());
48
+ t.setKey("screen", n), t.setKey("sdkInDesktopView", U());
50
49
  }, 200);
51
50
  return window.addEventListener("scroll", s), window.addEventListener("resize", a), () => {
52
51
  window.removeEventListener("scroll", s), window.removeEventListener("resize", a);
@@ -60,23 +59,23 @@ const J = Object.keys(L), Z = () => {
60
59
  });
61
60
  }, lt = 15, dt = (e, t) => {
62
61
  const s = E(null), a = E(0), [n] = N(
63
- ge({
62
+ ve({
64
63
  scrollPosition: 0,
65
64
  tabsShown: !0,
66
65
  scrollDirection: "forward"
67
66
  })
68
67
  ), r = f(t);
69
68
  return I(() => {
70
- const d = B() ? s.current : window;
69
+ const d = U() ? s.current : window;
71
70
  if (!d)
72
71
  return () => {
73
72
  };
74
- const l = F((i) => {
73
+ const l = z((i) => {
75
74
  const c = i.target;
76
75
  if (!c)
77
76
  return;
78
- let u = 0;
79
- B() ? u = c.scrollTop : u = e.current?.getBoundingClientRect().y || 0;
77
+ let u;
78
+ U() ? u = c.scrollTop : u = e.current?.getBoundingClientRect().y || 0;
80
79
  const m = a.current - u;
81
80
  if (lt > Math.abs(m))
82
81
  return;
@@ -346,7 +345,7 @@ const xt = /* @__PURE__ */ p("div")({
346
345
  name: "Name",
347
346
  class: "njsrqgr",
348
347
  propsAsIs: !1
349
- }), Bt = () => x, Ut = /* @__PURE__ */ p(Bt())({
348
+ }), Ut = () => x, Bt = /* @__PURE__ */ p(Ut())({
350
349
  name: "CurrentUserBadge",
351
350
  class: "c17uc4zr",
352
351
  propsAsIs: !0
@@ -364,15 +363,15 @@ const xt = /* @__PURE__ */ p("div")({
364
363
  t ? /* @__PURE__ */ o(Dt, { alt: "leaderboard-item-avatar", src: t }) : /* @__PURE__ */ o(Tt, { children: et(s || "") }),
365
364
  /* @__PURE__ */ v(_t, { children: [
366
365
  /* @__PURE__ */ o(Mt, { children: s || "" }),
367
- r && /* @__PURE__ */ o(Ut, { name: "icon-star" })
366
+ r && /* @__PURE__ */ o(Bt, { name: "icon-star" })
368
367
  ] })
369
368
  ] }),
370
369
  /* @__PURE__ */ o("div", { children: tt(n) })
371
- ] }), Ft = /* @__PURE__ */ p("div")({
370
+ ] }), zt = /* @__PURE__ */ p("div")({
372
371
  name: "Container",
373
372
  class: "c16btbfp",
374
373
  propsAsIs: !1
375
- }), zt = ({
374
+ }), Ft = ({
376
375
  items: e,
377
376
  currentUserId: t,
378
377
  openItemDetail: s,
@@ -380,7 +379,7 @@ const xt = /* @__PURE__ */ p("div")({
380
379
  scrollNode: n,
381
380
  hasMore: r
382
381
  }) => {
383
- const d = z((l) => {
382
+ const d = F((l) => {
384
383
  const i = l.target.getAttribute("data-name");
385
384
  i && s(i);
386
385
  }, [s]);
@@ -390,7 +389,7 @@ const xt = /* @__PURE__ */ p("div")({
390
389
  hasMore: r,
391
390
  useWindow: !1,
392
391
  getScrollParent: () => n.current,
393
- children: /* @__PURE__ */ o(Ft, {
392
+ children: /* @__PURE__ */ o(zt, {
394
393
  "data-a": "intr",
395
394
  onClick: d,
396
395
  children: e.map((l) => /* @__PURE__ */ o(Pt, {
@@ -432,7 +431,7 @@ const xt = /* @__PURE__ */ p("div")({
432
431
  return !r.length && !l ? /* @__PURE__ */ o(qt, {
433
432
  deepLink: c
434
433
  }) : /* @__PURE__ */ v(R, {
435
- children: [/* @__PURE__ */ o(zt, {
434
+ children: [/* @__PURE__ */ o(Ft, {
436
435
  items: r,
437
436
  scrollNode: t,
438
437
  scrollStore: s,
@@ -489,7 +488,7 @@ const xt = /* @__PURE__ */ p("div")({
489
488
  }), [s, d]), I(() => {
490
489
  i || u(D.HOME);
491
490
  }, [i]);
492
- let A = "0px";
491
+ let A;
493
492
  return h ? A = l ? "0px" : "calc(0px - var(--header-height))" : A = l ? "var(--header-height)" : "0px", /* @__PURE__ */ v(we, { className: w(t, "SL-Tabs", "sl-hide-on-modal"), style: r, children: [
494
493
  i && /* @__PURE__ */ o(
495
494
  $e,
@@ -527,7 +526,7 @@ const xt = /* @__PURE__ */ p("div")({
527
526
  }) => {
528
527
  const s = e + t;
529
528
  return s === 0 ? 0 : Math.round(e / s * 100);
530
- }, xn = ({
529
+ }, Rn = ({
531
530
  gamification: e,
532
531
  scrollStore: t,
533
532
  className: s,
@@ -551,7 +550,7 @@ const xt = /* @__PURE__ */ p("div")({
551
550
  }) => {
552
551
  const {
553
552
  topNavigation: d
554
- } = q(), l = f(e.openedQuestionId), i = f(e.openedQuestion.$store), c = f(e.openedUser || he(void 0)), {
553
+ } = q(), l = f(e.openedQuestionId), i = f(e.openedQuestion.$store), c = f(e.openedUser || ge(void 0)), {
555
554
  sdkInDesktopView: u
556
555
  } = f(r, {
557
556
  keys: ["sdkInDesktopView"]
@@ -586,7 +585,7 @@ const xt = /* @__PURE__ */ p("div")({
586
585
  })]
587
586
  })
588
587
  }) : null;
589
- return /* @__PURE__ */ o(fe, {
588
+ return /* @__PURE__ */ o(he, {
590
589
  container: n,
591
590
  useContainer: !u,
592
591
  children: g
@@ -721,7 +720,7 @@ var de;
721
720
  (function(e) {
722
721
  e.Unset = "unset", e.Required = "required", e.Optional = "optional", e.Completed = "completed", e.Disabled = "disabled", e.Unavailable = "unavailable";
723
722
  })(de || (de = {}));
724
- U.POLL, U.PREDICTION, U.TRIVIA;
723
+ B.POLL, B.PREDICTION, B.TRIVIA;
725
724
  const rs = {
726
725
  [y.GAMES]: !0
727
726
  }, is = /* @__PURE__ */ p("div")({
@@ -794,7 +793,7 @@ const rs = {
794
793
  name: "DashboardIcon",
795
794
  class: "df5w958",
796
795
  propsAsIs: !0
797
- }), $s = "h12x6aiv", As = ve(({
796
+ }), $s = "h12x6aiv", As = fe(({
798
797
  sdk: e,
799
798
  className: t
800
799
  }, s) => {
@@ -819,7 +818,7 @@ const rs = {
819
818
  ref: s
820
819
  })]
821
820
  });
822
- }), Cs = ve(({
821
+ }), Cs = fe(({
823
822
  sdk: e,
824
823
  className: t
825
824
  }, s) => {
@@ -906,7 +905,7 @@ const rs = {
906
905
  name: "Description",
907
906
  class: "d8uezec",
908
907
  propsAsIs: !1
909
- }), Bs = /* @__PURE__ */ p("button")({
908
+ }), Us = /* @__PURE__ */ p("button")({
910
909
  name: "ActionButton",
911
910
  class: "a1h1bk90",
912
911
  propsAsIs: !1
@@ -918,7 +917,7 @@ const rs = {
918
917
  ] }),
919
918
  s?.titleCard?.title && /* @__PURE__ */ o(_s, { children: s?.titleCard?.title }),
920
919
  s?.titleCard?.subtitle && /* @__PURE__ */ o(Ms, { children: s?.titleCard?.subtitle }),
921
- /* @__PURE__ */ o(Bs, { "data-a": "intr", onClick: t, children: "Play Now" })
920
+ /* @__PURE__ */ o(Us, { "data-a": "intr", onClick: t, children: "Play Now" })
922
921
  ] }), ke = [{
923
922
  graphicSrc: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/dark/step_1.png",
924
923
  tagline: "",
@@ -931,11 +930,11 @@ const rs = {
931
930
  }, {
932
931
  graphicSrc: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/dark/step_3.png",
933
932
  headline: "Win points and play against friends."
934
- }], Us = /* @__PURE__ */ p("div")({
933
+ }], Bs = /* @__PURE__ */ p("div")({
935
934
  name: "OnboardingContainer",
936
935
  class: "o1xni1kr",
937
936
  propsAsIs: !1
938
- }), Ps = () => V, Fs = /* @__PURE__ */ p(Ps())({
937
+ }), Ps = () => V, zs = /* @__PURE__ */ p(Ps())({
939
938
  name: "OnboardingNotificationContainer",
940
939
  class: "o1vnouv7",
941
940
  propsAsIs: !0
@@ -943,7 +942,7 @@ const rs = {
943
942
  name: "InnerContainer",
944
943
  class: "i59uefw",
945
944
  propsAsIs: !1
946
- }), zs = /* @__PURE__ */ p("div")({
945
+ }), Fs = /* @__PURE__ */ p("div")({
947
946
  name: "OnboardingOverlap",
948
947
  class: "ovnr8ov",
949
948
  propsAsIs: !1
@@ -956,7 +955,7 @@ const rs = {
956
955
  sdk: r,
957
956
  throttled: d
958
957
  }) => {
959
- const l = f(a.friends ? a.friends.getStore() : he({
958
+ const l = f(a.friends ? a.friends.getStore() : ge({
960
959
  data: []
961
960
  })), [i, c] = N(void 0), u = $(() => {
962
961
  const m = r.getInviter();
@@ -971,8 +970,8 @@ const rs = {
971
970
  return () => {
972
971
  m();
973
972
  };
974
- }, [e.$store]), /* @__PURE__ */ v(Us, {
975
- children: [/* @__PURE__ */ o(Ue, {
973
+ }, [e.$store]), /* @__PURE__ */ v(Bs, {
974
+ children: [/* @__PURE__ */ o(Be, {
976
975
  loading: n,
977
976
  rules: [{
978
977
  label: "Answer as many questions as you like.",
@@ -1000,7 +999,7 @@ const rs = {
1000
999
  gamification: a,
1001
1000
  sdk: r,
1002
1001
  inviterName: u
1003
- }), d && /* @__PURE__ */ o(zs, {})]
1002
+ }), d && /* @__PURE__ */ o(Fs, {})]
1004
1003
  });
1005
1004
  }, qs = ({
1006
1005
  sdk: e,
@@ -1024,8 +1023,8 @@ const rs = {
1024
1023
  const {
1025
1024
  loading: k,
1026
1025
  throttled: A
1027
- } = Be(h);
1028
- return c && m && i && n.current ? /* @__PURE__ */ o(fe, {
1026
+ } = Ue(h);
1027
+ return c && m && i && n.current ? /* @__PURE__ */ o(he, {
1029
1028
  container: n,
1030
1029
  useContainer: !r,
1031
1030
  children: /* @__PURE__ */ o(Vs, {
@@ -1053,7 +1052,7 @@ const rs = {
1053
1052
  },
1054
1053
  onboarding: i
1055
1054
  })
1056
- }), /* @__PURE__ */ o(Fs, {
1055
+ }), /* @__PURE__ */ o(zs, {
1057
1056
  style: a,
1058
1057
  hiding: t.hiding,
1059
1058
  children: /* @__PURE__ */ o(ue, {
@@ -1100,9 +1099,9 @@ const rs = {
1100
1099
  }
1101
1100
  }
1102
1101
  });
1103
- }), []), r = z((l) => {
1102
+ }), []), r = F((l) => {
1104
1103
  a.current = l;
1105
- }, []), d = z((l) => {
1104
+ }, []), d = F((l) => {
1106
1105
  s(l);
1107
1106
  }, []);
1108
1107
  return I(() => {
@@ -1150,7 +1149,7 @@ const rs = {
1150
1149
  })
1151
1150
  }), /* @__PURE__ */ o(Ws, {}, t.id)]
1152
1151
  })]
1153
- }) : t.type === M.QUESTION_RESOLVED && t.data?.question?.predictionResult ? /* @__PURE__ */ o(Fe, {
1152
+ }) : t.type === M.QUESTION_RESOLVED && t.data?.question?.predictionResult ? /* @__PURE__ */ o(ze, {
1154
1153
  style: {
1155
1154
  height: t.hiding ? 0 : i
1156
1155
  },
@@ -1271,7 +1270,7 @@ const rs = {
1271
1270
  scrollNode: n,
1272
1271
  responsiveStore: r
1273
1272
  }) => {
1274
- const [, d] = ze(e);
1273
+ const [, d] = Fe(e);
1275
1274
  return /* @__PURE__ */ o(ts, {
1276
1275
  className: t,
1277
1276
  scrollNode: n,
@@ -1374,13 +1373,13 @@ const rs = {
1374
1373
  })]
1375
1374
  })
1376
1375
  });
1377
- }, Ln = ({ event: e, topNavigation: t, theme: s, muted: a, withSidebarNotification: n = !0 }) => {
1376
+ }, xn = ({ event: e, topNavigation: t, theme: s, muted: a, withSidebarNotification: n = !0 }) => {
1378
1377
  const { sdk: r, status: d } = K(W), l = at(), i = rt(), { event: c } = K(W);
1379
1378
  if (d === G.UNSET)
1380
1379
  throw new Error("Wrap app in `StreamLayerProvider`");
1381
1380
  return d === G.CONNECTED ? /* @__PURE__ */ o("div", { className: "StreamLayerSDK", children: "wait" }) : r === null ? /* @__PURE__ */ o("div", { className: "StreamLayerSDK", children: "sdk not initialized" }) : !l.app && !l.appNotification && !l.appSidebar || !l.app && !l.appSidebar && l.appNotification && !n ? null : /* @__PURE__ */ o("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ o(ye, { customTheme: s ?? i.theme, themeMode: i.themeMode, children: /* @__PURE__ */ o(an, { sdk: r, muted: a, event: c?.current || e, topNavigation: t }) }) });
1382
1381
  };
1383
1382
  export {
1384
- xn as B,
1385
- Ln as D
1383
+ Rn as B,
1384
+ xn as D
1386
1385
  };
package/lib/es/index4.js CHANGED
@@ -2,10 +2,10 @@ import { jsx as P, jsxs as F } from "react/jsx-runtime";
2
2
  import { s as _, u as Se, a as mt, c as Ee } from "./feature.js";
3
3
  import $, { forwardRef as Ae, useRef as D, useState as W, useEffect as X, useLayoutEffect as ht, createContext as je, useMemo as He, useCallback as Re, memo as gt } from "react";
4
4
  import vt from "lodash.throttle";
5
- import { B as te } from "./index7.js";
6
- import { d as wt } from "./index8.js";
5
+ import { M as te } from "./index5.js";
6
+ import { d as wt } from "./index9.js";
7
7
  import { Q as yt } from "./index13.js";
8
- import { f as bt, g as St, S as qe } from "./useStreamLayerApp2.js";
8
+ import { g as bt, h as St, S as qe } from "./useStreamLayerApp2.js";
9
9
  function _e(t) {
10
10
  return t !== null && typeof t == "object" && "constructor" in t && t.constructor === Object;
11
11
  }