@streamlayer/react 1.4.1 → 1.5.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/insight.js CHANGED
@@ -1,69 +1,62 @@
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())({
1
+ import { jsx as d, jsxs as m } from "react/jsx-runtime";
2
+ import { useRef as c, useEffect as l } from "react";
3
+ import { a as o, s as f, b as h, u as p, d as S, S as I } from "./index2.js";
4
+ import { S as g } from "./useStreamLayerApp2.js";
5
+ const v = () => h, y = /* @__PURE__ */ f(v())({
7
6
  name: "QuestionWrap",
8
7
  class: "q10hhsxv",
9
8
  propsAsIs: !0
10
- }), H = ({
9
+ }), Q = ({
11
10
  gamification: e,
12
11
  persistent: s,
13
- hideHeader: r,
14
- insightId: t
12
+ hideHeader: n,
13
+ insightId: i
15
14
  }) => {
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);
15
+ const t = c(""), u = o(e.openedQuestion.$store);
16
+ return l(() => i ? (!s || e.isOpenedQuestion(i) || (t.current = i, e.getFeedItem(i).then((r) => {
17
+ var a;
18
+ t.current === i && ((a = r == null ? void 0 : r.attributes) == null ? void 0 : a.attributes.case) === "insight" && e.openQuestion(i, r);
19
19
  })), () => {
20
- a.current = "";
21
- }) : e.feedList.getStore().subscribe(({
22
- data: i
20
+ t.current = "";
21
+ }) : (e.activeQuestionId.subscribe(({
22
+ data: r
23
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
- })
24
+ var a;
25
+ r && ((a = r.feedItem) == null ? void 0 : a.type) === "insight" && (!s || e.isOpenedQuestion(r.feedItem.id) || (t.current = r.feedItem.id, e.openQuestion(r.feedItem.id, r.feedItem))), !r && t.current && (e.closeQuestion(t.current), t.current = "");
26
+ }), () => {
27
+ }), [e, s, i]), u ? /* @__PURE__ */ d(y, {
28
+ hideHeader: n,
29
+ gamification: e,
30
+ hideSponsor: !0
40
31
  }) : null;
41
32
  }, b = ({
42
33
  sdk: e,
43
- event: s,
44
- persistent: r,
45
- insightId: t,
46
- hideHeader: a
34
+ persistent: s,
35
+ insightId: n,
36
+ hideHeader: i
47
37
  }) => {
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()))
38
+ if (!o(e.featuresList.getStore()))
54
39
  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
40
+ const t = e.getFeature(g.GAMES);
41
+ return t ? /* @__PURE__ */ d(Q, {
42
+ insightId: n,
43
+ persistent: s,
44
+ hideHeader: i,
45
+ gamification: t
61
46
  }) : 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;
47
+ }, H = ({
48
+ event: e,
49
+ theme: s,
50
+ hideHeader: n,
51
+ persistent: i
52
+ }) => {
53
+ const t = p();
54
+ return t ? /* @__PURE__ */ m("div", { className: "StreamLayerSDK", children: [
55
+ /* @__PURE__ */ d(S, { customTheme: s, children: /* @__PURE__ */ d(b, { sdk: t, hideHeader: n, persistent: i }) }),
56
+ e !== void 0 && /* @__PURE__ */ d(I, { event: e })
57
+ ] }) : null;
65
58
  };
66
59
  export {
67
- O as StreamLayerSDKInsight,
60
+ H as StreamLayerSDKInsight,
68
61
  b as StreamLayerSDKInsightUI
69
62
  };
package/lib/es/masters.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import { M as o, a as s } from "./masters2.js";
3
3
  import "react";
