@amityco/ts-sdk-react-native 7.17.1-fe996ae.0 → 7.18.1-72bd324a.0

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 (70) hide show
  1. package/dist/@types/domains/community.d.ts +2 -0
  2. package/dist/@types/domains/community.d.ts.map +1 -1
  3. package/dist/@types/domains/content.d.ts +1 -1
  4. package/dist/@types/domains/notificationSettings.d.ts +101 -0
  5. package/dist/@types/domains/notificationSettings.d.ts.map +1 -0
  6. package/dist/@types/index.d.ts +1 -0
  7. package/dist/@types/index.d.ts.map +1 -1
  8. package/dist/cache/api/ingestInCache.d.ts.map +1 -1
  9. package/dist/client/api/index.d.ts +1 -0
  10. package/dist/client/api/index.d.ts.map +1 -1
  11. package/dist/client/api/notifications.d.ts +27 -0
  12. package/dist/client/api/notifications.d.ts.map +1 -0
  13. package/dist/client/api/setupLoginSubscriptions.d.ts.map +1 -1
  14. package/dist/commentRepository/api/tests/integration/createComment.integration.test.d.ts +2 -0
  15. package/dist/commentRepository/api/tests/integration/createComment.integration.test.d.ts.map +1 -0
  16. package/dist/commentRepository/api/tests/integration/deleteComment.integration.test.d.ts +2 -0
  17. package/dist/commentRepository/api/tests/integration/deleteComment.integration.test.d.ts.map +1 -0
  18. package/dist/commentRepository/api/tests/integration/flagComment.integration.test.d.ts +2 -0
  19. package/dist/commentRepository/api/tests/integration/flagComment.integration.test.d.ts.map +1 -0
  20. package/dist/commentRepository/api/tests/integration/getComment.integration.test.d.ts +2 -0
  21. package/dist/commentRepository/api/tests/integration/getComment.integration.test.d.ts.map +1 -0
  22. package/dist/commentRepository/api/tests/integration/getCommentByIds.integration.test.d.ts +2 -0
  23. package/dist/commentRepository/api/tests/integration/getCommentByIds.integration.test.d.ts.map +1 -0
  24. package/dist/commentRepository/api/tests/integration/getComments.integration.test.d.ts +2 -0
  25. package/dist/commentRepository/api/tests/integration/getComments.integration.test.d.ts.map +1 -0
  26. package/dist/commentRepository/api/tests/integration/hardDeleteComment.integration.test.d.ts +2 -0
  27. package/dist/commentRepository/api/tests/integration/hardDeleteComment.integration.test.d.ts.map +1 -0
  28. package/dist/commentRepository/api/tests/integration/isCommentFlaggedByMe.integration.test.d.ts +2 -0
  29. package/dist/commentRepository/api/tests/integration/isCommentFlaggedByMe.integration.test.d.ts.map +1 -0
  30. package/dist/commentRepository/api/tests/integration/queryComments.integration.test.d.ts +2 -0
  31. package/dist/commentRepository/api/tests/integration/queryComments.integration.test.d.ts.map +1 -0
  32. package/dist/commentRepository/api/tests/integration/softDeleteComment.integration.test.d.ts +2 -0
  33. package/dist/commentRepository/api/tests/integration/softDeleteComment.integration.test.d.ts.map +1 -0
  34. package/dist/commentRepository/api/tests/integration/unflagComment.integration.test.d.ts +2 -0
  35. package/dist/commentRepository/api/tests/integration/unflagComment.integration.test.d.ts.map +1 -0
  36. package/dist/commentRepository/api/tests/integration/updateComment.integration.test.d.ts +2 -0
  37. package/dist/commentRepository/api/tests/integration/updateComment.integration.test.d.ts.map +1 -0
  38. package/dist/commentRepository/events/utils.d.ts.map +1 -1
  39. package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersLiveCollectionController.d.ts.map +1 -1
  40. package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersPaginationController.d.ts.map +1 -1
  41. package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts.map +1 -1
  42. package/dist/communityRepository/communityMembership/observers/getMembers.d.ts.map +1 -1
  43. package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersLiveCollectionController.d.ts.map +1 -1
  44. package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersPaginationController.d.ts.map +1 -1
  45. package/dist/index.cjs.js +400 -44
  46. package/dist/index.esm.js +401 -45
  47. package/dist/index.umd.js +3 -3
  48. package/dist/postRepository/api/tests/integration/pinProduct.integration.test.d.ts +2 -0
  49. package/dist/postRepository/api/tests/integration/pinProduct.integration.test.d.ts.map +1 -0
  50. package/dist/postRepository/api/tests/integration/setup.d.ts +2 -0
  51. package/dist/postRepository/api/tests/integration/setup.d.ts.map +1 -1
  52. package/dist/postRepository/api/tests/integration/unpinProduct.integration.test.d.ts +2 -0
  53. package/dist/postRepository/api/tests/integration/unpinProduct.integration.test.d.ts.map +1 -0
  54. package/dist/postRepository/api/tests/integration/updateProductTags.integration.test.d.ts +2 -0
  55. package/dist/postRepository/api/tests/integration/updateProductTags.integration.test.d.ts.map +1 -0
  56. package/dist/productRepository/tests/integration/productAnalytics.integration.test.d.ts +2 -0
  57. package/dist/productRepository/tests/integration/productAnalytics.integration.test.d.ts.map +1 -0
  58. package/dist/roomRepository/api/tests/integration/setup.d.ts +11 -0
  59. package/dist/roomRepository/api/tests/integration/setup.d.ts.map +1 -0
  60. package/dist/roomRepository/api/tests/integration/updateCohostPermission.integration.test.d.ts +2 -0
  61. package/dist/roomRepository/api/tests/integration/updateCohostPermission.integration.test.d.ts.map +1 -0
  62. package/dist/userRepository/api/getAllBlockedUsers.d.ts +17 -0
  63. package/dist/userRepository/api/getAllBlockedUsers.d.ts.map +1 -0
  64. package/dist/userRepository/api/index.d.ts +1 -0
  65. package/dist/userRepository/api/index.d.ts.map +1 -1
  66. package/dist/userRepository/services/BlockedUserSyncEngine/blockedUserSyncEngine.d.ts +55 -0
  67. package/dist/userRepository/services/BlockedUserSyncEngine/blockedUserSyncEngine.d.ts.map +1 -0
  68. package/dist/userRepository/services/BlockedUserSyncEngine/blockedUserSyncEngineOnLoginHandler.d.ts +3 -0
  69. package/dist/userRepository/services/BlockedUserSyncEngine/blockedUserSyncEngineOnLoginHandler.d.ts.map +1 -0
  70. package/package.json +3 -2
