@stream-io/feeds-client 0.3.46 → 0.3.47

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.
Files changed (28) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/index.js +1 -1
  3. package/dist/cjs/react-bindings.js +56 -23
  4. package/dist/cjs/react-bindings.js.map +1 -1
  5. package/dist/es/index.mjs +2 -2
  6. package/dist/es/react-bindings.mjs +56 -23
  7. package/dist/es/react-bindings.mjs.map +1 -1
  8. package/dist/{feeds-client-CF1yEox0.js → feeds-client-CxjZlEtX.js} +20 -16
  9. package/dist/feeds-client-CxjZlEtX.js.map +1 -0
  10. package/dist/{feeds-client-CSg4hlZ4.mjs → feeds-client-ykIZW9Hi.mjs} +20 -16
  11. package/dist/feeds-client-ykIZW9Hi.mjs.map +1 -0
  12. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  13. package/dist/types/bindings/react/hooks/feed-state-hooks/index.d.ts +1 -0
  14. package/dist/types/bindings/react/hooks/feed-state-hooks/index.d.ts.map +1 -1
  15. package/dist/types/bindings/react/hooks/feed-state-hooks/useMembers.d.ts +17 -0
  16. package/dist/types/bindings/react/hooks/feed-state-hooks/useMembers.d.ts.map +1 -0
  17. package/dist/types/common/Poll.d.ts.map +1 -1
  18. package/dist/types/feed/event-handlers/activity-updater.d.ts +2 -2
  19. package/dist/types/feed/event-handlers/activity-updater.d.ts.map +1 -1
  20. package/dist/types/feeds-client/feeds-client.d.ts.map +1 -1
  21. package/package.json +1 -1
  22. package/src/bindings/react/hooks/feed-state-hooks/index.ts +1 -0
  23. package/src/bindings/react/hooks/feed-state-hooks/useMembers.ts +55 -0
  24. package/src/common/Poll.ts +5 -2
  25. package/src/feed/event-handlers/activity-updater.ts +2 -0
  26. package/src/feeds-client/feeds-client.ts +10 -11
  27. package/dist/feeds-client-CF1yEox0.js.map +0 -1
  28. package/dist/feeds-client-CSg4hlZ4.mjs.map +0 -1
@@ -4010,7 +4010,7 @@ const getRateLimitFromResponseHeader = (response_headers) => {
4010
4010
  };
4011
4011
  return result;
4012
4012
  };
4013
- const version = "0.3.46";
4013
+ const version = "0.3.47";
4014
4014
  const axios = axiosImport.default ?? axiosImport;
4015
4015
  class ApiClient {
4016
4016
  constructor(apiKey, tokenManager, connectionIdManager, options) {
@@ -4539,13 +4539,16 @@ class StreamPoll {
4539
4539
  const isOwnVote = event.poll_vote.user_id === this.client.state.getLatestValue().connected_user?.id;
4540
4540
  let latestAnswers = [...currentState.latest_answers];
4541
4541
  let ownAnswer = currentState.own_answer;
4542
- const ownVotesByOptionId = currentState.own_votes_by_option_id;
4542
+ let ownVotesByOptionId = currentState.own_votes_by_option_id;
4543
4543
  let maxVotedOptionIds = currentState.max_voted_option_ids;
4544
4544
  if (isOwnVote) {
4545
4545
  if (isVoteAnswer(event.poll_vote)) {
4546
4546
  ownAnswer = event.poll_vote;
4547
4547
  } else if (event.poll_vote.option_id) {
4548
- ownVotesByOptionId[event.poll_vote.option_id] = event.poll_vote;
4548
+ ownVotesByOptionId = {
4549
+ ...ownVotesByOptionId,
4550
+ [event.poll_vote.option_id]: event.poll_vote
4551
+ };
4549
4552
  }
4550
4553
  }
4551
4554
  if (isVoteAnswer(event.poll_vote)) {
@@ -5731,7 +5734,9 @@ const updateActivity = ({
5731
5734
  return {
5732
5735
  ...newActivtiy,
5733
5736
  own_reactions: currentActivity.own_reactions,
5734
- own_bookmarks: currentActivity.own_bookmarks
5737
+ own_bookmarks: currentActivity.own_bookmarks,
5738
+ friend_reactions: currentActivity.friend_reactions,
5739
+ friend_reaction_count: currentActivity.friend_reaction_count
5735
5740
  };
5736
5741
  };
5737
5742
  const sharedUpdateActivity$3 = updateActivity;
@@ -7871,17 +7876,16 @@ class FeedsClient extends FeedsApi {
7871
7876
  }
7872
7877
  hydratePollCache(activities) {
7873
7878
  for (const activity of activities) {
7874
- if (!activity.poll) {
7875
- continue;
7876
- }
7877
- const pollResponse = activity.poll;
7878
- const pollFromCache = this.pollFromState(pollResponse.id);
7879
- if (!pollFromCache) {
7880
- const poll = new StreamPoll({ client: this, poll: pollResponse });
7881
- this.polls_by_id.set(poll.id, poll);
7882
- } else {
7883
- pollFromCache.reinitializeState(pollResponse);
7884
- }
7879
+ const polls = [activity.poll, activity.parent?.poll].filter((p) => !!p);
7880
+ polls.forEach((pollResponse) => {
7881
+ const pollFromCache = this.pollFromState(pollResponse.id);
7882
+ if (!pollFromCache) {
7883
+ const poll = new StreamPoll({ client: this, poll: pollResponse });
7884
+ this.polls_by_id.set(poll.id, poll);
7885
+ } else {
7886
+ pollFromCache.reinitializeState(pollResponse);
7887
+ }
7888
+ });
7885
7889
  }
7886
7890
  }
7887
7891
  async queryFeeds(request) {
@@ -8093,4 +8097,4 @@ export {
8093
8097
  shouldUpdateState as s,
8094
8098
  uniqueArrayMerge as u
8095
8099
  };
8096
- //# sourceMappingURL=feeds-client-CSg4hlZ4.mjs.map
8100
+ //# sourceMappingURL=feeds-client-ykIZW9Hi.mjs.map