@streamlayer/react 0.41.10 → 1.0.0
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/app/app.d.ts +3 -1
- package/lib/app/provider.d.ts +1 -0
- package/lib/cjs/app.js +1 -1
- package/lib/cjs/gamification-feature.js +1 -1
- package/lib/cjs/gamification-feature2.js +1 -0
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index2.js +176 -12
- package/lib/cjs/masters.js +1 -1
- package/lib/cjs/masters2.js +9 -164
- package/lib/cjs/points.js +1 -1
- package/lib/cjs/useStreamLayerApp.js +1 -1
- package/lib/cjs/useStreamLayerApp2.js +17 -0
- package/lib/dist/cjs/gamification-feature.js +1 -1
- package/lib/dist/cjs/gamification-feature2.js +1 -0
- package/lib/dist/cjs/index.js +1 -1
- package/lib/dist/cjs/masters.js +64 -56
- package/lib/dist/es/gamification-feature.js +1 -1
- package/lib/dist/es/gamification-feature2.js +115 -0
- package/lib/dist/es/index.js +7 -5
- package/lib/dist/es/masters.js +11066 -10876
- package/lib/dist/index.d.ts +15 -13
- package/lib/dist/style.css +1 -1
- package/lib/es/app.js +916 -11
- package/lib/es/gamification-feature.js +1 -1
- package/lib/es/gamification-feature2.js +4 -0
- package/lib/es/index.js +6 -14
- package/lib/es/index2.js +23584 -74
- package/lib/es/masters.js +1 -1
- package/lib/es/masters2.js +704 -23031
- package/lib/es/points.js +29 -32
- package/lib/es/useStreamLayerApp.js +3 -36
- package/lib/es/useStreamLayerApp2.js +20507 -0
- package/lib/index.d.ts +1 -1
- package/lib/masters.d.ts +2 -1
- package/lib/style.css +1 -1
- package/package.json +13 -13
- package/lib/cjs/index3.js +0 -1
- package/lib/es/index3.js +0 -246
package/lib/es/app.js
CHANGED
|
@@ -1,16 +1,921 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var he = Object.defineProperty;
|
|
2
|
+
var ve = (e, s, n) => s in e ? he(e, s, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[s] = n;
|
|
3
|
+
var g = (e, s, n) => (ve(e, typeof s != "symbol" ? s + "" : s, n), n);
|
|
4
|
+
import { jsx as t, jsxs as y, Fragment as D } from "react/jsx-runtime";
|
|
5
|
+
import { a3 as V, u, F as ge, s as h, T as ie, c as me, x as ye, a as ke, N as fe, k as Ne, M as be, b as Se, e as Ie, g as $e, f as Ce, O as re, m as q, h as Ee, C as we, i as Ae, n as ae, j as Le, l as De, o as Te, q as U, t as xe, v as le, w as F, I as Oe, y as Re, r as Ve, A as qe, B as Pe, D as Qe, E as _e, G as Ue, H as O, J as B, $ as Fe, P as Ke, K as Me, L as ze, R as Be, U as We, V as P, Z as je, _ as Ge, p as W, a0 as He, W as Xe, X as Ye, Y as Ze, a4 as Je, a1 as de, a2 as j } from "./index2.js";
|
|
6
|
+
import { createContext as es, useContext as K, useRef as L, useState as $, useEffect as k, useTransition as ss, lazy as ns, useMemo as w, Suspense as ts, useLayoutEffect as os, useCallback as G } from "react";
|
|
7
|
+
import { C as E, c as H, Q as R, S as x } from "./useStreamLayerApp2.js";
|
|
8
|
+
window.dispatchEvent(new CustomEvent("grpc_devtools_loaded"));
|
|
9
|
+
function is(e) {
|
|
10
|
+
return e instanceof DOMException && // everything except Firefox
|
|
11
|
+
(e.code === 22 || // Firefox
|
|
12
|
+
e.code === 1014 || // test name field too, because code might not be present
|
|
13
|
+
// everything except Firefox
|
|
14
|
+
e.name === "QuotaExceededError" || // Firefox
|
|
15
|
+
e.name === "NS_ERROR_DOM_QUOTA_REACHED");
|
|
16
|
+
}
|
|
17
|
+
class rs {
|
|
18
|
+
constructor(s = "main", n = window.localStorage) {
|
|
19
|
+
g(this, "delimiter", ":");
|
|
20
|
+
g(this, "prefix");
|
|
21
|
+
g(this, "storage");
|
|
22
|
+
g(this, "clear", () => {
|
|
23
|
+
for (const s in window.localStorage)
|
|
24
|
+
s.startsWith(this.prefix) && this.storage.removeItem(s);
|
|
25
|
+
});
|
|
26
|
+
g(this, "generateKey", (s) => `${this.prefix}${this.delimiter}${s.join(this.delimiter)}`);
|
|
27
|
+
g(this, "write", (...s) => {
|
|
28
|
+
const n = s.pop() || "", o = this.generateKey(s);
|
|
29
|
+
try {
|
|
30
|
+
this.storage.setItem(o, n);
|
|
31
|
+
} catch (r) {
|
|
32
|
+
is(r) && this.storage === window.sessionStorage && (window.sessionStorage.removeItem("slstreamlogs"), this.storage.setItem(o, n));
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
g(this, "read", (...s) => {
|
|
36
|
+
const n = this.storage.getItem(this.generateKey(s));
|
|
37
|
+
return n === null ? void 0 : n;
|
|
38
|
+
});
|
|
39
|
+
g(this, "remove", (...s) => {
|
|
40
|
+
this.storage.removeItem(this.generateKey(s));
|
|
41
|
+
});
|
|
42
|
+
this.prefix = `sl-sdk${this.delimiter}${s}`, this.storage = n;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
var X;
|
|
46
|
+
(function(e) {
|
|
47
|
+
e.Init = "init", e.Ready = "ready", e.Connecting = "connecting", e.Connected = "connected", e.Disconnected = "disconnected", e.Failed = "failed", e.Reconnect = "reconnect", e.Reconnecting = "reconnecting";
|
|
48
|
+
})(X || (X = {}));
|
|
49
|
+
E.Unknown, E.Internal, E.DeadlineExceeded, E.ResourceExhausted, E.FailedPrecondition, E.Unavailable, E.DataLoss;
|
|
50
|
+
V("grpc:retry");
|
|
51
|
+
H(10, { description: "Number of attempts to retry" }), H(3e4, { description: "Max delay between retries in milliseconds" });
|
|
52
|
+
var I;
|
|
53
|
+
(function(e) {
|
|
54
|
+
e.SCHEMA = "schema", e.EXTERNAL_TOKEN = "eToken", e.TOKEN = "token";
|
|
55
|
+
})(I || (I = {}));
|
|
56
|
+
class as extends rs {
|
|
57
|
+
constructor() {
|
|
58
|
+
super("user");
|
|
59
|
+
// Schema
|
|
60
|
+
g(this, "setSchema", (n) => {
|
|
61
|
+
this.write(I.SCHEMA, n);
|
|
62
|
+
});
|
|
63
|
+
g(this, "getSchema", () => this.read(I.SCHEMA));
|
|
64
|
+
// Token
|
|
65
|
+
g(this, "setToken", (n) => {
|
|
66
|
+
this.write(I.TOKEN, n);
|
|
67
|
+
});
|
|
68
|
+
g(this, "getToken", () => this.read(I.TOKEN));
|
|
69
|
+
// External Token
|
|
70
|
+
g(this, "setExternalToken", (n) => {
|
|
71
|
+
this.write(I.EXTERNAL_TOKEN, n);
|
|
72
|
+
});
|
|
73
|
+
g(this, "getExternalToken", () => this.read(I.EXTERNAL_TOKEN));
|
|
74
|
+
g(this, "removeToken", () => {
|
|
75
|
+
this.remove(I.TOKEN);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
var Y;
|
|
80
|
+
(function(e) {
|
|
81
|
+
e.DISABLED = "disabled", e.INITIALIZATION = "initialization", e.READY = "ready", e.FAILED = "failed", e.SUSPENDED = "suspended";
|
|
82
|
+
})(Y || (Y = {}));
|
|
83
|
+
V("deep_link");
|
|
84
|
+
V("bypass");
|
|
85
|
+
new as();
|
|
86
|
+
V("video_player");
|
|
87
|
+
var Z;
|
|
88
|
+
(function(e) {
|
|
89
|
+
e.ALLOWED = "allowed", e.DISALLOWED = "disallowed";
|
|
90
|
+
})(Z || (Z = {}));
|
|
91
|
+
var J;
|
|
92
|
+
(function(e) {
|
|
93
|
+
e.UNKNOWN = "unknown", e.ALREADY_VOTED = "already_voted";
|
|
94
|
+
})(J || (J = {}));
|
|
95
|
+
var ee;
|
|
96
|
+
(function(e) {
|
|
97
|
+
e.ONBOARDING = "onboarding", e.ONBOARDING_IO = "onboarding_io";
|
|
98
|
+
})(ee || (ee = {}));
|
|
99
|
+
var se;
|
|
100
|
+
(function(e) {
|
|
101
|
+
e.Unset = "unset", e.Required = "required", e.Optional = "optional", e.Completed = "completed", e.Disabled = "disabled", e.Unavailable = "unavailable";
|
|
102
|
+
})(se || (se = {}));
|
|
103
|
+
R.POLL, R.PREDICTION, R.TRIVIA;
|
|
104
|
+
const ls = {
|
|
105
|
+
[x.GAMES]: !0
|
|
106
|
+
}, Q = /* @__PURE__ */ h("div")({
|
|
107
|
+
name: "LoadingContainer",
|
|
108
|
+
class: "l1a1b29x",
|
|
109
|
+
propsAsIs: !1
|
|
110
|
+
}), ds = ({
|
|
111
|
+
feature: e,
|
|
112
|
+
sdk: s,
|
|
113
|
+
children: n,
|
|
114
|
+
className: o,
|
|
115
|
+
noWait: r
|
|
116
|
+
}) => {
|
|
117
|
+
const a = u(e.status), i = u(s.sdkStore.slStreamId);
|
|
118
|
+
if (!r) {
|
|
119
|
+
if (i != null && i.loading && !i.data)
|
|
120
|
+
return /* @__PURE__ */ t(Q, {
|
|
121
|
+
className: o,
|
|
122
|
+
children: "Event is loading..."
|
|
123
|
+
});
|
|
124
|
+
if (!(i != null && i.data))
|
|
125
|
+
return /* @__PURE__ */ t(Q, {
|
|
126
|
+
className: o,
|
|
127
|
+
children: "Event is forbidden..."
|
|
128
|
+
});
|
|
129
|
+
if (a !== ge.Ready)
|
|
130
|
+
return /* @__PURE__ */ t(Q, {
|
|
131
|
+
className: o,
|
|
132
|
+
children: "Wait feature..."
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return n;
|
|
136
|
+
}, ce = es({
|
|
137
|
+
sdk: null
|
|
138
|
+
}), M = () => K(ce), cs = /* @__PURE__ */ h("div")({
|
|
139
|
+
name: "QuestionContainer",
|
|
140
|
+
class: "qfnqmpg",
|
|
141
|
+
propsAsIs: !1
|
|
142
|
+
}), ps = ({
|
|
143
|
+
openedQuestion: e
|
|
144
|
+
}) => {
|
|
145
|
+
var s, n;
|
|
146
|
+
const {
|
|
147
|
+
sdk: o
|
|
148
|
+
} = M();
|
|
149
|
+
return ((s = e == null ? void 0 : e.attributes) == null ? void 0 : s.attributes.case) === "insight" ? /* @__PURE__ */ t(ye, {
|
|
150
|
+
...e.attributes.attributes.value,
|
|
151
|
+
controlVideo: o == null ? void 0 : o.controlVideoPlayer
|
|
152
|
+
}) : ((n = e == null ? void 0 : e.attributes) == null ? void 0 : n.attributes.case) === "tweet" ? /* @__PURE__ */ t(ke, {
|
|
153
|
+
...e.attributes.attributes.value,
|
|
154
|
+
controlVideo: o == null ? void 0 : o.controlVideoPlayer
|
|
155
|
+
}) : null;
|
|
156
|
+
}, us = ({
|
|
157
|
+
extendedQuestion: e,
|
|
158
|
+
vote: s,
|
|
159
|
+
close: n
|
|
160
|
+
}) => {
|
|
161
|
+
const {
|
|
162
|
+
loading: o,
|
|
163
|
+
data: r
|
|
164
|
+
} = e;
|
|
165
|
+
return r ? /* @__PURE__ */ t(fe, {
|
|
166
|
+
vote: s,
|
|
167
|
+
close: n,
|
|
168
|
+
openedQuestion: r,
|
|
169
|
+
isLoading: !!o
|
|
170
|
+
}) : /* @__PURE__ */ t(Ne, {});
|
|
171
|
+
}, hs = ({
|
|
172
|
+
gamification: e
|
|
173
|
+
}) => {
|
|
174
|
+
var s;
|
|
175
|
+
const n = u(e.openedQuestion.$store), o = u(e.openedQuestion.$extendedStore);
|
|
176
|
+
if (!n)
|
|
177
|
+
return null;
|
|
178
|
+
const r = n.type;
|
|
179
|
+
return /* @__PURE__ */ y(cs, {
|
|
180
|
+
children: [/* @__PURE__ */ t(ie, {
|
|
181
|
+
close: e.closeQuestion,
|
|
182
|
+
type: ((s = n.attributes) == null ? void 0 : s.type) || R.UNSET
|
|
183
|
+
}), r === "question" && /* @__PURE__ */ t(us, {
|
|
184
|
+
vote: e.submitAnswer,
|
|
185
|
+
close: e.closeQuestion,
|
|
186
|
+
extendedQuestion: o
|
|
187
|
+
}), r !== "question" && /* @__PURE__ */ t(ps, {
|
|
188
|
+
openedQuestion: n
|
|
189
|
+
}), /* @__PURE__ */ t(me, {
|
|
190
|
+
sponsorLogo: ""
|
|
191
|
+
})]
|
|
192
|
+
});
|
|
193
|
+
}, vs = /* @__PURE__ */ h("div")({
|
|
194
|
+
name: "InviteFriendsContainer",
|
|
195
|
+
class: "i1d1hf8u",
|
|
196
|
+
propsAsIs: !1
|
|
197
|
+
}), gs = ({
|
|
198
|
+
deepLink: e
|
|
199
|
+
}) => /* @__PURE__ */ t(vs, {
|
|
200
|
+
children: /* @__PURE__ */ t(be, {
|
|
201
|
+
inviteLink: e,
|
|
202
|
+
inviteCardTitle: "It’s More Fun With Friends",
|
|
203
|
+
inviteCardSubtext: "Invite and compete against your friends for the top spot on the leaderboard."
|
|
204
|
+
})
|
|
205
|
+
}), ms = /* @__PURE__ */ h("div")({
|
|
206
|
+
name: "InviteLinkContainer",
|
|
207
|
+
class: "i9tvant",
|
|
208
|
+
propsAsIs: !1
|
|
209
|
+
}), ys = ({
|
|
210
|
+
gamification: e,
|
|
211
|
+
scrollNode: s,
|
|
212
|
+
scrollStore: n
|
|
213
|
+
}) => {
|
|
214
|
+
const o = L(null), {
|
|
215
|
+
data: r,
|
|
216
|
+
hasMore: a,
|
|
217
|
+
loading: i,
|
|
218
|
+
key: l
|
|
219
|
+
} = u(e.leaderboardList.$store), {
|
|
220
|
+
data: c
|
|
221
|
+
} = u(e.deepLink.$store), [d, p] = Se(o);
|
|
222
|
+
return !r.length && !i ? /* @__PURE__ */ t(gs, {
|
|
223
|
+
deepLink: c
|
|
224
|
+
}) : /* @__PURE__ */ y(D, {
|
|
225
|
+
children: [/* @__PURE__ */ t(Ie, {
|
|
226
|
+
items: r,
|
|
227
|
+
scrollNode: s,
|
|
228
|
+
scrollStore: n,
|
|
229
|
+
fetchMore: e.leaderboardList.fetchMore,
|
|
230
|
+
hasMore: a,
|
|
231
|
+
openItemDetail: e.openUser,
|
|
232
|
+
currentUserId: e.currentUserId.get()
|
|
233
|
+
}, l), c && /* @__PURE__ */ t(ms, {
|
|
234
|
+
ref: o,
|
|
235
|
+
children: /* @__PURE__ */ t($e, {
|
|
236
|
+
onClick: () => d(c),
|
|
237
|
+
title: "Invite Friends",
|
|
238
|
+
description: "Challenge them now!"
|
|
239
|
+
})
|
|
240
|
+
}), p]
|
|
241
|
+
});
|
|
242
|
+
}, ks = ({ store: e, openQuestion: s }) => {
|
|
243
|
+
const { sdk: n } = M(), o = u(e);
|
|
244
|
+
return /* @__PURE__ */ t(Ce, { openQuestion: s, questions: o.data, controlVideo: n == null ? void 0 : n.controlVideoPlayer });
|
|
245
|
+
}, fs = ({ userSummary: e }) => {
|
|
246
|
+
var s;
|
|
247
|
+
const [n, o] = $(void 0);
|
|
248
|
+
return k(() => {
|
|
249
|
+
const r = e.$store.subscribe((a) => {
|
|
250
|
+
a && o(a);
|
|
251
|
+
});
|
|
252
|
+
return () => {
|
|
253
|
+
r();
|
|
254
|
+
};
|
|
255
|
+
}, [e]), /* @__PURE__ */ t(re, { loading: !(n != null && n.summary), ...n == null ? void 0 : n.summary, successRate: (s = n == null ? void 0 : n.percentage) == null ? void 0 : s.correct });
|
|
256
|
+
}, Ns = ({ gamification: e, className: s, scrollStore: n, scrollNode: o, appNode: r, style: a, responsiveStore: i }) => {
|
|
257
|
+
const { tabsShown: l } = u(n, { keys: ["tabsShown"] }), [c, d] = $(q.HOME), [, p] = ss(), { sdkInDesktopView: v, screen: m } = u(i, { keys: ["sdkInDesktopView"] }), f = (b) => {
|
|
258
|
+
p(() => {
|
|
259
|
+
var A;
|
|
260
|
+
d(b), v === !1 && (((A = r.current) == null ? void 0 : A.getBoundingClientRect().y) || 0) < 0 && U(r, m.size, { behavior: "instant" });
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
k(() => n.subscribe((b) => {
|
|
264
|
+
if (b.scrollPosition === 0) {
|
|
265
|
+
n.setKey("tabsShown", !0);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
i.get().sdkInDesktopView ? n.setKey("tabsShown", b.scrollDirection === "backward") : n.setKey("tabsShown", b.scrollDirection === "forward");
|
|
269
|
+
}), [n, i]);
|
|
270
|
+
let N = "0px";
|
|
271
|
+
return v ? N = l ? "0px" : "calc(8px - var(--header-height) - var(--header-offset))" : N = l ? "calc(var(--header-height) + var(--header-offset) - 2px)" : "0px", /* @__PURE__ */ y(Ee, { className: s, style: a, children: [
|
|
272
|
+
/* @__PURE__ */ t(
|
|
273
|
+
we,
|
|
274
|
+
{
|
|
275
|
+
style: {
|
|
276
|
+
top: N
|
|
277
|
+
},
|
|
278
|
+
children: /* @__PURE__ */ t(Ae, { activePage: c, toggleActivePage: f })
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
c === q.HOME && /* @__PURE__ */ y(D, { children: [
|
|
282
|
+
/* @__PURE__ */ t(ae, { style: { paddingTop: "8px" }, children: /* @__PURE__ */ t(Le, { children: /* @__PURE__ */ t(fs, { userSummary: e.userSummary }) }) }),
|
|
283
|
+
/* @__PURE__ */ t(De, { style: { flex: 1 }, children: /* @__PURE__ */ t(ks, { openQuestion: e.openQuestion, store: e.feedList.getStore() }) })
|
|
284
|
+
] }),
|
|
285
|
+
c === q.LEADERBOARD && /* @__PURE__ */ t(Te, { children: /* @__PURE__ */ t(ys, { scrollStore: n, scrollNode: o, gamification: e }) })
|
|
286
|
+
] });
|
|
287
|
+
}, bs = () => F, ne = /* @__PURE__ */ h(bs())({
|
|
288
|
+
name: "OpenedContainer",
|
|
289
|
+
class: "o1o2cpiy",
|
|
290
|
+
propsAsIs: !0
|
|
291
|
+
}), Ss = /* @__PURE__ */ h("div")({
|
|
292
|
+
name: "UserContainer",
|
|
293
|
+
class: "u1ob6f8q",
|
|
294
|
+
propsAsIs: !1
|
|
295
|
+
}), Is = ({
|
|
296
|
+
correct: e,
|
|
297
|
+
incorrect: s
|
|
298
|
+
}) => {
|
|
299
|
+
const n = e + s;
|
|
300
|
+
return n === 0 ? 0 : Math.round(e / n * 100);
|
|
301
|
+
}, gn = ({
|
|
302
|
+
gamification: e,
|
|
303
|
+
scrollStore: s,
|
|
304
|
+
className: n,
|
|
305
|
+
appNode: o,
|
|
306
|
+
scrollNode: r,
|
|
307
|
+
responsiveStore: a
|
|
308
|
+
}) => /* @__PURE__ */ t(Ns, {
|
|
309
|
+
appNode: o,
|
|
310
|
+
scrollStore: s,
|
|
311
|
+
scrollNode: r,
|
|
312
|
+
className: n,
|
|
313
|
+
gamification: e,
|
|
314
|
+
responsiveStore: a
|
|
315
|
+
}), $s = ({
|
|
316
|
+
gamification: e,
|
|
317
|
+
className: s,
|
|
318
|
+
appNode: n,
|
|
319
|
+
responsiveStore: o
|
|
320
|
+
}) => {
|
|
321
|
+
const r = u(e.openedQuestion.$store), a = u(e.openedUser), {
|
|
322
|
+
sdkInDesktopView: i
|
|
323
|
+
} = u(o, {
|
|
324
|
+
keys: ["sdkInDesktopView"]
|
|
325
|
+
}), {
|
|
326
|
+
hiding: l,
|
|
327
|
+
onAnimationEnd: c
|
|
328
|
+
} = xe();
|
|
329
|
+
if (!n.current || !r && !a)
|
|
330
|
+
return null;
|
|
331
|
+
const d = r ? /* @__PURE__ */ t(ne, {
|
|
332
|
+
className: s,
|
|
333
|
+
hiding: l,
|
|
334
|
+
onAnimationEnd: c,
|
|
335
|
+
children: /* @__PURE__ */ t(hs, {
|
|
336
|
+
gamification: e
|
|
337
|
+
})
|
|
338
|
+
}) : a ? /* @__PURE__ */ t(ne, {
|
|
339
|
+
className: s,
|
|
340
|
+
hiding: l,
|
|
341
|
+
onAnimationEnd: c,
|
|
342
|
+
children: /* @__PURE__ */ y(Ss, {
|
|
343
|
+
children: [/* @__PURE__ */ t(ie, {
|
|
344
|
+
label: "Friend's Rank",
|
|
345
|
+
close: e.closeUser
|
|
346
|
+
}), /* @__PURE__ */ t(ae, {
|
|
347
|
+
children: /* @__PURE__ */ t(re, {
|
|
348
|
+
...a,
|
|
349
|
+
successRate: Is(a)
|
|
350
|
+
})
|
|
351
|
+
})]
|
|
352
|
+
})
|
|
353
|
+
}) : null;
|
|
354
|
+
return /* @__PURE__ */ t(le, {
|
|
355
|
+
container: n,
|
|
356
|
+
useContainer: !i,
|
|
357
|
+
children: d
|
|
358
|
+
});
|
|
359
|
+
}, Cs = ns(() => import("./gamification-feature.js")), Es = ({ sdk: e, feature: s, className: n, scrollStore: o, appNode: r, scrollNode: a, responsiveStore: i }) => {
|
|
360
|
+
const l = w(() => s && s.featureConfig.get().type === x.GAMES ? /* @__PURE__ */ t(ds, { className: n, sdk: e, feature: s, children: /* @__PURE__ */ t(
|
|
361
|
+
Cs,
|
|
362
|
+
{
|
|
363
|
+
appNode: r,
|
|
364
|
+
scrollStore: o,
|
|
365
|
+
scrollNode: a,
|
|
366
|
+
className: n,
|
|
367
|
+
responsiveStore: i,
|
|
368
|
+
gamification: s
|
|
369
|
+
}
|
|
370
|
+
) }) : null, [e, s, n, i, o, a, r]);
|
|
371
|
+
return /* @__PURE__ */ t(
|
|
372
|
+
ts,
|
|
373
|
+
{
|
|
374
|
+
fallback: /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "100%" }, children: "page loading..." }),
|
|
375
|
+
children: l
|
|
376
|
+
}
|
|
377
|
+
);
|
|
378
|
+
}, ws = ({ feature: e, className: s, appNode: n, responsiveStore: o }) => e && e.featureConfig.get().type === x.GAMES ? /* @__PURE__ */ t(
|
|
379
|
+
$s,
|
|
380
|
+
{
|
|
381
|
+
className: s,
|
|
382
|
+
appNode: n,
|
|
383
|
+
responsiveStore: o,
|
|
384
|
+
gamification: e
|
|
385
|
+
}
|
|
386
|
+
) : null, As = () => Re, Ls = /* @__PURE__ */ h(As())({
|
|
387
|
+
name: "Container",
|
|
388
|
+
class: "ckodz37",
|
|
389
|
+
propsAsIs: !0
|
|
390
|
+
}), Ds = ({
|
|
391
|
+
sdk: e
|
|
392
|
+
}) => {
|
|
393
|
+
const s = u(e.sdkStore.organizationSettings), n = u(e.sdkStore.streamSettings), o = u(e.getActiveFeature()), r = w(() => {
|
|
394
|
+
const i = (n == null ? void 0 : n.data) || (s == null ? void 0 : s.data);
|
|
395
|
+
return i != null && i.overlays ? i.overlays : [];
|
|
396
|
+
}, [s, n]), a = w(() => [...r.filter(({
|
|
397
|
+
enableSdkButton: i
|
|
398
|
+
}) => i).map((i) => ({
|
|
399
|
+
id: i.type,
|
|
400
|
+
onClick: () => e.openFeature(i.type),
|
|
401
|
+
disabled: !(i.type in ls),
|
|
402
|
+
label: i.name,
|
|
403
|
+
icon: /* @__PURE__ */ t("img", {
|
|
404
|
+
src: i.icon,
|
|
405
|
+
alt: ""
|
|
406
|
+
}),
|
|
407
|
+
/** multiplied by 10 to add the ability to insert custom buttons between our buttons */
|
|
408
|
+
position: i.position * 10
|
|
409
|
+
}))].sort((i, l) => i.position - l.position), [r, e]);
|
|
410
|
+
return /* @__PURE__ */ t(Ls, {
|
|
411
|
+
children: a.map((i) => /* @__PURE__ */ t(Oe, {
|
|
412
|
+
...i,
|
|
413
|
+
icon: void 0,
|
|
414
|
+
active: i.id === o
|
|
415
|
+
}, i.id))
|
|
416
|
+
});
|
|
417
|
+
}, Ts = /* @__PURE__ */ h("div")({
|
|
418
|
+
name: "Container",
|
|
419
|
+
class: "c3q0amv",
|
|
420
|
+
propsAsIs: !1
|
|
421
|
+
}), xs = /* @__PURE__ */ h("div")({
|
|
422
|
+
name: "CloseIconWrap",
|
|
423
|
+
class: "cqihknq",
|
|
424
|
+
propsAsIs: !1
|
|
425
|
+
}), Os = () => Ve, Rs = /* @__PURE__ */ h(Os())({
|
|
426
|
+
name: "CloseIcon",
|
|
427
|
+
class: "cl5ln9o",
|
|
428
|
+
propsAsIs: !0
|
|
429
|
+
}), Vs = /* @__PURE__ */ h("div")({
|
|
430
|
+
name: "Title",
|
|
431
|
+
class: "t1bejf60",
|
|
432
|
+
propsAsIs: !1
|
|
433
|
+
}), qs = /* @__PURE__ */ h("img")({
|
|
434
|
+
name: "SponsorLogo",
|
|
435
|
+
class: "sb0t4y8",
|
|
436
|
+
propsAsIs: !1
|
|
437
|
+
}), Ps = /* @__PURE__ */ h("div")({
|
|
438
|
+
name: "PresentsTitle",
|
|
439
|
+
class: "p1nmyo08",
|
|
440
|
+
propsAsIs: !1
|
|
441
|
+
}), Qs = /* @__PURE__ */ h("div")({
|
|
442
|
+
name: "Subtitle",
|
|
443
|
+
class: "sgd2pup",
|
|
444
|
+
propsAsIs: !1
|
|
445
|
+
}), _s = /* @__PURE__ */ h("div")({
|
|
446
|
+
name: "Description",
|
|
447
|
+
class: "d6e19hw",
|
|
448
|
+
propsAsIs: !1
|
|
449
|
+
}), Us = /* @__PURE__ */ h("button")({
|
|
450
|
+
name: "ActionButton",
|
|
451
|
+
class: "a17h53j4",
|
|
452
|
+
propsAsIs: !1
|
|
453
|
+
}), te = ({ close: e, action: s, onboarding: n }) => {
|
|
454
|
+
var o, r, a, i, l, c, d, p;
|
|
455
|
+
return /* @__PURE__ */ y(Ts, { children: [
|
|
456
|
+
/* @__PURE__ */ t(xs, { onClick: e, children: /* @__PURE__ */ t(Rs, { name: "icon-cross" }) }),
|
|
457
|
+
((r = (o = n == null ? void 0 : n.titleCard) == null ? void 0 : o.media) == null ? void 0 : r.sponsorLogo) && /* @__PURE__ */ y(Vs, { children: [
|
|
458
|
+
/* @__PURE__ */ t(qs, { alt: "sponsor-logo", src: (i = (a = n == null ? void 0 : n.titleCard) == null ? void 0 : a.media) == null ? void 0 : i.sponsorLogo }),
|
|
459
|
+
/* @__PURE__ */ t(Ps, { children: "PRESENTS" })
|
|
460
|
+
] }),
|
|
461
|
+
((l = n == null ? void 0 : n.titleCard) == null ? void 0 : l.title) && /* @__PURE__ */ t(Qs, { children: (c = n == null ? void 0 : n.titleCard) == null ? void 0 : c.title }),
|
|
462
|
+
((d = n == null ? void 0 : n.titleCard) == null ? void 0 : d.subtitle) && /* @__PURE__ */ t(_s, { children: (p = n == null ? void 0 : n.titleCard) == null ? void 0 : p.subtitle }),
|
|
463
|
+
/* @__PURE__ */ t(Us, { onClick: s, children: "Play Now" })
|
|
464
|
+
] });
|
|
465
|
+
}, _ = [{
|
|
466
|
+
graphicSrc: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/step_1.png",
|
|
467
|
+
tagline: "Featured groups+ experience",
|
|
468
|
+
headline: /* @__PURE__ */ y(D, {
|
|
469
|
+
children: ["Welcome to ", /* @__PURE__ */ t("br", {}), " Featured Groups +"]
|
|
470
|
+
})
|
|
471
|
+
}, {
|
|
472
|
+
graphicSrc: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/step_2.png",
|
|
473
|
+
headline: "Get real-time insights"
|
|
474
|
+
}, {
|
|
475
|
+
graphicSrc: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/step_3.png",
|
|
476
|
+
headline: "Predictions, trivia & polls synced to match play"
|
|
477
|
+
}, {
|
|
478
|
+
graphicSrc: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/step_4.png",
|
|
479
|
+
headline: "Win points for every answer you get right"
|
|
480
|
+
}, {
|
|
481
|
+
graphicSrc: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/step_5.png",
|
|
482
|
+
headline: "Compete against friends on the leaderboard"
|
|
483
|
+
}], Fs = /* @__PURE__ */ h("div")({
|
|
484
|
+
name: "OnboardingContainer",
|
|
485
|
+
class: "o1xcysoz",
|
|
486
|
+
propsAsIs: !1
|
|
487
|
+
}), Ks = () => F, Ms = /* @__PURE__ */ h(Ks())({
|
|
488
|
+
name: "OnboardingNotificationContainer",
|
|
489
|
+
class: "oejzp3v",
|
|
490
|
+
propsAsIs: !0
|
|
491
|
+
}), oe = /* @__PURE__ */ h("div")({
|
|
492
|
+
name: "InnerContainer",
|
|
493
|
+
class: "i134gfua",
|
|
494
|
+
propsAsIs: !1
|
|
495
|
+
}), zs = ({
|
|
496
|
+
deepLink: e,
|
|
497
|
+
onboardingOpts: s,
|
|
498
|
+
notification: n,
|
|
499
|
+
gamification: o,
|
|
500
|
+
loading: r,
|
|
501
|
+
renderToNode: a,
|
|
502
|
+
sdk: i
|
|
503
|
+
}) => {
|
|
504
|
+
var l, c, d, p, v, m, f;
|
|
505
|
+
const N = u(o.friends.getStore()), [b, A] = $(void 0), S = w(() => {
|
|
506
|
+
var C, T;
|
|
507
|
+
const z = i.getInviter();
|
|
508
|
+
return z ? (T = (C = N.data) == null ? void 0 : C.find(({
|
|
509
|
+
slId: ue
|
|
510
|
+
}) => ue === z)) == null ? void 0 : T.name : "";
|
|
511
|
+
}, [N.data, i]);
|
|
512
|
+
return k(() => {
|
|
513
|
+
const C = e.$store.subscribe((T) => {
|
|
514
|
+
T && A(T.data);
|
|
515
|
+
});
|
|
516
|
+
return () => {
|
|
517
|
+
C();
|
|
518
|
+
};
|
|
519
|
+
}, [e.$store]), /* @__PURE__ */ t(Fs, {
|
|
520
|
+
children: /* @__PURE__ */ t(Qe, {
|
|
521
|
+
loading: r,
|
|
522
|
+
renderToNode: a,
|
|
523
|
+
rules: [{
|
|
524
|
+
label: "Answer as many questions as you like.",
|
|
525
|
+
icon: "icon-btn-feature-groups"
|
|
526
|
+
}, {
|
|
527
|
+
label: "Win points for each correct trivia or prediction answer.",
|
|
528
|
+
icon: "icon-thumb-up"
|
|
529
|
+
}, {
|
|
530
|
+
label: "Top the leader board and best your friends.",
|
|
531
|
+
icon: "icon-trophy"
|
|
532
|
+
}],
|
|
533
|
+
rulesBtnLabel: (l = s.rules) == null ? void 0 : l.buttonLabel,
|
|
534
|
+
rulesTitle: (c = s.rules) == null ? void 0 : c.heading,
|
|
535
|
+
termsTitle: "Terms and Conditions",
|
|
536
|
+
termsText: (d = s.rules) == null ? void 0 : d.terms,
|
|
537
|
+
steps: _,
|
|
538
|
+
primaryColor: (p = s.inviteCard) == null ? void 0 : p.iconColor,
|
|
539
|
+
inviteLink: b,
|
|
540
|
+
inviteCardTitle: (v = s.inviteCard) == null ? void 0 : v.heading,
|
|
541
|
+
inviteCardSubtext: (m = s.inviteCard) == null ? void 0 : m.subtext,
|
|
542
|
+
inviteCardBtnLabel: (f = s.inviteCard) == null ? void 0 : f.buttonLabel,
|
|
543
|
+
onClose: () => {
|
|
544
|
+
var C;
|
|
545
|
+
(C = n.close) == null || C.call(n);
|
|
546
|
+
},
|
|
547
|
+
gamification: o,
|
|
548
|
+
sdk: i,
|
|
549
|
+
inviterName: S
|
|
550
|
+
})
|
|
551
|
+
});
|
|
552
|
+
}, Bs = ({
|
|
553
|
+
sdk: e,
|
|
554
|
+
notification: s,
|
|
555
|
+
saveHeight: n,
|
|
556
|
+
style: o,
|
|
557
|
+
appNode: r,
|
|
558
|
+
sdkInDesktopView: a,
|
|
559
|
+
responsiveStore: i
|
|
560
|
+
}) => {
|
|
561
|
+
var l;
|
|
562
|
+
const c = L(null), d = s.data.onboarding, [p, v] = $(d == null ? void 0 : d.instantOpen), m = e.getFeature(x.GAMES), f = w(() => _ == null ? void 0 : _.map(({
|
|
563
|
+
graphicSrc: S
|
|
564
|
+
}) => S), []), {
|
|
565
|
+
screen: N
|
|
566
|
+
} = u(i, {
|
|
567
|
+
keys: ["screen"]
|
|
568
|
+
});
|
|
569
|
+
(l = d == null ? void 0 : d.titleCard) != null && l.media && (d.titleCard.media.sponsorLogo = qe), os(() => {
|
|
570
|
+
var S;
|
|
571
|
+
n(((S = c.current) == null ? void 0 : S.getBoundingClientRect().height) || 0);
|
|
572
|
+
}, [n]);
|
|
573
|
+
const {
|
|
574
|
+
loading: b,
|
|
575
|
+
throttled: A
|
|
576
|
+
} = Pe(f);
|
|
577
|
+
return p && m && d && r.current && !A ? /* @__PURE__ */ t(le, {
|
|
578
|
+
container: r,
|
|
579
|
+
useContainer: !a,
|
|
580
|
+
children: /* @__PURE__ */ t(zs, {
|
|
581
|
+
notification: s,
|
|
582
|
+
setOpened: v,
|
|
583
|
+
gamification: m,
|
|
584
|
+
onboardingOpts: d,
|
|
585
|
+
deepLink: m.deepLink,
|
|
586
|
+
loading: b,
|
|
587
|
+
renderToNode: r,
|
|
588
|
+
sdk: e
|
|
589
|
+
})
|
|
590
|
+
}) : /* @__PURE__ */ y(D, {
|
|
591
|
+
children: [/* @__PURE__ */ t(oe, {
|
|
592
|
+
ref: c,
|
|
593
|
+
style: {
|
|
594
|
+
position: "absolute",
|
|
595
|
+
visibility: "hidden"
|
|
596
|
+
},
|
|
597
|
+
children: /* @__PURE__ */ t(te, {
|
|
598
|
+
close: () => {
|
|
599
|
+
},
|
|
600
|
+
action: () => {
|
|
601
|
+
},
|
|
602
|
+
onboarding: d
|
|
603
|
+
})
|
|
604
|
+
}), /* @__PURE__ */ t(Ms, {
|
|
605
|
+
style: o,
|
|
606
|
+
hiding: s.hiding,
|
|
607
|
+
children: /* @__PURE__ */ t(oe, {
|
|
608
|
+
children: /* @__PURE__ */ t(te, {
|
|
609
|
+
close: s.close,
|
|
610
|
+
action: () => {
|
|
611
|
+
var S;
|
|
612
|
+
v(!0), (((S = r.current) == null ? void 0 : S.getBoundingClientRect().y) || 0) < 0 && U(r, N.size, {
|
|
613
|
+
behavior: "smooth"
|
|
614
|
+
});
|
|
615
|
+
},
|
|
616
|
+
onboarding: d
|
|
617
|
+
})
|
|
618
|
+
})
|
|
619
|
+
})]
|
|
620
|
+
});
|
|
621
|
+
}, Ws = () => F, js = /* @__PURE__ */ h(Ws())({
|
|
622
|
+
name: "Container",
|
|
623
|
+
class: "c1cu0box",
|
|
624
|
+
propsAsIs: !0
|
|
625
|
+
}), pe = /* @__PURE__ */ h("div")({
|
|
626
|
+
name: "InnerContainer",
|
|
627
|
+
class: "i1p534h4",
|
|
628
|
+
propsAsIs: !1
|
|
629
|
+
}), Gs = () => pe, Hs = /* @__PURE__ */ h(Gs())({
|
|
630
|
+
name: "HiddenContainer",
|
|
631
|
+
class: "hyh76ez",
|
|
632
|
+
propsAsIs: !0
|
|
633
|
+
}), Xs = /* @__PURE__ */ h("div")({
|
|
634
|
+
name: "NotificationRefreshing",
|
|
635
|
+
class: "n1pj3cvw",
|
|
636
|
+
propsAsIs: !1
|
|
637
|
+
}), Ys = () => _e, Zs = /* @__PURE__ */ h(Ys())({
|
|
638
|
+
name: "Pill",
|
|
639
|
+
class: "pk13by5",
|
|
640
|
+
propsAsIs: !0
|
|
641
|
+
}), Js = (e) => {
|
|
642
|
+
const [s, n] = $(0), o = L(null), r = G((i) => {
|
|
643
|
+
o.current = i;
|
|
644
|
+
}, []);
|
|
645
|
+
k(() => {
|
|
646
|
+
var i;
|
|
647
|
+
const l = (i = o.current) == null ? void 0 : i.getBoundingClientRect();
|
|
648
|
+
l && n(l.height);
|
|
649
|
+
}, [e]);
|
|
650
|
+
const a = G((i) => {
|
|
651
|
+
n(i);
|
|
652
|
+
}, []);
|
|
653
|
+
return [r, s, a];
|
|
654
|
+
}, en = ({
|
|
655
|
+
sdk: e,
|
|
656
|
+
notification: s,
|
|
657
|
+
appNode: n,
|
|
658
|
+
responsiveStore: o
|
|
659
|
+
}) => {
|
|
660
|
+
var r, a;
|
|
661
|
+
const {
|
|
662
|
+
sdkInDesktopView: i
|
|
663
|
+
} = u(o, {
|
|
664
|
+
keys: ["sdkInDesktopView"]
|
|
665
|
+
}), {
|
|
666
|
+
sdk: l
|
|
667
|
+
} = M(), [c, d, p] = Js(s.id);
|
|
668
|
+
return s.type === O.QUESTION ? /* @__PURE__ */ y(D, {
|
|
669
|
+
children: [/* @__PURE__ */ t(Hs, {
|
|
670
|
+
ref: c,
|
|
671
|
+
children: /* @__PURE__ */ t(B, {
|
|
672
|
+
...s
|
|
673
|
+
})
|
|
674
|
+
}), /* @__PURE__ */ y(js, {
|
|
675
|
+
style: {
|
|
676
|
+
height: s.hiding ? 0 : d
|
|
677
|
+
},
|
|
678
|
+
hiding: s.hiding,
|
|
679
|
+
children: [/* @__PURE__ */ t(pe, {
|
|
680
|
+
style: {
|
|
681
|
+
height: "100%"
|
|
682
|
+
},
|
|
683
|
+
children: /* @__PURE__ */ t(B, {
|
|
684
|
+
...s,
|
|
685
|
+
controlVideo: l == null ? void 0 : l.controlVideoPlayer
|
|
686
|
+
})
|
|
687
|
+
}), /* @__PURE__ */ t(Xs, {}, s.id)]
|
|
688
|
+
})]
|
|
689
|
+
}) : s.type === O.QUESTION_RESOLVED && (a = (r = s.data) == null ? void 0 : r.question) != null && a.predictionResult ? /* @__PURE__ */ t(Fe, {
|
|
690
|
+
style: {
|
|
691
|
+
height: s.hiding ? 0 : d
|
|
692
|
+
},
|
|
693
|
+
saveHeight: p,
|
|
694
|
+
close: s.close,
|
|
695
|
+
hiding: s.hiding,
|
|
696
|
+
...s.data.question
|
|
697
|
+
}) : s.type === O.ONBOARDING ? /* @__PURE__ */ t(Bs, {
|
|
698
|
+
style: {
|
|
699
|
+
height: s.hiding ? 0 : d
|
|
700
|
+
},
|
|
701
|
+
saveHeight: p,
|
|
702
|
+
sdk: e,
|
|
703
|
+
notification: s,
|
|
704
|
+
sdkInDesktopView: i,
|
|
705
|
+
appNode: n,
|
|
706
|
+
responsiveStore: o
|
|
707
|
+
}) : null;
|
|
708
|
+
}, sn = "p6vl6vu", nn = ({
|
|
709
|
+
pill: e,
|
|
710
|
+
setPill: s,
|
|
711
|
+
appNode: n,
|
|
712
|
+
headerNode: o,
|
|
713
|
+
scrollNode: r,
|
|
714
|
+
responsiveStore: a,
|
|
715
|
+
scrollStore: i
|
|
716
|
+
}) => {
|
|
717
|
+
var l, c;
|
|
718
|
+
const {
|
|
719
|
+
screen: d
|
|
720
|
+
} = u(a, {
|
|
721
|
+
keys: ["screen"]
|
|
722
|
+
}), {
|
|
723
|
+
tabsShown: p,
|
|
724
|
+
scrollPosition: v
|
|
725
|
+
} = u(i, {
|
|
726
|
+
keys: ["tabsShown", "scrollPosition"]
|
|
727
|
+
});
|
|
728
|
+
k(() => {
|
|
729
|
+
a.get().sdkInDesktopView ? v < 50 && s(null) : v > -50 && s(null);
|
|
730
|
+
}, [v, a, s]);
|
|
731
|
+
const m = a.get().sdkInDesktopView ? n : o;
|
|
732
|
+
return !e || !m.current ? null : Ke.createPortal(/* @__PURE__ */ t(Zs, {
|
|
733
|
+
title: e.type === O.QUESTION_RESOLVED ? "Prediction result" : `New ${((c = Me[(l = e.data) == null ? void 0 : l.questionType]) == null ? void 0 : c.label) || "notification"}`,
|
|
734
|
+
onClick: () => {
|
|
735
|
+
var f;
|
|
736
|
+
a.get().sdkInDesktopView ? (f = r.current) == null || f.scrollTo({
|
|
737
|
+
top: 0,
|
|
738
|
+
behavior: "smooth"
|
|
739
|
+
}) : U(n, d.size, {
|
|
740
|
+
behavior: "smooth"
|
|
741
|
+
}), s(null);
|
|
742
|
+
},
|
|
743
|
+
className: ze(p && sn, "sl-pill-button")
|
|
744
|
+
}), m.current);
|
|
745
|
+
}, tn = ({
|
|
746
|
+
sdk: e,
|
|
747
|
+
headerNode: s,
|
|
748
|
+
scrollNode: n,
|
|
749
|
+
responsiveStore: o,
|
|
750
|
+
appNode: r,
|
|
751
|
+
scrollStore: a
|
|
752
|
+
}) => {
|
|
753
|
+
const [i] = $(e.getNotificationsStore()), l = u(i), [c, d] = $(null), p = w(() => e.getActiveNotification(), [e, l]);
|
|
754
|
+
return k(() => {
|
|
755
|
+
p && Ue.emit("notification", {
|
|
756
|
+
action: "rendered",
|
|
757
|
+
payload: {
|
|
758
|
+
questionId: p.data.questionId,
|
|
759
|
+
questionType: p.data.questionType
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
}, [p]), k(() => {
|
|
763
|
+
p && (o.get().sdkInDesktopView || o.get().sdkInView) && (!o.get().sdkInDesktopView && o.get().sdkInView && d(p), o.get().sdkInDesktopView && window.requestAnimationFrame(() => {
|
|
764
|
+
a.get().scrollPosition !== 0 && d(p);
|
|
765
|
+
}));
|
|
766
|
+
}, [p]), k(() => {
|
|
767
|
+
p || d(null);
|
|
768
|
+
}, [p]), /* @__PURE__ */ y(D, {
|
|
769
|
+
children: [!c && p && /* @__PURE__ */ t(en, {
|
|
770
|
+
headerNode: s,
|
|
771
|
+
appNode: r,
|
|
772
|
+
sdk: e,
|
|
773
|
+
notification: p,
|
|
774
|
+
responsiveStore: o
|
|
775
|
+
}), c && /* @__PURE__ */ t(nn, {
|
|
776
|
+
pill: c,
|
|
777
|
+
setPill: d,
|
|
778
|
+
appNode: r,
|
|
779
|
+
notification: p,
|
|
780
|
+
headerNode: s,
|
|
781
|
+
scrollNode: n,
|
|
782
|
+
scrollStore: a,
|
|
783
|
+
responsiveStore: o
|
|
784
|
+
})]
|
|
785
|
+
});
|
|
786
|
+
}, on = (e) => {
|
|
787
|
+
const s = L(""), [n, o] = $(!1), r = u(e.status), a = u(e.sdkStore.slStreamId), i = u(e.userId()), l = u(e.getActiveFeature()), c = r === "ready" && !!a.data;
|
|
788
|
+
k(() => {
|
|
789
|
+
const v = e.getFeature(x.GAMES);
|
|
790
|
+
v && (v.closeQuestion(), v.closeUser());
|
|
791
|
+
}, [l, e]);
|
|
792
|
+
const d = (v) => {
|
|
793
|
+
s.current = v, o(!0), e.initializeApp({ skipOrganizationSettings: !0 }).then(({ enabled: m, err: f }) => {
|
|
794
|
+
if (!f && m) {
|
|
795
|
+
e.isUserAuthorized().then((N) => {
|
|
796
|
+
N || e.disableApp();
|
|
797
|
+
});
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
});
|
|
801
|
+
}, p = () => {
|
|
802
|
+
o(!1), e.disableApp();
|
|
803
|
+
};
|
|
804
|
+
return k(() => {
|
|
805
|
+
if (!i) {
|
|
806
|
+
c && e.disableApp();
|
|
807
|
+
return;
|
|
808
|
+
}
|
|
809
|
+
if (i && s.current && n) {
|
|
810
|
+
e.initializeApp({ skipOrganizationSettings: !0 }).then(() => {
|
|
811
|
+
e.createEventSession(s.current);
|
|
812
|
+
});
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
}, [i]), k(() => () => {
|
|
816
|
+
o(!1), e.disableApp();
|
|
817
|
+
}, [o, e]), {
|
|
818
|
+
sdkEnabled: n,
|
|
819
|
+
sdkReady: c,
|
|
820
|
+
activateEventWithId: d,
|
|
821
|
+
deactivate: p,
|
|
822
|
+
isLogged: !!i
|
|
823
|
+
};
|
|
824
|
+
}, rn = ({ sdk: e, className: s, scrollStore: n, appNode: o, scrollNode: r, responsiveStore: a }) => {
|
|
825
|
+
const [, i] = He(e);
|
|
826
|
+
return /* @__PURE__ */ t(
|
|
827
|
+
Es,
|
|
828
|
+
{
|
|
829
|
+
className: s,
|
|
830
|
+
scrollNode: r,
|
|
831
|
+
appNode: o,
|
|
832
|
+
scrollStore: n,
|
|
833
|
+
feature: i,
|
|
834
|
+
responsiveStore: a,
|
|
835
|
+
sdk: e
|
|
836
|
+
}
|
|
837
|
+
);
|
|
838
|
+
}, an = ({ sdk: e, className: s, appNode: n, responsiveStore: o }) => {
|
|
839
|
+
const r = u(e.featuresList.getStore());
|
|
840
|
+
return r ? Array.from(r, (a) => {
|
|
841
|
+
const i = e.getFeature(a);
|
|
842
|
+
return i ? /* @__PURE__ */ t(
|
|
843
|
+
ws,
|
|
844
|
+
{
|
|
845
|
+
className: s,
|
|
846
|
+
appNode: n,
|
|
847
|
+
feature: i,
|
|
848
|
+
responsiveStore: o,
|
|
849
|
+
sdk: e
|
|
850
|
+
},
|
|
851
|
+
a
|
|
852
|
+
) : null;
|
|
853
|
+
}) : null;
|
|
854
|
+
}, ln = ({ sdk: e, event: s }) => {
|
|
855
|
+
const n = L(null), o = L(null), [r] = Be(n), [a, i] = We(n, r), { sdkEnabled: l, sdkReady: c, activateEventWithId: d, deactivate: p, isLogged: v } = on(e);
|
|
856
|
+
k(() => {
|
|
857
|
+
s ? (e.createEventSession(s), d(s)) : p();
|
|
858
|
+
}, [s, d, p, e]), P(n, { enabled: l, event: "click", listener: Xe }), P(a, {
|
|
859
|
+
enabled: l,
|
|
860
|
+
event: "scrollend",
|
|
861
|
+
listener: Ye,
|
|
862
|
+
useDomNode: !0
|
|
863
|
+
}), P(a, {
|
|
864
|
+
enabled: l,
|
|
865
|
+
event: "click",
|
|
866
|
+
listener: Ze,
|
|
867
|
+
useDomNode: !0
|
|
868
|
+
});
|
|
869
|
+
const m = w(() => ({ sdk: e }), [e]);
|
|
870
|
+
return k(() => {
|
|
871
|
+
import("./gamification-feature.js");
|
|
872
|
+
}, []), /* @__PURE__ */ t(ce.Provider, { value: m, children: /* @__PURE__ */ y(je, { ref: n, children: [
|
|
873
|
+
l && /* @__PURE__ */ t(Ds, { sdk: e }),
|
|
874
|
+
/* @__PURE__ */ y(Ge, { className: "sl-hide-on-modal", ref: a, "data-nav": l.toString(), children: [
|
|
875
|
+
c && /* @__PURE__ */ t(
|
|
876
|
+
tn,
|
|
877
|
+
{
|
|
878
|
+
sdk: e,
|
|
879
|
+
scrollNode: a,
|
|
880
|
+
headerNode: o,
|
|
881
|
+
appNode: n,
|
|
882
|
+
scrollStore: i,
|
|
883
|
+
responsiveStore: r
|
|
884
|
+
}
|
|
885
|
+
),
|
|
886
|
+
c && /* @__PURE__ */ t(
|
|
887
|
+
rn,
|
|
888
|
+
{
|
|
889
|
+
scrollStore: i,
|
|
890
|
+
responsiveStore: r,
|
|
891
|
+
scrollNode: a,
|
|
892
|
+
appNode: n,
|
|
893
|
+
className: W,
|
|
894
|
+
sdk: e
|
|
895
|
+
}
|
|
896
|
+
),
|
|
897
|
+
c && /* @__PURE__ */ t(an, { responsiveStore: r, appNode: n, className: W, sdk: e })
|
|
898
|
+
] }),
|
|
899
|
+
l && !v && /* @__PURE__ */ t(
|
|
900
|
+
"div",
|
|
901
|
+
{
|
|
902
|
+
style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "100%" },
|
|
903
|
+
children: "You are not logged in."
|
|
904
|
+
}
|
|
905
|
+
)
|
|
906
|
+
] }) });
|
|
907
|
+
}, dn = ({ children: e, style: s }) => /* @__PURE__ */ t("div", { className: "StreamLayerSDKTheme", children: /* @__PURE__ */ t("div", { className: Je, style: s, children: e }) }), mn = () => {
|
|
908
|
+
const { sdk: e } = K(de);
|
|
6
909
|
return e;
|
|
7
|
-
},
|
|
8
|
-
const { sdk:
|
|
9
|
-
if (
|
|
910
|
+
}, yn = ({ event: e }) => {
|
|
911
|
+
const { sdk: s, status: n } = K(de);
|
|
912
|
+
if (n === j.UNSET)
|
|
10
913
|
throw new Error("Wrap app in `StreamLayerProvider`");
|
|
11
|
-
return
|
|
914
|
+
return n === j.CONNECTED ? /* @__PURE__ */ t("div", { className: "StreamLayerSDK", children: "wait" }) : s === null ? /* @__PURE__ */ t("div", { className: "StreamLayerSDK", children: "sdk not initialized" }) : /* @__PURE__ */ t("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ t(dn, { children: /* @__PURE__ */ t(ln, { sdk: s, event: e }) }) });
|
|
12
915
|
};
|
|
13
916
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
917
|
+
yn as S,
|
|
918
|
+
dn as i,
|
|
919
|
+
gn as q,
|
|
920
|
+
mn as u
|
|
16
921
|
};
|