package/dist/index.cjs.js CHANGED
@@ -135,7 +135,7 @@ exports.ContentFlagReasonEnum = void 0;
135
135
  ContentFlagReasonEnum["SelfHarmOrSuicide"] = "Self-harm or suicide";
136
136
  ContentFlagReasonEnum["ViolenceOrThreateningContent"] = "Violence or threatening content";
137
137
  ContentFlagReasonEnum["SellingRestrictedItems"] = "Selling and promoting restricted items";
138
- ContentFlagReasonEnum["SexualContentOrNudity"] = "Sexual message or nudity";
138
+ ContentFlagReasonEnum["SexualContentOrNudity"] = "Sexual content or nudity";
139
139
  ContentFlagReasonEnum["SpamOrScams"] = "Spam or scams";
140
140
  ContentFlagReasonEnum["FalseInformation"] = "False information or misinformation";
141
141
  ContentFlagReasonEnum["Others"] = "Others";
@@ -276,10 +276,43 @@ exports.AnalyticsSourceTypeEnum = void 0;
276
276
  AnalyticsSourceTypeEnum["ROOM"] = "room";
277
277
  })(exports.AnalyticsSourceTypeEnum || (exports.AnalyticsSourceTypeEnum = {}));
278
278
 
279
+ exports.UserNotificationModuleNameEnum = void 0;
280
+ (function (UserNotificationModuleNameEnum) {
281
+ UserNotificationModuleNameEnum["CHAT"] = "chat";
282
+ UserNotificationModuleNameEnum["SOCIAL"] = "social";
283
+ UserNotificationModuleNameEnum["VIDEO_STREAMING"] = "video-streaming";
284
+ })(exports.UserNotificationModuleNameEnum || (exports.UserNotificationModuleNameEnum = {}));
285
+ exports.CommunityNotificationEventNameEnum = void 0;
286
+ (function (CommunityNotificationEventNameEnum) {
287
+ CommunityNotificationEventNameEnum["POST_CREATED"] = "post.created";
288
+ CommunityNotificationEventNameEnum["POST_REACTED"] = "post.reacted";
289
+ CommunityNotificationEventNameEnum["COMMENT_CREATED"] = "comment.created";
290
+ CommunityNotificationEventNameEnum["COMMENT_REPLIED"] = "comment.replied";
291
+ CommunityNotificationEventNameEnum["COMMENT_REACTED"] = "comment.reacted";
292
+ CommunityNotificationEventNameEnum["STORY_CREATED"] = "story.created";
293
+ CommunityNotificationEventNameEnum["STORY_REACTED"] = "story.reacted";
294
+ CommunityNotificationEventNameEnum["STORY_COMMENT_CREATED"] = "story-comment.created";
295
+ CommunityNotificationEventNameEnum["LIVESTREAM_START"] = "video-streaming.didStart";
296
+ })(exports.CommunityNotificationEventNameEnum || (exports.CommunityNotificationEventNameEnum = {}));
297
+ exports.NotificationSettingsLevelEnum = void 0;
298
+ (function (NotificationSettingsLevelEnum) {
299
+ NotificationSettingsLevelEnum["USER"] = "user";
300
+ NotificationSettingsLevelEnum["COMMUNITY"] = "community";
301
+ NotificationSettingsLevelEnum["CHANNEL"] = "channel";
302
+ })(exports.NotificationSettingsLevelEnum || (exports.NotificationSettingsLevelEnum = {}));
303
+ /**
304
+ * `NOT` variant is intentionally excluded from public API (internal server-side use only).
305
+ */
306
+ exports.NotificationRolesFilterTypeEnum = void 0;
307
+ (function (NotificationRolesFilterTypeEnum) {
308
+ NotificationRolesFilterTypeEnum["ALL"] = "all";
309
+ NotificationRolesFilterTypeEnum["ONLY"] = "only";
310
+ })(exports.NotificationRolesFilterTypeEnum || (exports.NotificationRolesFilterTypeEnum = {}));
311
+
279
312
  function getVersion() {
280
313
  try {
281
- // the string ''v7.17.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
282
- return 'v7.17.0-cjs';
314
+ // the string ''v7.18.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
315
+ return 'v7.18.0-cjs';
283
316
  }
284
317
  catch (error) {
285
318
  return '__dev__';
@@ -1881,13 +1914,13 @@ class NetworkActivitiesWatcher {
1881
1914
  this._listener.clear();
1882
1915
  }
1883
1916
  }
1884
- let instance$8;
1917
+ let instance$9;
1885
1918
  var NetworkActivitiesWatcher$1 = {
1886
1919
  getInstance: () => {
1887
- if (!instance$8) {
1888
- instance$8 = new NetworkActivitiesWatcher();
1920
+ if (!instance$9) {
1921
+ instance$9 = new NetworkActivitiesWatcher();
1889
1922
  }
1890
- return instance$8;
1923
+ return instance$9;
1891
1924
  },
1892
1925
  };
1893
1926
 
@@ -4955,6 +4988,8 @@ const ingestInCache = (payload = {}, options, replace = true) => {
4955
4988
  const resolver = getResolver(type);
4956
4989
  if (!resolver)
4957
4990
  return;
4991
+ if (!models)
4992
+ return;
4958
4993
  models.forEach(model => {
4959
4994
  (replace ? pushToCache : upsertInCache)([type, 'get', resolver(model)], model, options);
4960
4995
  });
@@ -6989,13 +7024,13 @@ class SessionWatcher {
6989
7024
  this._listener.clear();
6990
7025
  }
6991
7026
  }
6992
- let instance$7;
7027
+ let instance$8;
6993
7028
  var SessionWatcher$1 = {
6994
7029
  getInstance: () => {
6995
- if (!instance$7) {
6996
- instance$7 = new SessionWatcher();
7030
+ if (!instance$8) {
7031
+ instance$8 = new SessionWatcher();
6997
7032
  }
6998
- return instance$7;
7033
+ return instance$8;
6999
7034
  },
7000
7035
  };
7001
7036
 
@@ -8057,13 +8092,13 @@ class AnalyticsEngine {
8057
8092
  this._eventCapturer.resetAllBuckets();
8058
8093
  }
8059
8094
  }
8060
- let instance$6;
8095
+ let instance$7;
8061
8096
  var AnalyticsEngine$1 = {
8062
8097
  getInstance: () => {
8063
- if (!instance$6) {
8064
- instance$6 = new AnalyticsEngine();
8098
+ if (!instance$7) {
8099
+ instance$7 = new AnalyticsEngine();
8065
8100
  }
8066
- return instance$6;
8101
+ return instance$7;
8067
8102
  },
8068
8103
  };
8069
8104
 
@@ -8291,12 +8326,12 @@ class MessageReadReceiptSyncEngine {
8291
8326
  }
8292
8327
  }
8293
8328
  }
8294
- let instance$5 = null;
8329
+ let instance$6 = null;
8295
8330
  var ReadReceiptSyncEngine = {
8296
8331
  getInstance: () => {
8297
- if (!instance$5)
8298
- instance$5 = new MessageReadReceiptSyncEngine();
8299
- return instance$5;
8332
+ if (!instance$6)
8333
+ instance$6 = new MessageReadReceiptSyncEngine();
8334
+ return instance$6;
8300
8335
  },
8301
8336
  };
8302
8337
 
@@ -8550,12 +8585,12 @@ class LegacyMessageReadReceiptSyncEngine {
8550
8585
  }
8551
8586
  }