4
- import "./provider.js";
4
+ import "./index2.js";
5
5
  export {
6
6
  o as MastersStreamLayerProvider,
7
7
  s as MastersStreamLayerSDKReact
@@ -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, 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";
2
+ import { a as C, F as r2, s as u, T as j, i as i2, p as a2, h as l2, N as d2, k as c2, M as p2, j as u2, l as C2, C as v2, n as h2, O as K, o as x, q as m2, r as g2, t as L2, v as X, w as f2, x as S2, y as y2, z as U, A as k2, B as J, D as _, I as e2, c as P, G as N2, H as b2, J as z, K as A2, P as I2, R as $2, g as E2, U as T, V as q, W as V2, X as w2, Y as R2, f as H2, Z as Q, _ as T2, $ as x2, L as F, a0 as F2, a1 as D2, a2 as M2, a3 as O2, m as D, a4 as U2, a5 as _2, a6 as P2, a7 as B2, a8 as G2 } from "./index2.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";
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 = () => _, Q = /* @__PURE__ */ u(c0())({
186
+ }, c0 = () => _, Z = /* @__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(Q, {
230
+ const c = i ? /* @__PURE__ */ n(Z, {
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(Q, {
237
+ }) : r ? /* @__PURE__ */ n(Z, {
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 = Z2(() => import("./gamification-feature2.js")), h0 = ({ sdk: e, feature: s, className: t, scrollStore: o, appNode: i, scrollNode: r, responsiveStore: a }) => {
258
+ }, v0 = Q2(() => 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
- Q2,
271
+ Z2,
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
- }), Z0 = () => $2, Q0 = /* @__PURE__ */ u(Z0())({
566
+ }), Q0 = () => $2, Z0 = /* @__PURE__ */ u(Q0())({
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(Q0, {
662
+ return !e || !f.current ? null : w2.createPortal(/* @__PURE__ */ n(Z0, {
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}${Z.down("xl")`
808
+ `${s1}${w.REGULAR}${w.REGULAR}${w.COLOR}${w.SERIF}${w.WEIGHT_DEFAULT}${Q.down("xl")`
809
809
  --header-offset: 56px;
810
810
  --watch-live-header: 46px;
811
- `}${Z.intermediate("xl", "lg")`
811
+ `}${Q.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 }) => {
package/lib/es/points.js CHANGED
@@ -1,60 +1,59 @@
1
- import { jsxs as a, jsx as r } from "react/jsx-runtime";
2
- import { useState as u, useEffect as c } from "react";
3
- import { s as t, a as m, v as d, d as S, u as f, F as v } from "./provider.js";
4
- import { u as y, d as h } from "./index2.js";
1
+ import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
+ import { useState as p, useEffect as u } from "react";
3
+ import { s as n, c as m, m as d, e as S, a as f, F as y, u as v, d as h } from "./index2.js";
5
4
  import { S as g } from "./useStreamLayerApp2.js";
6
- const A = /* @__PURE__ */ t("div")({
5
+ const A = /* @__PURE__ */ n("div")({
7
6
  name: "PointsContainer",
8
7
  class: "psiob9b",
9
8
  propsAsIs: !1
10
- }), I = /* @__PURE__ */ t("div")({
9
+ }), I = /* @__PURE__ */ n("div")({
11
10
  name: "PointsIcon",
12
11
  class: "p1gqe4lh",
13
12
  propsAsIs: !1
14
- }), P = () => m, k = /* @__PURE__ */ t(P())({
13
+ }), P = () => m, k = /* @__PURE__ */ n(P())({
15
14
  name: "PointsSvg",
16
15
  class: "p15syg2y",
17
16
  propsAsIs: !0
18
- }), b = /* @__PURE__ */ t("div")({
17
+ }), b = /* @__PURE__ */ n("div")({
19
18
  name: "PointsBody",
20
19
  class: "p12n4f2h",
21
20
  propsAsIs: !1
22
- }), x = /* @__PURE__ */ t("div")({
21
+ }), x = /* @__PURE__ */ n("div")({
23
22
  name: "PointsTitle",
24
23
  class: "poqmx89",
25
24
  propsAsIs: !1
26
- }), C = /* @__PURE__ */ t("div")({
25
+ }), C = /* @__PURE__ */ n("div")({
27
26
  name: "PointsValue",
28
27
  class: "prj9b3v",
29
28
  propsAsIs: !1
30
- }), F = ({ points: s, onClick: e }) => /* @__PURE__ */ a(A, { className: d, onClick: e, children: [
31
- /* @__PURE__ */ r(I, { children: /* @__PURE__ */ r(k, { name: "icon-trophy" }) }),
32
- /* @__PURE__ */ a(b, { children: [
33
- /* @__PURE__ */ r(x, { children: "Total points" }),
34
- /* @__PURE__ */ r(C, { children: /* @__PURE__ */ r(S, { value: s }) })
29
+ }), F = ({ points: s, onClick: r }) => /* @__PURE__ */ o(A, { className: d, onClick: r, children: [
30
+ /* @__PURE__ */ e(I, { children: /* @__PURE__ */ e(k, { name: "icon-trophy" }) }),
31
+ /* @__PURE__ */ o(b, { children: [
32
+ /* @__PURE__ */ e(x, { children: "Total points" }),
33
+ /* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(S, { value: s }) })
35
34
  ] })
36
35
  ] }), L = ({ gamification: s }) => {
37
- const e = s.userSummary.$store, [i, l] = u(0);
38
- return c(() => {
39
- const p = e.subscribe((n) => {
40
- var o;
41
- (o = n == null ? void 0 : n.summary) != null && o.points && l(n.summary.points);
36
+ const r = s.userSummary.$store, [i, l] = p(0);
37
+ return u(() => {
38
+ const c = r.subscribe((t) => {
39
+ var a;
40
+ (a = t == null ? void 0 : t.summary) != null && a.points && l(t.summary.points);
42
41
  });
43
42
  return () => {
44
- p();
43
+ c();
45
44
  };
46
- }, [e]), /* @__PURE__ */ r(F, { points: i, onClick: () => {
47
- s.status.get() === v.Suspended && s.openFeature();
45
+ }, [r]), /* @__PURE__ */ e(F, { points: i, onClick: () => {
46
+ s.status.get() === y.Suspended && s.openFeature();
48
47
  } });
49
48
  }, $ = ({ sdk: s }) => {
50
49
  if (!f(s.featuresList.getStore()))
51
50
  return null;
52
- const e = s.getFeature(g.GAMES);
53
- return e ? /* @__PURE__ */ r(L, { gamification: e }) : null;
54
- }, K = () => {
55
- const s = y();
56
- return s ? /* @__PURE__ */ r("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ r(h, { children: /* @__PURE__ */ r($, { sdk: s }) }) }) : null;
51
+ const r = s.getFeature(g.GAMES);
52
+ return r ? /* @__PURE__ */ e(L, { gamification: r }) : null;
53
+ }, E = () => {
54
+ const s = v();
55
+ return s ? /* @__PURE__ */ e("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e($, { sdk: s }) }) }) : null;
57
56
  };
58
57
  export {
59
- K as StreamLayerSDKPoints
58
+ E as StreamLayerSDKPoints
60
59
  };