@streamlayer/sdk-web 1.10.11 → 1.10.12
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/index.js +4 -4
- package/lib/es/index.js +84 -82
- package/package.json +11 -11
package/lib/es/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { pino as Si } from "pino";
|
|
2
2
|
import { QuestionType as E, QuestionStatus as W, PromotionType as H, SilenceSetting as wi, UseAsNotification as Ai } from "@streamlayer/sl-eslib/interactive/interactive.common_pb";
|
|
3
|
-
import { PickHistoryStatus as
|
|
3
|
+
import { PickHistoryStatus as lt } from "@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb";
|
|
4
4
|
import { SdkOverlayType as D } from "@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb";
|
|
5
5
|
import { InvitationCategory as Rr, InvitationFrom as Vr } from "@streamlayer/sl-eslib/analytics/v1/invitations/invitations_pb";
|
|
6
6
|
import { computed as Ei, map as Ii, atom as Ct, batched as $r, onMount as br } from "nanostores";
|
|
7
7
|
import { v4 as St } from "uuid";
|
|
8
|
-
import { ConnectError as
|
|
8
|
+
import { ConnectError as rt, Code as ie, createContextKey as Mr, createClient as Br, createContextValues as Oi } from "@connectrpc/connect";
|
|
9
9
|
import { createGrpcWebTransport as Ur } from "@connectrpc/connect-web";
|
|
10
10
|
import { nanoquery as jr } from "@nanostores/query";
|
|
11
11
|
import { Events as Tn } from "@streamlayer/sl-eslib/sports/events/events_connect";
|
|
12
|
-
import { Client as
|
|
12
|
+
import { Client as nt } from "@streamlayer/sl-eslib/sdkSettings/client/client_connect";
|
|
13
13
|
import { Users as vr } from "@streamlayer/sl-eslib/users/users_connect";
|
|
14
14
|
import { Feed as se } from "@streamlayer/sl-eslib/interactive/feed/interactive.feed_connect";
|
|
15
15
|
import { Leaderboard as kn } from "@streamlayer/sl-eslib/interactive/leaderboard/interactive.leaderboard_connect";
|
|
@@ -71,18 +71,18 @@ function _i(t) {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
var Se = [], xe = !1, Ce,
|
|
74
|
+
var Se = [], xe = !1, Ce, pt = -1;
|
|
75
75
|
function Ci() {
|
|
76
|
-
!xe || !Ce || (xe = !1, Ce.length ? Se = Ce.concat(Se) :
|
|
76
|
+
!xe || !Ce || (xe = !1, Ce.length ? Se = Ce.concat(Se) : pt = -1, Se.length && Pn());
|
|
77
77
|
}
|
|
78
78
|
function Pn() {
|
|
79
79
|
if (!xe) {
|
|
80
80
|
var t = Ln(Ci);
|
|
81
81
|
xe = !0;
|
|
82
82
|
for (var e = Se.length; e; ) {
|
|
83
|
-
for (Ce = Se, Se = []; ++
|
|
84
|
-
Ce && Ce[
|
|
85
|
-
|
|
83
|
+
for (Ce = Se, Se = []; ++pt < e; )
|
|
84
|
+
Ce && Ce[pt].run();
|
|
85
|
+
pt = -1, e = Se.length;
|
|
86
86
|
}
|
|
87
87
|
Ce = null, xe = !1, _i(t);
|
|
88
88
|
}
|
|
@@ -218,10 +218,10 @@ const $i = {
|
|
|
218
218
|
[D.PUBLIC_CHAT]: "publicChat",
|
|
219
219
|
[D.TWITTER]: "twitter"
|
|
220
220
|
};
|
|
221
|
-
var
|
|
221
|
+
var Ze;
|
|
222
222
|
(function(t) {
|
|
223
223
|
t.Ready = "ready", t.Suspended = "suspended";
|
|
224
|
-
})(
|
|
224
|
+
})(Ze || (Ze = {}));
|
|
225
225
|
class Fn {
|
|
226
226
|
status;
|
|
227
227
|
source;
|
|
@@ -230,7 +230,7 @@ class Fn {
|
|
|
230
230
|
listeners = /* @__PURE__ */ new Set();
|
|
231
231
|
settingsKey;
|
|
232
232
|
constructor({ settings: e, ...r }, n) {
|
|
233
|
-
this.settingsKey = $i[r.type], this.status = Ct(
|
|
233
|
+
this.settingsKey = $i[r.type], this.status = Ct(Ze.Suspended), this.config = new Le(ee(r), `feature:config:${this.settingsKey}`), this.settingsKey !== void 0 && e?.overlaySettings.case === this.settingsKey ? this.settings = new Le(ee(e.overlaySettings.value), `feature:settings:${this.settingsKey}`) : this.settings = new Le(ee({}), `feature:settings:${this.settingsKey}`), this.source = n;
|
|
234
234
|
}
|
|
235
235
|
get featureConfig() {
|
|
236
236
|
return this.config.getStore();
|
|
@@ -242,10 +242,10 @@ class Fn {
|
|
|
242
242
|
this.listeners.add(e);
|
|
243
243
|
}
|
|
244
244
|
enable = () => {
|
|
245
|
-
this.status.set(
|
|
245
|
+
this.status.set(Ze.Ready);
|
|
246
246
|
};
|
|
247
247
|
disable = () => {
|
|
248
|
-
this.status.set(
|
|
248
|
+
this.status.set(Ze.Suspended);
|
|
249
249
|
};
|
|
250
250
|
setFeatureConfig = ({ settings: e, ...r }) => {
|
|
251
251
|
let n;
|
|
@@ -391,7 +391,7 @@ function Dn(t) {
|
|
|
391
391
|
t.name === "QuotaExceededError" || // Firefox
|
|
392
392
|
t.name === "NS_ERROR_DOM_QUOTA_REACHED");
|
|
393
393
|
}
|
|
394
|
-
class
|
|
394
|
+
class it {
|
|
395
395
|
delimiter = ":";
|
|
396
396
|
prefix;
|
|
397
397
|
storage;
|
|
@@ -485,7 +485,7 @@ class Ui {
|
|
|
485
485
|
for await (const o of i)
|
|
486
486
|
this.attempt = 0, this.onData(o);
|
|
487
487
|
} catch (n) {
|
|
488
|
-
n instanceof
|
|
488
|
+
n instanceof rt && n.code != ie.Canceled && this.onStreamError(n);
|
|
489
489
|
}
|
|
490
490
|
})(), this.updateState(ne.Connected);
|
|
491
491
|
};
|
|
@@ -525,7 +525,7 @@ class Ui {
|
|
|
525
525
|
*/
|
|
526
526
|
onStreamError = (e) => {
|
|
527
527
|
if (this.addStateLog(`error => ${e ? JSON.stringify(e) : "undefined"}}`), e !== void 0) {
|
|
528
|
-
if (e instanceof
|
|
528
|
+
if (e instanceof rt && e.code !== ie.Canceled) {
|
|
529
529
|
this.updateState(ne.Failed), this.state.setValue("error", e), e.code === ie.Unknown && e.cause === "missing trailer" && (this.attempt = 0), this.reconnect();
|
|
530
530
|
return;
|
|
531
531
|
}
|
|
@@ -551,8 +551,8 @@ const ji = /* @__PURE__ */ new Set([
|
|
|
551
551
|
return await t(e);
|
|
552
552
|
} catch (s) {
|
|
553
553
|
zr.trace({ attempt: o, error: s, url: e.url }, "retry attempt");
|
|
554
|
-
const a =
|
|
555
|
-
if (o >= r || !(a instanceof
|
|
554
|
+
const a = rt.from(s);
|
|
555
|
+
if (o >= r || !(a instanceof rt) || !ji.has(a.code))
|
|
556
556
|
throw s;
|
|
557
557
|
const u = Math.min(i, Math.pow(2, o) * n), d = Math.round(u * (1 + Math.random()) / 2);
|
|
558
558
|
await new Promise((c) => setTimeout(c, d));
|
|
@@ -707,7 +707,7 @@ const Gi = (t, e) => {
|
|
|
707
707
|
}
|
|
708
708
|
});
|
|
709
709
|
}, zi = (t, e) => {
|
|
710
|
-
const { client: r, queryKey: n } = e.createPromiseClient(
|
|
710
|
+
const { client: r, queryKey: n } = e.createPromiseClient(nt, { method: "getStream", params: [t] });
|
|
711
711
|
return e.nanoquery.createFetcherStore(n, {
|
|
712
712
|
fetcher: async (i, o, s) => s ? (await r.getStream({
|
|
713
713
|
id: s
|
|
@@ -735,12 +735,12 @@ const Gi = (t, e) => {
|
|
|
735
735
|
const { client: e, createRequestOptions: r } = t.createPromiseClient(vr, { method: "bypassAuth" }), n = r({ retryAttempts: 0 });
|
|
736
736
|
return ({ userKey: i, schema: o, init: s, inviterKey: a }) => e.bypassAuth({ userKey: i, schema: o, init: s, inviterKey: a }, { contextValues: n });
|
|
737
737
|
}, Yi = (t, e) => {
|
|
738
|
-
const { client: r, queryKey: n } = e.createPromiseClient(
|
|
738
|
+
const { client: r, queryKey: n } = e.createPromiseClient(nt, { method: "get", params: [t] });
|
|
739
739
|
return e.nanoquery.createFetcherStore(n, {
|
|
740
740
|
fetcher: async () => (await r.get({})).data?.attributes
|
|
741
741
|
});
|
|
742
742
|
}, Ji = (t, e) => {
|
|
743
|
-
const { client: r, queryKey: n } = e.createPromiseClient(
|
|
743
|
+
const { client: r, queryKey: n } = e.createPromiseClient(nt, { method: "getOrganization", params: [t] });
|
|
744
744
|
return e.nanoquery.createFetcherStore(n, {
|
|
745
745
|
fetcher: async () => {
|
|
746
746
|
const i = await r.getOrganization({});
|
|
@@ -751,7 +751,7 @@ const Gi = (t, e) => {
|
|
|
751
751
|
}
|
|
752
752
|
});
|
|
753
753
|
}, Xi = (t, e) => {
|
|
754
|
-
const { client: r, queryKey: n } = e.createPromiseClient(
|
|
754
|
+
const { client: r, queryKey: n } = e.createPromiseClient(nt, {
|
|
755
755
|
method: "getOrganizationAdvertising",
|
|
756
756
|
params: [t]
|
|
757
757
|
});
|
|
@@ -773,7 +773,7 @@ var ge;
|
|
|
773
773
|
(function(t) {
|
|
774
774
|
t.SCHEMA = "schema", t.EXTERNAL_TOKEN = "eToken", t.TOKEN = "token";
|
|
775
775
|
})(ge || (ge = {}));
|
|
776
|
-
class je extends
|
|
776
|
+
class je extends it {
|
|
777
777
|
constructor() {
|
|
778
778
|
super("user");
|
|
779
779
|
}
|
|
@@ -936,7 +936,7 @@ const io = (t, e, r) => {
|
|
|
936
936
|
return (await r.questionByUser({
|
|
937
937
|
questionId: t
|
|
938
938
|
})).data?.attributes?.question;
|
|
939
|
-
}, Ut = /* @__PURE__ */ new Map(),
|
|
939
|
+
}, Ut = /* @__PURE__ */ new Map(), Xe = (t, e) => {
|
|
940
940
|
const { client: r, queryKey: n, queryKeyStr: i } = e.createPromiseClient(se, {
|
|
941
941
|
method: "questionByUser",
|
|
942
942
|
params: [t]
|
|
@@ -1042,7 +1042,7 @@ const io = (t, e, r) => {
|
|
|
1042
1042
|
return;
|
|
1043
1043
|
const u = r.get().data?.find((c) => c.id === a?.questionId), d = a?.question?.openedFrom;
|
|
1044
1044
|
return u ? (u.openedFrom = d, u) : a.question;
|
|
1045
|
-
}), i = $r(n, (a) => a && a.type === "question" ? a.id : void 0), o =
|
|
1045
|
+
}), i = $r(n, (a) => a && a.type === "question" ? a.id : void 0), o = Xe(i, t);
|
|
1046
1046
|
return { $store: n, $extendedStore: o, updateExtendedQuestion: (a) => {
|
|
1047
1047
|
const u = o.get().data, d = (c, l) => {
|
|
1048
1048
|
if (!c || !l)
|
|
@@ -1071,7 +1071,7 @@ var ce;
|
|
|
1071
1071
|
(function(t) {
|
|
1072
1072
|
t.ONBOARDING = "onboarding", t.ONBOARDING_IO = "onboarding_io", t.QUESTION_RECEIVED = "q-received", t.QUESTION_OPENED = "q-opened";
|
|
1073
1073
|
})(ce || (ce = {}));
|
|
1074
|
-
class go extends
|
|
1074
|
+
class go extends it {
|
|
1075
1075
|
constructor() {
|
|
1076
1076
|
super("gamification-session", window.sessionStorage);
|
|
1077
1077
|
}
|
|
@@ -1080,7 +1080,7 @@ class go extends nt {
|
|
|
1080
1080
|
};
|
|
1081
1081
|
readValue = (e) => this.read(...e);
|
|
1082
1082
|
}
|
|
1083
|
-
class mo extends
|
|
1083
|
+
class mo extends it {
|
|
1084
1084
|
sessionStorage;
|
|
1085
1085
|
constructor() {
|
|
1086
1086
|
super("gamification"), this.sessionStorage = new go();
|
|
@@ -1146,7 +1146,7 @@ class bo {
|
|
|
1146
1146
|
this.feedList = new oe(po(this.slStreamId, this.interactiveAllowed, this.userId, this.organizationId, this.storage, r, e.transport), "gamification:feedList"), this.betPack = new oe(ho(this.slStreamId, this.userId, this.organizationId, this.storage, e.transport), "gamification:betPack"), this.activeQuestionId = uo(this.slStreamId, r, e.transport), this.openedQuestion = yo(e.transport, this.openedQuestionId, this.feedList.getStore()), this.cancels.add(this.openedQuestionId.listen((n) => {
|
|
1147
1147
|
this.log.debug({ item: n }, "received question"), n?.questionId ? (this.log.info("cleanup on close question"), this.questionSubscription !== void 0 && (e.transport.removeSubscription(this.questionSubscription), this.questionSubscription = void 0), this.questionSubscription = fo(n.questionId, e.transport), this.questionSubscription.addListener("feed-subscription-opened-question", (i) => {
|
|
1148
1148
|
const o = i.data?.attributes?.question;
|
|
1149
|
-
if (this.openedQuestion.updateExtendedQuestion(o), o?.type === E.PREDICTION && (o.status === W.ACTIVE || o.status === W.RESOLVED)) {
|
|
1149
|
+
if (this.openedQuestion.updateExtendedQuestion(o), this.betPack && o?.type === E.PREDICTION && (o.status === W.ACTIVE || o.status === W.RESOLVED)) {
|
|
1150
1150
|
const s = this.betPack.getValues().data?.data || {}, a = s?.[o.id];
|
|
1151
1151
|
if (a) {
|
|
1152
1152
|
const u = [], d = a.answers.sort((l, p) => l.id > p.id ? 1 : -1), c = o.answers.sort((l, p) => l.id > p.id ? 1 : -1);
|
|
@@ -1177,7 +1177,7 @@ class bo {
|
|
|
1177
1177
|
}), this.questionSubscription.connect()) : (this.log.info("cleanup on close question"), this.questionSubscription !== void 0 && (e.transport.removeSubscription(this.questionSubscription), this.questionSubscription = void 0));
|
|
1178
1178
|
})), this.feedSubscription = lo(this.slStreamId, e.transport), this.cancels.add(this.feedSubscription.addListener("bet-pack-update", async (n) => {
|
|
1179
1179
|
const i = n.data?.attributes?.question;
|
|
1180
|
-
if (i?.type === E.PREDICTION && (i.status === W.ACTIVE || i.status === W.RESOLVED)) {
|
|
1180
|
+
if (this.betPack && i?.type === E.PREDICTION && (i.status === W.ACTIVE || i.status === W.RESOLVED)) {
|
|
1181
1181
|
const o = this.betPack.getValues().data?.data || {}, s = o?.[i.id];
|
|
1182
1182
|
if (s)
|
|
1183
1183
|
this.betPack.getStore().mutate({
|
|
@@ -1377,7 +1377,7 @@ var wt;
|
|
|
1377
1377
|
(function(t) {
|
|
1378
1378
|
t.OPENED = "opened";
|
|
1379
1379
|
})(wt || (wt = {}));
|
|
1380
|
-
class So extends
|
|
1380
|
+
class So extends it {
|
|
1381
1381
|
constructor() {
|
|
1382
1382
|
super("notification");
|
|
1383
1383
|
}
|
|
@@ -1444,7 +1444,7 @@ const Hr = async (t, e) => {
|
|
|
1444
1444
|
try {
|
|
1445
1445
|
return await r.submitAnswer({ data: e }, { contextValues: i });
|
|
1446
1446
|
} catch (o) {
|
|
1447
|
-
throw
|
|
1447
|
+
throw rt.from(o)?.code === ie.AlreadyExists ? new Error(ze.ALREADY_VOTED) : new Error(ze.UNKNOWN);
|
|
1448
1448
|
}
|
|
1449
1449
|
}, $n = (t, e) => {
|
|
1450
1450
|
const { client: r, createRequestOptions: n } = t.createPromiseClient(se, { method: "submitInplay" }), i = n({ retryAttempts: 0 });
|
|
@@ -1491,7 +1491,7 @@ const Hr = async (t, e) => {
|
|
|
1491
1491
|
};
|
|
1492
1492
|
}), { $store: a, fetchMore: l, invalidate: c };
|
|
1493
1493
|
};
|
|
1494
|
-
class Oo extends
|
|
1494
|
+
class Oo extends it {
|
|
1495
1495
|
get = this.read;
|
|
1496
1496
|
set = this.write;
|
|
1497
1497
|
del = this.remove;
|
|
@@ -1685,7 +1685,7 @@ const Je = new je(), No = (t, e, r) => {
|
|
|
1685
1685
|
}, t.sdk.logout = () => {
|
|
1686
1686
|
t.auth.logout(), Je.clear();
|
|
1687
1687
|
}, t.sdk.getUserStore = () => t.stores.user.getStore(), t.sdk.isUserAuthorized = () => t.auth.isAuthenticated(), r();
|
|
1688
|
-
}, Xr = Ee("video_player"),
|
|
1688
|
+
}, Xr = Ee("video_player"), dt = {
|
|
1689
1689
|
debug: (...t) => {
|
|
1690
1690
|
Xr.debug(...t), localStorage.getItem("SL_DEBUG") && console.log(...t);
|
|
1691
1691
|
},
|
|
@@ -1696,13 +1696,13 @@ const Je = new je(), No = (t, e, r) => {
|
|
|
1696
1696
|
t.videoPlayer = {
|
|
1697
1697
|
controllers: /* @__PURE__ */ new Set()
|
|
1698
1698
|
}, t.sdk.addVideoPlayerController = (n) => {
|
|
1699
|
-
|
|
1699
|
+
dt.trace("adding video player controller"), t.videoPlayer.controllers.add(n);
|
|
1700
1700
|
}, e.videoPlayerController && t.sdk.addVideoPlayerController(e.videoPlayerController), t.sdk.removeVideoPlayerController = (n) => {
|
|
1701
|
-
|
|
1701
|
+
dt.trace("removing video player controller"), t.videoPlayer.controllers.delete(n);
|
|
1702
1702
|
}, t.sdk.controlVideoPlayer = (n) => {
|
|
1703
|
-
|
|
1703
|
+
dt.trace("controlling video player");
|
|
1704
1704
|
for (const i of t.videoPlayer.controllers) {
|
|
1705
|
-
|
|
1705
|
+
dt.trace("calling video player controller");
|
|
1706
1706
|
try {
|
|
1707
1707
|
i(n);
|
|
1708
1708
|
} catch (o) {
|
|
@@ -1878,7 +1878,7 @@ const Je = new je(), No = (t, e, r) => {
|
|
|
1878
1878
|
a ? t.stores.slStreamId.getStore().set({ loading: !1, data: s }) : t.stores.providerStreamId.setValue(s);
|
|
1879
1879
|
}, r();
|
|
1880
1880
|
}, $o = (t, e) => {
|
|
1881
|
-
const { client: r, queryKey: n } = t.createPromiseClient(
|
|
1881
|
+
const { client: r, queryKey: n } = t.createPromiseClient(nt, {
|
|
1882
1882
|
method: "generateDeepLink",
|
|
1883
1883
|
params: e
|
|
1884
1884
|
});
|
|
@@ -1964,7 +1964,7 @@ const Uo = (t, e, r, n) => {
|
|
|
1964
1964
|
}
|
|
1965
1965
|
}
|
|
1966
1966
|
});
|
|
1967
|
-
},
|
|
1967
|
+
}, ft = (t, e, r, n, i, o, s, a) => {
|
|
1968
1968
|
try {
|
|
1969
1969
|
const u = e.userId.get(), d = e.organizationId.get(), c = e.slStreamId.get();
|
|
1970
1970
|
if (!u || !d || !c)
|
|
@@ -2005,12 +2005,12 @@ const Uo = (t, e, r, n) => {
|
|
|
2005
2005
|
});
|
|
2006
2006
|
const u = [];
|
|
2007
2007
|
return a.get() !== $.Completed && (u.push(e.userId.listen((c) => {
|
|
2008
|
-
c &&
|
|
2008
|
+
c && ft(a, e, t, n, s, u, r, i);
|
|
2009
2009
|
})), u.push(e.moderation.listen((c) => {
|
|
2010
|
-
c.data &&
|
|
2010
|
+
c.data && ft(a, e, t, n, s, u, r, i);
|
|
2011
2011
|
})), u.push(t.featureSettings.listen((c) => {
|
|
2012
|
-
c &&
|
|
2013
|
-
}))),
|
|
2012
|
+
c && ft(a, e, t, n, s, u, r, i);
|
|
2013
|
+
}))), ft(a, e, t, n, s, u, r, i), { $store: a, submitInplay: async () => {
|
|
2014
2014
|
const c = e.slStreamId.get();
|
|
2015
2015
|
if (c) {
|
|
2016
2016
|
await $n(r, c), a.set($.Completed), s.saveOnboardingStatus({
|
|
@@ -2143,7 +2143,7 @@ class xo extends Fn {
|
|
|
2143
2143
|
prefix: `notification-id:${s}`
|
|
2144
2144
|
}), d = [...this.feedList.getValues().data || []], c = d.findIndex((G) => G.id === s), l = d[c];
|
|
2145
2145
|
let p = l?.attributes?.attributes?.value?.answerId;
|
|
2146
|
-
const b =
|
|
2146
|
+
const b = Xe(s, this.transport), S = b.subscribe(() => {
|
|
2147
2147
|
});
|
|
2148
2148
|
await b.get().promise;
|
|
2149
2149
|
let m = b.get().data;
|
|
@@ -2153,7 +2153,7 @@ class xo extends Fn {
|
|
|
2153
2153
|
const v = a.find(({ correct: G }) => G), k = p ? a.find(({ id: G }) => G === p) : void 0, V = !!k?.correct;
|
|
2154
2154
|
if (l && d[c]?.attributes?.attributes.case === "question") {
|
|
2155
2155
|
try {
|
|
2156
|
-
d[c].attributes.attributes.value.answerId = p, d[c].attributes.attributes.value.openForVoting = !1, p && (d[c].attributes.attributes.value.status = V ?
|
|
2156
|
+
d[c].attributes.attributes.value.answerId = p, d[c].attributes.attributes.value.openForVoting = !1, p && (d[c].attributes.attributes.value.status = V ? lt.WON : lt.LOST);
|
|
2157
2157
|
} catch {
|
|
2158
2158
|
}
|
|
2159
2159
|
this.feedList.getStore().mutate(d);
|
|
@@ -2251,11 +2251,13 @@ class xo extends Fn {
|
|
|
2251
2251
|
this.background.feedSubscription.removeListener("feed-subscription-prediction-close"), this.background.feedSubscription.removeListener("feed-subscription-questions-list");
|
|
2252
2252
|
};
|
|
2253
2253
|
betPackVote = async (e, r) => {
|
|
2254
|
+
if (!this.betPack)
|
|
2255
|
+
return;
|
|
2254
2256
|
try {
|
|
2255
2257
|
await Hr(this.transport, { questionId: e, answerId: r });
|
|
2256
2258
|
} catch (o) {
|
|
2257
2259
|
if (o.message === ze.ALREADY_VOTED) {
|
|
2258
|
-
const s =
|
|
2260
|
+
const s = Xe(e, this.transport), a = s.subscribe(() => {
|
|
2259
2261
|
});
|
|
2260
2262
|
s.invalidate(), a();
|
|
2261
2263
|
}
|
|
@@ -2274,7 +2276,7 @@ class xo extends Fn {
|
|
|
2274
2276
|
} : o), this.betPack.getStore().mutate({ data: n, timestamp: Date.now() }));
|
|
2275
2277
|
};
|
|
2276
2278
|
submitAnswer = async (e, r) => {
|
|
2277
|
-
const n =
|
|
2279
|
+
const n = Xe(e, this.transport), i = n.subscribe(() => {
|
|
2278
2280
|
}), o = { ...n.get().data || {} }, s = () => {
|
|
2279
2281
|
const a = this.feedList.getValues().data;
|
|
2280
2282
|
if (!a)
|
|
@@ -2291,7 +2293,7 @@ class xo extends Fn {
|
|
|
2291
2293
|
const l = n.get().data;
|
|
2292
2294
|
if (i(), l) {
|
|
2293
2295
|
const p = l.answers.find((v) => v.correct === !0), b = l.answers.findIndex((v) => v.id === r), S = l.answers[b], m = l.answers.every(({ percentageDecimal: v }, k) => v === o?.answers[k].percentageDecimal);
|
|
2294
|
-
a[u].attributes.attributes.value.answerId = r, a[u].attributes.attributes.value.openForVoting = !1, a[u].attributes.attributes.value.text = S?.text || "", p && (a[u].attributes.attributes.value.status = p.id === r ?
|
|
2296
|
+
a[u].attributes.attributes.value.answerId = r, a[u].attributes.attributes.value.openForVoting = !1, a[u].attributes.attributes.value.text = S?.text || "", p && (a[u].attributes.attributes.value.status = p.id === r ? lt.WON : lt.LOST), this.feedList.getStore().mutate([...a]), l.answers[b].correct = p?.id === r, l.answers[b].youVoted = !0, m && l.answers.forEach((v) => {
|
|
2295
2297
|
v.percentageDecimal = 0;
|
|
2296
2298
|
}), p?.id === r && (l.answers[b].pointsEarned = l.status === W.RESOLVED ? 0 : p.points), n.mutate({ ...l });
|
|
2297
2299
|
}
|
|
@@ -2317,7 +2319,7 @@ class xo extends Fn {
|
|
|
2317
2319
|
return () => {
|
|
2318
2320
|
};
|
|
2319
2321
|
const n = r?.openedFrom === "bet-pack";
|
|
2320
|
-
this.notifications.close(this.background.getCurrentSessionId({
|
|
2322
|
+
n || Xe(e, this.transport).invalidate(), this.notifications.close(this.background.getCurrentSessionId({
|
|
2321
2323
|
prefix: "notification",
|
|
2322
2324
|
entity: e
|
|
2323
2325
|
}), {
|
|
@@ -2755,7 +2757,7 @@ class Jo {
|
|
|
2755
2757
|
});
|
|
2756
2758
|
};
|
|
2757
2759
|
}
|
|
2758
|
-
const
|
|
2760
|
+
const et = {
|
|
2759
2761
|
[E.UNSET]: q.UNSET,
|
|
2760
2762
|
[E.FACTOID]: q.POLLS_INSIGHT,
|
|
2761
2763
|
[E.POLL]: q.POLLS_POLL,
|
|
@@ -2826,7 +2828,7 @@ class Zo {
|
|
|
2826
2828
|
...this.analytics.commonStore.getValues(),
|
|
2827
2829
|
kind: x.NOTIFICATION_RECEIVED,
|
|
2828
2830
|
topicId: e,
|
|
2829
|
-
topicType: r ?
|
|
2831
|
+
topicType: r ? et[r] : q.UNSET,
|
|
2830
2832
|
topicSubType: n
|
|
2831
2833
|
},
|
|
2832
2834
|
notificationKind: ye.POLLS,
|
|
@@ -2839,7 +2841,7 @@ class Zo {
|
|
|
2839
2841
|
...this.analytics.commonStore.getValues(),
|
|
2840
2842
|
kind: x.NOTIFICATION_OPENED,
|
|
2841
2843
|
topicId: e,
|
|
2842
|
-
topicType: r ?
|
|
2844
|
+
topicType: r ? et[r] : q.UNSET,
|
|
2843
2845
|
topicSubType: n
|
|
2844
2846
|
},
|
|
2845
2847
|
notificationKind: ye.POLLS,
|
|
@@ -2881,7 +2883,7 @@ class es {
|
|
|
2881
2883
|
...this.analytics.commonStore.getValues(),
|
|
2882
2884
|
kind: x.POLLS_RECEIVED,
|
|
2883
2885
|
topicId: e,
|
|
2884
|
-
topicType: r ?
|
|
2886
|
+
topicType: r ? et[r] : q.UNSET
|
|
2885
2887
|
},
|
|
2886
2888
|
pollOpenedFrom: X.UNSET
|
|
2887
2889
|
});
|
|
@@ -2893,7 +2895,7 @@ class es {
|
|
|
2893
2895
|
...this.analytics.commonStore.getValues(),
|
|
2894
2896
|
kind: x.POLLS_OPENED,
|
|
2895
2897
|
topicId: e,
|
|
2896
|
-
topicType: r ?
|
|
2898
|
+
topicType: r ? et[r] : q.UNSET
|
|
2897
2899
|
},
|
|
2898
2900
|
pollOpenedFrom: n === "list" ? X.PICK_HISTORY : X.IN_APP
|
|
2899
2901
|
});
|
|
@@ -2905,7 +2907,7 @@ class es {
|
|
|
2905
2907
|
...this.analytics.commonStore.getValues(),
|
|
2906
2908
|
kind: x.POLLS_VOTE,
|
|
2907
2909
|
topicId: e,
|
|
2908
|
-
topicType: r ?
|
|
2910
|
+
topicType: r ? et[r] : q.UNSET
|
|
2909
2911
|
},
|
|
2910
2912
|
pollOpenedFrom: X.UNSET
|
|
2911
2913
|
});
|
|
@@ -3658,7 +3660,7 @@ var Ks = function t(e) {
|
|
|
3658
3660
|
"%URIErrorPrototype%": ["URIError", "prototype"],
|
|
3659
3661
|
"%WeakMapPrototype%": ["WeakMap", "prototype"],
|
|
3660
3662
|
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
|
3661
|
-
},
|
|
3663
|
+
}, ot = Ir, At = $s, Hs = ot.call(Function.call, Array.prototype.concat), Ws = ot.call(Function.apply, Array.prototype.splice), un = ot.call(Function.call, String.prototype.replace), Et = ot.call(Function.call, String.prototype.slice), Ys = ot.call(Function.call, RegExp.prototype.exec), Js = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, Xs = /\\(\\)?/g, Zs = function(e) {
|
|
3662
3664
|
var r = Et(e, 0, 1), n = Et(e, -1);
|
|
3663
3665
|
if (r === "%" && n !== "%")
|
|
3664
3666
|
throw new Ke("invalid intrinsic syntax, expected closing `%`");
|
|
@@ -3681,7 +3683,7 @@ var Ks = function t(e) {
|
|
|
3681
3683
|
};
|
|
3682
3684
|
}
|
|
3683
3685
|
throw new Ke("intrinsic " + e + " does not exist!");
|
|
3684
|
-
},
|
|
3686
|
+
}, st = function(e, r) {
|
|
3685
3687
|
if (typeof e != "string" || e.length === 0)
|
|
3686
3688
|
throw new Ge("intrinsic name must be a non-empty string");
|
|
3687
3689
|
if (arguments.length > 1 && typeof r != "boolean")
|
|
@@ -3715,7 +3717,7 @@ var Ks = function t(e) {
|
|
|
3715
3717
|
function Or() {
|
|
3716
3718
|
if (cn) return Qt;
|
|
3717
3719
|
cn = 1;
|
|
3718
|
-
var t =
|
|
3720
|
+
var t = st, e = t("%Object.defineProperty%", !0) || !1;
|
|
3719
3721
|
if (e)
|
|
3720
3722
|
try {
|
|
3721
3723
|
e({}, "a", { value: 1 });
|
|
@@ -3724,7 +3726,7 @@ function Or() {
|
|
|
3724
3726
|
}
|
|
3725
3727
|
return Qt = e, Qt;
|
|
3726
3728
|
}
|
|
3727
|
-
var ta =
|
|
3729
|
+
var ta = st, yt = ta("%Object.getOwnPropertyDescriptor%", !0);
|
|
3728
3730
|
if (yt)
|
|
3729
3731
|
try {
|
|
3730
3732
|
yt([], "length");
|
|
@@ -3768,7 +3770,7 @@ ri.hasArrayLengthDefineBug = function() {
|
|
|
3768
3770
|
return !0;
|
|
3769
3771
|
}
|
|
3770
3772
|
};
|
|
3771
|
-
var ia = ri, oa =
|
|
3773
|
+
var ia = ri, oa = st, fn = na, sa = ia(), pn = Vt, hn = Rt, aa = oa("%Math.floor%"), ua = function(e, r) {
|
|
3772
3774
|
if (typeof e != "function")
|
|
3773
3775
|
throw new hn("`fn` is not a function");
|
|
3774
3776
|
if (typeof r != "number" || r < 0 || r > 4294967295 || aa(r) !== r)
|
|
@@ -3793,7 +3795,7 @@ var ia = ri, oa = ot, fn = na, sa = ia(), pn = Vt, hn = Rt, aa = oa("%Math.floor
|
|
|
3793
3795
|
)), e;
|
|
3794
3796
|
};
|
|
3795
3797
|
(function(t) {
|
|
3796
|
-
var e = Ir, r =
|
|
3798
|
+
var e = Ir, r = st, n = ua, i = Rt, o = r("%Function.prototype.apply%"), s = r("%Function.prototype.call%"), a = r("%Reflect.apply%", !0) || e.call(s, o), u = Or(), d = r("%Math.max%");
|
|
3797
3799
|
t.exports = function(p) {
|
|
3798
3800
|
if (typeof p != "function")
|
|
3799
3801
|
throw new i("a function is required");
|
|
@@ -3809,7 +3811,7 @@ var ia = ri, oa = ot, fn = na, sa = ia(), pn = Vt, hn = Rt, aa = oa("%Math.floor
|
|
|
3809
3811
|
};
|
|
3810
3812
|
u ? u(t.exports, "apply", { value: c }) : t.exports.apply = c;
|
|
3811
3813
|
})(ti);
|
|
3812
|
-
var Tr = ti.exports, ni =
|
|
3814
|
+
var Tr = ti.exports, ni = st, ii = Tr, ca = ii(ni("String.prototype.indexOf")), kr = function(e, r) {
|
|
3813
3815
|
var n = ni(e, !!r);
|
|
3814
3816
|
return typeof n == "function" && ca(e, ".prototype.") > -1 ? ii(n) : n;
|
|
3815
3817
|
}, la = Dt(), da = kr, cr = da("Object.prototype.toString"), $t = function(e) {
|
|
@@ -4156,10 +4158,10 @@ var Ka = function(e) {
|
|
|
4156
4158
|
return u(y) === "[object ArrayBuffer]";
|
|
4157
4159
|
}
|
|
4158
4160
|
Ve.working = typeof ArrayBuffer < "u" && Ve(new ArrayBuffer());
|
|
4159
|
-
function
|
|
4161
|
+
function at(y) {
|
|
4160
4162
|
return typeof ArrayBuffer > "u" ? !1 : Ve.working ? Ve(y) : y instanceof ArrayBuffer;
|
|
4161
4163
|
}
|
|
4162
|
-
t.isArrayBuffer =
|
|
4164
|
+
t.isArrayBuffer = at;
|
|
4163
4165
|
function f(y) {
|
|
4164
4166
|
return u(y) === "[object DataView]";
|
|
4165
4167
|
}
|
|
@@ -4200,28 +4202,28 @@ var Ka = function(e) {
|
|
|
4200
4202
|
return S(y, d);
|
|
4201
4203
|
}
|
|
4202
4204
|
t.isNumberObject = ke;
|
|
4203
|
-
function
|
|
4205
|
+
function ut(y) {
|
|
4204
4206
|
return S(y, c);
|
|
4205
4207
|
}
|
|
4206
|
-
t.isStringObject =
|
|
4208
|
+
t.isStringObject = ut;
|
|
4207
4209
|
function $e(y) {
|
|
4208
4210
|
return S(y, l);
|
|
4209
4211
|
}
|
|
4210
4212
|
t.isBooleanObject = $e;
|
|
4211
|
-
function
|
|
4213
|
+
function ct(y) {
|
|
4212
4214
|
return s && S(y, p);
|
|
4213
4215
|
}
|
|
4214
|
-
t.isBigIntObject =
|
|
4216
|
+
t.isBigIntObject = ct;
|
|
4215
4217
|
function Dr(y) {
|
|
4216
4218
|
return a && S(y, b);
|
|
4217
4219
|
}
|
|
4218
4220
|
t.isSymbolObject = Dr;
|
|
4219
4221
|
function mi(y) {
|
|
4220
|
-
return ke(y) ||
|
|
4222
|
+
return ke(y) || ut(y) || $e(y) || ct(y) || Dr(y);
|
|
4221
4223
|
}
|
|
4222
4224
|
t.isBoxedPrimitive = mi;
|
|
4223
4225
|
function bi(y) {
|
|
4224
|
-
return typeof Uint8Array < "u" && (
|
|
4226
|
+
return typeof Uint8Array < "u" && (at(y) || C(y));
|
|
4225
4227
|
}
|
|
4226
4228
|
t.isAnyArrayBuffer = bi, ["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function(y) {
|
|
4227
4229
|
Object.defineProperty(t, y, {
|
|
@@ -4393,8 +4395,8 @@ var Za = yr.exports;
|
|
|
4393
4395
|
}
|
|
4394
4396
|
var F = "", Y = !1, ke = ["{", "}"];
|
|
4395
4397
|
if (v(h) && (Y = !0, ke = ["[", "]"]), pe(h)) {
|
|
4396
|
-
var
|
|
4397
|
-
F = " [Function" +
|
|
4398
|
+
var ut = h.name ? ": " + h.name : "";
|
|
4399
|
+
F = " [Function" + ut + "]";
|
|
4398
4400
|
}
|
|
4399
4401
|
if (ae(h) && (F = " " + RegExp.prototype.toString.call(h)), Fe(h) && (F = " " + Date.prototype.toUTCString.call(h)), Te(h) && (F = " " + p(h)), L.length === 0 && (!Y || h.length == 0))
|
|
4400
4402
|
return ke[0] + F + ke[1];
|
|
@@ -4402,8 +4404,8 @@ var Za = yr.exports;
|
|
|
4402
4404
|
return ae(h) ? f.stylize(RegExp.prototype.toString.call(h), "regexp") : f.stylize("[Object]", "special");
|
|
4403
4405
|
f.seen.push(h);
|
|
4404
4406
|
var $e;
|
|
4405
|
-
return Y ? $e = b(f, h, g, I, L) : $e = L.map(function(
|
|
4406
|
-
return S(f, h, g, I,
|
|
4407
|
+
return Y ? $e = b(f, h, g, I, L) : $e = L.map(function(ct) {
|
|
4408
|
+
return S(f, h, g, I, ct, Y);
|
|
4407
4409
|
}), f.seen.pop(), m($e, F, ke);
|
|
4408
4410
|
}
|
|
4409
4411
|
function l(f, h) {
|
|
@@ -4616,7 +4618,7 @@ var Za = yr.exports;
|
|
|
4616
4618
|
}
|
|
4617
4619
|
return h(f);
|
|
4618
4620
|
}
|
|
4619
|
-
function
|
|
4621
|
+
function at(f) {
|
|
4620
4622
|
if (typeof f != "function")
|
|
4621
4623
|
throw new TypeError('The "original" argument must be of type Function');
|
|
4622
4624
|
function h() {
|
|
@@ -4642,7 +4644,7 @@ var Za = yr.exports;
|
|
|
4642
4644
|
e(f)
|
|
4643
4645
|
), h;
|
|
4644
4646
|
}
|
|
4645
|
-
t.callbackify =
|
|
4647
|
+
t.callbackify = at;
|
|
4646
4648
|
})(Ft);
|
|
4647
4649
|
const { inherits: eu, format: Jt } = Ft;
|
|
4648
4650
|
function _e(t, e, r = Error) {
|
|
@@ -5176,7 +5178,7 @@ Nr.exports.loadPlugin = Fr;
|
|
|
5176
5178
|
var gu = Nr.exports;
|
|
5177
5179
|
const In = jn, mu = Yn.EventEmitter, bu = Ft.inherits, {
|
|
5178
5180
|
AVV_ERR_EXPOSE_ALREADY_DEFINED: tr,
|
|
5179
|
-
AVV_ERR_CALLBACK_NOT_FN:
|
|
5181
|
+
AVV_ERR_CALLBACK_NOT_FN: tt,
|
|
5180
5182
|
AVV_ERR_PLUGIN_NOT_VALID: vu,
|
|
5181
5183
|
AVV_ERR_ROOT_PLG_BOOTED: Su,
|
|
5182
5184
|
AVV_ERR_READY_TIMEOUT: wu
|
|
@@ -5195,15 +5197,15 @@ function Eu(t, e, r) {
|
|
|
5195
5197
|
return typeof d != "function" ? r._loadRegistered() : (r.after(nr(d, this)), this);
|
|
5196
5198
|
}, t[s] = function(d) {
|
|
5197
5199
|
if (d && typeof d != "function")
|
|
5198
|
-
throw new
|
|
5200
|
+
throw new tt(s, typeof d);
|
|
5199
5201
|
return r.ready(d ? nr(d, this) : void 0);
|
|
5200
5202
|
}, t[a] = function(d) {
|
|
5201
5203
|
if (typeof d != "function")
|
|
5202
|
-
throw new
|
|
5204
|
+
throw new tt(a, typeof d);
|
|
5203
5205
|
return r.onClose(_u(d, this)), this;
|
|
5204
5206
|
}, t[u] = function(d) {
|
|
5205
5207
|
if (d && typeof d != "function")
|
|
5206
|
-
throw new
|
|
5208
|
+
throw new tt(u, typeof d);
|
|
5207
5209
|
return d ? (r.close(nr(d, this)), this) : r.close();
|
|
5208
5210
|
};
|
|
5209
5211
|
}
|
|
@@ -5297,7 +5299,7 @@ Q.prototype.close = function(t) {
|
|
|
5297
5299
|
let e;
|
|
5298
5300
|
if (t) {
|
|
5299
5301
|
if (typeof t != "function")
|
|
5300
|
-
throw new
|
|
5302
|
+
throw new tt("close", typeof t);
|
|
5301
5303
|
} else
|
|
5302
5304
|
e = new Promise(function(r, n) {
|
|
5303
5305
|
t = function(i) {
|
|
@@ -5313,7 +5315,7 @@ Q.prototype.close = function(t) {
|
|
|
5313
5315
|
Q.prototype.ready = function(t) {
|
|
5314
5316
|
if (t) {
|
|
5315
5317
|
if (typeof t != "function")
|
|
5316
|
-
throw new
|
|
5318
|
+
throw new tt("ready", typeof t);
|
|
5317
5319
|
this._readyQ.push(t), queueMicrotask(this.start.bind(this));
|
|
5318
5320
|
return;
|
|
5319
5321
|
}
|
package/package.json
CHANGED
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"avvio": "=8.2.1",
|
|
26
26
|
"tslib": "^2.7.0",
|
|
27
|
-
"@streamlayer/feature-gamification": "^1.16.
|
|
28
|
-
"@streamlayer/sdk-web-analytics": "^1.7.
|
|
29
|
-
"@streamlayer/sdk-web-api": "^1.8.
|
|
30
|
-
"@streamlayer/sdk-web-core": "^1.11.
|
|
31
|
-
"@streamlayer/sdk-web-features": "^1.0.
|
|
32
|
-
"@streamlayer/sdk-web-interfaces": "^1.5.
|
|
33
|
-
"@streamlayer/sdk-web-logger": "^1.0.
|
|
34
|
-
"@streamlayer/sdk-web-notifications": "^1.3.
|
|
35
|
-
"@streamlayer/sdk-web-storage": "^1.0.
|
|
36
|
-
"@streamlayer/sdk-web-types": "^1.10.
|
|
27
|
+
"@streamlayer/feature-gamification": "^1.16.12",
|
|
28
|
+
"@streamlayer/sdk-web-analytics": "^1.7.12",
|
|
29
|
+
"@streamlayer/sdk-web-api": "^1.8.12",
|
|
30
|
+
"@streamlayer/sdk-web-core": "^1.11.14",
|
|
31
|
+
"@streamlayer/sdk-web-features": "^1.0.59",
|
|
32
|
+
"@streamlayer/sdk-web-interfaces": "^1.5.3",
|
|
33
|
+
"@streamlayer/sdk-web-logger": "^1.0.59",
|
|
34
|
+
"@streamlayer/sdk-web-notifications": "^1.3.21",
|
|
35
|
+
"@streamlayer/sdk-web-storage": "^1.0.59",
|
|
36
|
+
"@streamlayer/sdk-web-types": "^1.10.16"
|
|
37
37
|
},
|
|
38
|
-
"version": "1.10.
|
|
38
|
+
"version": "1.10.12",
|
|
39
39
|
"type": "module",
|
|
40
40
|
"main": "./src/index.js",
|
|
41
41
|
"typings": "./src/index.d.ts"
|