8552
8587
  }
8553
- let instance$4 = null;
8588
+ let instance$5 = null;
8554
8589
  var LegacyReadReceiptSyncEngine = {
8555
8590
  getInstance: () => {
8556
- if (!instance$4)
8557
- instance$4 = new LegacyMessageReadReceiptSyncEngine();
8558
- return instance$4;
8591
+ if (!instance$5)
8592
+ instance$5 = new LegacyMessageReadReceiptSyncEngine();
8593
+ return instance$5;
8559
8594
  },
8560
8595
  };
8561
8596
 
@@ -8831,12 +8866,12 @@ class ObjectResolverEngine {
8831
8866
  this.stopResolver();
8832
8867
  }
8833
8868
  }
8834
- let instance$3 = null;
8869
+ let instance$4 = null;
8835
8870
  var ObjectResolverEngine$1 = {
8836
8871
  getInstance: () => {
8837
- if (!instance$3)
8838
- instance$3 = new ObjectResolverEngine();
8839
- return instance$3;
8872
+ if (!instance$4)
8873
+ instance$4 = new ObjectResolverEngine();
8874
+ return instance$4;
8840
8875
  },
8841
8876
  };
8842
8877
 
@@ -8986,13 +9021,13 @@ class LiveReactionSyncEngine {
8986
9021
  this.stopReactionsSync();
8987
9022
  }
