@amityco/ts-sdk-react-native 7.17.1-ea71edb3.0 → 7.18.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.
- package/dist/@types/domains/community.d.ts +2 -0
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/@types/domains/content.d.ts +1 -1
- package/dist/@types/index.d.ts +0 -1
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/cache/api/ingestInCache.d.ts.map +1 -1
- package/dist/client/api/index.d.ts +0 -1
- package/dist/client/api/index.d.ts.map +1 -1
- package/dist/client/api/setupLoginSubscriptions.d.ts.map +1 -1
- package/dist/commentRepository/api/tests/integration/createComment.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/createComment.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/deleteComment.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/deleteComment.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/flagComment.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/flagComment.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/getComment.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/getComment.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/getCommentByIds.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/getCommentByIds.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/getComments.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/getComments.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/hardDeleteComment.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/hardDeleteComment.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/isCommentFlaggedByMe.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/isCommentFlaggedByMe.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/queryComments.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/queryComments.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/softDeleteComment.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/softDeleteComment.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/unflagComment.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/unflagComment.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/updateComment.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/updateComment.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/events/utils.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersPaginationController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersPaginationController.d.ts.map +1 -1
- package/dist/index.cjs.js +233 -220
- package/dist/index.esm.js +234 -221
- package/dist/index.umd.js +3 -3
- package/dist/postRepository/api/tests/integration/pinProduct.integration.test.d.ts +2 -0
- package/dist/postRepository/api/tests/integration/pinProduct.integration.test.d.ts.map +1 -0
- package/dist/postRepository/api/tests/integration/setup.d.ts +2 -0
- package/dist/postRepository/api/tests/integration/setup.d.ts.map +1 -1
- package/dist/postRepository/api/tests/integration/unpinProduct.integration.test.d.ts +2 -0
- package/dist/postRepository/api/tests/integration/unpinProduct.integration.test.d.ts.map +1 -0
- package/dist/postRepository/api/tests/integration/updateProductTags.integration.test.d.ts +2 -0
- package/dist/postRepository/api/tests/integration/updateProductTags.integration.test.d.ts.map +1 -0
- package/dist/productRepository/tests/integration/productAnalytics.integration.test.d.ts +2 -0
- package/dist/productRepository/tests/integration/productAnalytics.integration.test.d.ts.map +1 -0
- package/dist/roomRepository/api/tests/integration/setup.d.ts +11 -0
- package/dist/roomRepository/api/tests/integration/setup.d.ts.map +1 -0
- package/dist/roomRepository/api/tests/integration/updateCohostPermission.integration.test.d.ts +2 -0
- package/dist/roomRepository/api/tests/integration/updateCohostPermission.integration.test.d.ts.map +1 -0
- package/dist/userRepository/api/getAllBlockedUsers.d.ts +17 -0
- package/dist/userRepository/api/getAllBlockedUsers.d.ts.map +1 -0
- package/dist/userRepository/api/index.d.ts +1 -0
- package/dist/userRepository/api/index.d.ts.map +1 -1
- package/dist/userRepository/services/BlockedUserSyncEngine/blockedUserSyncEngine.d.ts +55 -0
- package/dist/userRepository/services/BlockedUserSyncEngine/blockedUserSyncEngine.d.ts.map +1 -0
- package/dist/userRepository/services/BlockedUserSyncEngine/blockedUserSyncEngineOnLoginHandler.d.ts +3 -0
- package/dist/userRepository/services/BlockedUserSyncEngine/blockedUserSyncEngineOnLoginHandler.d.ts.map +1 -0
- package/package.json +3 -2
- package/dist/@types/domains/notificationSettings.d.ts +0 -109
- package/dist/@types/domains/notificationSettings.d.ts.map +0 -1
- package/dist/client/api/notifications.d.ts +0 -27
- package/dist/client/api/notifications.d.ts.map +0 -1
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
|
|
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,50 +276,10 @@ 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.ChannelNotificationEventNameEnum = void 0;
|
|
286
|
-
(function (ChannelNotificationEventNameEnum) {
|
|
287
|
-
ChannelNotificationEventNameEnum["MESSAGE_CREATED"] = "message.created";
|
|
288
|
-
ChannelNotificationEventNameEnum["MESSAGE_REACTED"] = "message.reacted";
|
|
289
|
-
ChannelNotificationEventNameEnum["MENTION_CREATED"] = "mention.created";
|
|
290
|
-
ChannelNotificationEventNameEnum["POLL_VOTE_CREATED"] = "poll.vote.created";
|
|
291
|
-
})(exports.ChannelNotificationEventNameEnum || (exports.ChannelNotificationEventNameEnum = {}));
|
|
292
|
-
exports.CommunityNotificationEventNameEnum = void 0;
|
|
293
|
-
(function (CommunityNotificationEventNameEnum) {
|
|
294
|
-
CommunityNotificationEventNameEnum["POST_CREATED"] = "post.created";
|
|
295
|
-
CommunityNotificationEventNameEnum["POST_REACTED"] = "post.reacted";
|
|
296
|
-
CommunityNotificationEventNameEnum["COMMENT_CREATED"] = "comment.created";
|
|
297
|
-
CommunityNotificationEventNameEnum["COMMENT_REPLIED"] = "comment.replied";
|
|
298
|
-
CommunityNotificationEventNameEnum["COMMENT_REACTED"] = "comment.reacted";
|
|
299
|
-
CommunityNotificationEventNameEnum["STORY_CREATED"] = "story.created";
|
|
300
|
-
CommunityNotificationEventNameEnum["STORY_REACTED"] = "story.reacted";
|
|
301
|
-
CommunityNotificationEventNameEnum["STORY_COMMENT_CREATED"] = "story-comment.created";
|
|
302
|
-
CommunityNotificationEventNameEnum["LIVESTREAM_START"] = "video-streaming.didStart";
|
|
303
|
-
})(exports.CommunityNotificationEventNameEnum || (exports.CommunityNotificationEventNameEnum = {}));
|
|
304
|
-
exports.NotificationSettingsLevelEnum = void 0;
|
|
305
|
-
(function (NotificationSettingsLevelEnum) {
|
|
306
|
-
NotificationSettingsLevelEnum["USER"] = "user";
|
|
307
|
-
NotificationSettingsLevelEnum["COMMUNITY"] = "community";
|
|
308
|
-
NotificationSettingsLevelEnum["CHANNEL"] = "channel";
|
|
309
|
-
})(exports.NotificationSettingsLevelEnum || (exports.NotificationSettingsLevelEnum = {}));
|
|
310
|
-
/**
|
|
311
|
-
* `NOT` variant is intentionally excluded from public API (internal server-side use only).
|
|
312
|
-
*/
|
|
313
|
-
exports.NotificationRolesFilterTypeEnum = void 0;
|
|
314
|
-
(function (NotificationRolesFilterTypeEnum) {
|
|
315
|
-
NotificationRolesFilterTypeEnum["ALL"] = "all";
|
|
316
|
-
NotificationRolesFilterTypeEnum["ONLY"] = "only";
|
|
317
|
-
})(exports.NotificationRolesFilterTypeEnum || (exports.NotificationRolesFilterTypeEnum = {}));
|
|
318
|
-
|
|
319
279
|
function getVersion() {
|
|
320
280
|
try {
|
|
321
|
-
// the string ''v7.
|
|
322
|
-
return 'v7.
|
|
281
|
+
// the string ''v7.18.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
282
|
+
return 'v7.18.0-cjs';
|
|
323
283
|
}
|
|
324
284
|
catch (error) {
|
|
325
285
|
return '__dev__';
|
|
@@ -1921,13 +1881,13 @@ class NetworkActivitiesWatcher {
|
|
|
1921
1881
|
this._listener.clear();
|
|
1922
1882
|
}
|
|
1923
1883
|
}
|
|
1924
|
-
let instance$
|
|
1884
|
+
let instance$9;
|
|
1925
1885
|
var NetworkActivitiesWatcher$1 = {
|
|
1926
1886
|
getInstance: () => {
|
|
1927
|
-
if (!instance$
|
|
1928
|
-
instance$
|
|
1887
|
+
if (!instance$9) {
|
|
1888
|
+
instance$9 = new NetworkActivitiesWatcher();
|
|
1929
1889
|
}
|
|
1930
|
-
return instance$
|
|
1890
|
+
return instance$9;
|
|
1931
1891
|
},
|
|
1932
1892
|
};
|
|
1933
1893
|
|
|
@@ -4995,6 +4955,8 @@ const ingestInCache = (payload = {}, options, replace = true) => {
|
|
|
4995
4955
|
const resolver = getResolver(type);
|
|
4996
4956
|
if (!resolver)
|
|
4997
4957
|
return;
|
|
4958
|
+
if (!models)
|
|
4959
|
+
return;
|
|
4998
4960
|
models.forEach(model => {
|
|
4999
4961
|
(replace ? pushToCache : upsertInCache)([type, 'get', resolver(model)], model, options);
|
|
5000
4962
|
});
|
|
@@ -7029,13 +6991,13 @@ class SessionWatcher {
|
|
|
7029
6991
|
this._listener.clear();
|
|
7030
6992
|
}
|
|
7031
6993
|
}
|
|
7032
|
-
let instance$
|
|
6994
|
+
let instance$8;
|
|
7033
6995
|
var SessionWatcher$1 = {
|
|
7034
6996
|
getInstance: () => {
|
|
7035
|
-
if (!instance$
|
|
7036
|
-
instance$
|
|
6997
|
+
if (!instance$8) {
|
|
6998
|
+
instance$8 = new SessionWatcher();
|
|
7037
6999
|
}
|
|
7038
|
-
return instance$
|
|
7000
|
+
return instance$8;
|
|
7039
7001
|
},
|
|
7040
7002
|
};
|
|
7041
7003
|
|
|
@@ -8097,13 +8059,13 @@ class AnalyticsEngine {
|
|
|
8097
8059
|
this._eventCapturer.resetAllBuckets();
|
|
8098
8060
|
}
|
|
8099
8061
|
}
|
|
8100
|
-
let instance$
|
|
8062
|
+
let instance$7;
|
|
8101
8063
|
var AnalyticsEngine$1 = {
|
|
8102
8064
|
getInstance: () => {
|
|
8103
|
-
if (!instance$
|
|
8104
|
-
instance$
|
|
8065
|
+
if (!instance$7) {
|
|
8066
|
+
instance$7 = new AnalyticsEngine();
|
|
8105
8067
|
}
|
|
8106
|
-
return instance$
|
|
8068
|
+
return instance$7;
|
|
8107
8069
|
},
|
|
8108
8070
|
};
|
|
8109
8071
|
|
|
@@ -8331,12 +8293,12 @@ class MessageReadReceiptSyncEngine {
|
|
|
8331
8293
|
}
|
|
8332
8294
|
}
|
|
8333
8295
|
}
|
|
8334
|
-
let instance$
|
|
8296
|
+
let instance$6 = null;
|
|
8335
8297
|
var ReadReceiptSyncEngine = {
|
|
8336
8298
|
getInstance: () => {
|
|
8337
|
-
if (!instance$
|
|
8338
|
-
instance$
|
|
8339
|
-
return instance$
|
|
8299
|
+
if (!instance$6)
|
|
8300
|
+
instance$6 = new MessageReadReceiptSyncEngine();
|
|
8301
|
+
return instance$6;
|
|
8340
8302
|
},
|
|
8341
8303
|
};
|
|
8342
8304
|
|
|
@@ -8590,12 +8552,12 @@ class LegacyMessageReadReceiptSyncEngine {
|
|
|
8590
8552
|
}
|
|
8591
8553
|
}
|
|
8592
8554
|
}
|
|
8593
|
-
let instance$
|
|
8555
|
+
let instance$5 = null;
|
|
8594
8556
|
var LegacyReadReceiptSyncEngine = {
|
|
8595
8557
|
getInstance: () => {
|
|
8596
|
-
if (!instance$
|
|
8597
|
-
instance$
|
|
8598
|
-
return instance$
|
|
8558
|
+
if (!instance$5)
|
|
8559
|
+
instance$5 = new LegacyMessageReadReceiptSyncEngine();
|
|
8560
|
+
return instance$5;
|
|
8599
8561
|
},
|
|
8600
8562
|
};
|
|
8601
8563
|
|
|
@@ -8871,12 +8833,12 @@ class ObjectResolverEngine {
|
|
|
8871
8833
|
this.stopResolver();
|
|
8872
8834
|
}
|
|
8873
8835
|
}
|
|
8874
|
-
let instance$
|
|
8836
|
+
let instance$4 = null;
|
|
8875
8837
|
var ObjectResolverEngine$1 = {
|
|
8876
8838
|
getInstance: () => {
|
|
8877
|
-
if (!instance$
|
|
8878
|
-
instance$
|
|
8879
|
-
return instance$
|
|
8839
|
+
if (!instance$4)
|
|
8840
|
+
instance$4 = new ObjectResolverEngine();
|
|
8841
|
+
return instance$4;
|
|
8880
8842
|
},
|
|
8881
8843
|
};
|
|
8882
8844
|
|
|
@@ -9026,13 +8988,13 @@ class LiveReactionSyncEngine {
|
|
|
9026
8988
|
this.stopReactionsSync();
|
|
9027
8989
|
}
|
|
9028
8990
|
}
|
|
9029
|
-
let instance$
|
|
8991
|
+
let instance$3;
|
|
9030
8992
|
var ReactionSyncEngine = {
|
|
9031
8993
|
getInstance: () => {
|
|
9032
|
-
if (!instance$
|
|
9033
|
-
instance$
|
|
8994
|
+
if (!instance$3) {
|
|
8995
|
+
instance$3 = new LiveReactionSyncEngine();
|
|
9034
8996
|
}
|
|
9035
|
-
return instance$
|
|
8997
|
+
return instance$3;
|
|
9036
8998
|
},
|
|
9037
8999
|
};
|
|
9038
9000
|
|
|
@@ -9054,6 +9016,148 @@ var reactionSyncEngineOnLoginHandler = () => {
|
|
|
9054
9016
|
};
|
|
9055
9017
|
};
|
|
9056
9018
|
|
|
9019
|
+
function prepareBlockedUserPayload(response) {
|
|
9020
|
+
const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
|
|
9021
|
+
return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
|
|
9022
|
+
const followUser = users.find(user => user.userId === follow.from);
|
|
9023
|
+
return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
|
|
9024
|
+
}), users: users.map(convertRawUserToInternalUser) });
|
|
9025
|
+
}
|
|
9026
|
+
|
|
9027
|
+
const BLOCK_LIST_LIMIT = 100;
|
|
9028
|
+
const TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
9029
|
+
/**
|
|
9030
|
+
* Session-scoped singleton engine that manages TTL-based fetching and caching
|
|
9031
|
+
* of blocked users. Provides a lazy `ensureFetched()` gate for the
|
|
9032
|
+
* `getAllBlockedUsers()` API.
|
|
9033
|
+
*
|
|
9034
|
+
* Key behaviours:
|
|
9035
|
+
* - `establish()` is a no-op — fetch is lazy, triggered only by consumer call
|
|
9036
|
+
* - `destroy()` resets `lastFetchedAt` to null (ensures fresh fetch on next session)
|
|
9037
|
+
* - `ensureFetched()` fetches from server only when cache is expired or never fetched
|
|
9038
|
+
* - `lastFetchedAt` is only updated on successful fetch
|
|
9039
|
+
* - `blockedUserIds` is kept in sync with each successful fetch
|
|
9040
|
+
*
|
|
9041
|
+
* @internal
|
|
9042
|
+
*/
|
|
9043
|
+
class BlockedUserSyncEngine {
|
|
9044
|
+
constructor() {
|
|
9045
|
+
/** Epoch ms of last successful fetch. null = never fetched in this session. */
|
|
9046
|
+
this.lastFetchedAt = null;
|
|
9047
|
+
/** Ordered list of userId strings from the most recent successful fetch. */
|
|
9048
|
+
this.blockedUserIds = [];
|
|
9049
|
+
}
|
|
9050
|
+
// ---------------------------------------------------------------------------
|
|
9051
|
+
// SessionComponent lifecycle
|
|
9052
|
+
// ---------------------------------------------------------------------------
|
|
9053
|
+
/** No-op — fetch is lazy, triggered by consumer calling getAllBlockedUsers(). */
|
|
9054
|
+
// eslint-disable-next-line class-methods-use-this
|
|
9055
|
+
onSessionEstablished() {
|
|
9056
|
+
// intentionally empty
|
|
9057
|
+
}
|
|
9058
|
+
/** Resets state so the next session starts with a cold cache. */
|
|
9059
|
+
onSessionDestroyed() {
|
|
9060
|
+
this.lastFetchedAt = null;
|
|
9061
|
+
this.blockedUserIds = [];
|
|
9062
|
+
}
|
|
9063
|
+
/** No-op for this engine. */
|
|
9064
|
+
// eslint-disable-next-line class-methods-use-this
|
|
9065
|
+
onTokenExpired() {
|
|
9066
|
+
// intentionally empty
|
|
9067
|
+
}
|
|
9068
|
+
// ---------------------------------------------------------------------------
|
|
9069
|
+
// Cache helpers
|
|
9070
|
+
// ---------------------------------------------------------------------------
|
|
9071
|
+
isCacheExpired() {
|
|
9072
|
+
if (this.lastFetchedAt === null)
|
|
9073
|
+
return true;
|
|
9074
|
+
return Date.now() - this.lastFetchedAt > TTL_MS;
|
|
9075
|
+
}
|
|
9076
|
+
// ---------------------------------------------------------------------------
|
|
9077
|
+
// Core fetch gate
|
|
9078
|
+
// ---------------------------------------------------------------------------
|
|
9079
|
+
/**
|
|
9080
|
+
* Ensures the local store is populated with fresh blocked-user data.
|
|
9081
|
+
*
|
|
9082
|
+
* - If the cache is still within the 5-minute TTL window: resolves immediately
|
|
9083
|
+
* (no server call).
|
|
9084
|
+
* - If the cache is expired (or never fetched): fetches from the server,
|
|
9085
|
+
* persists the payload to the cache, and updates `lastFetchedAt`.
|
|
9086
|
+
*
|
|
9087
|
+
* On failure the error propagates to the caller and `lastFetchedAt` is NOT
|
|
9088
|
+
* updated, so the next call will retry.
|
|
9089
|
+
*/
|
|
9090
|
+
async ensureFetched() {
|
|
9091
|
+
if (!this.isCacheExpired())
|
|
9092
|
+
return;
|
|
9093
|
+
const client = getActiveClient();
|
|
9094
|
+
const { data } = await client.http.get('/api/v4/me/user-blocks', { params: { options: { limit: BLOCK_LIST_LIMIT }, isDeleted: false } });
|
|
9095
|
+
const cachedAt = client.cache && Date.now();
|
|
9096
|
+
const payload = prepareBlockedUserPayload(data);
|
|
9097
|
+
if (client.cache) {
|
|
9098
|
+
ingestInCache(payload, { cachedAt });
|
|
9099
|
+
}
|
|
9100
|
+
// Keep the ordered list of blocked user IDs for getCachedUsers()
|
|
9101
|
+
this.blockedUserIds = payload.users.map(u => u.userId);
|
|
9102
|
+
// Only update timestamp on success — failure leaves it unchanged so the
|
|
9103
|
+
// next call retries.
|
|
9104
|
+
this.lastFetchedAt = Date.now();
|
|
9105
|
+
}
|
|
9106
|
+
// ---------------------------------------------------------------------------
|
|
9107
|
+
// Local store read
|
|
9108
|
+
// ---------------------------------------------------------------------------
|
|
9109
|
+
/**
|
|
9110
|
+
* Returns blocked {@link Amity.InternalUser} objects from the in-memory cache.
|
|
9111
|
+
*
|
|
9112
|
+
* Applies the spec-mandated filter:
|
|
9113
|
+
* - Only users whose `isDeleted` is false or null
|
|
9114
|
+
* - Hard limit of 100 results
|
|
9115
|
+
*
|
|
9116
|
+
* This always reads the latest local state, so changes made by `blockUser()`
|
|
9117
|
+
* and `unblockUser()` are reflected even within the TTL window.
|
|
9118
|
+
*/
|
|
9119
|
+
getCachedUsers() {
|
|
9120
|
+
const client = getActiveClient();
|
|
9121
|
+
if (!client.cache) {
|
|
9122
|
+
// No cache available — fall back to the in-memory list from the last fetch
|
|
9123
|
+
return [];
|
|
9124
|
+
}
|
|
9125
|
+
return this.blockedUserIds
|
|
9126
|
+
.map(id => { var _a; return (_a = pullFromCache(['user', 'get', id])) === null || _a === void 0 ? void 0 : _a.data; })
|
|
9127
|
+
.filter((user) => user != null && user.isDeleted !== true)
|
|
9128
|
+
.slice(0, BLOCK_LIST_LIMIT);
|
|
9129
|
+
}
|
|
9130
|
+
}
|
|
9131
|
+
// ---------------------------------------------------------------------------
|
|
9132
|
+
// Module-level singleton
|
|
9133
|
+
// ---------------------------------------------------------------------------
|
|
9134
|
+
let instance$2 = null;
|
|
9135
|
+
var BlockedUserSyncEngine$1 = {
|
|
9136
|
+
getInstance: () => {
|
|
9137
|
+
if (!instance$2)
|
|
9138
|
+
instance$2 = new BlockedUserSyncEngine();
|
|
9139
|
+
return instance$2;
|
|
9140
|
+
},
|
|
9141
|
+
};
|
|
9142
|
+
|
|
9143
|
+
var blockedUserSyncEngineOnLoginHandler = () => {
|
|
9144
|
+
const blockedUserSyncEngine = BlockedUserSyncEngine$1.getInstance();
|
|
9145
|
+
onSessionStateChange(state => {
|
|
9146
|
+
if (state === "established" /* Amity.SessionStates.ESTABLISHED */) {
|
|
9147
|
+
blockedUserSyncEngine.onSessionEstablished();
|
|
9148
|
+
}
|
|
9149
|
+
else if (state === "tokenExpired" /* Amity.SessionStates.TOKEN_EXPIRED */) {
|
|
9150
|
+
blockedUserSyncEngine.onTokenExpired();
|
|
9151
|
+
}
|
|
9152
|
+
else {
|
|
9153
|
+
blockedUserSyncEngine.onSessionDestroyed();
|
|
9154
|
+
}
|
|
9155
|
+
});
|
|
9156
|
+
return () => {
|
|
9157
|
+
blockedUserSyncEngine.onSessionDestroyed();
|
|
9158
|
+
};
|
|
9159
|
+
};
|
|
9160
|
+
|
|
9057
9161
|
const EVENTS = [
|
|
9058
9162
|
'disconnected',
|
|
9059
9163
|
'error',
|
|
@@ -9219,7 +9323,7 @@ const setupLoginSubscriptions = (unsubWatcher) => {
|
|
|
9219
9323
|
// NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
|
|
9220
9324
|
// the channel because currently backend can't handle this, so every time a user is banned from
|
|
9221
9325
|
// a channel or the channel is deleted the channel's unread count will not be reset to zero
|
|
9222
|
-
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler());
|
|
9326
|
+
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler(), blockedUserSyncEngineOnLoginHandler());
|
|
9223
9327
|
if (client.useLegacyUnreadCount) {
|
|
9224
9328
|
subscriptions.push(readReceiptSyncEngineOnLoginHandler());
|
|
9225
9329
|
}
|
|
@@ -10843,140 +10947,6 @@ const setAccessTokenHandler = (accessTokenHandler) => {
|
|
|
10843
10947
|
client.accessTokenHandler = accessTokenHandler;
|
|
10844
10948
|
};
|
|
10845
10949
|
|
|
10846
|
-
function parseRolesFilter(listenFromRoleIds, ignoreFromRoleIds) {
|
|
10847
|
-
if (ignoreFromRoleIds && ignoreFromRoleIds.length > 0) {
|
|
10848
|
-
return { type: 'not', roleIds: ignoreFromRoleIds };
|
|
10849
|
-
}
|
|
10850
|
-
if (listenFromRoleIds && listenFromRoleIds.length > 0) {
|
|
10851
|
-
return { type: exports.NotificationRolesFilterTypeEnum.ONLY, roleIds: listenFromRoleIds };
|
|
10852
|
-
}
|
|
10853
|
-
return { type: exports.NotificationRolesFilterTypeEnum.ALL };
|
|
10854
|
-
}
|
|
10855
|
-
function serializeRolesFilter(rolesFilter) {
|
|
10856
|
-
if ((rolesFilter === null || rolesFilter === void 0 ? void 0 : rolesFilter.type) === exports.NotificationRolesFilterTypeEnum.ONLY) {
|
|
10857
|
-
return { listenFromRoleIds: rolesFilter.roleIds };
|
|
10858
|
-
}
|
|
10859
|
-
return { listenFromRoleIds: [] };
|
|
10860
|
-
}
|
|
10861
|
-
class ChannelNotifications {
|
|
10862
|
-
constructor(channelId) {
|
|
10863
|
-
this.channelId = channelId;
|
|
10864
|
-
}
|
|
10865
|
-
async enable() {
|
|
10866
|
-
const client = getActiveClient();
|
|
10867
|
-
const body = {
|
|
10868
|
-
level: exports.NotificationSettingsLevelEnum.CHANNEL,
|
|
10869
|
-
channelId: this.channelId,
|
|
10870
|
-
isPushNotifiable: true,
|
|
10871
|
-
};
|
|
10872
|
-
await client.http.post('/api/v3/notification/setting', body);
|
|
10873
|
-
}
|
|
10874
|
-
async disable() {
|
|
10875
|
-
const client = getActiveClient();
|
|
10876
|
-
const body = {
|
|
10877
|
-
level: exports.NotificationSettingsLevelEnum.CHANNEL,
|
|
10878
|
-
channelId: this.channelId,
|
|
10879
|
-
isPushNotifiable: false,
|
|
10880
|
-
};
|
|
10881
|
-
await client.http.post('/api/v3/notification/setting', body);
|
|
10882
|
-
}
|
|
10883
|
-
async getSettings() {
|
|
10884
|
-
const client = getActiveClient();
|
|
10885
|
-
const { data } = await client.http.get(`/api/v3/notification/setting?level=channel&channelId=${encodeURIComponent(this.channelId)}`);
|
|
10886
|
-
return { isEnabled: data.isPushNotifiable };
|
|
10887
|
-
}
|
|
10888
|
-
}
|
|
10889
|
-
class UserNotifications {
|
|
10890
|
-
async enable(modules) {
|
|
10891
|
-
var _a;
|
|
10892
|
-
const client = getActiveClient();
|
|
10893
|
-
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 : [];
|
|
10894
|
-
const body = {
|
|
10895
|
-
level: exports.NotificationSettingsLevelEnum.USER,
|
|
10896
|
-
isPushNotifiable: true,
|
|
10897
|
-
notifiableEvents,
|
|
10898
|
-
};
|
|
10899
|
-
await client.http.post('/api/v3/notification/setting', body);
|
|
10900
|
-
}
|
|
10901
|
-
async disableAllNotifications() {
|
|
10902
|
-
const client = getActiveClient();
|
|
10903
|
-
const body = {
|
|
10904
|
-
level: exports.NotificationSettingsLevelEnum.USER,
|
|
10905
|
-
isPushNotifiable: false,
|
|
10906
|
-
notifiableEvents: [],
|
|
10907
|
-
};
|
|
10908
|
-
await client.http.post('/api/v3/notification/setting', body);
|
|
10909
|
-
}
|
|
10910
|
-
async getSettings() {
|
|
10911
|
-
var _a;
|
|
10912
|
-
const client = getActiveClient();
|
|
10913
|
-
const { data } = await client.http.get(`/api/v3/notification/setting?level=${exports.NotificationSettingsLevelEnum.USER}`);
|
|
10914
|
-
const validModuleNames = Object.values(exports.UserNotificationModuleNameEnum);
|
|
10915
|
-
const modules = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
10916
|
-
.filter(e => e.moduleName != null && validModuleNames.includes(e.moduleName))
|
|
10917
|
-
.map(e => ({
|
|
10918
|
-
moduleName: e.moduleName,
|
|
10919
|
-
isEnabled: e.isPushNotifiable,
|
|
10920
|
-
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
10921
|
-
}));
|
|
10922
|
-
return { isEnabled: data.isPushNotifiable, modules };
|
|
10923
|
-
}
|
|
10924
|
-
}
|
|
10925
|
-
class CommunityNotifications {
|
|
10926
|
-
constructor(communityId) {
|
|
10927
|
-
this.communityId = communityId;
|
|
10928
|
-
}
|
|
10929
|
-
async enable(events) {
|
|
10930
|
-
var _a;
|
|
10931
|
-
const client = getActiveClient();
|
|
10932
|
-
const notifiableEvents = (_a = events === null || events === void 0 ? void 0 : events.map(event => (Object.assign({ moduleName: 'social', name: event.eventName, isPushNotifiable: event.isEnabled }, serializeRolesFilter(event.rolesFilter))))) !== null && _a !== void 0 ? _a : [];
|
|
10933
|
-
const body = {
|
|
10934
|
-
level: exports.NotificationSettingsLevelEnum.COMMUNITY,
|
|
10935
|
-
communityId: this.communityId,
|
|
10936
|
-
isPushNotifiable: true,
|
|
10937
|
-
notifiableEvents,
|
|
10938
|
-
};
|
|
10939
|
-
await client.http.post('/api/v3/notification/setting', body);
|
|
10940
|
-
}
|
|
10941
|
-
async disable() {
|
|
10942
|
-
const client = getActiveClient();
|
|
10943
|
-
const body = {
|
|
10944
|
-
level: exports.NotificationSettingsLevelEnum.COMMUNITY,
|
|
10945
|
-
communityId: this.communityId,
|
|
10946
|
-
isPushNotifiable: false,
|
|
10947
|
-
notifiableEvents: [],
|
|
10948
|
-
};
|
|
10949
|
-
await client.http.post('/api/v3/notification/setting', body);
|
|
10950
|
-
}
|
|
10951
|
-
async getSettings() {
|
|
10952
|
-
var _a;
|
|
10953
|
-
const client = getActiveClient();
|
|
10954
|
-
const { data } = await client.http.get(`/api/v3/notification/setting?level=${exports.NotificationSettingsLevelEnum.COMMUNITY}&communityId=${encodeURIComponent(this.communityId)}`);
|
|
10955
|
-
const validEventNames = Object.values(exports.CommunityNotificationEventNameEnum);
|
|
10956
|
-
const events = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
10957
|
-
.filter(e => e.name != null && validEventNames.includes(e.name))
|
|
10958
|
-
.map(e => ({
|
|
10959
|
-
eventName: e.name,
|
|
10960
|
-
isEnabled: e.isPushNotifiable,
|
|
10961
|
-
isNetworkEnabled: e.isNetworkEnabled,
|
|
10962
|
-
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
10963
|
-
}));
|
|
10964
|
-
return { isEnabled: data.isPushNotifiable, events };
|
|
10965
|
-
}
|
|
10966
|
-
}
|
|
10967
|
-
class Notifications {
|
|
10968
|
-
user() {
|
|
10969
|
-
return new UserNotifications();
|
|
10970
|
-
}
|
|
10971
|
-
community(communityId) {
|
|
10972
|
-
return new CommunityNotifications(communityId);
|
|
10973
|
-
}
|
|
10974
|
-
channel(channelId) {
|
|
10975
|
-
return new ChannelNotifications(channelId);
|
|
10976
|
-
}
|
|
10977
|
-
}
|
|
10978
|
-
const notifications = () => new Notifications();
|
|
10979
|
-
|
|
10980
10950
|
/**
|
|
10981
10951
|
* ```js
|
|
10982
10952
|
* import { onChannelMarkerFetched } from '@amityco/ts-sdk-react-native'
|
|
@@ -11360,7 +11330,6 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
11360
11330
|
getCurrentUserType: getCurrentUserType,
|
|
11361
11331
|
setCurrentUserType: setCurrentUserType,
|
|
11362
11332
|
setAccessTokenHandler: setAccessTokenHandler,
|
|
11363
|
-
notifications: notifications,
|
|
11364
11333
|
onConnectionError: onConnectionError,
|
|
11365
11334
|
onClientDisconnected: onClientDisconnected,
|
|
11366
11335
|
onClientBanned: onClientBanned,
|
|
@@ -13393,7 +13362,7 @@ const getWatchSessionStorage = () => {
|
|
|
13393
13362
|
return storageInstance;
|
|
13394
13363
|
};
|
|
13395
13364
|
|
|
13396
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
13365
|
+
const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHo80SecH7FuF2\nhFYnb+l26/VN8UMLXAQFLnxciNTEwkGVFMpdezlH8rU2HtUJL4RETogbAOLVY0XM\njs6sPn8G1nALmh9qeDpUtVqFOVtBHxEZ910TLOtQiunjqJKO5nWdqZ71EC3OFluR\niGQkO84BiIFbv37ub7xl3S8XarbtKoLcyVpkDHi+1wx1pgCAn6gtBUgckPL5NR8j\nLseabl3HAXQfhTCKo4tmOFM2Dxwl1IUMmIJrJg/aIU/U0tj/1Eoo7mG0JcNWX19l\nW3EecCbi0ncCJOrkUdwlBrcjaMayaX/ubEwyUeTGiLdyc4L3GRLHjyK8xgVNXRMH\nbZWJ2a5NAgMBAAECggEASxuE+35zTFO/XydKgmvIGcWL9FbgMlXb7Vcf0nBoG945\nbiz0NVc2paraIhJXc608xbYF3qLmtAE1MVBI0ORyRdBHNxY024l/6H6SH60Ed+uI\nM4ysp5ourY6Vj+DLwpdRiI9YDjqYAQDIUmhNxJP7XPhOMoZI6st+xZQBM34ic/bv\nAMSJm9OZphSp3+qXVkFZztr2mxD2EZSJJLYxi8BCdgM2qhazalbcJ6zDKHCZWVWm\n8RRxDGldyMb/237JxETzP40tAlzOZDmBAbUgEnurDJ93RVDIE3rbZUshwgeQd18a\nem096mWgvB1AIKYgsTAR3pw+V19YWAjq/glP6fz8wQKBgQD/oQq+ukKF0PRgBeM5\ngeTjSwsdGppQLmf5ndujvoiz/TpdjDEPu6R8kigQr1rG2t4K/yfdZoI8RdmJD1al\n3Q7N9hofooSy4rj6E3txzWZCHJjHad2cnCp/O26HiReGAl7wTcfTmNdiFHhZQzm5\nJBkvWAiwuvQMNfEbnXxw6/vIDwKBgQDH7fX8gsc77JLvAWgp1MaQN/sbqVb6JeT1\nFQfR8E/WFCSmzQBtNzd5KgYuCeelwr/8DyYytvN2BzCYZXp73gI1jF3YlW5jVn74\nOY6TwQ095digwo6Z0yuxopdIOApKgAkL9PRKgNrqAf3NAyMua6lOGifzjDojC3KU\nfylQmxMn4wKBgHp2B9O/H0dEBw5JQ8W0+JX6yWQz7mEjGiR2/1W+XXb8hQ1zr709\nw1r6Gb+EghRpnZ3fBpYGGbYOMFx8wKHM+N6qW3F0ReX8v2juFGE8aRSa5oYBrWzt\nU16Idjbv8hj84cZ1PJmdyvDtpYn9rpWHOZl4rxEbPvbqkIsOMyNVqdT5AoGAOSge\nmwIIU2le2FVeohbibXiToWTYKMuMmURZ5/r72AgKMmWJKbAPe+Q3wBG01/7FRBpQ\noU8Ma0HC8s6QJbliiEyIx9JwrJWd1vkdecBHONrtA4ibm/5zD2WcOllLF+FitLhi\n3qnX6+6F0IaFGFBPJrTzlv0P4dTz/OAdv52V7GECgYEA2TttOKBAqWllgOaZOkql\nLVMJVmgR7s6tLi1+cEP8ZcapV9aRbRzTAKXm4f8AEhtlG9F9kCOvHYCYGi6JaiWJ\nZkHjeex3T+eE6Di6y5Bm/Ift5jtVhJ4jCVwHOKTMej79NPUFTJfv8hCo29haBDv6\nRXFrv+T21KCcw8k3sJeJWWQ=\n-----END PRIVATE KEY-----";
|
|
13397
13366
|
/*
|
|
13398
13367
|
* The crypto algorithm used for importing key and signing string
|
|
13399
13368
|
*/
|
|
@@ -15904,6 +15873,35 @@ const isUserFlaggedByMe = async (userId) => {
|
|
|
15904
15873
|
};
|
|
15905
15874
|
/* end_public_function */
|
|
15906
15875
|
|
|
15876
|
+
/* begin_public_function
|
|
15877
|
+
id: user.get_all_blocked_users
|
|
15878
|
+
*/
|
|
15879
|
+
/**
|
|
15880
|
+
* ```js
|
|
15881
|
+
* import { UserRepository } from '@amityco/ts-sdk'
|
|
15882
|
+
* const blockedUsers = await UserRepository.getAllBlockedUsers()
|
|
15883
|
+
* ```
|
|
15884
|
+
*
|
|
15885
|
+
* Returns all blocked users as a non-paginated list (limit 100) with TTL-based caching (5-minute window).
|
|
15886
|
+
* Within the TTL window, subsequent calls resolve instantly from the local store without any server call.
|
|
15887
|
+
* After the TTL expires, the next call triggers a fresh server fetch.
|
|
15888
|
+
*
|
|
15889
|
+
* @returns A promise that resolves to an array of blocked {@link Amity.User} objects
|
|
15890
|
+
*
|
|
15891
|
+
* @category Block API
|
|
15892
|
+
* @async
|
|
15893
|
+
*/
|
|
15894
|
+
const getAllBlockedUsers = async () => {
|
|
15895
|
+
const client = getActiveClient();
|
|
15896
|
+
client.log('user/getAllBlockedUsers');
|
|
15897
|
+
const engine = BlockedUserSyncEngine$1.getInstance();
|
|
15898
|
+
// Ensure data is fetched (no-op if cache is fresh)
|
|
15899
|
+
await engine.ensureFetched();
|
|
15900
|
+
// Read from the engine's bounded ID list — O(blocked users) not O(cache size)
|
|
15901
|
+
return engine.getCachedUsers();
|
|
15902
|
+
};
|
|
15903
|
+
/* end_public_function */
|
|
15904
|
+
|
|
15907
15905
|
/**
|
|
15908
15906
|
* ```js
|
|
15909
15907
|
* import { onUserUpdated } from '@amityco/ts-sdk-react-native'
|
|
@@ -16325,14 +16323,6 @@ class BlockedUserQueryStreamController extends QueryStreamController {
|
|
|
16325
16323
|
}
|
|
16326
16324
|
}
|
|
16327
16325
|
|
|
16328
|
-
function prepareBlockedUserPayload(response) {
|
|
16329
|
-
const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
|
|
16330
|
-
return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
|
|
16331
|
-
const followUser = users.find(user => user.userId === follow.from);
|
|
16332
|
-
return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
|
|
16333
|
-
}), users: users.map(convertRawUserToInternalUser) });
|
|
16334
|
-
}
|
|
16335
|
-
|
|
16336
16326
|
const convertEventPayload = (eventHandler, sourceModelProp, destinationDomain) => (callback) => eventHandler(sourceModel => {
|
|
16337
16327
|
var _a;
|
|
16338
16328
|
if (!sourceModel) {
|
|
@@ -16719,6 +16709,7 @@ var index$q = /*#__PURE__*/Object.freeze({
|
|
|
16719
16709
|
flagUser: flagUser,
|
|
16720
16710
|
unflagUser: unflagUser,
|
|
16721
16711
|
isUserFlaggedByMe: isUserFlaggedByMe,
|
|
16712
|
+
getAllBlockedUsers: getAllBlockedUsers,
|
|
16722
16713
|
onUserUpdated: onUserUpdated,
|
|
16723
16714
|
onUserDeleted: onUserDeleted$2,
|
|
16724
16715
|
onUserFlagged: onUserFlagged,
|
|
@@ -18398,8 +18389,10 @@ const createLocalCommentEventSubscriber = (event, callback) => {
|
|
|
18398
18389
|
else {
|
|
18399
18390
|
const postCacheKey = ['post', 'get', comments[0].referenceId];
|
|
18400
18391
|
const postCache = (_d = pullFromCache(postCacheKey)) === null || _d === void 0 ? void 0 : _d.data;
|
|
18401
|
-
|
|
18402
|
-
|
|
18392
|
+
if (postCache) {
|
|
18393
|
+
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); }) });
|
|
18394
|
+
pushToCache(postCacheKey, updatedPost);
|
|
18395
|
+
}
|
|
18403
18396
|
}
|
|
18404
18397
|
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; });
|
|
18405
18398
|
queries === null || queries === void 0 ? void 0 : queries.map(({ key, data }) => upsertInCache(key, data, { cachedAt: -1 }));
|
|
@@ -23486,7 +23479,7 @@ const removeMembers = async (communityId, userIds) => {
|
|
|
23486
23479
|
*/
|
|
23487
23480
|
class CommunityMembersPaginationController extends PaginationController {
|
|
23488
23481
|
async getRequest(queryParams, token) {
|
|
23489
|
-
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted"]);
|
|
23482
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted, excludingRoles: _excludingRoles } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted", "excludingRoles"]);
|
|
23490
23483
|
const options = token ? { token } : { limit };
|
|
23491
23484
|
const isDeleted = includeDeleted === false ? false : undefined;
|
|
23492
23485
|
const { data: queryResponse } = await this.http.get(`/api/v3/communities/${params.communityId}/users`, {
|
|
@@ -23536,6 +23529,7 @@ class CommunityMembersQueryStreamController extends QueryStreamController {
|
|
|
23536
23529
|
if (!collection)
|
|
23537
23530
|
return;
|
|
23538
23531
|
communityMembers.forEach(communityMember => {
|
|
23532
|
+
var _a;
|
|
23539
23533
|
const communityMemberCacheId = getResolver('communityUsers')({
|
|
23540
23534
|
communityId: this.query.communityId,
|
|
23541
23535
|
userId: communityMember.userId,
|
|
@@ -23544,6 +23538,13 @@ class CommunityMembersQueryStreamController extends QueryStreamController {
|
|
|
23544
23538
|
collection.data = collection.data.filter(m => m !== communityMemberCacheId);
|
|
23545
23539
|
}
|
|
23546
23540
|
else if (!collection.data.includes(communityMemberCacheId)) {
|
|
23541
|
+
// Reactor-level exclusion: prevent excluded items from entering query stream
|
|
23542
|
+
if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
23543
|
+
const memberRoles = communityMember.roles || [];
|
|
23544
|
+
if (memberRoles.some(role => this.query.excludingRoles.includes(role))) {
|
|
23545
|
+
return; // Skip — don't add to query stream
|
|
23546
|
+
}
|
|
23547
|
+
}
|
|
23547
23548
|
collection.data = [communityMemberCacheId, ...collection.data];
|
|
23548
23549
|
}
|
|
23549
23550
|
});
|
|
@@ -24031,6 +24032,7 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
|
|
|
24031
24032
|
});
|
|
24032
24033
|
}
|
|
24033
24034
|
applyFilter(data) {
|
|
24035
|
+
var _a;
|
|
24034
24036
|
let communityMembers = filterByPropIntersection(data, 'roles', this.query.roles);
|
|
24035
24037
|
if (this.query.memberships) {
|
|
24036
24038
|
communityMembers = communityMembers.filter(({ communityMembership }) => {
|
|
@@ -24038,6 +24040,9 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
|
|
|
24038
24040
|
return memberships.includes(communityMembership);
|
|
24039
24041
|
});
|
|
24040
24042
|
}
|
|
24043
|
+
if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
24044
|
+
communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => this.query.excludingRoles.includes(role)));
|
|
24045
|
+
}
|
|
24041
24046
|
if (this.query.includeDeleted === false) {
|
|
24042
24047
|
communityMembers = communityMembers.filter(({ user }) => (user === null || user === void 0 ? void 0 : user.isDeleted) !== true);
|
|
24043
24048
|
}
|
|
@@ -24059,6 +24064,7 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
|
|
|
24059
24064
|
* @hidden
|
|
24060
24065
|
*/
|
|
24061
24066
|
const applyFilter = (data, params) => {
|
|
24067
|
+
var _a;
|
|
24062
24068
|
let communityMembers = filterByPropIntersection(data, 'roles', params.roles);
|
|
24063
24069
|
if (params.memberships) {
|
|
24064
24070
|
communityMembers = communityMembers.filter(({ communityMembership }) => {
|
|
@@ -24066,6 +24072,9 @@ const applyFilter = (data, params) => {
|
|
|
24066
24072
|
return membership.includes(communityMembership);
|
|
24067
24073
|
});
|
|
24068
24074
|
}
|
|
24075
|
+
if ((_a = params.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
24076
|
+
communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => params.excludingRoles.includes(role)));
|
|
24077
|
+
}
|
|
24069
24078
|
const sortBy = params.sortBy ? params.sortBy : 'lastCreated';
|
|
24070
24079
|
communityMembers = communityMembers.sort(sortBy === 'lastCreated' ? sortByLastCreated : sortByFirstCreated);
|
|
24071
24080
|
return communityMembers;
|
|
@@ -24119,7 +24128,7 @@ const getMembers = (params, callback, config) => {
|
|
|
24119
24128
|
*/
|
|
24120
24129
|
class SearchCommunityMembersPaginationController extends PaginationController {
|
|
24121
24130
|
async getRequest(queryParams, token) {
|
|
24122
|
-
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted"]);
|
|
24131
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted, excludingRoles } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted", "excludingRoles"]);
|
|
24123
24132
|
const options = token ? { token } : { limit };
|
|
24124
24133
|
const isDeleted = includeDeleted === false ? false : undefined;
|
|
24125
24134
|
const { data: queryResponse } = await this.http.get(`/api/v3/communities/${params.communityId}/users`, {
|
|
@@ -24269,6 +24278,7 @@ class SearchCommunityMembersLiveCollectionController extends LiveCollectionContr
|
|
|
24269
24278
|
});
|
|
24270
24279
|
}
|
|
24271
24280
|
applyFilter(data) {
|
|
24281
|
+
var _a;
|
|
24272
24282
|
let communityMembers = filterByPropIntersection(data, 'roles', this.query.roles);
|
|
24273
24283
|
if (this.query.memberships) {
|
|
24274
24284
|
communityMembers = communityMembers.filter(({ communityMembership }) => {
|
|
@@ -24279,6 +24289,9 @@ class SearchCommunityMembersLiveCollectionController extends LiveCollectionContr
|
|
|
24279
24289
|
if (this.query.search) {
|
|
24280
24290
|
communityMembers = filterBySearchTerm(communityMembers, this.query.search);
|
|
24281
24291
|
}
|
|
24292
|
+
if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
24293
|
+
communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => this.query.excludingRoles.includes(role)));
|
|
24294
|
+
}
|
|
24282
24295
|
if (this.query.includeDeleted === false) {
|
|
24283
24296
|
communityMembers = communityMembers.filter(({ user }) => (user === null || user === void 0 ? void 0 : user.isDeleted) !== true);
|
|
24284
24297
|
}
|