@streamlayer/react 1.14.3 → 1.14.5

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.
@@ -13748,7 +13748,10 @@ const jk = (e, t, n) => {
13748
13748
  fetcher: async (c, l, m, u, d) => {
13749
13749
  var T;
13750
13750
  if (!m || !u || !d)
13751
- return null;
13751
+ return {
13752
+ timestamp: Date.now(),
13753
+ data: null
13754
+ };
13752
13755
  const y = await o.betPack({
13753
13756
  eventId: m,
13754
13757
  types: [M.PREDICTION],
@@ -13759,24 +13762,30 @@ const jk = (e, t, n) => {
13759
13762
  order: "asc"
13760
13763
  }
13761
13764
  });
13762
- return !y.data || !y.data.length ? null : (T = y.data) == null ? void 0 : T.reduce((g, f) => {
13763
- var O;
13764
- const _ = (O = f == null ? void 0 : f.attributes) == null ? void 0 : O.question;
13765
- if (!(_ != null && _.id))
13766
- return g;
13767
- const h = {
13768
- eventId: m,
13769
- userId: u,
13770
- organizationId: d
13771
- };
13772
- return a.isBetPackQuestionReceived(h, _.id) || (ae.emit("poll", {
13773
- action: "received",
13774
- payload: {
13775
- questionId: _.id,
13776
- questionType: _.type
13777
- }
13778
- }), a.saveBetPackQuestionReceived(h, _.id)), { ...g, [_.id]: _ };
13779
- }, {});
13765
+ return !y.data || !y.data.length ? {
13766
+ timestamp: Date.now(),
13767
+ data: null
13768
+ } : {
13769
+ timestamp: Date.now(),
13770
+ data: (T = y.data) == null ? void 0 : T.reduce((g, f) => {
13771
+ var O;
13772
+ const _ = (O = f == null ? void 0 : f.attributes) == null ? void 0 : O.question;
13773
+ if (!(_ != null && _.id))
13774
+ return g;
13775
+ const h = {
13776
+ eventId: m,
13777
+ userId: u,
13778
+ organizationId: d
13779
+ };
13780
+ return a.isBetPackQuestionReceived(h, _.id) || (ae.emit("poll", {
13781
+ action: "received",
13782
+ payload: {
13783
+ questionId: _.id,
13784
+ questionType: _.type
13785
+ }
13786
+ }), a.saveBetPackQuestionReceived(h, _.id)), { ...g, [_.id]: _ };
13787
+ }, {})
13788
+ };
13780
13789
  },
13781
13790
  dedupeTime: 0,
13782
13791
  refetchInterval: 0
@@ -14087,39 +14096,45 @@ class mh {
14087
14096
  const n = !!t.sdk.options.get().betPack;
14088
14097
  this.feedList = new we(eh(this.slStreamId, this.interactiveAllowed, n, t.transport), "gamification:feedList"), this.betPack = new we(nh(this.slStreamId, this.userId, this.organizationId, this.storage, t.transport), "gamification:betPack"), this.activeQuestionId = zk(this.slStreamId, n, t.transport), this.openedQuestion = ah(t.transport, this.openedQuestionId, this.feedList.getStore()), this.cancels.add(this.openedQuestionId.listen((a) => {
14089
14098
  this.log.debug({ item: a }, "received question"), a != null && a.questionId ? (this.questionSubscription = Zk(a.questionId, t.transport), this.questionSubscription.addListener("feed-subscription-opened-question", async (s) => {
14090
- var r, c;
14099
+ var r, c, l;
14091
14100
  const o = (c = (r = s.data) == null ? void 0 : r.attributes) == null ? void 0 : c.question;
14092
14101
  if (this.openedQuestion.updateExtendedQuestion(o), (o == null ? void 0 : o.type) === M.PREDICTION && (o.status === Z.ACTIVE || o.status === Z.RESOLVED)) {
14093
- const l = this.betPack.getValues().data || {};
14094
- if (l != null && l[o.id] || Object.keys(l).length < 5) {
14095
- const m = Dt(o.id, this.transport), u = m.subscribe(() => {
14102
+ const m = ((l = this.betPack.getValues().data) == null ? void 0 : l.data) || {};
14103
+ if (m != null && m[o.id] || Object.keys(m).length < 5) {
14104
+ const u = Dt(o.id, this.transport), d = u.subscribe(() => {
14096
14105
  });
14097
- await m.get().promise;
14098
- let d = m.get().data;
14099
- d || (d = await ts(o.id, this.transport)), u(), window.requestAnimationFrame(() => {
14100
- m.invalidate();
14106
+ await u.get().promise;
14107
+ let y = u.get().data;
14108
+ y || (y = await ts(o.id, this.transport)), d(), window.requestAnimationFrame(() => {
14109
+ u.invalidate();
14101
14110
  }), this.betPack.getStore().mutate({
14102
- ...l,
14103
- [o.id]: d
14111
+ timestamp: Date.now(),
14112
+ data: {
14113
+ ...m,
14114
+ [o.id]: y
14115
+ }
14104
14116
  });
14105
14117
  }
14106
14118
  }
14107
14119
  }), this.questionSubscription.connect()) : (this.log.info("cleanup on close question"), this.questionSubscription !== void 0 && (t.transport.removeSubscription(this.questionSubscription), this.questionSubscription = void 0));
14108
14120
  })), this.feedSubscription = Xk(this.slStreamId, t.transport), this.cancels.add(this.feedSubscription.addListener("bet-pack-update", async (a) => {
14109
- var o, r;
14121
+ var o, r, c;
14110
14122
  const s = (r = (o = a.data) == null ? void 0 : o.attributes) == null ? void 0 : r.question;
14111
14123
  if ((s == null ? void 0 : s.type) === M.PREDICTION && (s.status === Z.ACTIVE || s.status === Z.RESOLVED)) {
14112
- const c = this.betPack.getValues().data || {};
14113
- if (c != null && c[s.id] || Object.keys(c).length < 5) {
14114
- const l = Dt(s.id, this.transport), m = l.subscribe(() => {
14124
+ const l = ((c = this.betPack.getValues().data) == null ? void 0 : c.data) || {};
14125
+ if (l != null && l[s.id] || Object.keys(l).length < 5) {
14126
+ const m = Dt(s.id, this.transport), u = m.subscribe(() => {
14115
14127
  });
14116
- await l.get().promise;
14117
- let u = l.get().data;
14118
- u || (u = await ts(s.id, this.transport)), m(), window.requestAnimationFrame(() => {
14119
- l.invalidate();
14128
+ await m.get().promise;
14129
+ let d = m.get().data;
14130
+ d || (d = await ts(s.id, this.transport)), u(), window.requestAnimationFrame(() => {
14131
+ m.invalidate();
14120
14132
  }), this.betPack.getStore().mutate({
14121
- ...c,
14122
- [s.id]: u
14133
+ timestamp: Date.now(),
14134
+ data: {
14135
+ ...l,
14136
+ [s.id]: d
14137
+ }
14123
14138
  });
14124
14139
  }
14125
14140
  }
@@ -15137,27 +15152,28 @@ class Ch extends rc {
15137
15152
  this.background.feedSubscription.removeListener("feed-subscription-prediction-close"), this.background.feedSubscription.removeListener("feed-subscription-questions-list");
15138
15153
  });
15139
15154
  p(this, "betPackVote", async (n, a) => {
15155
+ var r;
15140
15156
  try {
15141
15157
  await dr(this.transport, { questionId: n, answerId: a });
15142
- } catch (r) {
15143
- if (r.message === Vt.ALREADY_VOTED) {
15144
- const c = Dt(n, this.transport), l = c.subscribe(() => {
15158
+ } catch (c) {
15159
+ if (c.message === Vt.ALREADY_VOTED) {
15160
+ const l = Dt(n, this.transport), m = l.subscribe(() => {
15145
15161
  });
15146
- c.invalidate(), l();
15162
+ l.invalidate(), m();
15147
15163
  }
15148
- throw r;
15164
+ throw c;
15149
15165
  }
15150
- const s = { ...this.betPack.getValues().data }, o = s == null ? void 0 : s[n];
15166
+ const s = { ...(r = this.betPack.getValues().data) == null ? void 0 : r.data }, o = s == null ? void 0 : s[n];
15151
15167
  o && (ae.emit("poll", {
15152
15168
  action: "voted",
15153
15169
  payload: {
15154
15170
  questionId: n,
15155
15171
  questionType: o.type
15156
15172
  }
15157
- }), o.answers = o.answers.map((r) => r.id === a ? {
15158
- ...r,
15173
+ }), o.answers = o.answers.map((c) => c.id === a ? {
15174
+ ...c,
15159
15175
  youVoted: !0
15160
- } : r), this.betPack.getStore().mutate(s));
15176
+ } : c), this.betPack.getStore().mutate({ data: s, timestamp: Date.now() }));
15161
15177
  });
15162
15178
  p(this, "submitAnswer", async (n, a) => {
15163
15179
  const s = Dt(n, this.transport), o = s.subscribe(() => {
@@ -18419,7 +18435,7 @@ const OE = ({
18419
18435
  f = !0;
18420
18436
  };
18421
18437
  const _ = bE(e, n, a, {
18422
- version: "1.14.3",
18438
+ version: "1.14.5",
18423
18439
  onDeepLinkHandled: s,
18424
18440
  videoPlayerController: o,
18425
18441
  onContentActivate: r,