@ai-matrx/meet 0.7.12 → 0.7.14

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/dist/react.cjs CHANGED
@@ -1999,7 +1999,18 @@ function withItem(collab, row, fromRoom = false) {
1999
1999
  const poll = pollFromRow(row);
2000
2000
  if (poll === null) return collab;
2001
2001
  const known = collab.polls.find((p) => p.id === poll.id);
2002
- const merged = fromRoom && known !== void 0 ? { ...poll, myVote: known.myVote } : poll;
2002
+ let merged = fromRoom && known !== void 0 ? { ...poll, myVote: known.myVote } : poll;
2003
+ if (fromRoom && known !== void 0 && !poll.options.some((o) => o.votes !== void 0)) {
2004
+ const counted = new Map(known.options.map((o) => [o.id, o]));
2005
+ merged = {
2006
+ ...merged,
2007
+ voterCount: known.voterCount,
2008
+ options: merged.options.map((o) => {
2009
+ const had = counted.get(o.id);
2010
+ return had === void 0 ? o : { ...o, votes: had.votes, voters: had.voters };
2011
+ })
2012
+ };
2013
+ }
2003
2014
  return { ...collab, polls: upsert(collab.polls, merged) };
2004
2015
  }
2005
2016
  if (kind === "question") {
@@ -2032,13 +2043,8 @@ function without(collab, ids) {
2032
2043
  }
2033
2044
  function applyCollabPacket(collab, payload, context) {
2034
2045
  const item = obj(payload["item"]);
2035
- const audience = str(payload["audience"]);
2036
2046
  if (item !== null) {
2037
2047
  const kind = str(item["kind"]);
2038
- const hostOnlyView = kind === "poll" || kind === "question";
2039
- if (hostOnlyView && context.isHost && audience !== "hosts") {
2040
- return { next: null, dropped: "the room copy of an item a host receives in full" };
2041
- }
2042
2048
  let next = withItem(collab, item, true);
2043
2049
  if (kind === "poll" && str(item["state"]) === "live") {
2044
2050
  const before = collab.polls.find((p) => p.id === str(item["id"]));