@stream-io/feeds-client 0.3.2 → 0.3.4

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/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.3.4](https://github.com/GetStream/stream-feeds-js/compare/@stream-io/feeds-client-0.3.3...@stream-io/feeds-client-0.3.4) (2025-11-04)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * forward all relevant config options from getOrCreate in getNextPage ([#158](https://github.com/GetStream/stream-feeds-js/issues/158)) ([a6216a8](https://github.com/GetStream/stream-feeds-js/commit/a6216a83d26f7045e8fcc38b6ff142e5bc75f7e6))
11
+ * getNextPage returns undefined if there is no more page to fetch ([#157](https://github.com/GetStream/stream-feeds-js/issues/157)) ([7bf9093](https://github.com/GetStream/stream-feeds-js/commit/7bf90938585032aec9160b6f07885dd5a681953f))
12
+
13
+ ## [0.3.3](https://github.com/GetStream/stream-feeds-js/compare/@stream-io/feeds-client-0.3.2...@stream-io/feeds-client-0.3.3) (2025-10-31)
14
+
15
+
16
+ ### Features
17
+
18
+ * client-side features to support reading feeds with filter ([#155](https://github.com/GetStream/stream-feeds-js/issues/155)) ([8552de1](https://github.com/GetStream/stream-feeds-js/commit/8552de1566560b436b1e62189f0497f8d14fe57f))
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * check pinned activities as well when updating from user events ([#153](https://github.com/GetStream/stream-feeds-js/issues/153)) ([d895b94](https://github.com/GetStream/stream-feeds-js/commit/d895b94544eaf58d94467e02f12fce0c5f2f620e))
24
+
5
25
  ## [0.3.2](https://github.com/GetStream/stream-feeds-js/compare/@stream-io/feeds-client-0.3.1...@stream-io/feeds-client-0.3.2) (2025-10-30)
6
26
 
7
27
 
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const stateStore = require("@stream-io/state-store");
4
- const feedsClient = require("../feeds-client-jZwPzici.js");
4
+ const feedsClient = require("../feeds-client-HvoTzr-z.js");
5
5
  const loggerInternal = require("@stream-io/logger");
6
6
  const ChannelOwnCapability = {
7
7
  BAN_CHANNEL_MEMBERS: "ban-channel-members",
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require$$0 = require("react");
4
4
  require("@stream-io/state-store");
5
- const feedsClient = require("../feeds-client-jZwPzici.js");
5
+ const feedsClient = require("../feeds-client-HvoTzr-z.js");
6
6
  require("@stream-io/logger");
7
7
  require("axios");
8
8
  var shim = { exports: {} };
package/dist/es/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { StateStore } from "@stream-io/state-store";
2
2
  export * from "@stream-io/state-store";
3
- import { d as debounce } from "../feeds-client-ZdWyhS1v.mjs";
4
- import { C, a, F, S, b, c, m, o, n, k, g, e, h, f, j, i, r, s, u, l } from "../feeds-client-ZdWyhS1v.mjs";
3
+ import { d as debounce } from "../feeds-client-CNHZvctN.mjs";
4
+ import { C, a, F, S, b, c, m, o, n, k, g, e, h, f, j, i, r, s, u, l } from "../feeds-client-CNHZvctN.mjs";
5
5
  import { LogLevelEnum, restoreDefaults } from "@stream-io/logger";
6
6
  const ChannelOwnCapability = {
7
7
  BAN_CHANNEL_MEMBERS: "ban-channel-members",
@@ -1,6 +1,6 @@
1
1
  import require$$0, { useCallback, useMemo, useState, useEffect, createContext, useContext, useRef } from "react";
2
2
  import "@stream-io/state-store";
3
- import { F as FeedsClient, g as isCommentResponse, c as checkHasAnotherPage } from "../feeds-client-ZdWyhS1v.mjs";
3
+ import { F as FeedsClient, g as isCommentResponse, c as checkHasAnotherPage } from "../feeds-client-CNHZvctN.mjs";
4
4
  import "@stream-io/logger";
5
5
  import "axios";
6
6
  var shim = { exports: {} };
@@ -3764,7 +3764,7 @@ const getRateLimitFromResponseHeader = (response_headers) => {
3764
3764
  };
3765
3765
  return result;
3766
3766
  };
3767
- const version = "0.3.2";
3767
+ const version = "0.3.4";
3768
3768
  class ApiClient {
3769
3769
  constructor(apiKey, tokenManager, connectionIdManager, options) {
3770
3770
  this.apiKey = apiKey;
@@ -5361,6 +5361,11 @@ function addActivitiesToState(newActivities, activities, position) {
5361
5361
  return result;
5362
5362
  }
5363
5363
  function handleActivityAdded(event) {
5364
+ if (this.activityAddedEventFilter) {
5365
+ if (!this.activityAddedEventFilter(event)) {
5366
+ return;
5367
+ }
5368
+ }
5364
5369
  const currentActivities = this.currentState.activities;
5365
5370
  const result = addActivitiesToState.bind(this)(
5366
5371
  [event.activity],
@@ -6055,8 +6060,9 @@ function handleActivityFeedback(event) {
6055
6060
  }
6056
6061
  }
6057
6062
  const _Feed = class _Feed extends FeedApi {
6058
- constructor(client, groupId, id, data, watch = false, addNewActivitiesTo = "start") {
6063
+ constructor(client, groupId, id, data, watch = false, addNewActivitiesTo = "start", activityAddedEventFilter) {
6059
6064
  super(client, groupId, id);
6065
+ this.activityAddedEventFilter = activityAddedEventFilter;
6060
6066
  this.indexedActivityIds = /* @__PURE__ */ new Set();
6061
6067
  this.stateUpdateQueue = /* @__PURE__ */ new Set();
6062
6068
  this.eventHandlers = {
@@ -6152,6 +6158,11 @@ const _Feed = class _Feed extends FeedApi {
6152
6158
  hasActivity(activityId) {
6153
6159
  return this.indexedActivityIds.has(activityId);
6154
6160
  }
6161
+ hasPinnedActivity(activityId) {
6162
+ return this.currentState.pinned_activities?.some(
6163
+ (pinnedActivity) => pinnedActivity.activity.id === activityId
6164
+ );
6165
+ }
6155
6166
  async synchronize() {
6156
6167
  const { last_get_or_create_request_config } = this.state.getLatestValue();
6157
6168
  if (last_get_or_create_request_config?.watch) {
@@ -6571,9 +6582,17 @@ const _Feed = class _Feed extends FeedApi {
6571
6582
  });
6572
6583
  return response;
6573
6584
  }
6585
+ /**
6586
+ * Fetches the next page of activities for the feed.
6587
+ * @returns The response from the API or `undefined` if there is no next page.
6588
+ */
6574
6589
  async getNextPage() {
6575
6590
  const currentState = this.currentState;
6591
+ if (!currentState.next) {
6592
+ return;
6593
+ }
6576
6594
  return await this.getOrCreate({
6595
+ ...currentState.last_get_or_create_request_config,
6577
6596
  member_pagination: {
6578
6597
  limit: 0
6579
6598
  },
@@ -6583,8 +6602,8 @@ const _Feed = class _Feed extends FeedApi {
6583
6602
  following_pagination: {
6584
6603
  limit: 0
6585
6604
  },
6586
- next: currentState.next,
6587
- limit: currentState.last_get_or_create_request_config?.limit ?? 20
6605
+ watch: void 0,
6606
+ next: currentState.next
6588
6607
  });
6589
6608
  }
6590
6609
  async addActivity(request) {
@@ -6992,7 +7011,8 @@ class FeedsClient extends FeedsApi {
6992
7011
  id,
6993
7012
  void 0,
6994
7013
  void 0,
6995
- options2?.addNewActivitiesTo
7014
+ options2?.addNewActivitiesTo,
7015
+ options2?.activityAddedEventFilter
6996
7016
  );
6997
7017
  };
6998
7018
  this.updateNetworkConnectionStatus = (event) => {
@@ -7002,7 +7022,7 @@ class FeedsClient extends FeedsApi {
7002
7022
  };
7003
7023
  this.eventDispatcher.dispatch(networkEvent);
7004
7024
  };
7005
- this.getOrCreateActiveFeed = (group, id, data, watch, addNewActivitiesTo) => {
7025
+ this.getOrCreateActiveFeed = (group, id, data, watch, addNewActivitiesTo, activityAddedEventFilter) => {
7006
7026
  const fid = `${group}:${id}`;
7007
7027
  if (!this.activeFeeds[fid]) {
7008
7028
  this.activeFeeds[fid] = new Feed(
@@ -7011,7 +7031,8 @@ class FeedsClient extends FeedsApi {
7011
7031
  id,
7012
7032
  data,
7013
7033
  watch,
7014
- addNewActivitiesTo
7034
+ addNewActivitiesTo,
7035
+ activityAddedEventFilter
7015
7036
  );
7016
7037
  }
7017
7038
  const feed = this.activeFeeds[fid];
@@ -7121,13 +7142,13 @@ class FeedsClient extends FeedsApi {
7121
7142
  case "feeds.bookmark.deleted":
7122
7143
  case "feeds.bookmark.updated": {
7123
7144
  const activityId = event.bookmark.activity.id;
7124
- const feeds = this.findActiveFeedByActivityId(activityId);
7145
+ const feeds = this.findActiveFeedsByActivityId(activityId);
7125
7146
  feeds.forEach((f) => f.handleWSEvent(event));
7126
7147
  break;
7127
7148
  }
7128
7149
  case "feeds.activity.feedback": {
7129
7150
  const activityId = event.activity_feedback.activity_id;
7130
- const feeds = this.findActiveFeedByActivityId(activityId);
7151
+ const feeds = this.findActiveFeedsByActivityId(activityId);
7131
7152
  feeds.forEach((f) => f.handleWSEvent(event));
7132
7153
  break;
7133
7154
  }
@@ -7265,11 +7286,9 @@ class FeedsClient extends FeedsApi {
7265
7286
  }
7266
7287
  return response;
7267
7288
  }
7268
- findActiveFeedByActivityId(activityId) {
7289
+ findActiveFeedsByActivityId(activityId) {
7269
7290
  return Object.values(this.activeFeeds).filter(
7270
- (feed) => feed.currentState.activities?.some(
7271
- (activity) => activity.id === activityId
7272
- )
7291
+ (feed) => feed.hasActivity(activityId) || feed.hasPinnedActivity(activityId)
7273
7292
  );
7274
7293
  }
7275
7294
  }
@@ -7296,4 +7315,4 @@ export {
7296
7315
  shouldUpdateState as s,
7297
7316
  uniqueArrayMerge as u
7298
7317
  };
7299
- //# sourceMappingURL=feeds-client-ZdWyhS1v.mjs.map
7318
+ //# sourceMappingURL=feeds-client-CNHZvctN.mjs.map