8988
9023
  }
8989
- let instance$2;
9024
+ let instance$3;
8990
9025
  var ReactionSyncEngine = {
8991
9026
  getInstance: () => {
8992
- if (!instance$2) {
8993
- instance$2 = new LiveReactionSyncEngine();
9027
+ if (!instance$3) {
9028
+ instance$3 = new LiveReactionSyncEngine();
8994
9029
  }
8995
- return instance$2;
9030
+ return instance$3;
8996
9031
  },
8997
9032
  };
8998
9033
 
@@ -9014,6 +9049,148 @@ var reactionSyncEngineOnLoginHandler = () => {
9014
9049
  };
9015
9050
  };
9016
9051
 
9052
+ function prepareBlockedUserPayload(response) {
9053
+ const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
9054
+ return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
9055
+ const followUser = users.find(user => user.userId === follow.from);
9056
+ return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
9057
+ }), users: users.map(convertRawUserToInternalUser) });
9058
+ }
9059
+
9060
+ const BLOCK_LIST_LIMIT = 100;
9061
+ const TTL_MS = 5 * 60 * 1000; // 5 minutes
9062
+ /**
9063
+ * Session-scoped singleton engine that manages TTL-based fetching and caching
9064
+ * of blocked users. Provides a lazy `ensureFetched()` gate for the
9065
+ * `getAllBlockedUsers()` API.
9066
+ *
9067
+ * Key behaviours:
9068
+ * - `establish()` is a no-op — fetch is lazy, triggered only by consumer call
9069
+ * - `destroy()` resets `lastFetchedAt` to null (ensures fresh fetch on next session)
9070
+ * - `ensureFetched()` fetches from server only when cache is expired or never fetched
9071
+ * - `lastFetchedAt` is only updated on successful fetch
9072
+ * - `blockedUserIds` is kept in sync with each successful fetch
9073
+ *
9074
+ * @internal
9075
+ */
9076
+ class BlockedUserSyncEngine {
9077
+ constructor() {
9078
+ /** Epoch ms of last successful fetch. null = never fetched in this session. */
9079
+ this.lastFetchedAt = null;
9080
+ /** Ordered list of userId strings from the most recent successful fetch. */
9081
+ this.blockedUserIds = [];
9082
+ }
9083
+ // ---------------------------------------------------------------------------
9084
+ // SessionComponent lifecycle
9085
+ // ---------------------------------------------------------------------------
9086
+ /** No-op — fetch is lazy, triggered by consumer calling getAllBlockedUsers(). */
9087
+ // eslint-disable-next-line class-methods-use-this
9088
+ onSessionEstablished() {
9089
+ // intentionally empty
9090
+ }
9091
+ /** Resets state so the next session starts with a cold cache. */
9092
+ onSessionDestroyed() {
9093
+ this.lastFetchedAt = null;
9094
+ this.blockedUserIds = [];
9095
+ }
9096
+ /** No-op for this engine. */
9097
+ // eslint-disable-next-line class-methods-use-this
9098
+ onTokenExpired() {
9099
+ // intentionally empty
9100
+ }
9101
+ // ---------------------------------------------------------------------------
9102
+ // Cache helpers
9103
+ // ---------------------------------------------------------------------------
9104
+ isCacheExpired() {
9105
+ if (this.lastFetchedAt === null)
9106
+ return true;
9107
+ return Date.now() - this.lastFetchedAt > TTL_MS;
9108
+ }
9109
+ // ---------------------------------------------------------------------------
9110
+ // Core fetch gate
9111
+ // ---------------------------------------------------------------------------
9112
+ /**
9113
+ * Ensures the local store is populated with fresh blocked-user data.
9114
+ *
9115
+ * - If the cache is still within the 5-minute TTL window: resolves immediately
9116
+ * (no server call).
9117
+ * - If the cache is expired (or never fetched): fetches from the server,
9118
+ * persists the payload to the cache, and updates `lastFetchedAt`.
9119
+ *
9120
+ * On failure the error propagates to the caller and `lastFetchedAt` is NOT
9121
+ * updated, so the next call will retry.
9122
+ */
9123
+ async ensureFetched() {
9124
+ if (!this.isCacheExpired())
9125
+ return;
9126
+ const client = getActiveClient();
9127
+ const { data } = await client.http.get('/api/v4/me/user-blocks', { params: { options: { limit: BLOCK_LIST_LIMIT }, isDeleted: false } });
9128
+ const cachedAt = client.cache && Date.now();
9129
+ const payload = prepareBlockedUserPayload(data);
9130
+ if (client.cache) {
9131
+ ingestInCache(payload, { cachedAt });
9132
+ }
9133
+ // Keep the ordered list of blocked user IDs for getCachedUsers()
9134
+ this.blockedUserIds = payload.users.map(u => u.userId);
9135
+ // Only update timestamp on success — failure leaves it unchanged so the
9136
+ // next call retries.
9137
+ this.lastFetchedAt = Date.now();
9138
+ }
9139
+ // ---------------------------------------------------------------------------
9140
+ // Local store read
9141
+ // ---------------------------------------------------------------------------
9142
+ /**
9143
+ * Returns blocked {@link Amity.InternalUser} objects from the in-memory cache.
9144
+ *
9145
+ * Applies the spec-mandated filter:
9146
+ * - Only users whose `isDeleted` is false or null
9147
+ * - Hard limit of 100 results
9148
+ *
9149
+ * This always reads the latest local state, so changes made by `blockUser()`
9150
+ * and `unblockUser()` are reflected even within the TTL window.
9151
+ */
9152
+ getCachedUsers() {
9153
+ const client = getActiveClient();
9154
+ if (!client.cache) {
9155
+ // No cache available — fall back to the in-memory list from the last fetch
9156
+ return [];
9157
+ }
9158
+ return this.blockedUserIds
9159
+ .map(id => { var _a; return (_a = pullFromCache(['user', 'get', id])) === null || _a === void 0 ? void 0 : _a.data; })
9160
+ .filter((user) => user != null && user.isDeleted !== true)
9161
+ .slice(0, BLOCK_LIST_LIMIT);
9162
+ }
9163
+ }
9164
+ // ---------------------------------------------------------------------------
9165
+ // Module-level singleton
9166
+ // ---------------------------------------------------------------------------
9167
+ let instance$2 = null;
9168
+ var BlockedUserSyncEngine$1 = {
9169
+ getInstance: () => {
9170
+ if (!instance$2)
9171
+ instance$2 = new BlockedUserSyncEngine();
9172
+ return instance$2;
9173
+ },
9174
+ };
9175
+
9176
+ var blockedUserSyncEngineOnLoginHandler = () => {
9177
+ const blockedUserSyncEngine = BlockedUserSyncEngine$1.getInstance();
9178
+ onSessionStateChange(state => {
9179
+ if (state === "established" /* Amity.SessionStates.ESTABLISHED */) {
9180
+ blockedUserSyncEngine.onSessionEstablished();
9181
+ }
9182
+ else if (state === "tokenExpired" /* Amity.SessionStates.TOKEN_EXPIRED */) {
9183
+ blockedUserSyncEngine.onTokenExpired();
9184
+ }
9185
+ else {
9186
+ blockedUserSyncEngine.onSessionDestroyed();
9187
+ }
9188
+ });
9189
+ return () => {
9190
+ blockedUserSyncEngine.onSessionDestroyed();
9191
+ };
9192
+ };
9193
+
9017
9194
  const EVENTS = [
9018
9195
  'disconnected',
9019
9196
  'error',
@@ -9179,7 +9356,7 @@ const setupLoginSubscriptions = (unsubWatcher) => {
9179
9356
  // NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
9180
9357
  // the channel because currently backend can't handle this, so every time a user is banned from
9181
9358
  // a channel or the channel is deleted the channel's unread count will not be reset to zero
9182
- onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler());
9359
+ onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler(), blockedUserSyncEngineOnLoginHandler());
9183
9360
  if (client.useLegacyUnreadCount) {
9184
9361
  subscriptions.push(readReceiptSyncEngineOnLoginHandler());
9185
9362
  }
