@streamlayer/react 1.4.0 → 1.4.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.
package/lib/es/index2.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var fe = Object.defineProperty;
2
2
  var ke = (e, s, n) => s in e ? fe(e, s, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[s] = n;
3
3
  var m = (e, s, n) => ke(e, typeof s != "symbol" ? s + "" : s, n);
4
- import { h as w, i as G, Q as x, S as C } from "./useStreamLayerApp2.js";
5
- import { a4 as P, u, F as ye, s as h, T as re, i as Ne, p as be, b as Se, N as Ie, k as Ee, M as Ae, f as we, S as Ce, C as $e, g as De, O as le, m as q, l as Le, h as Te, j as Oe, n as de, o as xe, q as Re, r as Ve, t as M, w as Pe, x as ce, y as U, z as qe, A as H, I as O, a as pe, D as _e, E as Fe, G as Qe, e as Ke, H as R, J as j, K as Me, P as Ue, R as ze, c as ue, V as We, W as Be, L as _, _ as Ge, v as F, $ as He, a0 as je, X as Xe, Y as Ye, Z as Ze, a5 as Je, a2 as he, a3 as X } from "./provider.js";
4
+ import { h as w, i as G, d as x, S as C } from "./useStreamLayerApp2.js";
5
+ import { a4 as P, u, F as ye, s as h, T as re, i as Ne, p as be, b as Se, N as Ie, k as Ee, M as Ae, f as we, S as Ce, C as $e, g as De, O as le, m as q, l as Le, h as Te, j as Oe, n as de, o as xe, q as Re, r as Ve, t as Q, w as Pe, y as ce, x as U, z as qe, A as H, I as O, a as pe, D as _e, E as Fe, G as Ke, e as Me, H as R, J as j, K as Qe, P as Ue, R as ze, c as ue, V as We, W as Be, L as _, _ as Ge, v as F, $ as He, a0 as je, X as Xe, Y as Ye, Z as Ze, a5 as Je, a2 as he, a3 as X } from "./provider.js";
6
6
  import { jsx as t, jsxs as g, Fragment as L } from "react/jsx-runtime";
7
7
  import { createContext as es, useContext as z, useRef as D, useState as E, useEffect as k, useTransition as ss, lazy as ns, useMemo as $, Suspense as ts, forwardRef as os, useLayoutEffect as is, useCallback as V } from "react";
8
8
  window.dispatchEvent(new CustomEvent("grpc_devtools_loaded"));
@@ -107,7 +107,7 @@ var te;
107
107
  x.POLL, x.PREDICTION, x.TRIVIA;
108
108
  const ds = {
109
109
  [C.GAMES]: !0
110
- }, Q = /* @__PURE__ */ h("div")({
110
+ }, K = /* @__PURE__ */ h("div")({
111
111
  name: "LoadingContainer",
112
112
  class: "lclc0ej",
113
113
  propsAsIs: !1
@@ -121,17 +121,17 @@ const ds = {
121
121
  const r = u(e.status), l = u(s.sdkStore.slStreamId);
122
122
  if (!a) {
123
123
  if (l != null && l.loading && !l.data)
124
- return /* @__PURE__ */ t(Q, {
124
+ return /* @__PURE__ */ t(K, {
125
125
  className: o,
126
126
  children: "Event is loading..."
127
127
  });
128
128
  if (!(l != null && l.data))
129
- return /* @__PURE__ */ t(Q, {
129
+ return /* @__PURE__ */ t(K, {
130
130
  className: o,
131
131
  children: "Event is forbidden..."
132
132
  });
133
133
  if (r !== ye.Ready)
134
- return /* @__PURE__ */ t(Q, {
134
+ return /* @__PURE__ */ t(K, {
135
135
  className: o,
136
136
  children: "Wait feature..."
137
137
  });
@@ -265,7 +265,7 @@ const ds = {
265
265
  const { tabsShown: d } = u(n, { keys: ["tabsShown"] }), [i, c] = E(q.HOME), [, p] = ss(), { sdkInDesktopView: v, screen: f } = u(l, { keys: ["sdkInDesktopView"] }), N = (S) => {
266
266
  p(() => {
267
267
  var y;
268
- c(S), v === !1 && (((y = a.current) == null ? void 0 : y.getBoundingClientRect().y) || 0) < 0 && M(a, f.size, { behavior: "instant" });
268
+ c(S), v === !1 && (((y = a.current) == null ? void 0 : y.getBoundingClientRect().y) || 0) < 0 && Q(a, f.size, { behavior: "instant" });
269
269
  });
270
270
  };
271
271
  k(() => n.subscribe((S) => {
@@ -478,11 +478,11 @@ const ds = {
478
478
  name: "Subtitle",
479
479
  class: "s1eftsbu",
480
480
  propsAsIs: !1
481
- }), Qs = /* @__PURE__ */ h("div")({
481
+ }), Ks = /* @__PURE__ */ h("div")({
482
482
  name: "Description",
483
483
  class: "d8uezec",
484
484
  propsAsIs: !1
485
- }), Ks = /* @__PURE__ */ h("button")({
485
+ }), Ms = /* @__PURE__ */ h("button")({
486
486
  name: "ActionButton",
487
487
  class: "a1h1bk90",
488
488
  propsAsIs: !1
@@ -495,10 +495,10 @@ const ds = {
495
495
  /* @__PURE__ */ t(_s, { children: "PRESENTS" })
496
496
  ] }),
497
497
  ((d = n == null ? void 0 : n.titleCard) == null ? void 0 : d.title) && /* @__PURE__ */ t(Fs, { children: (i = n == null ? void 0 : n.titleCard) == null ? void 0 : i.title }),
498
- ((c = n == null ? void 0 : n.titleCard) == null ? void 0 : c.subtitle) && /* @__PURE__ */ t(Qs, { children: (p = n == null ? void 0 : n.titleCard) == null ? void 0 : p.subtitle }),
499
- /* @__PURE__ */ t(Ks, { onClick: s, children: "Play Now" })
498
+ ((c = n == null ? void 0 : n.titleCard) == null ? void 0 : c.subtitle) && /* @__PURE__ */ t(Ks, { children: (p = n == null ? void 0 : n.titleCard) == null ? void 0 : p.subtitle }),
499
+ /* @__PURE__ */ t(Ms, { onClick: s, children: "Play Now" })
500
500
  ] });
501
- }, K = [{
501
+ }, M = [{
502
502
  graphicSrc: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/step_0.png",
503
503
  tagline: "",
504
504
  headline: /* @__PURE__ */ g(L, {
@@ -516,7 +516,7 @@ const ds = {
516
516
  }, {
517
517
  graphicSrc: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/step_5.png",
518
518
  headline: "Compete against friends on the leaderboard"
519
- }], Ms = /* @__PURE__ */ h("div")({
519
+ }], Qs = /* @__PURE__ */ h("div")({
520
520
  name: "OnboardingContainer",
521
521
  class: "o1xni1kr",
522
522
  propsAsIs: !1
@@ -551,7 +551,7 @@ const ds = {
551
551
  return () => {
552
552
  A();
553
553
  };
554
- }, [e.$store]), /* @__PURE__ */ t(Ms, {
554
+ }, [e.$store]), /* @__PURE__ */ t(Qs, {
555
555
  children: /* @__PURE__ */ t(Fe, {
556
556
  loading: a,
557
557
  rules: [{
@@ -568,7 +568,7 @@ const ds = {
568
568
  rulesTitle: (d = s.rules) == null ? void 0 : d.heading,
569
569
  termsTitle: "Terms and Conditions",
570
570
  termsText: (i = s.rules) == null ? void 0 : i.terms,
571
- steps: K,
571
+ steps: M,
572
572
  primaryColor: (c = s.inviteCard) == null ? void 0 : c.iconColor,
573
573
  inviteLink: b,
574
574
  inviteCardTitle: (p = s.inviteCard) == null ? void 0 : p.heading,
@@ -592,7 +592,7 @@ const ds = {
592
592
  sdkInDesktopView: r,
593
593
  responsiveStore: l
594
594
  }) => {
595
- const d = D(null), i = s.data.onboarding, [c, p] = E(i == null ? void 0 : i.instantOpen), v = e.getFeature(C.GAMES), f = $(() => K == null ? void 0 : K.map(({
595
+ const d = D(null), i = s.data.onboarding, [c, p] = E(i == null ? void 0 : i.instantOpen), v = e.getFeature(C.GAMES), f = $(() => M == null ? void 0 : M.map(({
596
596
  graphicSrc: y
597
597
  }) => y), []), {
598
598
  screen: N
@@ -642,7 +642,7 @@ const ds = {
642
642
  close: s.close,
643
643
  action: () => {
644
644
  var y;
645
- p(!0), (((y = a.current) == null ? void 0 : y.getBoundingClientRect().y) || 0) < 0 && M(a, N.size, {
645
+ p(!0), (((y = a.current) == null ? void 0 : y.getBoundingClientRect().y) || 0) < 0 && Q(a, N.size, {
646
646
  behavior: "smooth"
647
647
  });
648
648
  },
@@ -667,7 +667,7 @@ const ds = {
667
667
  name: "NotificationRefreshing",
668
668
  class: "n192d1q8",
669
669
  propsAsIs: !1
670
- }), Zs = () => Qe, Js = /* @__PURE__ */ h(Zs())({
670
+ }), Zs = () => Ke, Js = /* @__PURE__ */ h(Zs())({
671
671
  name: "Pill",
672
672
  class: "p1lha68t",
673
673
  propsAsIs: !0
@@ -719,7 +719,7 @@ const ds = {
719
719
  })
720
720
  }), /* @__PURE__ */ t(Ys, {}, s.id)]
721
721
  })]
722
- }) : s.type === R.QUESTION_RESOLVED && (r = (a = s.data) == null ? void 0 : a.question) != null && r.predictionResult ? /* @__PURE__ */ t(Me, {
722
+ }) : s.type === R.QUESTION_RESOLVED && (r = (a = s.data) == null ? void 0 : a.question) != null && r.predictionResult ? /* @__PURE__ */ t(Qe, {
723
723
  style: {
724
724
  height: s.hiding ? 0 : c
725
725
  },
@@ -769,7 +769,7 @@ const ds = {
769
769
  r.get().sdkInDesktopView ? (N = a.current) == null || N.scrollTo({
770
770
  top: 0,
771
771
  behavior: "smooth"
772
- }) : M(n, c.size, {
772
+ }) : Q(n, c.size, {
773
773
  behavior: "smooth"
774
774
  }), s(null);
775
775
  },
@@ -785,7 +785,7 @@ const ds = {
785
785
  }) => {
786
786
  const [l] = E(e.getNotificationsStore()), d = u(l), [i, c] = E(null), p = $(() => e.getActiveNotification(), [e, d]);
787
787
  return k(() => {
788
- p && Ke.emit("notification", {
788
+ p && Me.emit("notification", {
789
789
  action: "rendered",
790
790
  payload: {
791
791
  questionId: p.data.questionId,
@@ -953,6 +953,7 @@ export {
953
953
  gn as E,
954
954
  an as F,
955
955
  kn as S,
956
+ vs as a,
956
957
  cn as d,
957
958
  fn as u
958
959
  };
@@ -0,0 +1,69 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { useEffect as l, useRef as h } from "react";
3
+ import { u as p, x as f, s as S } from "./provider.js";
4
+ import { F as g, a as v, u as y, d as I } from "./index2.js";
5
+ import { S as Q, Q as x } from "./useStreamLayerApp2.js";
6
+ const E = () => v, L = /* @__PURE__ */ S(E())({
7
+ name: "QuestionWrap",
8
+ class: "q10hhsxv",
9
+ propsAsIs: !0
10
+ }), H = ({
11
+ gamification: e,
12
+ persistent: s,
13
+ hideHeader: r,
14
+ insightId: t
15
+ }) => {
16
+ const a = h(""), o = p(e.openedQuestion.$store);
17
+ return l(() => t ? (!s || e.isOpenedQuestion(t) || (a.current = t, e.getFeedItem(t).then((i) => {
18
+ a.current === t && e.openQuestion(t, i);
19
+ })), () => {
20
+ a.current = "";
21
+ }) : e.feedList.getStore().subscribe(({
22
+ data: i
23
+ }) => {
24
+ if (i) {
25
+ const u = i, d = u == null ? void 0 : u.find(({
26
+ type: m,
27
+ attributes: c
28
+ }) => m === "insight" && (c == null ? void 0 : c.status) === x.ACTIVE);
29
+ d && (!s || e.isOpenedQuestion(d.id) || e.openQuestion(d.id, d));
30
+ }
31
+ }), [e, s, t]), o ? /* @__PURE__ */ n(f, {
32
+ style: {
33
+ height: "100%"
34
+ },
35
+ children: /* @__PURE__ */ n(L, {
36
+ hideHeader: r,
37
+ gamification: e,
38
+ hideSponsor: !0
39
+ })
40
+ }) : null;
41
+ }, b = ({
42
+ sdk: e,
43
+ event: s,
44
+ persistent: r,
45
+ insightId: t,
46
+ hideHeader: a
47
+ }) => {
48
+ const {
49
+ deactivate: o
50
+ } = g(e);
51
+ if (l(() => {
52
+ s ? e.createEventSession(s) : o();
53
+ }, [s, o, e]), !p(e.featuresList.getStore()))
54
+ return null;
55
+ const i = e.getFeature(Q.GAMES);
56
+ return i ? /* @__PURE__ */ n(H, {
57
+ insightId: t,
58
+ persistent: r,
59
+ hideHeader: a,
60
+ gamification: i
61
+ }) : null;
62
+ }, O = ({ event: e, hideHeader: s, persistent: r }) => {
63
+ const t = y();
64
+ return t ? /* @__PURE__ */ n("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ n(I, { children: /* @__PURE__ */ n(b, { sdk: t, event: e, hideHeader: s, persistent: r }) }) }) : null;
65
+ };
66
+ export {
67
+ O as StreamLayerSDKInsight,
68
+ b as StreamLayerSDKInsightUI
69
+ };
@@ -1,7 +1,7 @@
1
1
  import { jsx as n, jsxs as L, Fragment as E } from "react/jsx-runtime";
2
- import { u as C, F as r2, s as u, T as j, i as i2, p as a2, b as l2, N as d2, k as c2, M as p2, f as u2, S as C2, C as v2, g as h2, O as K, m as x, l as m2, h as g2, j as L2, n as X, o as f2, q as S2, r as y2, t as U, w as k2, x as J, y as _, I as e2, a as P, z as N2, A as b2, B as z, D as A2, E as I2, G as $2, e as E2, H as T, J as q, K as V2, P as w2, R as R2, c as H2, U as Q, V as T2, W as x2, L as F, X as F2, Y as D2, Z as M2, _ as O2, v as D, $ as U2, a0 as _2, a1 as P2, a2 as B2, a3 as G2 } from "./provider.js";
3
- import { createContext as z2, useContext as s2, useRef as $, useState as b, useEffect as k, useTransition as q2, lazy as Q2, useMemo as H, Suspense as Z2, forwardRef as Y2, useLayoutEffect as W2, useCallback as R, Component as j2 } from "react";
4
- import { Q as K2, S as I } from "./useStreamLayerApp2.js";
2
+ import { u as C, F as r2, s as u, T as j, i as i2, p as a2, b as l2, N as d2, k as c2, M as p2, f as u2, S as C2, C as v2, g as h2, O as K, m as x, l as m2, h as g2, j as L2, n as X, o as f2, q as S2, r as y2, t as U, w as k2, y as J, x as _, I as e2, a as P, z as N2, A as b2, B as z, D as A2, E as I2, G as $2, e as E2, H as T, J as q, K as V2, P as w2, R as R2, c as H2, U as Z, V as T2, W as x2, L as F, X as F2, Y as D2, Z as M2, _ as O2, v as D, $ as U2, a0 as _2, a1 as P2, a2 as B2, a3 as G2 } from "./provider.js";
3
+ import { createContext as z2, useContext as s2, useRef as $, useState as b, useEffect as k, useTransition as q2, lazy as Z2, useMemo as H, Suspense as Q2, forwardRef as Y2, useLayoutEffect as W2, useCallback as R, Component as j2 } from "react";
4
+ import { d as K2, S as I } from "./useStreamLayerApp2.js";
5
5
  const M = /* @__PURE__ */ u("div")({
6
6
  name: "LoadingContainer",
7
7
  class: "l7wseip",
@@ -183,7 +183,7 @@ const M = /* @__PURE__ */ u("div")({
183
183
  ] }),
184
184
  d === x.LEADERBOARD && /* @__PURE__ */ n(y2, { children: /* @__PURE__ */ n(i0, { scrollStore: t, scrollNode: o, gamification: e }) })
185
185
  ] });
186
- }, c0 = () => _, Z = /* @__PURE__ */ u(c0())({
186
+ }, c0 = () => _, Q = /* @__PURE__ */ u(c0())({
187
187
  name: "OpenedContainer",
188
188
  class: "o1seszvt",
189
189
  propsAsIs: !0
@@ -227,14 +227,14 @@ const M = /* @__PURE__ */ u("div")({
227
227
  } = k2();
228
228
  if (!t.current || !i && !r)
229
229
  return null;
230
- const c = i ? /* @__PURE__ */ n(Z, {
230
+ const c = i ? /* @__PURE__ */ n(Q, {
231
231
  className: s,
232
232
  hiding: p,
233
233
  onAnimationEnd: d,
234
234
  children: /* @__PURE__ */ n(t0, {
235
235
  gamification: e
236
236
  })
237
- }) : r ? /* @__PURE__ */ n(Z, {
237
+ }) : r ? /* @__PURE__ */ n(Q, {
238
238
  className: s,
239
239
  hiding: p,
240
240
  onAnimationEnd: d,
@@ -255,7 +255,7 @@ const M = /* @__PURE__ */ u("div")({
255
255
  useContainer: !a,
256
256
  children: c
257
257
  });
258
- }, v0 = Q2(() => import("./gamification-feature2.js")), h0 = ({ sdk: e, feature: s, className: t, scrollStore: o, appNode: i, scrollNode: r, responsiveStore: a }) => {
258
+ }, v0 = Z2(() => import("./gamification-feature2.js")), h0 = ({ sdk: e, feature: s, className: t, scrollStore: o, appNode: i, scrollNode: r, responsiveStore: a }) => {
259
259
  const p = H(() => s && s.featureConfig.get().type === I.GAMES ? /* @__PURE__ */ n(X2, { className: t, sdk: e, feature: s, children: /* @__PURE__ */ n(
260
260
  v0,
261
261
  {
@@ -268,7 +268,7 @@ const M = /* @__PURE__ */ u("div")({
268
268
  }
269
269
  ) }) : null, [e, s, t, a, o, r, i]);
270
270
  return /* @__PURE__ */ n(
271
- Z2,
271
+ Q2,
272
272
  {
273
273
  fallback: /* @__PURE__ */ n("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "100%" }, children: "page loading..." }),
274
274
  children: p
@@ -563,7 +563,7 @@ const M = /* @__PURE__ */ u("div")({
563
563
  name: "NotificationRefreshing",
564
564
  class: "n13rok4i",
565
565
  propsAsIs: !1
566
- }), Q0 = () => $2, Z0 = /* @__PURE__ */ u(Q0())({
566
+ }), Z0 = () => $2, Q0 = /* @__PURE__ */ u(Z0())({
567
567
  name: "Pill",
568
568
  class: "pht79xf",
569
569
  propsAsIs: !0
@@ -659,7 +659,7 @@ const M = /* @__PURE__ */ u("div")({
659
659
  r.get().sdkInDesktopView ? h < 50 && s(null) : h > -50 && s(null);
660
660
  }, [h, r, s]);
661
661
  const f = r.get().sdkInDesktopView ? t : o;
662
- return !e || !f.current ? null : w2.createPortal(/* @__PURE__ */ n(Z0, {
662
+ return !e || !f.current ? null : w2.createPortal(/* @__PURE__ */ n(Q0, {
663
663
  title: e.type === T.QUESTION_RESOLVED ? "Prediction result" : `New ${((d = R2[(p = e.data) == null ? void 0 : p.questionType]) == null ? void 0 : d.label) || "notification"}`,
664
664
  onClick: () => {
665
665
  var S;
@@ -805,10 +805,10 @@ const M = /* @__PURE__ */ u("div")({
805
805
  ${e}
806
806
  --color-${s.toLowerCase().replaceAll("_", "-")}: ${t};
807
807
  `, "");
808
- `${s1}${w.REGULAR}${w.REGULAR}${w.COLOR}${w.SERIF}${w.WEIGHT_DEFAULT}${Q.down("xl")`
808
+ `${s1}${w.REGULAR}${w.REGULAR}${w.COLOR}${w.SERIF}${w.WEIGHT_DEFAULT}${Z.down("xl")`
809
809
  --header-offset: 56px;
810
810
  --watch-live-header: 46px;
811
- `}${Q.intermediate("xl", "lg")`
811
+ `}${Z.intermediate("xl", "lg")`
812
812
  --header-offset: 76px;
813
813
  `}`;
814
814
  const t1 = "m1ojpy2l", n1 = ({ children: e, style: s }) => /* @__PURE__ */ n("div", { className: "StreamLayerSDKTheme", children: /* @__PURE__ */ n("div", { className: t1, style: s, children: e }) }), o1 = ({ sdk: e, className: s, scrollStore: t, appNode: o, scrollNode: i, responsiveStore: r }) => {
@@ -4,7 +4,7 @@ var fs = (c, p, m) => Ik(c, typeof p != "symbol" ? p + "" : p, m);
4
4
  import * as _ from "react";
5
5
  import Pa, { useCallback as lr, useSyncExternalStore as _k, useState as Rt, useEffect as Wt, useRef as Zn, useMemo as li, useLayoutEffect as lv, Component as sv, createElement as Pk, PureComponent as Nk, createContext as Mk } from "react";
6
6
  import { jsx as x, jsxs as Q, Fragment as ci } from "react/jsx-runtime";
7
- import { p as Ak, S as bp, Q as $e, d as Nu, e as Nc, I as uv, g as zk, f as Cp, u as Ok } from "./useStreamLayerApp2.js";
7
+ import { p as Ak, S as bp, d as $e, e as Nu, Q as Nc, I as uv, g as zk, f as Cp, u as Ok } from "./useStreamLayerApp2.js";
8
8
  var wp = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
9
9
  function cv(c) {
10
10
  return c && c.__esModule && Object.prototype.hasOwnProperty.call(c, "default") ? c.default : c;
@@ -23226,7 +23226,7 @@ export {
23226
23226
  y7 as u,
23227
23227
  NP as v,
23228
23228
  BS as w,
23229
- DP as x,
23230
- I7 as y,
23229
+ I7 as x,
23230
+ DP as y,
23231
23231
  QP as z
23232
23232
  };
@@ -17708,7 +17708,7 @@ const $_ = ({
17708
17708
  m = !0;
17709
17709
  };
17710
17710
  const u = Y_(e, n, a, {
17711
- version: "1.4.0",
17711
+ version: "1.4.1",
17712
17712
  onDeepLinkHandled: s,
17713
17713
  videoPlayerController: r,
17714
17714
  onContentActivate: o
@@ -17730,13 +17730,13 @@ export {
17730
17730
  Fa as I,
17731
17731
  mm as N,
17732
17732
  Ze as P,
17733
- G as Q,
17733
+ ae as Q,
17734
17734
  j as S,
17735
17735
  Jo as a,
17736
17736
  um as b,
17737
17737
  ym as c,
17738
- ft as d,
17739
- ae as e,
17738
+ G as d,
17739
+ ft as e,
17740
17740
  Yt as f,
17741
17741
  Yr as g,
17742
17742
  P as h,