@streamlayer/react 1.10.0 → 1.11.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/cjs/masters2.js +1 -1
- package/lib/cjs/provider.js +60 -52
- package/lib/cjs/useStreamLayerApp2.js +1 -1
- package/lib/classic/app/advertisement.d.ts +18 -0
- package/lib/classic/app/app.d.ts +19 -0
- package/lib/classic/app/auth.d.ts +4 -0
- package/lib/classic/app/event.d.ts +4 -0
- package/lib/classic/app/insight.d.ts +13 -0
- package/lib/classic/app/masters.d.ts +28 -0
- package/lib/classic/app/notification.d.ts +5 -0
- package/lib/classic/app/points.d.ts +3 -0
- package/lib/classic/app/provider.d.ts +43 -0
- package/lib/classic/app/useStreamLayerApp.d.ts +19 -0
- package/lib/classic/cjs/advertisement.js +1 -0
- package/lib/classic/cjs/auth.js +1 -0
- package/lib/classic/cjs/gamification-feature.js +1 -0
- package/lib/classic/cjs/gamification-feature2.js +1 -0
- package/lib/classic/cjs/index.js +1 -0
- package/lib/classic/cjs/insight.js +1 -0
- package/lib/classic/cjs/masters.js +1 -0
- package/lib/classic/cjs/masters2.js +9 -0
- package/lib/classic/cjs/notification.js +1 -0
- package/lib/classic/cjs/points.js +1 -0
- package/lib/classic/cjs/provider.js +195 -0
- package/lib/classic/cjs/useStreamLayerApp.js +1 -0
- package/lib/classic/cjs/useStreamLayerApp2.js +17 -0
- package/lib/classic/es/advertisement.js +755 -0
- package/lib/classic/es/auth.js +11 -0
- package/lib/classic/es/gamification-feature.js +4 -0
- package/lib/classic/es/gamification-feature2.js +4 -0
- package/lib/classic/es/index.js +16 -0
- package/lib/classic/es/insight.js +75 -0
- package/lib/classic/es/masters.js +8 -0
- package/lib/classic/es/masters2.js +1066 -0
- package/lib/classic/es/notification.js +468 -0
- package/lib/classic/es/points.js +59 -0
- package/lib/classic/es/provider.js +24526 -0
- package/lib/classic/es/useStreamLayerApp.js +5 -0
- package/lib/classic/es/useStreamLayerApp2.js +18023 -0
- package/lib/classic/index.d.ts +14 -0
- package/lib/classic/masters.d.ts +5 -0
- package/lib/classic/style.css +1 -0
- package/lib/dist/cjs/gamification-feature2.js +1 -1
- package/lib/dist/cjs/masters.js +56 -48
- package/lib/dist/es/gamification-feature2.js +10 -10
- package/lib/dist/es/index.js +3 -3
- package/lib/dist/es/masters.js +6601 -6554
- package/lib/es/index.js +1 -1
- package/lib/es/masters2.js +22 -22
- package/lib/es/notification.js +18 -18
- package/lib/es/provider.js +4727 -4679
- package/lib/es/useStreamLayerApp2.js +1 -1
- package/package.json +49 -13
package/lib/es/index.js
CHANGED
package/lib/es/masters2.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as n, jsxs as L, Fragment as V } from "react/jsx-runtime";
|
|
2
|
-
import { s as u, k as n2, a as v, A as k, l as G, F as C2, m as o2, n as v2, p as h2, o as m2, N as g2, q as f2, M as L2, T as S2, r as b2, C as y2, t as k2, O as r2, v as M, w as I2, x as N2, y as
|
|
3
|
-
import { useRef as E, useState as I, useEffect as b, createContext as
|
|
2
|
+
import { s as u, k as n2, a as v, A as k, l as G, F as C2, m as o2, n as v2, p as h2, o as m2, N as g2, q as f2, M as L2, T as S2, r as b2, C as y2, t as k2, O as r2, v as M, w as I2, x as N2, y as A2, B as i2, D as P, I as a2, f as W, E as w2, G as E2, H as $2, J as T2, i as V2, K as D, Q as Y, R as x2, U as R2, V as F2, e as D2, W as T, X as j, L as _, Z as H2, _ as M2, $ as _2, c as O, a0 as O2, a1 as U2, a2 as z2, a3 as G2 } from "./provider.js";
|
|
3
|
+
import { useRef as E, useState as I, useEffect as b, createContext as B2, useContext as l2, lazy as P2, useMemo as F, Suspense as W2, forwardRef as Z2, useLayoutEffect as Q2, useCallback as R, Component as q2 } from "react";
|
|
4
4
|
import { Q as Y2, S as $ } from "./useStreamLayerApp2.js";
|
|
5
5
|
const j2 = /* @__PURE__ */ u("div")({
|
|
6
6
|
name: "SDKContainer",
|
|
@@ -104,7 +104,7 @@ const j2 = /* @__PURE__ */ u("div")({
|
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
return t;
|
|
107
|
-
}, c2 =
|
|
107
|
+
}, c2 = B2({
|
|
108
108
|
sdk: null
|
|
109
109
|
}), Q = () => l2(c2), l0 = /* @__PURE__ */ u("div")({
|
|
110
110
|
name: "QuestionContainer",
|
|
@@ -225,7 +225,7 @@ const j2 = /* @__PURE__ */ u("div")({
|
|
|
225
225
|
};
|
|
226
226
|
}, [e]), /* @__PURE__ */ n(r2, { loading: !(t != null && t.summary), ...t == null ? void 0 : t.summary, successRate: (s = t == null ? void 0 : t.percentage) == null ? void 0 : s.correct });
|
|
227
227
|
}, f0 = ({ gamification: e, className: s, scrollStore: t, scrollNode: o, appNode: r, style: i, responsiveStore: a }) => {
|
|
228
|
-
const { tabsShown: p } = v(t, { keys: ["tabsShown"] }), [c, d] = I(M.HOME), [, l] =
|
|
228
|
+
const { tabsShown: p } = v(t, { keys: ["tabsShown"] }), [c, d] = I(M.HOME), [, l] = I2(), { sdkInDesktopView: C, screen: m } = v(a, { keys: ["sdkInDesktopView"] }), S = (f) => {
|
|
229
229
|
l(() => {
|
|
230
230
|
var y;
|
|
231
231
|
d(f), C === !1 && (((y = r.current) == null ? void 0 : y.getBoundingClientRect().y) || 0) < 0 && Z(r, m.size, { behavior: "instant" });
|
|
@@ -246,7 +246,7 @@ const j2 = /* @__PURE__ */ u("div")({
|
|
|
246
246
|
style: {
|
|
247
247
|
top: h
|
|
248
248
|
},
|
|
249
|
-
children: /* @__PURE__ */ n(
|
|
249
|
+
children: /* @__PURE__ */ n(N2, { activePage: c, toggleActivePage: S })
|
|
250
250
|
}
|
|
251
251
|
),
|
|
252
252
|
c === M.HOME && /* @__PURE__ */ L(V, { children: [
|
|
@@ -296,7 +296,7 @@ const j2 = /* @__PURE__ */ u("div")({
|
|
|
296
296
|
}), {
|
|
297
297
|
hiding: p,
|
|
298
298
|
onAnimationEnd: c
|
|
299
|
-
} =
|
|
299
|
+
} = A2();
|
|
300
300
|
if (!t.current || !r && !i)
|
|
301
301
|
return null;
|
|
302
302
|
const d = r ? /* @__PURE__ */ n(K, {
|
|
@@ -388,7 +388,7 @@ const j2 = /* @__PURE__ */ u("div")({
|
|
|
388
388
|
name: "Navigation",
|
|
389
389
|
class: "n19lpak2",
|
|
390
390
|
propsAsIs: !1
|
|
391
|
-
}), F0 = () =>
|
|
391
|
+
}), F0 = () => w2, D0 = /* @__PURE__ */ u(F0())({
|
|
392
392
|
name: "NavigationItems",
|
|
393
393
|
class: "n1w473c2",
|
|
394
394
|
propsAsIs: !0
|
|
@@ -528,7 +528,7 @@ const j2 = /* @__PURE__ */ u("div")({
|
|
|
528
528
|
g();
|
|
529
529
|
};
|
|
530
530
|
}, [e.$store]), /* @__PURE__ */ n(q0, {
|
|
531
|
-
children: /* @__PURE__ */ n(
|
|
531
|
+
children: /* @__PURE__ */ n($2, {
|
|
532
532
|
loading: r,
|
|
533
533
|
rules: [{
|
|
534
534
|
label: "Answer as many questions as you like.",
|
|
@@ -583,7 +583,7 @@ const j2 = /* @__PURE__ */ u("div")({
|
|
|
583
583
|
const {
|
|
584
584
|
loading: f,
|
|
585
585
|
throttled: y
|
|
586
|
-
} =
|
|
586
|
+
} = E2(S);
|
|
587
587
|
return l && m && d && r.current && !y ? /* @__PURE__ */ n(i2, {
|
|
588
588
|
container: r,
|
|
589
589
|
useContainer: !i,
|
|
@@ -643,7 +643,7 @@ const j2 = /* @__PURE__ */ u("div")({
|
|
|
643
643
|
name: "NotificationRefreshing",
|
|
644
644
|
class: "n13rok4i",
|
|
645
645
|
propsAsIs: !1
|
|
646
|
-
}), o1 = () =>
|
|
646
|
+
}), o1 = () => T2, r1 = /* @__PURE__ */ u(o1())({
|
|
647
647
|
name: "Pill",
|
|
648
648
|
class: "pht79xf",
|
|
649
649
|
propsAsIs: !0
|
|
@@ -695,7 +695,7 @@ const j2 = /* @__PURE__ */ u("div")({
|
|
|
695
695
|
})
|
|
696
696
|
}), /* @__PURE__ */ n(n1, {}, s.id)]
|
|
697
697
|
})]
|
|
698
|
-
}) : s.type === D.QUESTION_RESOLVED && (i = (r = s.data) == null ? void 0 : r.question) != null && i.predictionResult ? /* @__PURE__ */ n(
|
|
698
|
+
}) : s.type === D.QUESTION_RESOLVED && (i = (r = s.data) == null ? void 0 : r.question) != null && i.predictionResult ? /* @__PURE__ */ n(x2, {
|
|
699
699
|
style: {
|
|
700
700
|
height: s.hiding ? 0 : d
|
|
701
701
|
},
|
|
@@ -739,8 +739,8 @@ const j2 = /* @__PURE__ */ u("div")({
|
|
|
739
739
|
i.get().sdkInDesktopView ? C < 50 && s(null) : C > -50 && s(null);
|
|
740
740
|
}, [C, i, s]);
|
|
741
741
|
const m = i.get().sdkInDesktopView ? t : o;
|
|
742
|
-
return !e || !m.current ? null :
|
|
743
|
-
title: e.type === D.QUESTION_RESOLVED ? "Prediction result" : `New ${((c =
|
|
742
|
+
return !e || !m.current ? null : R2.createPortal(/* @__PURE__ */ n(r1, {
|
|
743
|
+
title: e.type === D.QUESTION_RESOLVED ? "Prediction result" : `New ${((c = F2[(p = e.data) == null ? void 0 : p.questionType]) == null ? void 0 : c.label) || "notification"}`,
|
|
744
744
|
onClick: () => {
|
|
745
745
|
var S;
|
|
746
746
|
i.get().sdkInDesktopView ? (S = r.current) == null || S.scrollTo({
|
|
@@ -750,7 +750,7 @@ const j2 = /* @__PURE__ */ u("div")({
|
|
|
750
750
|
behavior: "smooth"
|
|
751
751
|
}), s(null);
|
|
752
752
|
},
|
|
753
|
-
className:
|
|
753
|
+
className: D2(l && l1, "sl-pill-button")
|
|
754
754
|
}), m.current);
|
|
755
755
|
}, c1 = ({
|
|
756
756
|
sdk: e,
|
|
@@ -762,7 +762,7 @@ const j2 = /* @__PURE__ */ u("div")({
|
|
|
762
762
|
}) => {
|
|
763
763
|
const [a] = I(e.getNotificationsStore()), p = v(a), [c, d] = I(null), l = F(() => e.getActiveNotification(), [e, p]);
|
|
764
764
|
return b(() => {
|
|
765
|
-
l &&
|
|
765
|
+
l && V2.emit("notification", {
|
|
766
766
|
action: "rendered",
|
|
767
767
|
payload: {
|
|
768
768
|
questionId: l.data.questionId,
|
|
@@ -934,7 +934,7 @@ const j2 = /* @__PURE__ */ u("div")({
|
|
|
934
934
|
--header-offset: 76px;
|
|
935
935
|
`}`;
|
|
936
936
|
const h1 = "m1ojpy2l", m1 = ({ children: e, style: s }) => /* @__PURE__ */ n("div", { className: "StreamLayerSDKTheme", children: /* @__PURE__ */ n("div", { className: h1, style: s, children: e }) }), g1 = ({ sdk: e, className: s, scrollStore: t, appNode: o, scrollNode: r, responsiveStore: i }) => {
|
|
937
|
-
const [, a] =
|
|
937
|
+
const [, a] = O2(e);
|
|
938
938
|
return /* @__PURE__ */ n(
|
|
939
939
|
I0,
|
|
940
940
|
{
|
|
@@ -965,15 +965,15 @@ const h1 = "m1ojpy2l", m1 = ({ children: e, style: s }) => /* @__PURE__ */ n("di
|
|
|
965
965
|
}) : null;
|
|
966
966
|
}, L1 = ({ sdk: e, overlays: s, children: t }) => {
|
|
967
967
|
const o = E(null), r = E(null), [i] = u1(o), [a, p] = i0(o, i), { sdkEnabled: c, sdkReady: d, activeOverlay: l, activateAndLoadOverlay: C, activateEventWithId: m, deactivate: S, isLogged: h } = p1(e);
|
|
968
|
-
_(o, { enabled: c, event: "click", listener:
|
|
968
|
+
_(o, { enabled: c, event: "click", listener: H2 }), _(a, {
|
|
969
969
|
enabled: c,
|
|
970
970
|
event: "scrollend",
|
|
971
|
-
listener:
|
|
971
|
+
listener: M2,
|
|
972
972
|
useDomNode: !0
|
|
973
973
|
}), _(a, {
|
|
974
974
|
enabled: c,
|
|
975
975
|
event: "click",
|
|
976
|
-
listener:
|
|
976
|
+
listener: _2,
|
|
977
977
|
useDomNode: !0
|
|
978
978
|
});
|
|
979
979
|
const f = F(() => ({ sdk: e }), [e]);
|
|
@@ -1031,7 +1031,7 @@ const h1 = "m1ojpy2l", m1 = ({ children: e, style: s }) => /* @__PURE__ */ n("di
|
|
|
1031
1031
|
)
|
|
1032
1032
|
] }) });
|
|
1033
1033
|
}, A1 = ({ sdkKey: e, plugins: s, children: t, onDeepLinkHandled: o, videoPlayerController: r, production: i = !0 }) => /* @__PURE__ */ n(
|
|
1034
|
-
|
|
1034
|
+
U2,
|
|
1035
1035
|
{
|
|
1036
1036
|
sdkKey: e,
|
|
1037
1037
|
plugins: s,
|
|
@@ -1042,8 +1042,8 @@ const h1 = "m1ojpy2l", m1 = ({ children: e, style: s }) => /* @__PURE__ */ n("di
|
|
|
1042
1042
|
children: t
|
|
1043
1043
|
}
|
|
1044
1044
|
), S1 = ({ children: e, overlays: s }) => {
|
|
1045
|
-
const { sdk: t, status: o } = l2(
|
|
1046
|
-
return o ===
|
|
1045
|
+
const { sdk: t, status: o } = l2(z2);
|
|
1046
|
+
return o === G2.UNSET ? (console.error("Wrap app in `StreamLayerProvider`"), e({})) : t ? /* @__PURE__ */ n("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ n(m1, { style: { height: "100%" }, children: /* @__PURE__ */ n(L1, { sdk: t, overlays: s, children: e }) }) }) : e({});
|
|
1047
1047
|
};
|
|
1048
1048
|
class w1 extends q2 {
|
|
1049
1049
|
constructor(s) {
|
package/lib/es/notification.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { f as m, s as e,
|
|
1
|
+
import { f as m, s as e, a4 as L, a5 as z, a6 as B, V as O, a7 as R, g as P, d as Q, a as V, i as U, K as T, u as F, b as K, j as W, h as G } from "./provider.js";
|
|
2
2
|
import { i as p, Q as I, j as Y, S as _ } from "./useStreamLayerApp2.js";
|
|
3
3
|
import { jsxs as c, jsx as s } from "react/jsx-runtime";
|
|
4
|
-
import { useState as q, useEffect as E, useMemo as
|
|
4
|
+
import { useState as q, useEffect as E, useMemo as H } from "react";
|
|
5
5
|
const h = /* @__PURE__ */ e("div")({
|
|
6
6
|
name: "Media",
|
|
7
7
|
class: "m1bcvojl",
|
|
8
8
|
propsAsIs: !1
|
|
9
|
-
}),
|
|
9
|
+
}), J = () => h, X = /* @__PURE__ */ e(J())({
|
|
10
10
|
name: "MediaImgBottom",
|
|
11
11
|
class: "m58gin0",
|
|
12
12
|
propsAsIs: !0
|
|
@@ -246,7 +246,7 @@ const h = /* @__PURE__ */ e("div")({
|
|
|
246
246
|
name: "Subtitle",
|
|
247
247
|
class: "sz7237i",
|
|
248
248
|
propsAsIs: !1
|
|
249
|
-
}),
|
|
249
|
+
}), Vs = ({
|
|
250
250
|
step: t,
|
|
251
251
|
children: o,
|
|
252
252
|
answer: i,
|
|
@@ -268,7 +268,7 @@ const h = /* @__PURE__ */ e("div")({
|
|
|
268
268
|
}), "Your Pick: ", i]
|
|
269
269
|
})
|
|
270
270
|
})]
|
|
271
|
-
}),
|
|
271
|
+
}), Us = /* @__PURE__ */ e("div")({
|
|
272
272
|
name: "Container",
|
|
273
273
|
class: "ckyzolp",
|
|
274
274
|
propsAsIs: !1
|
|
@@ -276,11 +276,11 @@ const h = /* @__PURE__ */ e("div")({
|
|
|
276
276
|
name: "Line",
|
|
277
277
|
class: "l16t1zr7",
|
|
278
278
|
propsAsIs: !1
|
|
279
|
-
}), Fs = () => y,
|
|
279
|
+
}), Fs = () => y, Ks = /* @__PURE__ */ e(Fs())({
|
|
280
280
|
name: "Line1",
|
|
281
281
|
class: "le78kvg",
|
|
282
282
|
propsAsIs: !0
|
|
283
|
-
}),
|
|
283
|
+
}), Ws = () => y, Gs = /* @__PURE__ */ e(Ws())({
|
|
284
284
|
name: "Line2",
|
|
285
285
|
class: "l1o7966d",
|
|
286
286
|
propsAsIs: !0
|
|
@@ -288,15 +288,15 @@ const h = /* @__PURE__ */ e("div")({
|
|
|
288
288
|
name: "Line3",
|
|
289
289
|
class: "lu9lyxq",
|
|
290
290
|
propsAsIs: !0
|
|
291
|
-
}),
|
|
292
|
-
children: [/* @__PURE__ */ s(
|
|
291
|
+
}), Hs = () => /* @__PURE__ */ c(Us, {
|
|
292
|
+
children: [/* @__PURE__ */ s(Ks, {
|
|
293
293
|
children: /* @__PURE__ */ s("div", {})
|
|
294
|
-
}), /* @__PURE__ */ s(
|
|
294
|
+
}), /* @__PURE__ */ s(Gs, {
|
|
295
295
|
children: /* @__PURE__ */ s("div", {})
|
|
296
296
|
}), /* @__PURE__ */ s(_s, {
|
|
297
297
|
children: /* @__PURE__ */ s("div", {})
|
|
298
298
|
})]
|
|
299
|
-
}),
|
|
299
|
+
}), Js = /* @__PURE__ */ e("div")({
|
|
300
300
|
name: "Container",
|
|
301
301
|
class: "c10jy6zf",
|
|
302
302
|
propsAsIs: !1
|
|
@@ -304,7 +304,7 @@ const h = /* @__PURE__ */ e("div")({
|
|
|
304
304
|
name: "CheckIcon",
|
|
305
305
|
class: "c1c7scay",
|
|
306
306
|
propsAsIs: !0
|
|
307
|
-
}), se = () => /* @__PURE__ */ c(
|
|
307
|
+
}), se = () => /* @__PURE__ */ c(Js, {
|
|
308
308
|
children: [/* @__PURE__ */ s(Zs, {
|
|
309
309
|
name: "icon-check"
|
|
310
310
|
}), " Prediction results are in!"]
|
|
@@ -412,8 +412,8 @@ const h = /* @__PURE__ */ e("div")({
|
|
|
412
412
|
return /* @__PURE__ */ s(b, { children: /* @__PURE__ */ s(w, { children: /* @__PURE__ */ s(se, {}) }) });
|
|
413
413
|
let v = "pending";
|
|
414
414
|
return (r === 3 || r === 4) && (v = n ? "correct" : "incorrect"), /* @__PURE__ */ s(b, { onClick: () => o == null ? void 0 : o(), children: /* @__PURE__ */ c(w, { children: [
|
|
415
|
-
r !== 1 && /* @__PURE__ */ s(
|
|
416
|
-
/* @__PURE__ */ c(
|
|
415
|
+
r !== 1 && /* @__PURE__ */ s(Hs, {}, r),
|
|
416
|
+
/* @__PURE__ */ c(Vs, { state: v, step: r, answer: (a == null ? void 0 : a.title) || "unknown", children: [
|
|
417
417
|
r === 2 && /* @__PURE__ */ s(oe, { title: d || "unknown" }),
|
|
418
418
|
r === 3 && n && /* @__PURE__ */ s(re, {}),
|
|
419
419
|
r === 3 && !n && /* @__PURE__ */ s(le, { title: l || "unknown" }),
|
|
@@ -441,9 +441,9 @@ const h = /* @__PURE__ */ e("div")({
|
|
|
441
441
|
class: "n1i4h28u",
|
|
442
442
|
propsAsIs: !1
|
|
443
443
|
}), $e = (t) => /* @__PURE__ */ s(Ae, { children: /* @__PURE__ */ s(ve, { ...t }) }), ye = ({ sdk: t }) => {
|
|
444
|
-
const [o] = q(t.getNotificationsStore()), i =
|
|
444
|
+
const [o] = q(t.getNotificationsStore()), i = V(o), a = t.getFeature(_.GAMES), n = H(() => t.getActiveNotification(), [t, i]);
|
|
445
445
|
return E(() => {
|
|
446
|
-
n &&
|
|
446
|
+
n && U.emit("notification", {
|
|
447
447
|
action: "rendered",
|
|
448
448
|
payload: {
|
|
449
449
|
questionId: n.data.questionId,
|
|
@@ -459,8 +459,8 @@ const h = /* @__PURE__ */ e("div")({
|
|
|
459
459
|
}
|
|
460
460
|
) : null : n && n.type === T.ONBOARDING ? n.data.onboarding ? /* @__PURE__ */ s(Ms, { open: a == null ? void 0 : a.openFeature, close: n.close, ...n.data.onboarding }) : null : n && /* @__PURE__ */ s(gs, { ...n.data, action: n.action });
|
|
461
461
|
}, Ne = ({ theme: t }) => {
|
|
462
|
-
const o = F(), i =
|
|
463
|
-
return o && a.appNotification ? a.app ? null : /* @__PURE__ */ s("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ s(
|
|
462
|
+
const o = F(), i = K(), a = W();
|
|
463
|
+
return o && a.appNotification ? a.app ? null : /* @__PURE__ */ s("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ s(G, { customTheme: t ?? i.theme, themeMode: i.themeMode, children: /* @__PURE__ */ s(ye, { sdk: o }) }) }) : null;
|
|
464
464
|
};
|
|
465
465
|
export {
|
|
466
466
|
Ne as StreamLayerSDKNotification,
|