@streamlayer/react 1.9.8 → 1.10.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 -2
- package/lib/app/notification.d.ts +5 -0
- package/lib/app/provider.d.ts +1 -1
- package/lib/cjs/advertisement.js +1 -1
- package/lib/cjs/auth.js +1 -1
- package/lib/cjs/gamification-feature.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/insight.js +1 -1
- package/lib/cjs/masters.js +1 -1
- package/lib/cjs/masters2.js +3 -3
- package/lib/cjs/notification.js +1 -0
- package/lib/cjs/points.js +1 -1
- package/lib/cjs/{index2.js → provider.js} +40 -40
- package/lib/cjs/useStreamLayerApp2.js +12 -12
- package/lib/dist/cjs/gamification-feature2.js +1 -1
- package/lib/dist/cjs/masters.js +57 -57
- package/lib/dist/es/gamification-feature2.js +17 -17
- package/lib/dist/es/masters.js +8069 -8023
- package/lib/dist/style.css +1 -1
- package/lib/es/advertisement.js +32 -32
- package/lib/es/auth.js +1 -1
- package/lib/es/gamification-feature.js +1 -1
- package/lib/es/index.js +10 -6
- package/lib/es/insight.js +15 -15
- package/lib/es/masters.js +1 -1
- package/lib/es/masters2.js +16 -16
- package/lib/es/notification.js +468 -0
- package/lib/es/points.js +13 -13
- package/lib/es/{index2.js → provider.js} +3868 -3828
- package/lib/es/useStreamLayerApp2.js +1106 -1078
- package/lib/index.d.ts +2 -1
- package/lib/style.css +1 -1
- package/package.json +18 -13
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
import { f as m, s as e, a3 as L, a4 as z, a5 as B, U as O, a6 as R, g as P, d as Q, a as U, i as V, J as T, u as F, b as W, j as G, h as K } from "./provider.js";
|
|
2
|
+
import { i as p, Q as I, j as Y, S as _ } from "./useStreamLayerApp2.js";
|
|
3
|
+
import { jsxs as c, jsx as s } from "react/jsx-runtime";
|
|
4
|
+
import { useState as q, useEffect as E, useMemo as J } from "react";
|
|
5
|
+
const h = /* @__PURE__ */ e("div")({
|
|
6
|
+
name: "Media",
|
|
7
|
+
class: "m1bcvojl",
|
|
8
|
+
propsAsIs: !1
|
|
9
|
+
}), H = () => h, X = /* @__PURE__ */ e(H())({
|
|
10
|
+
name: "MediaImgBottom",
|
|
11
|
+
class: "m58gin0",
|
|
12
|
+
propsAsIs: !0
|
|
13
|
+
}), Z = () => h, C = /* @__PURE__ */ e(Z())({
|
|
14
|
+
name: "MediaImgSolid",
|
|
15
|
+
class: "m1atm8do",
|
|
16
|
+
propsAsIs: !0
|
|
17
|
+
}), ss = () => h, es = /* @__PURE__ */ e(ss())({
|
|
18
|
+
name: "MediaImgRounded",
|
|
19
|
+
class: "myx3xoi",
|
|
20
|
+
propsAsIs: !0
|
|
21
|
+
}), ns = () => h, ts = /* @__PURE__ */ e(ns())({
|
|
22
|
+
name: "MediaImgCentered",
|
|
23
|
+
class: "m1bwv0gx",
|
|
24
|
+
propsAsIs: !0
|
|
25
|
+
}), os = () => h, is = /* @__PURE__ */ e(os())({
|
|
26
|
+
name: "MediaImgInsight",
|
|
27
|
+
class: "mntjanp",
|
|
28
|
+
propsAsIs: !0
|
|
29
|
+
}), as = /* @__PURE__ */ e("div")({
|
|
30
|
+
name: "VideoIcon",
|
|
31
|
+
class: "v1kofb47",
|
|
32
|
+
propsAsIs: !1
|
|
33
|
+
}), cs = {
|
|
34
|
+
[p.UNSET]: C,
|
|
35
|
+
[p.NONE]: C,
|
|
36
|
+
[p.ROUNDED]: es,
|
|
37
|
+
[p.CENTERED]: ts,
|
|
38
|
+
[p.TRANSPARENT]: X
|
|
39
|
+
}, N = ({
|
|
40
|
+
src: t,
|
|
41
|
+
imageMode: o = p.UNSET,
|
|
42
|
+
withVideo: i,
|
|
43
|
+
fromInsight: a
|
|
44
|
+
}) => {
|
|
45
|
+
if (o === p.NONE)
|
|
46
|
+
return null;
|
|
47
|
+
const n = a ? is : cs[o];
|
|
48
|
+
return /* @__PURE__ */ c(n, {
|
|
49
|
+
children: [/* @__PURE__ */ s("img", {
|
|
50
|
+
src: t,
|
|
51
|
+
alt: ""
|
|
52
|
+
}), i && /* @__PURE__ */ s(as, {
|
|
53
|
+
children: /* @__PURE__ */ s(m, {
|
|
54
|
+
name: "icon-play"
|
|
55
|
+
})
|
|
56
|
+
})]
|
|
57
|
+
});
|
|
58
|
+
}, rs = /* @__PURE__ */ e("div")({
|
|
59
|
+
name: "NotificationContent",
|
|
60
|
+
class: "nuraq9m",
|
|
61
|
+
propsAsIs: !1
|
|
62
|
+
}), ls = /* @__PURE__ */ e("div")({
|
|
63
|
+
name: "NotificationContainer",
|
|
64
|
+
class: "ns1nzpg",
|
|
65
|
+
propsAsIs: !1
|
|
66
|
+
}), j = /* @__PURE__ */ e("div")({
|
|
67
|
+
name: "Body",
|
|
68
|
+
class: "b1j59nzs",
|
|
69
|
+
propsAsIs: !1
|
|
70
|
+
}), ds = /* @__PURE__ */ e("div")({
|
|
71
|
+
name: "Title",
|
|
72
|
+
class: "t9vmnpp",
|
|
73
|
+
propsAsIs: !1
|
|
74
|
+
}), ps = /* @__PURE__ */ e("button")({
|
|
75
|
+
name: "Button",
|
|
76
|
+
class: "b14ivj5k",
|
|
77
|
+
propsAsIs: !1
|
|
78
|
+
}), ms = () => m, us = /* @__PURE__ */ e(ms())({
|
|
79
|
+
name: "StyledChevronRight",
|
|
80
|
+
class: "s1atci8n",
|
|
81
|
+
propsAsIs: !0
|
|
82
|
+
}), Is = /* @__PURE__ */ e("div")({
|
|
83
|
+
name: "QuoteWrap",
|
|
84
|
+
class: "q4w8jgs",
|
|
85
|
+
propsAsIs: !1
|
|
86
|
+
}), hs = /* @__PURE__ */ e("blockquote")({
|
|
87
|
+
name: "Quote",
|
|
88
|
+
class: "qaa0kez",
|
|
89
|
+
propsAsIs: !1
|
|
90
|
+
}), vs = /* @__PURE__ */ e("div")({
|
|
91
|
+
name: "Body",
|
|
92
|
+
class: "b1wvd52w",
|
|
93
|
+
propsAsIs: !1
|
|
94
|
+
}), As = /* @__PURE__ */ e("div")({
|
|
95
|
+
name: "Container",
|
|
96
|
+
class: "ccvukea",
|
|
97
|
+
propsAsIs: !1
|
|
98
|
+
}), $s = ({ image: t, tweet: o, account: i, accountVerified: a, body: n, title: l }) => {
|
|
99
|
+
var d;
|
|
100
|
+
return /* @__PURE__ */ c(As, { children: [
|
|
101
|
+
l && /* @__PURE__ */ s(Is, { children: /* @__PURE__ */ s(hs, { children: l }) }),
|
|
102
|
+
/* @__PURE__ */ s(
|
|
103
|
+
L,
|
|
104
|
+
{
|
|
105
|
+
image: t,
|
|
106
|
+
name: (d = o == null ? void 0 : o.meta) == null ? void 0 : d.accountName,
|
|
107
|
+
userName: i,
|
|
108
|
+
verified: a,
|
|
109
|
+
createdTweet: o == null ? void 0 : o.date
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ s(vs, { children: z(n) })
|
|
113
|
+
] });
|
|
114
|
+
}, ys = ({ title: t, questionType: o, questionTypeData: i }) => /* @__PURE__ */ c(j, { children: [
|
|
115
|
+
/* @__PURE__ */ s(
|
|
116
|
+
B,
|
|
117
|
+
{
|
|
118
|
+
questionTypeData: i,
|
|
119
|
+
questionType: o,
|
|
120
|
+
questionStatus: Y.UNSET
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
t && /* @__PURE__ */ s(ds, { children: t })
|
|
124
|
+
] }), fs = ({ tweet: t }) => t ? /* @__PURE__ */ s(j, { children: /* @__PURE__ */ s($s, { ...t, controlVideo: () => {
|
|
125
|
+
} }) }) : null, gs = ({ action: t, questionType: o, inApp: i, insight: a, tweet: n }) => {
|
|
126
|
+
var l;
|
|
127
|
+
const d = O[o], r = R[o];
|
|
128
|
+
if (!d || !i || !i.notification)
|
|
129
|
+
return null;
|
|
130
|
+
const { title: v, image: A, imageMode: f } = i.notification;
|
|
131
|
+
let u = A;
|
|
132
|
+
o === I.TWEET && n != null && n.tweetMedia && (u = n.tweetMedia.image), f === p.NONE && (u = "");
|
|
133
|
+
const $ = i.useMediaFromContent && (a == null ? void 0 : a.image), g = o === I.TWEET && ((l = n == null ? void 0 : n.tweetMedia) == null ? void 0 : l.video) || o === I.FACTOID && (a == null ? void 0 : a.video);
|
|
134
|
+
return /* @__PURE__ */ s(ls, { className: "SL_InApp", onClick: t, children: /* @__PURE__ */ c(rs, { style: u ? {} : { paddingLeft: "1.5rem" }, children: [
|
|
135
|
+
u && !$ && /* @__PURE__ */ s(N, { src: u, imageMode: f, withVideo: !!g }),
|
|
136
|
+
$ && /* @__PURE__ */ s(N, { src: $, fromInsight: !0, withVideo: !!g }),
|
|
137
|
+
o === I.TWEET ? /* @__PURE__ */ s(fs, { tweet: n }) : /* @__PURE__ */ s(ys, { questionTypeData: d, questionType: o, title: v }),
|
|
138
|
+
/* @__PURE__ */ s(ps, { name: "inapp-button", children: r || "Open" }),
|
|
139
|
+
/* @__PURE__ */ s(us, { name: "chevronRight" })
|
|
140
|
+
] }) });
|
|
141
|
+
}, Ts = /* @__PURE__ */ e("div")({
|
|
142
|
+
name: "NotificationContainer",
|
|
143
|
+
class: "n11jcrxe",
|
|
144
|
+
propsAsIs: !1
|
|
145
|
+
}), k = /* @__PURE__ */ e("img")({
|
|
146
|
+
name: "Icon",
|
|
147
|
+
class: "i1vmpt6u",
|
|
148
|
+
propsAsIs: !1
|
|
149
|
+
}), Cs = /* @__PURE__ */ e("div")({
|
|
150
|
+
name: "IconContainer",
|
|
151
|
+
class: "i180665s",
|
|
152
|
+
propsAsIs: !1
|
|
153
|
+
}), Ns = () => m, ks = /* @__PURE__ */ e(Ns())({
|
|
154
|
+
name: "TitleIcon",
|
|
155
|
+
class: "t16zzzei",
|
|
156
|
+
propsAsIs: !0
|
|
157
|
+
}), bs = () => P, ws = /* @__PURE__ */ e(bs())({
|
|
158
|
+
name: "Close",
|
|
159
|
+
class: "c1sur0q2",
|
|
160
|
+
propsAsIs: !0
|
|
161
|
+
}), Ss = /* @__PURE__ */ e("div")({
|
|
162
|
+
name: "Body",
|
|
163
|
+
class: "bai9j52",
|
|
164
|
+
propsAsIs: !1
|
|
165
|
+
}), qs = /* @__PURE__ */ e("div")({
|
|
166
|
+
name: "Title",
|
|
167
|
+
class: "t1bnt25p",
|
|
168
|
+
propsAsIs: !1
|
|
169
|
+
}), Es = /* @__PURE__ */ e("div")({
|
|
170
|
+
name: "Description",
|
|
171
|
+
class: "dmixjec",
|
|
172
|
+
propsAsIs: !1
|
|
173
|
+
}), js = /* @__PURE__ */ e("button")({
|
|
174
|
+
name: "Button",
|
|
175
|
+
class: "b1ubkw1q",
|
|
176
|
+
propsAsIs: !1
|
|
177
|
+
}), Ms = ({
|
|
178
|
+
open: t,
|
|
179
|
+
close: o,
|
|
180
|
+
...i
|
|
181
|
+
}) => {
|
|
182
|
+
var a, n;
|
|
183
|
+
return /* @__PURE__ */ c(
|
|
184
|
+
Ts,
|
|
185
|
+
{
|
|
186
|
+
onClick: () => {
|
|
187
|
+
t == null || t(), i && (i.instantOpen = !0);
|
|
188
|
+
},
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ c(Cs, { children: [
|
|
191
|
+
/* @__PURE__ */ s(k, { className: "on-light", src: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/notification.png" }),
|
|
192
|
+
/* @__PURE__ */ s(
|
|
193
|
+
k,
|
|
194
|
+
{
|
|
195
|
+
className: "on-dark",
|
|
196
|
+
src: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/notification-dark.png"
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
] }),
|
|
200
|
+
/* @__PURE__ */ c(Ss, { children: [
|
|
201
|
+
/* @__PURE__ */ c(qs, { children: [
|
|
202
|
+
/* @__PURE__ */ s(ks, { name: "icon-trophy-solid" }),
|
|
203
|
+
(a = i == null ? void 0 : i.titleCard) == null ? void 0 : a.title
|
|
204
|
+
] }),
|
|
205
|
+
/* @__PURE__ */ c(Es, { children: [
|
|
206
|
+
/* @__PURE__ */ s("span", { children: (n = i == null ? void 0 : i.titleCard) == null ? void 0 : n.subtitle }),
|
|
207
|
+
/* @__PURE__ */ s(js, { name: "inapp-button", children: "Play Now" })
|
|
208
|
+
] })
|
|
209
|
+
] }),
|
|
210
|
+
/* @__PURE__ */ s(
|
|
211
|
+
ws,
|
|
212
|
+
{
|
|
213
|
+
close: (l) => {
|
|
214
|
+
l == null || l.stopPropagation(), o == null || o();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
}, xs = /* @__PURE__ */ e("div")({
|
|
222
|
+
name: "Container",
|
|
223
|
+
class: "cef8huz",
|
|
224
|
+
propsAsIs: !1
|
|
225
|
+
}), Ds = () => m, Ls = /* @__PURE__ */ e(Ds())({
|
|
226
|
+
name: "CheckIcon",
|
|
227
|
+
class: "c1mo15kk",
|
|
228
|
+
propsAsIs: !0
|
|
229
|
+
}), zs = () => m, Bs = /* @__PURE__ */ e(zs())({
|
|
230
|
+
name: "PredictionIcon",
|
|
231
|
+
class: "p16zkqnm",
|
|
232
|
+
propsAsIs: !0
|
|
233
|
+
}), Os = /* @__PURE__ */ e("div")({
|
|
234
|
+
name: "PredictionIconContainer",
|
|
235
|
+
class: "pjszi7a",
|
|
236
|
+
propsAsIs: !1
|
|
237
|
+
}), Rs = /* @__PURE__ */ e("div")({
|
|
238
|
+
name: "BodyContainer",
|
|
239
|
+
class: "bftbmo3",
|
|
240
|
+
propsAsIs: !1
|
|
241
|
+
}), Ps = /* @__PURE__ */ e("div")({
|
|
242
|
+
name: "Body",
|
|
243
|
+
class: "barrbyu",
|
|
244
|
+
propsAsIs: !1
|
|
245
|
+
}), Qs = /* @__PURE__ */ e("div")({
|
|
246
|
+
name: "Subtitle",
|
|
247
|
+
class: "sz7237i",
|
|
248
|
+
propsAsIs: !1
|
|
249
|
+
}), Us = ({
|
|
250
|
+
step: t,
|
|
251
|
+
children: o,
|
|
252
|
+
answer: i,
|
|
253
|
+
state: a = "pending"
|
|
254
|
+
}) => /* @__PURE__ */ c(xs, {
|
|
255
|
+
children: [/* @__PURE__ */ s(Os, {
|
|
256
|
+
children: /* @__PURE__ */ s(Bs, {
|
|
257
|
+
name: "icon-prediction"
|
|
258
|
+
})
|
|
259
|
+
}), /* @__PURE__ */ s(Rs, {
|
|
260
|
+
children: /* @__PURE__ */ s(Ps, {
|
|
261
|
+
children: o
|
|
262
|
+
}, t)
|
|
263
|
+
}), /* @__PURE__ */ s(Qs, {
|
|
264
|
+
className: a,
|
|
265
|
+
children: /* @__PURE__ */ c("div", {
|
|
266
|
+
children: [/* @__PURE__ */ s(Ls, {
|
|
267
|
+
name: "icon-check"
|
|
268
|
+
}), "Your Pick: ", i]
|
|
269
|
+
})
|
|
270
|
+
})]
|
|
271
|
+
}), Vs = /* @__PURE__ */ e("div")({
|
|
272
|
+
name: "Container",
|
|
273
|
+
class: "ckyzolp",
|
|
274
|
+
propsAsIs: !1
|
|
275
|
+
}), y = /* @__PURE__ */ e("div")({
|
|
276
|
+
name: "Line",
|
|
277
|
+
class: "l16t1zr7",
|
|
278
|
+
propsAsIs: !1
|
|
279
|
+
}), Fs = () => y, Ws = /* @__PURE__ */ e(Fs())({
|
|
280
|
+
name: "Line1",
|
|
281
|
+
class: "le78kvg",
|
|
282
|
+
propsAsIs: !0
|
|
283
|
+
}), Gs = () => y, Ks = /* @__PURE__ */ e(Gs())({
|
|
284
|
+
name: "Line2",
|
|
285
|
+
class: "l1o7966d",
|
|
286
|
+
propsAsIs: !0
|
|
287
|
+
}), Ys = () => y, _s = /* @__PURE__ */ e(Ys())({
|
|
288
|
+
name: "Line3",
|
|
289
|
+
class: "lu9lyxq",
|
|
290
|
+
propsAsIs: !0
|
|
291
|
+
}), Js = () => /* @__PURE__ */ c(Vs, {
|
|
292
|
+
children: [/* @__PURE__ */ s(Ws, {
|
|
293
|
+
children: /* @__PURE__ */ s("div", {})
|
|
294
|
+
}), /* @__PURE__ */ s(Ks, {
|
|
295
|
+
children: /* @__PURE__ */ s("div", {})
|
|
296
|
+
}), /* @__PURE__ */ s(_s, {
|
|
297
|
+
children: /* @__PURE__ */ s("div", {})
|
|
298
|
+
})]
|
|
299
|
+
}), Hs = /* @__PURE__ */ e("div")({
|
|
300
|
+
name: "Container",
|
|
301
|
+
class: "c10jy6zf",
|
|
302
|
+
propsAsIs: !1
|
|
303
|
+
}), Xs = () => m, Zs = /* @__PURE__ */ e(Xs())({
|
|
304
|
+
name: "CheckIcon",
|
|
305
|
+
class: "c1c7scay",
|
|
306
|
+
propsAsIs: !0
|
|
307
|
+
}), se = () => /* @__PURE__ */ c(Hs, {
|
|
308
|
+
children: [/* @__PURE__ */ s(Zs, {
|
|
309
|
+
name: "icon-check"
|
|
310
|
+
}), " Prediction results are in!"]
|
|
311
|
+
}), ee = /* @__PURE__ */ e("div")({
|
|
312
|
+
name: "Container",
|
|
313
|
+
class: "cf6k2yy",
|
|
314
|
+
propsAsIs: !1
|
|
315
|
+
}), ne = /* @__PURE__ */ e("div")({
|
|
316
|
+
name: "Caption",
|
|
317
|
+
class: "c1c8xjus",
|
|
318
|
+
propsAsIs: !1
|
|
319
|
+
}), te = /* @__PURE__ */ e("div")({
|
|
320
|
+
name: "Title",
|
|
321
|
+
class: "t1d1uekn",
|
|
322
|
+
propsAsIs: !1
|
|
323
|
+
}), oe = ({
|
|
324
|
+
title: t
|
|
325
|
+
}) => /* @__PURE__ */ c(ee, {
|
|
326
|
+
children: [/* @__PURE__ */ s(ne, {
|
|
327
|
+
children: "Results for"
|
|
328
|
+
}), /* @__PURE__ */ s(te, {
|
|
329
|
+
children: t
|
|
330
|
+
})]
|
|
331
|
+
}), M = /* @__PURE__ */ e("div")({
|
|
332
|
+
name: "Container",
|
|
333
|
+
class: "c181a1as",
|
|
334
|
+
propsAsIs: !1
|
|
335
|
+
}), x = /* @__PURE__ */ e("div")({
|
|
336
|
+
name: "Title",
|
|
337
|
+
class: "t1cduox6",
|
|
338
|
+
propsAsIs: !1
|
|
339
|
+
}), ie = () => m, D = /* @__PURE__ */ e(ie())({
|
|
340
|
+
name: "CorrectIcon",
|
|
341
|
+
class: "c1onrv6j",
|
|
342
|
+
propsAsIs: !0
|
|
343
|
+
}), ae = () => D, ce = /* @__PURE__ */ e(ae())({
|
|
344
|
+
name: "InCorrectIcon",
|
|
345
|
+
class: "i17n9o7e",
|
|
346
|
+
propsAsIs: !0
|
|
347
|
+
}), re = () => /* @__PURE__ */ c(M, {
|
|
348
|
+
children: [/* @__PURE__ */ c(x, {
|
|
349
|
+
children: ["Congratulations!", /* @__PURE__ */ s("br", {}), "You answered correctly."]
|
|
350
|
+
}), /* @__PURE__ */ s(D, {
|
|
351
|
+
name: "icon-check"
|
|
352
|
+
})]
|
|
353
|
+
}), le = ({
|
|
354
|
+
title: t
|
|
355
|
+
}) => /* @__PURE__ */ c(M, {
|
|
356
|
+
children: [/* @__PURE__ */ c(x, {
|
|
357
|
+
children: ["Better luck next time!", /* @__PURE__ */ s("br", {}), "Correct: ", t]
|
|
358
|
+
}), /* @__PURE__ */ s(ce, {
|
|
359
|
+
name: "icon-cross"
|
|
360
|
+
})]
|
|
361
|
+
}), de = /* @__PURE__ */ e("div")({
|
|
362
|
+
name: "Container",
|
|
363
|
+
class: "cnxgcs2",
|
|
364
|
+
propsAsIs: !1
|
|
365
|
+
}), pe = /* @__PURE__ */ e("div")({
|
|
366
|
+
name: "Title",
|
|
367
|
+
class: "t903f8n",
|
|
368
|
+
propsAsIs: !1
|
|
369
|
+
}), me = () => m, ue = /* @__PURE__ */ e(me())({
|
|
370
|
+
name: "CheckIcon",
|
|
371
|
+
class: "ceyu3qj",
|
|
372
|
+
propsAsIs: !0
|
|
373
|
+
}), Ie = ({
|
|
374
|
+
points: t
|
|
375
|
+
}) => /* @__PURE__ */ c(de, {
|
|
376
|
+
children: [/* @__PURE__ */ c(pe, {
|
|
377
|
+
children: ["You won ", /* @__PURE__ */ s(Q, {
|
|
378
|
+
delay: 0.5,
|
|
379
|
+
prefix: "+",
|
|
380
|
+
suffix: " points",
|
|
381
|
+
value: t
|
|
382
|
+
})]
|
|
383
|
+
}), /* @__PURE__ */ s(ue, {
|
|
384
|
+
name: "icon-trophy-solid"
|
|
385
|
+
})]
|
|
386
|
+
}), b = /* @__PURE__ */ e("div")({
|
|
387
|
+
name: "Container",
|
|
388
|
+
class: "cq3agu2",
|
|
389
|
+
propsAsIs: !1
|
|
390
|
+
}), w = /* @__PURE__ */ e("div")({
|
|
391
|
+
name: "Body",
|
|
392
|
+
class: "b16qj0do",
|
|
393
|
+
propsAsIs: !1
|
|
394
|
+
}), S = {
|
|
395
|
+
1: 3e3,
|
|
396
|
+
2: 4e3,
|
|
397
|
+
3: 4e3,
|
|
398
|
+
4: 4e3
|
|
399
|
+
}, he = ({ close: t, action: o, setStep: i, votedAnswer: a, correct: n, correctAnswerTitle: l, questionTitle: d, step: r }) => {
|
|
400
|
+
if (E(() => {
|
|
401
|
+
if (i) {
|
|
402
|
+
const A = setTimeout(() => {
|
|
403
|
+
S[r + 1] && (n || r < 3) ? i(r + 1) : t == null || t();
|
|
404
|
+
}, S[r]);
|
|
405
|
+
return () => {
|
|
406
|
+
A && clearTimeout(A);
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
return () => {
|
|
410
|
+
};
|
|
411
|
+
}, [i, r, t, n]), r === 1)
|
|
412
|
+
return /* @__PURE__ */ s(b, { children: /* @__PURE__ */ s(w, { children: /* @__PURE__ */ s(se, {}) }) });
|
|
413
|
+
let v = "pending";
|
|
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(Js, {}, r),
|
|
416
|
+
/* @__PURE__ */ c(Us, { state: v, step: r, answer: (a == null ? void 0 : a.title) || "unknown", children: [
|
|
417
|
+
r === 2 && /* @__PURE__ */ s(oe, { title: d || "unknown" }),
|
|
418
|
+
r === 3 && n && /* @__PURE__ */ s(re, {}),
|
|
419
|
+
r === 3 && !n && /* @__PURE__ */ s(le, { title: l || "unknown" }),
|
|
420
|
+
r === 4 && /* @__PURE__ */ s(Ie, { points: (a == null ? void 0 : a.points) || 0 })
|
|
421
|
+
] })
|
|
422
|
+
] }) });
|
|
423
|
+
}, ve = ({ close: t, action: o, votedAnswer: i, correct: a, correctAnswerTitle: n, questionTitle: l }) => {
|
|
424
|
+
const [d, r] = q(1);
|
|
425
|
+
return /* @__PURE__ */ s(
|
|
426
|
+
he,
|
|
427
|
+
{
|
|
428
|
+
close: t,
|
|
429
|
+
action: o,
|
|
430
|
+
votedAnswer: i,
|
|
431
|
+
correct: a,
|
|
432
|
+
correctAnswerTitle: n,
|
|
433
|
+
questionTitle: l,
|
|
434
|
+
setStep: r,
|
|
435
|
+
step: d,
|
|
436
|
+
title: ""
|
|
437
|
+
}
|
|
438
|
+
);
|
|
439
|
+
}, Ae = /* @__PURE__ */ e("div")({
|
|
440
|
+
name: "NotificationContainer",
|
|
441
|
+
class: "n1i4h28u",
|
|
442
|
+
propsAsIs: !1
|
|
443
|
+
}), $e = (t) => /* @__PURE__ */ s(Ae, { children: /* @__PURE__ */ s(ve, { ...t }) }), ye = ({ sdk: t }) => {
|
|
444
|
+
const [o] = q(t.getNotificationsStore()), i = U(o), a = t.getFeature(_.GAMES), n = J(() => t.getActiveNotification(), [t, i]);
|
|
445
|
+
return E(() => {
|
|
446
|
+
n && V.emit("notification", {
|
|
447
|
+
action: "rendered",
|
|
448
|
+
payload: {
|
|
449
|
+
questionId: n.data.questionId,
|
|
450
|
+
questionType: n.data.questionType
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
}, [n]), n && n.type === T.QUESTION_RESOLVED ? n.data.question && n.data.questionType === I.PREDICTION ? /* @__PURE__ */ s(
|
|
454
|
+
$e,
|
|
455
|
+
{
|
|
456
|
+
action: n.action,
|
|
457
|
+
close: n.close,
|
|
458
|
+
...n.data.question
|
|
459
|
+
}
|
|
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
|
+
}, Ne = ({ theme: t }) => {
|
|
462
|
+
const o = F(), i = W(), a = G();
|
|
463
|
+
return o && a.appNotification ? a.app ? null : /* @__PURE__ */ s("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ s(K, { customTheme: t ?? i.theme, themeMode: i.themeMode, children: /* @__PURE__ */ s(ye, { sdk: o }) }) }) : null;
|
|
464
|
+
};
|
|
465
|
+
export {
|
|
466
|
+
Ne as StreamLayerSDKNotification,
|
|
467
|
+
ye as StreamLayerSDKNotificationUI
|
|
468
|
+
};
|
package/lib/es/points.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { s as r,
|
|
2
|
+
import { useState as u, useEffect as p } from "react";
|
|
3
|
+
import { s as r, f as d, c as h, d as f, a as S, F as l, u as y, b as v, h as g } from "./provider.js";
|
|
4
4
|
import { S as b } from "./useStreamLayerApp2.js";
|
|
5
5
|
const k = /* @__PURE__ */ r("div")({
|
|
6
6
|
name: "PointsContainer",
|
|
@@ -26,33 +26,33 @@ const k = /* @__PURE__ */ r("div")({
|
|
|
26
26
|
name: "PointsValue",
|
|
27
27
|
class: "prj9b3v",
|
|
28
28
|
propsAsIs: !1
|
|
29
|
-
}), x = ({ points: s, onClick: e }) => /* @__PURE__ */ i(k, { className:
|
|
30
|
-
/* @__PURE__ */ t(A, { children: /* @__PURE__ */ t(P, { name: "icon-trophy" }) }),
|
|
29
|
+
}), x = ({ points: s, onClick: e }) => /* @__PURE__ */ i(k, { className: h, onClick: e, children: [
|
|
30
|
+
/* @__PURE__ */ t(A, { children: /* @__PURE__ */ t(P, { name: "icon-trophy-solid" }) }),
|
|
31
31
|
/* @__PURE__ */ i(T, { children: [
|
|
32
32
|
/* @__PURE__ */ t(F, { children: "Total points" }),
|
|
33
|
-
/* @__PURE__ */ t(L, { children: /* @__PURE__ */ t(
|
|
33
|
+
/* @__PURE__ */ t(L, { children: /* @__PURE__ */ t(f, { value: s }) })
|
|
34
34
|
] })
|
|
35
35
|
] }), C = ({ gamification: s }) => {
|
|
36
|
-
const e = s.userSummary.$store, [a,
|
|
36
|
+
const e = s.userSummary.$store, [a, m] = u(0);
|
|
37
37
|
return p(() => {
|
|
38
|
-
const
|
|
39
|
-
var
|
|
40
|
-
(
|
|
38
|
+
const c = e.subscribe((o) => {
|
|
39
|
+
var n;
|
|
40
|
+
(n = o == null ? void 0 : o.summary) != null && n.points && m(o.summary.points);
|
|
41
41
|
});
|
|
42
42
|
return () => {
|
|
43
|
-
|
|
43
|
+
c();
|
|
44
44
|
};
|
|
45
45
|
}, [e]), /* @__PURE__ */ t(x, { points: a, onClick: () => {
|
|
46
46
|
s.status.get() === l.Suspended ? s.openFeature() : s.status.get() === l.Ready && s.closeFeature(!1);
|
|
47
47
|
} });
|
|
48
48
|
}, j = ({ sdk: s }) => {
|
|
49
|
-
if (!
|
|
49
|
+
if (!S(s.featuresList.getStore()))
|
|
50
50
|
return null;
|
|
51
51
|
const e = s.getFeature(b.GAMES);
|
|
52
52
|
return e ? /* @__PURE__ */ t(C, { gamification: e }) : null;
|
|
53
53
|
}, K = ({ theme: s }) => {
|
|
54
|
-
const e =
|
|
55
|
-
return e ? /* @__PURE__ */ t("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ t(g, { customTheme: s ?? a, children: /* @__PURE__ */ t(j, { sdk: e }) }) }) : null;
|
|
54
|
+
const e = y(), a = v();
|
|
55
|
+
return e ? /* @__PURE__ */ t("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ t(g, { customTheme: s ?? a.theme, themeMode: a.themeMode, children: /* @__PURE__ */ t(j, { sdk: e }) }) }) : null;
|
|
56
56
|
};
|
|
57
57
|
export {
|
|
58
58
|
K as StreamLayerSDKPoints
|