@@ -10803,6 +10980,140 @@ const setAccessTokenHandler = (accessTokenHandler) => {
10803
10980
  client.accessTokenHandler = accessTokenHandler;
10804
10981
  };
10805
10982
 
10983
+ function parseRolesFilter(listenFromRoleIds, ignoreFromRoleIds) {
10984
+ if (ignoreFromRoleIds && ignoreFromRoleIds.length > 0) {
10985
+ return { type: 'not', roleIds: ignoreFromRoleIds };
10986
+ }
10987
+ if (listenFromRoleIds && listenFromRoleIds.length > 0) {
10988
+ return { type: exports.NotificationRolesFilterTypeEnum.ONLY, roleIds: listenFromRoleIds };
10989
+ }
10990
+ return { type: exports.NotificationRolesFilterTypeEnum.ALL };
10991
+ }
10992
+ function serializeRolesFilter(rolesFilter) {
10993
+ if ((rolesFilter === null || rolesFilter === void 0 ? void 0 : rolesFilter.type) === exports.NotificationRolesFilterTypeEnum.ONLY) {
10994
+ return { listenFromRoleIds: rolesFilter.roleIds };
10995
+ }
10996
+ return { listenFromRoleIds: [] };
10997
+ }
10998
+ class ChannelNotifications {
10999
+ constructor(channelId) {
11000
+ this.channelId = channelId;
11001
+ }
11002
+ async enable() {
11003
+ const client = getActiveClient();
11004
+ const body = {
11005
+ level: exports.NotificationSettingsLevelEnum.CHANNEL,
11006
+ channelId: this.channelId,
11007
+ isPushNotifiable: true,
11008
+ };
11009
+ await client.http.post('/api/v3/notification/setting', body);
11010
+ }
11011
+ async disable() {
11012
+ const client = getActiveClient();
11013
+ const body = {
11014
+ level: exports.NotificationSettingsLevelEnum.CHANNEL,
11015
+ channelId: this.channelId,
11016
+ isPushNotifiable: false,
11017
+ };
11018
+ await client.http.post('/api/v3/notification/setting', body);
11019
+ }
11020
+ async getSettings() {
11021
+ const client = getActiveClient();
11022
+ const { data } = await client.http.get(`/api/v3/notification/setting?level=${exports.NotificationSettingsLevelEnum.CHANNEL}&channelId=${encodeURIComponent(this.channelId)}`);
11023
+ return { isEnabled: data.isPushNotifiable };
11024
+ }
11025
+ }
11026
+ class UserNotifications {
11027
+ async enable(modules) {
11028
+ var _a;
11029
+ const client = getActiveClient();
11030
+ const notifiableEvents = (_a = modules === null || modules === void 0 ? void 0 : modules.map(module => (Object.assign({ moduleName: module.moduleName, isPushNotifiable: module.isEnabled }, serializeRolesFilter(module.rolesFilter))))) !== null && _a !== void 0 ? _a : [];
11031
+ const body = {
11032
+ level: exports.NotificationSettingsLevelEnum.USER,
11033
+ isPushNotifiable: true,
11034
+ notifiableEvents,
11035
+ };
11036
+ await client.http.post('/api/v3/notification/setting', body);
11037
+ }
11038
+ async disableAllNotifications() {
11039
+ const client = getActiveClient();
11040
+ const body = {
11041
+ level: exports.NotificationSettingsLevelEnum.USER,
11042
+ isPushNotifiable: false,
11043
+ notifiableEvents: [],
11044
+ };
11045
+ await client.http.post('/api/v3/notification/setting', body);
11046
+ }
11047
+ async getSettings() {
11048
+ var _a;
11049
+ const client = getActiveClient();
11050
+ const { data } = await client.http.get(`/api/v3/notification/setting?level=${exports.NotificationSettingsLevelEnum.USER}`);
11051
+ const validModuleNames = Object.values(exports.UserNotificationModuleNameEnum);
11052
+ const modules = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
11053
+ .filter(e => e.moduleName != null && validModuleNames.includes(e.moduleName))
11054
+ .map(e => ({
11055
+ moduleName: e.moduleName,
11056
+ isEnabled: e.isPushNotifiable,
11057
+ rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
11058
+ }));
11059
+ return { isEnabled: data.isPushNotifiable, modules };
11060
+ }
11061
+ }
11062
+ class CommunityNotifications {
11063
+ constructor(communityId) {
11064
+ this.communityId = communityId;
11065
+ }
11066
+ async enable(events) {
11067
+ var _a;
11068
+ const client = getActiveClient();
11069
+ const notifiableEvents = (_a = events === null || events === void 0 ? void 0 : events.map(event => (Object.assign({ moduleName: exports.UserNotificationModuleNameEnum.SOCIAL, name: event.eventName, isPushNotifiable: event.isEnabled }, serializeRolesFilter(event.rolesFilter))))) !== null && _a !== void 0 ? _a : [];
11070
+ const body = {
11071
+ level: exports.NotificationSettingsLevelEnum.COMMUNITY,
11072
+ communityId: this.communityId,
11073
+ isPushNotifiable: true,
11074
+ notifiableEvents,
11075
+ };
11076
+ await client.http.post('/api/v3/notification/setting', body);
11077
+ }
11078
+ async disable() {
11079
+ const client = getActiveClient();
11080
+ const body = {
11081
+ level: exports.NotificationSettingsLevelEnum.COMMUNITY,
11082
+ communityId: this.communityId,
11083
+ isPushNotifiable: false,
11084
+ notifiableEvents: [],
11085
+ };
11086
+ await client.http.post('/api/v3/notification/setting', body);
11087
+ }
11088
+ async getSettings() {
11089
+ var _a;
11090
+ const client = getActiveClient();
11091
+ const { data } = await client.http.get(`/api/v3/notification/setting?level=${exports.NotificationSettingsLevelEnum.COMMUNITY}&communityId=${encodeURIComponent(this.communityId)}`);
11092
+ const validEventNames = Object.values(exports.CommunityNotificationEventNameEnum);
11093
+ const events = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
11094
+ .filter(e => e.name != null && validEventNames.includes(e.name))
11095
+ .map(e => ({
11096
+ eventName: e.name,
11097
+ isEnabled: e.isPushNotifiable,
11098
+ isNetworkEnabled: e.isNetworkEnabled,
11099
+ rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
11100
+ }));
11101
+ return { isEnabled: data.isPushNotifiable, events };
11102
+ }
11103
+ }
11104
+ class Notifications {
11105
+ user() {
11106
+ return new UserNotifications();
11107
+ }
11108
+ community(communityId) {
11109
+ return new CommunityNotifications(communityId);
11110
+ }
11111
+ channel(channelId) {
11112
+ return new ChannelNotifications(channelId);
11113
+ }
11114
+ }
11115
+ const notifications = () => new Notifications();
11116
+
10806
11117
  /**
10807
11118
  * ```js
10808
11119
  * import { onChannelMarkerFetched } from '@amityco/ts-sdk-react-native'
@@ -11186,6 +11497,7 @@ var index$s = /*#__PURE__*/Object.freeze({
11186
11497
  getCurrentUserType: getCurrentUserType,
11187
11498
  setCurrentUserType: setCurrentUserType,
11188
11499
  setAccessTokenHandler: setAccessTokenHandler,
11500
+ notifications: notifications,
11189
11501
  onConnectionError: onConnectionError,
11190
11502
  onClientDisconnected: onClientDisconnected,
11191
11503
  onClientBanned: onClientBanned,
@@ -15729,6 +16041,35 @@ const isUserFlaggedByMe = async (userId) => {
15729
16041
  };
15730
16042
  /* end_public_function */
15731
16043
 
16044
+ /* begin_public_function
16045
+ id: user.get_all_blocked_users
16046
+ */
16047
+ /**
16048
+ * ```js
16049
+ * import { UserRepository } from '@amityco/ts-sdk'
16050
+ * const blockedUsers = await UserRepository.getAllBlockedUsers()
16051
+ * ```
16052
+ *
16053
+ * Returns all blocked users as a non-paginated list (limit 100) with TTL-based caching (5-minute window).
16054
+ * Within the TTL window, subsequent calls resolve instantly from the local store without any server call.
16055
+ * After the TTL expires, the next call triggers a fresh server fetch.
16056
+ *
16057
+ * @returns A promise that resolves to an array of blocked {@link Amity.User} objects
16058
+ *
16059
+ * @category Block API
16060
+ * @async
16061
+ */
16062
+ const getAllBlockedUsers = async () => {
16063
+ const client = getActiveClient();
16064
+ client.log('user/getAllBlockedUsers');
16065
+ const engine = BlockedUserSyncEngine$1.getInstance();
16066
+ // Ensure data is fetched (no-op if cache is fresh)
16067
+ await engine.ensureFetched();
16068
+ // Read from the engine's bounded ID list — O(blocked users) not O(cache size)
16069
+ return engine.getCachedUsers();
16070
+ };
16071
+ /* end_public_function */
16072
+
15732
16073
  /**
15733
16074
  * ```js
15734
16075
  * import { onUserUpdated } from '@amityco/ts-sdk-react-native'
@@ -16150,14 +16491,6 @@ class BlockedUserQueryStreamController extends QueryStreamController {
16150
16491
  }
16151
16492
  }
16152
16493
 
16153
- function prepareBlockedUserPayload(response) {
16154
- const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
16155
- return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
16156
- const followUser = users.find(user => user.userId === follow.from);
16157
- return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
16158
- }), users: users.map(convertRawUserToInternalUser) });
16159
- }
16160
-
16161
16494
  const convertEventPayload = (eventHandler, sourceModelProp, destinationDomain) => (callback) => eventHandler(sourceModel => {
16162
16495
  var _a;
16163
16496
  if (!sourceModel) {
@@ -16544,6 +16877,7 @@ var index$q = /*#__PURE__*/Object.freeze({
16544
16877
  flagUser: flagUser,
16545
16878
  unflagUser: unflagUser,
16546
16879
  isUserFlaggedByMe: isUserFlaggedByMe,
16880
+ getAllBlockedUsers: getAllBlockedUsers,
16547
16881
  onUserUpdated: onUserUpdated,
16548
16882
  onUserDeleted: onUserDeleted$2,
16549
16883
  onUserFlagged: onUserFlagged,
@@ -18223,8 +18557,10 @@ const createLocalCommentEventSubscriber = (event, callback) => {
18223
18557
  else {
18224
18558
  const postCacheKey = ['post', 'get', comments[0].referenceId];
18225
18559
  const postCache = (_d = pullFromCache(postCacheKey)) === null || _d === void 0 ? void 0 : _d.data;
18226
- const updatedPost = Object.assign(Object.assign({}, postCache), { comments: postCache === null || postCache === void 0 ? void 0 : postCache.comments.filter(commentId => { var _a; return commentId !== ((_a = comments[0]) === null || _a === void 0 ? void 0 : _a.commentId); }) });
18227
- pushToCache(postCacheKey, updatedPost);
18560
+ if (postCache) {
18561
+ const updatedPost = Object.assign(Object.assign({}, postCache), { comments: postCache === null || postCache === void 0 ? void 0 : postCache.comments.filter(commentId => { var _a; return commentId !== ((_a = comments[0]) === null || _a === void 0 ? void 0 : _a.commentId); }) });
18562
+ pushToCache(postCacheKey, updatedPost);
18563
+ }
18228
18564
  }
18229
18565
  const queries = (_e = queryCache(['comment', 'query'])) === null || _e === void 0 ? void 0 : _e.filter(({ key }) => { var _a; return ((_a = key[2]) === null || _a === void 0 ? void 0 : _a.referenceId) === comment.data.referenceId; });
18230
18566
  queries === null || queries === void 0 ? void 0 : queries.map(({ key, data }) => upsertInCache(key, data, { cachedAt: -1 }));
@@ -23311,7 +23647,7 @@ const removeMembers = async (communityId, userIds) => {
23311
23647
  */
23312
23648
  class CommunityMembersPaginationController extends PaginationController {
23313
23649
  async getRequest(queryParams, token) {
23314
- const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted"]);
23650
+ const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted, excludingRoles: _excludingRoles } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted", "excludingRoles"]);
23315
23651
  const options = token ? { token } : { limit };
23316
23652
  const isDeleted = includeDeleted === false ? false : undefined;
23317
23653
  const { data: queryResponse } = await this.http.get(`/api/v3/communities/${params.communityId}/users`, {
@@ -23361,6 +23697,7 @@ class CommunityMembersQueryStreamController extends QueryStreamController {
23361
23697
  if (!collection)
23362
23698
  return;
23363
23699
  communityMembers.forEach(communityMember => {
23700
+ var _a;
23364
23701
  const communityMemberCacheId = getResolver('communityUsers')({
23365
23702
  communityId: this.query.communityId,
23366
23703
  userId: communityMember.userId,
@@ -23369,6 +23706,13 @@ class CommunityMembersQueryStreamController extends QueryStreamController {
23369
23706
  collection.data = collection.data.filter(m => m !== communityMemberCacheId);
23370
23707
  }
23371
23708
  else if (!collection.data.includes(communityMemberCacheId)) {
23709
+ // Reactor-level exclusion: prevent excluded items from entering query stream
23710
+ if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
23711
+ const memberRoles = communityMember.roles || [];
23712
+ if (memberRoles.some(role => this.query.excludingRoles.includes(role))) {
23713
+ return; // Skip — don't add to query stream
23714
+ }
23715
+ }
23372
23716
  collection.data = [communityMemberCacheId, ...collection.data];
23373
23717
  }
23374
23718
  });
@@ -23856,6 +24200,7 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
23856
24200
  });
23857
24201
  }
23858
24202
  applyFilter(data) {
24203
+ var _a;
23859
24204
  let communityMembers = filterByPropIntersection(data, 'roles', this.query.roles);
23860
24205
  if (this.query.memberships) {
23861
24206
  communityMembers = communityMembers.filter(({ communityMembership }) => {
@@ -23863,6 +24208,9 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
23863
24208
  return memberships.includes(communityMembership);
23864
24209
  });
23865
24210
  }
24211
+ if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
24212
+ communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => this.query.excludingRoles.includes(role)));
24213
+ }
23866
24214
  if (this.query.includeDeleted === false) {
23867
24215
  communityMembers = communityMembers.filter(({ user }) => (user === null || user === void 0 ? void 0 : user.isDeleted) !== true);
23868
24216
  }
@@ -23884,6 +24232,7 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
23884
24232
  * @hidden
23885
24233
  */
23886
24234
  const applyFilter = (data, params) => {
24235
+ var _a;
23887
24236
  let communityMembers = filterByPropIntersection(data, 'roles', params.roles);
23888
24237
  if (params.memberships) {
23889
24238
  communityMembers = communityMembers.filter(({ communityMembership }) => {
@@ -23891,6 +24240,9 @@ const applyFilter = (data, params) => {
23891
24240
  return membership.includes(communityMembership);
23892
24241
  });
23893
24242
  }
24243
+ if ((_a = params.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
24244
+ communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => params.excludingRoles.includes(role)));
24245
+ }
23894
24246
  const sortBy = params.sortBy ? params.sortBy : 'lastCreated';
23895
24247
  communityMembers = communityMembers.sort(sortBy === 'lastCreated' ? sortByLastCreated : sortByFirstCreated);
23896
24248
  return communityMembers;
@@ -23944,7 +24296,7 @@ const getMembers = (params, callback, config) => {
23944
24296
  */
23945
24297
  class SearchCommunityMembersPaginationController extends PaginationController {
23946
24298
  async getRequest(queryParams, token) {
23947
- const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted"]);
24299
+ const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted, excludingRoles } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted", "excludingRoles"]);
23948
24300
  const options = token ? { token } : { limit };
23949
24301
  const isDeleted = includeDeleted === false ? false : undefined;
23950
24302
  const { data: queryResponse } = await this.http.get(`/api/v3/communities/${params.communityId}/users`, {
@@ -24094,6 +24446,7 @@ class SearchCommunityMembersLiveCollectionController extends LiveCollectionContr
24094
24446
  });
24095
24447
  }
24096
24448
  applyFilter(data) {
24449
+ var _a;
24097
24450
  let communityMembers = filterByPropIntersection(data, 'roles', this.query.roles);
24098
24451
  if (this.query.memberships) {
24099
24452
  communityMembers = communityMembers.filter(({ communityMembership }) => {
@@ -24104,6 +24457,9 @@ class SearchCommunityMembersLiveCollectionController extends LiveCollectionContr
24104
24457
  if (this.query.search) {
24105
24458
  communityMembers = filterBySearchTerm(communityMembers, this.query.search);
24106
24459
  }
24460
+ if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
24461
+ communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => this.query.excludingRoles.includes(role)));
24462
+ }
24107
24463
  if (this.query.includeDeleted === false) {
24108
24464
  communityMembers = communityMembers.filter(({ user }) => (user === null || user === void 0 ? void 0 : user.isDeleted) !== true);
24109
24465
  }