@streamlayer/react 0.28.1 → 0.28.3
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/masters.js +1 -1
- package/lib/cjs/points.js +1 -1
- package/lib/es/masters.js +3 -3
- package/lib/es/points.js +3 -3
- package/lib/{index-ed9cc1f5.js → index-05d85ab5.js} +194 -101
- package/lib/index-44ee2284.cjs +1 -0
- package/lib/index-6b61558d.cjs +1 -0
- package/lib/index-ba692797.js +1363 -0
- package/lib/masters-0e939bcb.js +10047 -0
- package/lib/masters-11a6e952.cjs +16 -0
- package/lib/style.css +1 -1
- package/package.json +11 -11
- package/lib/index-0006746d.cjs +0 -6
- package/lib/index-3a549ff3.cjs +0 -1
- package/lib/index-c325cc40.js +0 -2699
- package/lib/masters-56975aec.js +0 -393
- package/lib/masters-e1de41e7.cjs +0 -1
package/lib/masters-56975aec.js
DELETED
|
@@ -1,393 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as m, Fragment as w } from "react/jsx-runtime";
|
|
2
|
-
import { f as N, S as L, a as R, b as z, p as F } from "./index-0d23b24e.js";
|
|
3
|
-
import { lazy as j, useMemo as O, Suspense as q, useRef as D, useState as g, useCallback as G, useEffect as C, useContext as P } from "react";
|
|
4
|
-
import { FeatureType as E, QuestionType as d } from "@streamlayer/sdk-web-types";
|
|
5
|
-
import { useStore as h } from "@nanostores/react";
|
|
6
|
-
import { FeatureStatus as b } from "@streamlayer/sdk-web-interfaces";
|
|
7
|
-
import { s as l, q as y, c as M } from "./index-ed9cc1f5.js";
|
|
8
|
-
import { NotificationType as A } from "@streamlayer/sdk-web-notifications";
|
|
9
|
-
const U = ({ feature: s, sdk: a, children: t, className: n }) => {
|
|
10
|
-
const c = h(s.status), { slStreamId: i } = h(a.sdkStore);
|
|
11
|
-
return i != null && i.loading ? /* @__PURE__ */ e("div", { className: n, children: "event is loading..." }) : i != null && i.data ? c !== b.Ready ? /* @__PURE__ */ e("div", { className: n, children: "wait feature..." }) : t : /* @__PURE__ */ e("div", { className: n, children: "event is forbidden..." });
|
|
12
|
-
}, B = j(() => import("./index-c325cc40.js")), Q = ({
|
|
13
|
-
sdk: s,
|
|
14
|
-
feature: a,
|
|
15
|
-
className: t
|
|
16
|
-
}) => {
|
|
17
|
-
const n = O(() => a && a.featureConfig.get().type === E.GAMES ? /* @__PURE__ */ e(U, { className: t, sdk: s, feature: a, children: /* @__PURE__ */ e(B, { className: t, gamification: a, sdk: s }) }) : null, [s, a, t]);
|
|
18
|
-
return /* @__PURE__ */ e(
|
|
19
|
-
q,
|
|
20
|
-
{
|
|
21
|
-
fallback: /* @__PURE__ */ e("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "100%" }, children: "page loading..." }),
|
|
22
|
-
children: n
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
const V = /* @__PURE__ */ l("button")({
|
|
27
|
-
name: "e",
|
|
28
|
-
class: "enu64b2",
|
|
29
|
-
propsAsIs: !1
|
|
30
|
-
}), K = /* @__PURE__ */ l("span")({
|
|
31
|
-
name: "t",
|
|
32
|
-
class: "tw2meku",
|
|
33
|
-
propsAsIs: !1
|
|
34
|
-
}), W = /* @__PURE__ */ l("span")({
|
|
35
|
-
name: "a",
|
|
36
|
-
class: "aka8vam",
|
|
37
|
-
propsAsIs: !1
|
|
38
|
-
}), $ = ({ disabled: s, active: a, onClick: t, label: n, icon: c }) => /* @__PURE__ */ e(V, { onClick: t, disabled: s, "data-selected": a, children: /* @__PURE__ */ m(w, { children: [
|
|
39
|
-
c && /* @__PURE__ */ e(K, { children: c }),
|
|
40
|
-
/* @__PURE__ */ e(W, { children: n })
|
|
41
|
-
] }) });
|
|
42
|
-
const Y = () => y, H = /* @__PURE__ */ l(Y())({
|
|
43
|
-
name: "a",
|
|
44
|
-
class: "a10lggiw",
|
|
45
|
-
propsAsIs: !0
|
|
46
|
-
}), I = "channels", J = (s) => {
|
|
47
|
-
var a;
|
|
48
|
-
return /* @__PURE__ */ e($, {
|
|
49
|
-
...s,
|
|
50
|
-
id: "channels",
|
|
51
|
-
label: "Channels",
|
|
52
|
-
icon: /* @__PURE__ */ e(H, {
|
|
53
|
-
name: "icon-btn-channels",
|
|
54
|
-
"data-selected": (a = s.active) == null ? void 0 : a.toString()
|
|
55
|
-
})
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
const X = () => y, Z = /* @__PURE__ */ l(X())({
|
|
59
|
-
name: "d",
|
|
60
|
-
class: "d1x5s8ie",
|
|
61
|
-
propsAsIs: !0
|
|
62
|
-
}), u = "featuredGroups", ss = (s) => {
|
|
63
|
-
var a;
|
|
64
|
-
return /* @__PURE__ */ e($, {
|
|
65
|
-
...s,
|
|
66
|
-
label: "FG+",
|
|
67
|
-
id: "featuredGroups",
|
|
68
|
-
icon: /* @__PURE__ */ e(Z, {
|
|
69
|
-
name: "icon-btn-feature-groups",
|
|
70
|
-
"data-selected": (a = s.active) == null ? void 0 : a.toString()
|
|
71
|
-
})
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
const es = () => y, as = /* @__PURE__ */ l(es())({
|
|
75
|
-
name: "n",
|
|
76
|
-
class: "ntav86o",
|
|
77
|
-
propsAsIs: !0
|
|
78
|
-
}), k = "leaderboard", ns = (s) => {
|
|
79
|
-
var a;
|
|
80
|
-
return /* @__PURE__ */ e($, {
|
|
81
|
-
...s,
|
|
82
|
-
label: "Leader Board",
|
|
83
|
-
id: "leaderboard",
|
|
84
|
-
icon: /* @__PURE__ */ e(as, {
|
|
85
|
-
name: "icon-btn-leaderboard",
|
|
86
|
-
"data-selected": (a = s.active) == null ? void 0 : a.toString()
|
|
87
|
-
})
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
const ts = /* @__PURE__ */ l("div")({
|
|
91
|
-
name: "n",
|
|
92
|
-
class: "n1rlvhvz",
|
|
93
|
-
propsAsIs: !1
|
|
94
|
-
}), ls = ({
|
|
95
|
-
children: s,
|
|
96
|
-
className: a
|
|
97
|
-
}) => /* @__PURE__ */ e(ts, {
|
|
98
|
-
className: a,
|
|
99
|
-
children: s
|
|
100
|
-
});
|
|
101
|
-
const is = () => ls, rs = /* @__PURE__ */ l(is())({
|
|
102
|
-
name: "n",
|
|
103
|
-
class: "n9bnom",
|
|
104
|
-
propsAsIs: !0
|
|
105
|
-
}), cs = ({ activeOverlay: s, setActiveOverlay: a, sdkReady: t, className: n }) => /* @__PURE__ */ m(rs, { className: n, children: [
|
|
106
|
-
/* @__PURE__ */ e(J, { active: s === I, onClick: () => a(I) }),
|
|
107
|
-
/* @__PURE__ */ e(
|
|
108
|
-
ss,
|
|
109
|
-
{
|
|
110
|
-
active: s === u,
|
|
111
|
-
disabled: !t,
|
|
112
|
-
onClick: () => {
|
|
113
|
-
a(u);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
),
|
|
117
|
-
/* @__PURE__ */ e(
|
|
118
|
-
ns,
|
|
119
|
-
{
|
|
120
|
-
active: s === k,
|
|
121
|
-
onClick: () => a(k)
|
|
122
|
-
}
|
|
123
|
-
)
|
|
124
|
-
] }), os = {
|
|
125
|
-
[d.TWEET]: { label: "Insight", iconName: "icon-insight" },
|
|
126
|
-
[d.PROMOTION]: { label: "Insight", iconName: "icon-insight" },
|
|
127
|
-
[d.UNSET]: void 0,
|
|
128
|
-
[d.FACTOID]: { label: "Insight", iconName: "icon-insight" },
|
|
129
|
-
[d.POLL]: { label: "Poll", iconName: "icon-poll" },
|
|
130
|
-
[d.TRIVIA]: { label: "Trivia", iconName: "icon-trivia" },
|
|
131
|
-
[d.PREDICTION]: { label: "Prediction", iconName: "icon-prediction" }
|
|
132
|
-
};
|
|
133
|
-
const ds = /* @__PURE__ */ l("div")({
|
|
134
|
-
name: "i",
|
|
135
|
-
class: "i1bwjtdb",
|
|
136
|
-
propsAsIs: !1
|
|
137
|
-
}), ps = /* @__PURE__ */ l("video")({
|
|
138
|
-
name: "e",
|
|
139
|
-
class: "enb7moc",
|
|
140
|
-
propsAsIs: !1
|
|
141
|
-
}), us = /* @__PURE__ */ l("img")({
|
|
142
|
-
name: "r",
|
|
143
|
-
class: "r1ws5lyh",
|
|
144
|
-
propsAsIs: !1
|
|
145
|
-
}), ms = /* @__PURE__ */ l("div")({
|
|
146
|
-
name: "s",
|
|
147
|
-
class: "soibf55",
|
|
148
|
-
propsAsIs: !1
|
|
149
|
-
}), vs = ({ poster: s, source: a }) => {
|
|
150
|
-
const t = D(null), [n, c] = g(!1), [i, o] = g(!0);
|
|
151
|
-
return /* @__PURE__ */ m(ds, { onClick: () => {
|
|
152
|
-
const r = t == null ? void 0 : t.current;
|
|
153
|
-
r && c((v) => v ? (r.pause(), !1) : (r.play(), o(!1), !0));
|
|
154
|
-
}, children: [
|
|
155
|
-
/* @__PURE__ */ e(
|
|
156
|
-
ps,
|
|
157
|
-
{
|
|
158
|
-
ref: t,
|
|
159
|
-
src: a,
|
|
160
|
-
onEnded: () => {
|
|
161
|
-
var r;
|
|
162
|
-
(r = t == null ? void 0 : t.current) == null || r.load(), c(!1), o(!0);
|
|
163
|
-
},
|
|
164
|
-
style: { visibility: i ? "hidden" : "visible" }
|
|
165
|
-
}
|
|
166
|
-
),
|
|
167
|
-
/* @__PURE__ */ e(us, { src: s, style: { visibility: i ? "visible" : "hidden" } }),
|
|
168
|
-
/* @__PURE__ */ e(ms, { children: !n && /* @__PURE__ */ e(y, { name: "icon-play" }) })
|
|
169
|
-
] });
|
|
170
|
-
};
|
|
171
|
-
const hs = /* @__PURE__ */ l("div")({
|
|
172
|
-
name: "r",
|
|
173
|
-
class: "rcr31jh",
|
|
174
|
-
propsAsIs: !1
|
|
175
|
-
}), fs = /* @__PURE__ */ l("div")({
|
|
176
|
-
name: "t",
|
|
177
|
-
class: "thj4z8w",
|
|
178
|
-
propsAsIs: !1
|
|
179
|
-
}), ys = /* @__PURE__ */ l("h3")({
|
|
180
|
-
name: "i",
|
|
181
|
-
class: "i1oks4sz",
|
|
182
|
-
propsAsIs: !1
|
|
183
|
-
}), bs = /* @__PURE__ */ l("div")({
|
|
184
|
-
name: "n",
|
|
185
|
-
class: "n18s3mno",
|
|
186
|
-
propsAsIs: !1
|
|
187
|
-
}), gs = /* @__PURE__ */ l("button")({
|
|
188
|
-
name: "l",
|
|
189
|
-
class: "lc8mqwv",
|
|
190
|
-
propsAsIs: !1
|
|
191
|
-
}), Is = ({
|
|
192
|
-
video: s,
|
|
193
|
-
heading: a,
|
|
194
|
-
body: t,
|
|
195
|
-
action: n
|
|
196
|
-
}) => /* @__PURE__ */ m(hs, { children: [
|
|
197
|
-
s && /* @__PURE__ */ e(vs, { source: s.url, poster: s.thumbnailUrl }),
|
|
198
|
-
/* @__PURE__ */ m(fs, { children: [
|
|
199
|
-
/* @__PURE__ */ e(ys, { children: a }),
|
|
200
|
-
/* @__PURE__ */ e(bs, { children: t }),
|
|
201
|
-
n && /* @__PURE__ */ e(gs, { onClick: n, children: "View Insight" })
|
|
202
|
-
] })
|
|
203
|
-
] });
|
|
204
|
-
const ks = () => y, As = () => y, Ss = /* @__PURE__ */ l("div")({
|
|
205
|
-
name: "p",
|
|
206
|
-
class: "p16oo5uk",
|
|
207
|
-
propsAsIs: !1
|
|
208
|
-
}), $s = /* @__PURE__ */ l("div")({
|
|
209
|
-
name: "a",
|
|
210
|
-
class: "a18c5k3h",
|
|
211
|
-
propsAsIs: !1
|
|
212
|
-
}), Ns = /* @__PURE__ */ l(ks())({
|
|
213
|
-
name: "c",
|
|
214
|
-
class: "czv5t8k",
|
|
215
|
-
propsAsIs: !0
|
|
216
|
-
}), xs = /* @__PURE__ */ l("div")({
|
|
217
|
-
name: "s",
|
|
218
|
-
class: "s1wp1emp",
|
|
219
|
-
propsAsIs: !1
|
|
220
|
-
}), _s = /* @__PURE__ */ l(As())({
|
|
221
|
-
name: "l",
|
|
222
|
-
class: "l1nz0q6x",
|
|
223
|
-
propsAsIs: !0
|
|
224
|
-
}), Os = /* @__PURE__ */ l("span")({
|
|
225
|
-
name: "g",
|
|
226
|
-
class: "g1jhb9lu",
|
|
227
|
-
propsAsIs: !1
|
|
228
|
-
}), Cs = /* @__PURE__ */ l("div")({
|
|
229
|
-
name: "d",
|
|
230
|
-
class: "ds6gfsv",
|
|
231
|
-
propsAsIs: !1
|
|
232
|
-
}), Es = /* @__PURE__ */ l("button")({
|
|
233
|
-
name: "x",
|
|
234
|
-
class: "xkzz16s",
|
|
235
|
-
propsAsIs: !1
|
|
236
|
-
}), x = ({
|
|
237
|
-
close: s,
|
|
238
|
-
action: a,
|
|
239
|
-
data: { questionType: t, question: n, insight: c }
|
|
240
|
-
}) => {
|
|
241
|
-
const i = os[t];
|
|
242
|
-
return i ? /* @__PURE__ */ m(Ss, { children: [
|
|
243
|
-
/* @__PURE__ */ e($s, { onClick: s, children: /* @__PURE__ */ e(Ns, { name: "icon-cross" }) }),
|
|
244
|
-
/* @__PURE__ */ m(xs, { children: [
|
|
245
|
-
/* @__PURE__ */ e(_s, { name: i.iconName }),
|
|
246
|
-
/* @__PURE__ */ e(Os, { children: i.label })
|
|
247
|
-
] }),
|
|
248
|
-
t === d.FACTOID ? /* @__PURE__ */ e(Is, { ...c, action: a }) : /* @__PURE__ */ e(Cs, { children: n == null ? void 0 : n.title }),
|
|
249
|
-
t !== d.FACTOID && /* @__PURE__ */ e(Es, { onClick: a, children: "Answer" })
|
|
250
|
-
] }) : null;
|
|
251
|
-
};
|
|
252
|
-
const Ts = /* @__PURE__ */ l("div")({
|
|
253
|
-
name: "s",
|
|
254
|
-
class: "s1aopxp8",
|
|
255
|
-
propsAsIs: !1
|
|
256
|
-
}), ws = "c1t0h6s", Ls = ({
|
|
257
|
-
children: s,
|
|
258
|
-
style: a,
|
|
259
|
-
className: t,
|
|
260
|
-
hiding: n
|
|
261
|
-
}) => /* @__PURE__ */ e(Ts, {
|
|
262
|
-
style: a,
|
|
263
|
-
className: M(t, n && ws),
|
|
264
|
-
children: s
|
|
265
|
-
});
|
|
266
|
-
const Rs = () => Ls, S = /* @__PURE__ */ l(Rs())({
|
|
267
|
-
name: "d",
|
|
268
|
-
class: "d1qqtt3e",
|
|
269
|
-
propsAsIs: !0
|
|
270
|
-
}), zs = ({ sdk: s }) => {
|
|
271
|
-
const a = s.getNotificationsStore(), t = h(a), n = O(() => t != null && t.size ? t.values().next().value : null, [t]);
|
|
272
|
-
return (n == null ? void 0 : n.type) === A.QUESTION ? /* @__PURE__ */ e(S, { hiding: n.hiding, children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(x, { ...n }) }) }) : (n == null ? void 0 : n.type) === A.QUESTION_RESOLVED ? /* @__PURE__ */ e(S, { hiding: n.hiding, children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(x, { ...n }) }) }) : (n == null ? void 0 : n.type) === A.ONBOARDING ? /* @__PURE__ */ e(S, { hiding: n.hiding, children: /* @__PURE__ */ e("div", { children: "Onboarding" }) }) : null;
|
|
273
|
-
};
|
|
274
|
-
const Fs = () => qs, js = /* @__PURE__ */ l("div")({
|
|
275
|
-
name: "i",
|
|
276
|
-
class: "idhrx8x",
|
|
277
|
-
propsAsIs: !1
|
|
278
|
-
}), _ = /* @__PURE__ */ l("div")({
|
|
279
|
-
name: "r",
|
|
280
|
-
class: "r1k6v4ep",
|
|
281
|
-
propsAsIs: !1
|
|
282
|
-
}), qs = /* @__PURE__ */ l("div")({
|
|
283
|
-
name: "a",
|
|
284
|
-
class: "a1v8kucd",
|
|
285
|
-
propsAsIs: !1
|
|
286
|
-
}), Js = /* @__PURE__ */ l(Fs())({
|
|
287
|
-
name: "e",
|
|
288
|
-
class: "e16yw7z1",
|
|
289
|
-
propsAsIs: !0
|
|
290
|
-
}), Ds = (s) => {
|
|
291
|
-
const [a, t] = g(!1), n = h(s.status), { data: c } = h(s.getUserStore()), i = n === "ready", [o, r] = g(u), v = G(
|
|
292
|
-
(p, f) => {
|
|
293
|
-
r(f), f === u ? (p && s.createEventSession(p), s.openFeature(E.GAMES)) : s.closeFeature();
|
|
294
|
-
},
|
|
295
|
-
[s]
|
|
296
|
-
);
|
|
297
|
-
return C(() => {
|
|
298
|
-
!i && o === u && (r(I), s.closeFeature());
|
|
299
|
-
}, [i, o, s]), {
|
|
300
|
-
sdkEnabled: a,
|
|
301
|
-
sdkReady: i,
|
|
302
|
-
activeOverlay: o,
|
|
303
|
-
activateAndLoadOverlay: v,
|
|
304
|
-
enableSdk: (p) => {
|
|
305
|
-
s.initializeApp().then(({ enabled: f, err: T }) => {
|
|
306
|
-
if (t(!0), T) {
|
|
307
|
-
v(p, I);
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
if (f) {
|
|
311
|
-
v(p, u);
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
},
|
|
316
|
-
disableSdk: () => {
|
|
317
|
-
t(!1), s.disableApp();
|
|
318
|
-
},
|
|
319
|
-
isLogged: !!c
|
|
320
|
-
};
|
|
321
|
-
}, Gs = (s) => {
|
|
322
|
-
const a = h(s.getActiveFeature()), t = h(s.streamStore()), [n, c] = g(null);
|
|
323
|
-
return C(() => {
|
|
324
|
-
const i = s.getFeatures();
|
|
325
|
-
if (a)
|
|
326
|
-
for (const [o, r] of i)
|
|
327
|
-
o === a ? r.status.get() === b.Suspended && (r.enable(), c(r)) : r.status.get() === b.Ready && r.disable();
|
|
328
|
-
else {
|
|
329
|
-
for (const [, o] of i)
|
|
330
|
-
o.status.get() === b.Ready && o.disable();
|
|
331
|
-
c(null);
|
|
332
|
-
}
|
|
333
|
-
return () => {
|
|
334
|
-
for (const [, o] of i)
|
|
335
|
-
o.status.get() === b.Ready && o.disable();
|
|
336
|
-
};
|
|
337
|
-
}, [a, s, t]), [a, n];
|
|
338
|
-
}, Ps = ({ sdk: s, className: a }) => {
|
|
339
|
-
const [, t] = Gs(s);
|
|
340
|
-
return /* @__PURE__ */ e(Q, { className: a, feature: t, sdk: s });
|
|
341
|
-
}, Ms = ({ sdk: s, overlays: a, children: t }) => {
|
|
342
|
-
const { sdkEnabled: n, sdkReady: c, activeOverlay: i, activateAndLoadOverlay: o, enableSdk: r, disableSdk: v, isLogged: p } = Ds(s);
|
|
343
|
-
return /* @__PURE__ */ m(js, { children: [
|
|
344
|
-
n && /* @__PURE__ */ e(
|
|
345
|
-
cs,
|
|
346
|
-
{
|
|
347
|
-
sdkReady: c,
|
|
348
|
-
activeOverlay: i,
|
|
349
|
-
className: N,
|
|
350
|
-
setActiveOverlay: (f) => o("", f)
|
|
351
|
-
}
|
|
352
|
-
),
|
|
353
|
-
n && /* @__PURE__ */ e(zs, { sdk: s }),
|
|
354
|
-
/* @__PURE__ */ e(
|
|
355
|
-
_,
|
|
356
|
-
{
|
|
357
|
-
"data-nav": n.toString(),
|
|
358
|
-
style: { display: !n || i === I ? "block" : "none" },
|
|
359
|
-
children: t && t({ enableSdk: r, disableSdk: v })
|
|
360
|
-
}
|
|
361
|
-
),
|
|
362
|
-
/* @__PURE__ */ e(
|
|
363
|
-
_,
|
|
364
|
-
{
|
|
365
|
-
"data-nav": n.toString(),
|
|
366
|
-
style: { display: i === k ? "block" : "none" },
|
|
367
|
-
children: a && i === k && a[i]
|
|
368
|
-
}
|
|
369
|
-
),
|
|
370
|
-
p && n && i === u && /* @__PURE__ */ e(Ps, { className: N, sdk: s }),
|
|
371
|
-
!p && n && i === u && /* @__PURE__ */ e("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "100%" }, children: "You are not logged in." })
|
|
372
|
-
] });
|
|
373
|
-
}, Xs = ({
|
|
374
|
-
sdkKey: s,
|
|
375
|
-
plugins: a,
|
|
376
|
-
children: t,
|
|
377
|
-
production: n = !0
|
|
378
|
-
}) => /* @__PURE__ */ e(L, { sdkKey: s, plugins: a, production: n, autoEnable: !1, children: t }), Zs = ({ children: s, overlays: a }) => {
|
|
379
|
-
const { sdk: t, status: n } = P(R);
|
|
380
|
-
if (n === z.UNSET)
|
|
381
|
-
throw new Error("Wrap app in `StreamLayerProvider`");
|
|
382
|
-
return t ? /* @__PURE__ */ e("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(Ms, { sdk: t, overlays: a, children: s }) }) }) : s({});
|
|
383
|
-
};
|
|
384
|
-
export {
|
|
385
|
-
Xs as M,
|
|
386
|
-
qs as a,
|
|
387
|
-
Zs as b,
|
|
388
|
-
Js as e,
|
|
389
|
-
Ls as f,
|
|
390
|
-
os as o,
|
|
391
|
-
_ as r,
|
|
392
|
-
vs as w
|
|
393
|
-
};
|
package/lib/masters-e1de41e7.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),m=require("./index-89c19a6e.cjs"),o=require("react"),u=require("@streamlayer/sdk-web-types"),v=require("@nanostores/react"),h=require("@streamlayer/sdk-web-interfaces"),l=require("./index-3a549ff3.cjs"),g=require("@streamlayer/sdk-web-notifications"),O=({feature:s,sdk:t,children:n,className:a})=>{const d=v.useStore(s.status),{slStreamId:i}=v.useStore(t.sdkStore);return i!=null&&i.loading?e.jsx("div",{className:a,children:"event is loading..."}):i!=null&&i.data?d!==h.FeatureStatus.Ready?e.jsx("div",{className:a,children:"wait feature..."}):n:e.jsx("div",{className:a,children:"event is forbidden..."})},C=o.lazy(()=>Promise.resolve().then(()=>require("./index-0006746d.cjs"))),E=({sdk:s,feature:t,className:n})=>{const a=o.useMemo(()=>t&&t.featureConfig.get().type===u.FeatureType.GAMES?e.jsx(O,{className:n,sdk:s,feature:t,children:e.jsx(C,{className:n,gamification:t,sdk:s})}):null,[s,t,n]);return e.jsx(o.Suspense,{fallback:e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"},children:"page loading..."}),children:a})};const w=l.styled_default("button")({name:"e",class:"enu64b2",propsAsIs:!1}),F=l.styled_default("span")({name:"t",class:"tw2meku",propsAsIs:!1}),L=l.styled_default("span")({name:"a",class:"aka8vam",propsAsIs:!1}),k=({disabled:s,active:t,onClick:n,label:a,icon:d})=>e.jsx(w,{onClick:n,disabled:s,"data-selected":t,children:e.jsxs(e.Fragment,{children:[d&&e.jsx(F,{children:d}),e.jsx(L,{children:a})]})});const R=()=>l.q,z=l.styled_default(R())({name:"a",class:"a10lggiw",propsAsIs:!0}),j="channels",Q=s=>{var t;return e.jsx(k,{...s,id:"channels",label:"Channels",icon:e.jsx(z,{name:"icon-btn-channels","data-selected":(t=s.active)==null?void 0:t.toString()})})};const P=()=>l.q,D=l.styled_default(P())({name:"d",class:"d1x5s8ie",propsAsIs:!0}),y="featuredGroups",M=s=>{var t;return e.jsx(k,{...s,label:"FG+",id:"featuredGroups",icon:e.jsx(D,{name:"icon-btn-feature-groups","data-selected":(t=s.active)==null?void 0:t.toString()})})};const G=()=>l.q,U=l.styled_default(G())({name:"n",class:"ntav86o",propsAsIs:!0}),b="leaderboard",W=s=>{var t;return e.jsx(k,{...s,label:"Leader Board",id:"leaderboard",icon:e.jsx(U,{name:"icon-btn-leaderboard","data-selected":(t=s.active)==null?void 0:t.toString()})})};const B=l.styled_default("div")({name:"n",class:"n1rlvhvz",propsAsIs:!1}),K=({children:s,className:t})=>e.jsx(B,{className:t,children:s});const V=()=>K,Y=l.styled_default(V())({name:"n",class:"n9bnom",propsAsIs:!0}),H=({activeOverlay:s,setActiveOverlay:t,sdkReady:n,className:a})=>e.jsxs(Y,{className:a,children:[e.jsx(Q,{active:s===j,onClick:()=>t(j)}),e.jsx(M,{active:s===y,disabled:!n,onClick:()=>{t(y)}}),e.jsx(W,{active:s===b,onClick:()=>t(b)})]}),A={[u.QuestionType.TWEET]:{label:"Insight",iconName:"icon-insight"},[u.QuestionType.PROMOTION]:{label:"Insight",iconName:"icon-insight"},[u.QuestionType.UNSET]:void 0,[u.QuestionType.FACTOID]:{label:"Insight",iconName:"icon-insight"},[u.QuestionType.POLL]:{label:"Poll",iconName:"icon-poll"},[u.QuestionType.TRIVIA]:{label:"Trivia",iconName:"icon-trivia"},[u.QuestionType.PREDICTION]:{label:"Prediction",iconName:"icon-prediction"}};const J=l.styled_default("div")({name:"i",class:"i1bwjtdb",propsAsIs:!1}),X=l.styled_default("video")({name:"e",class:"enb7moc",propsAsIs:!1}),Z=l.styled_default("img")({name:"r",class:"r1ws5lyh",propsAsIs:!1}),ee=l.styled_default("div")({name:"s",class:"soibf55",propsAsIs:!1}),N=({poster:s,source:t})=>{const n=o.useRef(null),[a,d]=o.useState(!1),[i,c]=o.useState(!0);return e.jsxs(J,{onClick:()=>{const r=n==null?void 0:n.current;r&&d(f=>f?(r.pause(),!1):(r.play(),c(!1),!0))},children:[e.jsx(X,{ref:n,src:t,onEnded:()=>{var r;(r=n==null?void 0:n.current)==null||r.load(),d(!1),c(!0)},style:{visibility:i?"hidden":"visible"}}),e.jsx(Z,{src:s,style:{visibility:i?"visible":"hidden"}}),e.jsx(ee,{children:!a&&e.jsx(l.q,{name:"icon-play"})})]})};const se=l.styled_default("div")({name:"r",class:"rcr31jh",propsAsIs:!1}),te=l.styled_default("div")({name:"t",class:"thj4z8w",propsAsIs:!1}),ae=l.styled_default("h3")({name:"i",class:"i1oks4sz",propsAsIs:!1}),ne=l.styled_default("div")({name:"n",class:"n18s3mno",propsAsIs:!1}),le=l.styled_default("button")({name:"l",class:"lc8mqwv",propsAsIs:!1}),ie=({video:s,heading:t,body:n,action:a})=>e.jsxs(se,{children:[s&&e.jsx(N,{source:s.url,poster:s.thumbnailUrl}),e.jsxs(te,{children:[e.jsx(ae,{children:t}),e.jsx(ne,{children:n}),a&&e.jsx(le,{onClick:a,children:"View Insight"})]})]});const re=()=>l.q,de=()=>l.q,ce=l.styled_default("div")({name:"p",class:"p16oo5uk",propsAsIs:!1}),oe=l.styled_default("div")({name:"a",class:"a18c5k3h",propsAsIs:!1}),ue=l.styled_default(re())({name:"c",class:"czv5t8k",propsAsIs:!0}),pe=l.styled_default("div")({name:"s",class:"s1wp1emp",propsAsIs:!1}),ye=l.styled_default(de())({name:"l",class:"l1nz0q6x",propsAsIs:!0}),fe=l.styled_default("span")({name:"g",class:"g1jhb9lu",propsAsIs:!1}),ve=l.styled_default("div")({name:"d",class:"ds6gfsv",propsAsIs:!1}),xe=l.styled_default("button")({name:"x",class:"xkzz16s",propsAsIs:!1}),I=({close:s,action:t,data:{questionType:n,question:a,insight:d}})=>{const i=A[n];return i?e.jsxs(ce,{children:[e.jsx(oe,{onClick:s,children:e.jsx(ue,{name:"icon-cross"})}),e.jsxs(pe,{children:[e.jsx(ye,{name:i.iconName}),e.jsx(fe,{children:i.label})]}),n===u.QuestionType.FACTOID?e.jsx(ie,{...d,action:t}):e.jsx(ve,{children:a==null?void 0:a.title}),n!==u.QuestionType.FACTOID&&e.jsx(xe,{onClick:t,children:"Answer"})]}):null};const me=l.styled_default("div")({name:"s",class:"s1aopxp8",propsAsIs:!1}),he="c1t0h6s",$=({children:s,style:t,className:n,hiding:a})=>e.jsx(me,{style:t,className:l.cx_default(n,a&&he),children:s});const je=()=>$,S=l.styled_default(je())({name:"d",class:"d1qqtt3e",propsAsIs:!0}),be=({sdk:s})=>{const t=s.getNotificationsStore(),n=v.useStore(t),a=o.useMemo(()=>n!=null&&n.size?n.values().next().value:null,[n]);return(a==null?void 0:a.type)===g.NotificationType.QUESTION?e.jsx(S,{hiding:a.hiding,children:e.jsx("div",{children:e.jsx(I,{...a})})}):(a==null?void 0:a.type)===g.NotificationType.QUESTION_RESOLVED?e.jsx(S,{hiding:a.hiding,children:e.jsx("div",{children:e.jsx(I,{...a})})}):(a==null?void 0:a.type)===g.NotificationType.ONBOARDING?e.jsx(S,{hiding:a.hiding,children:e.jsx("div",{children:"Onboarding"})}):null};const ge=()=>T,Se=l.styled_default("div")({name:"i",class:"idhrx8x",propsAsIs:!1}),_=l.styled_default("div")({name:"r",class:"r1k6v4ep",propsAsIs:!1}),T=l.styled_default("div")({name:"a",class:"a1v8kucd",propsAsIs:!1}),_e=l.styled_default(ge())({name:"e",class:"e16yw7z1",propsAsIs:!0}),ke=s=>{const[t,n]=o.useState(!1),a=v.useStore(s.status),{data:d}=v.useStore(s.getUserStore()),i=a==="ready",[c,r]=o.useState(y),f=o.useCallback((p,x)=>{r(x),x===y?(p&&s.createEventSession(p),s.openFeature(u.FeatureType.GAMES)):s.closeFeature()},[s]);return o.useEffect(()=>{!i&&c===y&&(r(j),s.closeFeature())},[i,c,s]),{sdkEnabled:t,sdkReady:i,activeOverlay:c,activateAndLoadOverlay:f,enableSdk:p=>{s.initializeApp().then(({enabled:x,err:q})=>{if(n(!0),q){f(p,j);return}if(x){f(p,y);return}})},disableSdk:()=>{n(!1),s.disableApp()},isLogged:!!d}},Ie=s=>{const t=v.useStore(s.getActiveFeature()),n=v.useStore(s.streamStore()),[a,d]=o.useState(null);return o.useEffect(()=>{const i=s.getFeatures();if(t)for(const[c,r]of i)c===t?r.status.get()===h.FeatureStatus.Suspended&&(r.enable(),d(r)):r.status.get()===h.FeatureStatus.Ready&&r.disable();else{for(const[,c]of i)c.status.get()===h.FeatureStatus.Ready&&c.disable();d(null)}return()=>{for(const[,c]of i)c.status.get()===h.FeatureStatus.Ready&&c.disable()}},[t,s,n]),[t,a]},Ae=({sdk:s,className:t})=>{const[,n]=Ie(s);return e.jsx(E,{className:t,feature:n,sdk:s})},Ne=({sdk:s,overlays:t,children:n})=>{const{sdkEnabled:a,sdkReady:d,activeOverlay:i,activateAndLoadOverlay:c,enableSdk:r,disableSdk:f,isLogged:p}=ke(s);return e.jsxs(Se,{children:[a&&e.jsx(H,{sdkReady:d,activeOverlay:i,className:m.f,setActiveOverlay:x=>c("",x)}),a&&e.jsx(be,{sdk:s}),e.jsx(_,{"data-nav":a.toString(),style:{display:!a||i===j?"block":"none"},children:n&&n({enableSdk:r,disableSdk:f})}),e.jsx(_,{"data-nav":a.toString(),style:{display:i===b?"block":"none"},children:t&&i===b&&t[i]}),p&&a&&i===y&&e.jsx(Ae,{className:m.f,sdk:s}),!p&&a&&i===y&&e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"},children:"You are not logged in."})]})},$e=({sdkKey:s,plugins:t,children:n,production:a=!0})=>e.jsx(m.StreamLayerProvider,{sdkKey:s,plugins:t,production:a,autoEnable:!1,children:n}),Te=({children:s,overlays:t})=>{const{sdk:n,status:a}=o.useContext(m.StreamLayerContext);if(a===m.StreamLayerStatus.UNSET)throw new Error("Wrap app in `StreamLayerProvider`");return n?e.jsx("div",{className:"StreamLayerSDK",children:e.jsx(m.p,{children:e.jsx(Ne,{sdk:n,overlays:t,children:s})})}):s({})};exports.MastersStreamLayerProvider=$e;exports.MastersStreamLayerSDKReact=Te;exports.a=T;exports.e=_e;exports.f=$;exports.o=A;exports.r=_;exports.w=N;
|