@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.esm.js
CHANGED
|
@@ -101,7 +101,7 @@ var ContentFlagReasonEnum;
|
|
|
101
101
|
ContentFlagReasonEnum["SelfHarmOrSuicide"] = "Self-harm or suicide";
|
|
102
102
|
ContentFlagReasonEnum["ViolenceOrThreateningContent"] = "Violence or threatening content";
|
|
103
103
|
ContentFlagReasonEnum["SellingRestrictedItems"] = "Selling and promoting restricted items";
|
|
104
|
-
ContentFlagReasonEnum["SexualContentOrNudity"] = "Sexual
|
|
104
|
+
ContentFlagReasonEnum["SexualContentOrNudity"] = "Sexual content or nudity";
|
|
105
105
|
ContentFlagReasonEnum["SpamOrScams"] = "Spam or scams";
|
|
106
106
|
ContentFlagReasonEnum["FalseInformation"] = "False information or misinformation";
|
|
107
107
|
ContentFlagReasonEnum["Others"] = "Others";
|
|
@@ -242,50 +242,10 @@ var AnalyticsSourceTypeEnum;
|
|
|
242
242
|
AnalyticsSourceTypeEnum["ROOM"] = "room";
|
|
243
243
|
})(AnalyticsSourceTypeEnum || (AnalyticsSourceTypeEnum = {}));
|
|
244
244
|
|
|
245
|
-
var UserNotificationModuleNameEnum;
|
|
246
|
-
(function (UserNotificationModuleNameEnum) {
|
|
247
|
-
UserNotificationModuleNameEnum["CHAT"] = "chat";
|
|
248
|
-
UserNotificationModuleNameEnum["SOCIAL"] = "social";
|
|
249
|
-
UserNotificationModuleNameEnum["VIDEO_STREAMING"] = "video-streaming";
|
|
250
|
-
})(UserNotificationModuleNameEnum || (UserNotificationModuleNameEnum = {}));
|
|
251
|
-
var ChannelNotificationEventNameEnum;
|
|
252
|
-
(function (ChannelNotificationEventNameEnum) {
|
|
253
|
-
ChannelNotificationEventNameEnum["MESSAGE_CREATED"] = "message.created";
|
|
254
|
-
ChannelNotificationEventNameEnum["MESSAGE_REACTED"] = "message.reacted";
|
|
255
|
-
ChannelNotificationEventNameEnum["MENTION_CREATED"] = "mention.created";
|
|
256
|
-
ChannelNotificationEventNameEnum["POLL_VOTE_CREATED"] = "poll.vote.created";
|
|
257
|
-
})(ChannelNotificationEventNameEnum || (ChannelNotificationEventNameEnum = {}));
|
|
258
|
-
var CommunityNotificationEventNameEnum;
|
|
259
|
-
(function (CommunityNotificationEventNameEnum) {
|
|
260
|
-
CommunityNotificationEventNameEnum["POST_CREATED"] = "post.created";
|
|
261
|
-
CommunityNotificationEventNameEnum["POST_REACTED"] = "post.reacted";
|
|
262
|
-
CommunityNotificationEventNameEnum["COMMENT_CREATED"] = "comment.created";
|
|
263
|
-
CommunityNotificationEventNameEnum["COMMENT_REPLIED"] = "comment.replied";
|
|
264
|
-
CommunityNotificationEventNameEnum["COMMENT_REACTED"] = "comment.reacted";
|
|
265
|
-
CommunityNotificationEventNameEnum["STORY_CREATED"] = "story.created";
|
|
266
|
-
CommunityNotificationEventNameEnum["STORY_REACTED"] = "story.reacted";
|
|
267
|
-
CommunityNotificationEventNameEnum["STORY_COMMENT_CREATED"] = "story-comment.created";
|
|
268
|
-
CommunityNotificationEventNameEnum["LIVESTREAM_START"] = "video-streaming.didStart";
|
|
269
|
-
})(CommunityNotificationEventNameEnum || (CommunityNotificationEventNameEnum = {}));
|
|
270
|
-
var NotificationSettingsLevelEnum;
|
|
271
|
-
(function (NotificationSettingsLevelEnum) {
|
|
272
|
-
NotificationSettingsLevelEnum["USER"] = "user";
|
|
273
|
-
NotificationSettingsLevelEnum["COMMUNITY"] = "community";
|
|
274
|
-
NotificationSettingsLevelEnum["CHANNEL"] = "channel";
|
|
275
|
-
})(NotificationSettingsLevelEnum || (NotificationSettingsLevelEnum = {}));
|
|
276
|
-
/**
|
|
277
|
-
* `NOT` variant is intentionally excluded from public API (internal server-side use only).
|
|
278
|
-
*/
|
|
279
|
-
var NotificationRolesFilterTypeEnum;
|
|
280
|
-
(function (NotificationRolesFilterTypeEnum) {
|
|
281
|
-
NotificationRolesFilterTypeEnum["ALL"] = "all";
|
|
282
|
-
NotificationRolesFilterTypeEnum["ONLY"] = "only";
|
|
283
|
-
})(NotificationRolesFilterTypeEnum || (NotificationRolesFilterTypeEnum = {}));
|
|
284
|
-
|
|
285
245
|
function getVersion() {
|
|
286
246
|
try {
|
|
287
|
-
// the string ''v7.
|
|
288
|
-
return 'v7.
|
|
247
|
+
// the string ''v7.18.0-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
248
|
+
return 'v7.18.0-esm';
|
|
289
249
|
}
|
|
290
250
|
catch (error) {
|
|
291
251
|
return '__dev__';
|
|
@@ -1887,13 +1847,13 @@ class NetworkActivitiesWatcher {
|
|
|
1887
1847
|
this._listener.clear();
|
|
1888
1848
|
}
|
|
1889
1849
|
}
|
|
1890
|
-
let instance$
|
|
1850
|
+
let instance$9;
|
|
1891
1851
|
var NetworkActivitiesWatcher$1 = {
|
|
1892
1852
|
getInstance: () => {
|
|
1893
|
-
if (!instance$
|
|
1894
|
-
instance$
|
|
1853
|
+
if (!instance$9) {
|
|
1854
|
+
instance$9 = new NetworkActivitiesWatcher();
|
|
1895
1855
|
}
|
|
1896
|
-
return instance$
|
|
1856
|
+
return instance$9;
|
|
1897
1857
|
},
|
|
1898
1858
|
};
|
|
1899
1859
|
|
|
@@ -21052,6 +21012,8 @@ const ingestInCache = (payload = {}, options, replace = true) => {
|
|
|
21052
21012
|
const resolver = getResolver(type);
|
|
21053
21013
|
if (!resolver)
|
|
21054
21014
|
return;
|
|
21015
|
+
if (!models)
|
|
21016
|
+
return;
|
|
21055
21017
|
models.forEach(model => {
|
|
21056
21018
|
(replace ? pushToCache : upsertInCache)([type, 'get', resolver(model)], model, options);
|
|
21057
21019
|
});
|
|
@@ -23102,13 +23064,13 @@ class SessionWatcher {
|
|
|
23102
23064
|
this._listener.clear();
|
|
23103
23065
|
}
|
|
23104
23066
|
}
|
|
23105
|
-
let instance$
|
|
23067
|
+
let instance$8;
|
|
23106
23068
|
var SessionWatcher$1 = {
|
|
23107
23069
|
getInstance: () => {
|
|
23108
|
-
if (!instance$
|
|
23109
|
-
instance$
|
|
23070
|
+
if (!instance$8) {
|
|
23071
|
+
instance$8 = new SessionWatcher();
|
|
23110
23072
|
}
|
|
23111
|
-
return instance$
|
|
23073
|
+
return instance$8;
|
|
23112
23074
|
},
|
|
23113
23075
|
};
|
|
23114
23076
|
|
|
@@ -24170,13 +24132,13 @@ class AnalyticsEngine {
|
|
|
24170
24132
|
this._eventCapturer.resetAllBuckets();
|
|
24171
24133
|
}
|
|
24172
24134
|
}
|
|
24173
|
-
let instance$
|
|
24135
|
+
let instance$7;
|
|
24174
24136
|
var AnalyticsEngine$1 = {
|
|
24175
24137
|
getInstance: () => {
|
|
24176
|
-
if (!instance$
|
|
24177
|
-
instance$
|
|
24138
|
+
if (!instance$7) {
|
|
24139
|
+
instance$7 = new AnalyticsEngine();
|
|
24178
24140
|
}
|
|
24179
|
-
return instance$
|
|
24141
|
+
return instance$7;
|
|
24180
24142
|
},
|
|
24181
24143
|
};
|
|
24182
24144
|
|
|
@@ -24404,12 +24366,12 @@ class MessageReadReceiptSyncEngine {
|
|
|
24404
24366
|
}
|
|
24405
24367
|
}
|
|
24406
24368
|
}
|
|
24407
|
-
let instance$
|
|
24369
|
+
let instance$6 = null;
|
|
24408
24370
|
var ReadReceiptSyncEngine = {
|
|
24409
24371
|
getInstance: () => {
|
|
24410
|
-
if (!instance$
|
|
24411
|
-
instance$
|
|
24412
|
-
return instance$
|
|
24372
|
+
if (!instance$6)
|
|
24373
|
+
instance$6 = new MessageReadReceiptSyncEngine();
|
|
24374
|
+
return instance$6;
|
|
24413
24375
|
},
|
|
24414
24376
|
};
|
|
24415
24377
|
|
|
@@ -24663,12 +24625,12 @@ class LegacyMessageReadReceiptSyncEngine {
|
|
|
24663
24625
|
}
|
|
24664
24626
|
}
|
|
24665
24627
|
}
|
|
24666
|
-
let instance$
|
|
24628
|
+
let instance$5 = null;
|
|
24667
24629
|
var LegacyReadReceiptSyncEngine = {
|
|
24668
24630
|
getInstance: () => {
|
|
24669
|
-
if (!instance$
|
|
24670
|
-
instance$
|
|
24671
|
-
return instance$
|
|
24631
|
+
if (!instance$5)
|
|
24632
|
+
instance$5 = new LegacyMessageReadReceiptSyncEngine();
|
|
24633
|
+
return instance$5;
|
|
24672
24634
|
},
|
|
24673
24635
|
};
|
|
24674
24636
|
|
|
@@ -24944,12 +24906,12 @@ class ObjectResolverEngine {
|
|
|
24944
24906
|
this.stopResolver();
|
|
24945
24907
|
}
|
|
24946
24908
|
}
|
|
24947
|
-
let instance$
|
|
24909
|
+
let instance$4 = null;
|
|
24948
24910
|
var ObjectResolverEngine$1 = {
|
|
24949
24911
|
getInstance: () => {
|
|
24950
|
-
if (!instance$
|
|
24951
|
-
instance$
|
|
24952
|
-
return instance$
|
|
24912
|
+
if (!instance$4)
|
|
24913
|
+
instance$4 = new ObjectResolverEngine();
|
|
24914
|
+
return instance$4;
|
|
24953
24915
|
},
|
|
24954
24916
|
};
|
|
24955
24917
|
|
|
@@ -25099,13 +25061,13 @@ class LiveReactionSyncEngine {
|
|
|
25099
25061
|
this.stopReactionsSync();
|
|
25100
25062
|
}
|
|
25101
25063
|
}
|
|
25102
|
-
let instance$
|
|
25064
|
+
let instance$3;
|
|
25103
25065
|
var ReactionSyncEngine = {
|
|
25104
25066
|
getInstance: () => {
|
|
25105
|
-
if (!instance$
|
|
25106
|
-
instance$
|
|
25067
|
+
if (!instance$3) {
|
|
25068
|
+
instance$3 = new LiveReactionSyncEngine();
|
|
25107
25069
|
}
|
|
25108
|
-
return instance$
|
|
25070
|
+
return instance$3;
|
|
25109
25071
|
},
|
|
25110
25072
|
};
|
|
25111
25073
|
|
|
@@ -25127,6 +25089,148 @@ var reactionSyncEngineOnLoginHandler = () => {
|
|
|
25127
25089
|
};
|
|
25128
25090
|
};
|
|
25129
25091
|
|
|
25092
|
+
function prepareBlockedUserPayload(response) {
|
|
25093
|
+
const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
|
|
25094
|
+
return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
|
|
25095
|
+
const followUser = users.find(user => user.userId === follow.from);
|
|
25096
|
+
return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
|
|
25097
|
+
}), users: users.map(convertRawUserToInternalUser) });
|
|
25098
|
+
}
|
|
25099
|
+
|
|
25100
|
+
const BLOCK_LIST_LIMIT = 100;
|
|
25101
|
+
const TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
25102
|
+
/**
|
|
25103
|
+
* Session-scoped singleton engine that manages TTL-based fetching and caching
|
|
25104
|
+
* of blocked users. Provides a lazy `ensureFetched()` gate for the
|
|
25105
|
+
* `getAllBlockedUsers()` API.
|
|
25106
|
+
*
|
|
25107
|
+
* Key behaviours:
|
|
25108
|
+
* - `establish()` is a no-op — fetch is lazy, triggered only by consumer call
|
|
25109
|
+
* - `destroy()` resets `lastFetchedAt` to null (ensures fresh fetch on next session)
|
|
25110
|
+
* - `ensureFetched()` fetches from server only when cache is expired or never fetched
|
|
25111
|
+
* - `lastFetchedAt` is only updated on successful fetch
|
|
25112
|
+
* - `blockedUserIds` is kept in sync with each successful fetch
|
|
25113
|
+
*
|
|
25114
|
+
* @internal
|
|
25115
|
+
*/
|
|
25116
|
+
class BlockedUserSyncEngine {
|
|
25117
|
+
constructor() {
|
|
25118
|
+
/** Epoch ms of last successful fetch. null = never fetched in this session. */
|
|
25119
|
+
this.lastFetchedAt = null;
|
|
25120
|
+
/** Ordered list of userId strings from the most recent successful fetch. */
|
|
25121
|
+
this.blockedUserIds = [];
|
|
25122
|
+
}
|
|
25123
|
+
// ---------------------------------------------------------------------------
|
|
25124
|
+
// SessionComponent lifecycle
|
|
25125
|
+
// ---------------------------------------------------------------------------
|
|
25126
|
+
/** No-op — fetch is lazy, triggered by consumer calling getAllBlockedUsers(). */
|
|
25127
|
+
// eslint-disable-next-line class-methods-use-this
|
|
25128
|
+
onSessionEstablished() {
|
|
25129
|
+
// intentionally empty
|
|
25130
|
+
}
|
|
25131
|
+
/** Resets state so the next session starts with a cold cache. */
|
|
25132
|
+
onSessionDestroyed() {
|
|
25133
|
+
this.lastFetchedAt = null;
|
|
25134
|
+
this.blockedUserIds = [];
|
|
25135
|
+
}
|
|
25136
|
+
/** No-op for this engine. */
|
|
25137
|
+
// eslint-disable-next-line class-methods-use-this
|
|
25138
|
+
onTokenExpired() {
|
|
25139
|
+
// intentionally empty
|
|
25140
|
+
}
|
|
25141
|
+
// ---------------------------------------------------------------------------
|
|
25142
|
+
// Cache helpers
|
|
25143
|
+
// ---------------------------------------------------------------------------
|
|
25144
|
+
isCacheExpired() {
|
|
25145
|
+
if (this.lastFetchedAt === null)
|
|
25146
|
+
return true;
|
|
25147
|
+
return Date.now() - this.lastFetchedAt > TTL_MS;
|
|
25148
|
+
}
|
|
25149
|
+
// ---------------------------------------------------------------------------
|
|
25150
|
+
// Core fetch gate
|
|
25151
|
+
// ---------------------------------------------------------------------------
|
|
25152
|
+
/**
|
|
25153
|
+
* Ensures the local store is populated with fresh blocked-user data.
|
|
25154
|
+
*
|
|
25155
|
+
* - If the cache is still within the 5-minute TTL window: resolves immediately
|
|
25156
|
+
* (no server call).
|
|
25157
|
+
* - If the cache is expired (or never fetched): fetches from the server,
|
|
25158
|
+
* persists the payload to the cache, and updates `lastFetchedAt`.
|
|
25159
|
+
*
|
|
25160
|
+
* On failure the error propagates to the caller and `lastFetchedAt` is NOT
|
|
25161
|
+
* updated, so the next call will retry.
|
|
25162
|
+
*/
|
|
25163
|
+
async ensureFetched() {
|
|
25164
|
+
if (!this.isCacheExpired())
|
|
25165
|
+
return;
|
|
25166
|
+
const client = getActiveClient();
|
|
25167
|
+
const { data } = await client.http.get('/api/v4/me/user-blocks', { params: { options: { limit: BLOCK_LIST_LIMIT }, isDeleted: false } });
|
|
25168
|
+
const cachedAt = client.cache && Date.now();
|
|
25169
|
+
const payload = prepareBlockedUserPayload(data);
|
|
25170
|
+
if (client.cache) {
|
|
25171
|
+
ingestInCache(payload, { cachedAt });
|
|
25172
|
+
}
|
|
25173
|
+
// Keep the ordered list of blocked user IDs for getCachedUsers()
|
|
25174
|
+
this.blockedUserIds = payload.users.map(u => u.userId);
|
|
25175
|
+
// Only update timestamp on success — failure leaves it unchanged so the
|
|
25176
|
+
// next call retries.
|
|
25177
|
+
this.lastFetchedAt = Date.now();
|
|
25178
|
+
}
|
|
25179
|
+
// ---------------------------------------------------------------------------
|
|
25180
|
+
// Local store read
|
|
25181
|
+
// ---------------------------------------------------------------------------
|
|
25182
|
+
/**
|
|
25183
|
+
* Returns blocked {@link Amity.InternalUser} objects from the in-memory cache.
|
|
25184
|
+
*
|
|
25185
|
+
* Applies the spec-mandated filter:
|
|
25186
|
+
* - Only users whose `isDeleted` is false or null
|
|
25187
|
+
* - Hard limit of 100 results
|
|
25188
|
+
*
|
|
25189
|
+
* This always reads the latest local state, so changes made by `blockUser()`
|
|
25190
|
+
* and `unblockUser()` are reflected even within the TTL window.
|
|
25191
|
+
*/
|
|
25192
|
+
getCachedUsers() {
|
|
25193
|
+
const client = getActiveClient();
|
|
25194
|
+
if (!client.cache) {
|
|
25195
|
+
// No cache available — fall back to the in-memory list from the last fetch
|
|
25196
|
+
return [];
|
|
25197
|
+
}
|
|
25198
|
+
return this.blockedUserIds
|
|
25199
|
+
.map(id => { var _a; return (_a = pullFromCache(['user', 'get', id])) === null || _a === void 0 ? void 0 : _a.data; })
|
|
25200
|
+
.filter((user) => user != null && user.isDeleted !== true)
|
|
25201
|
+
.slice(0, BLOCK_LIST_LIMIT);
|
|
25202
|
+
}
|
|
25203
|
+
}
|
|
25204
|
+
// ---------------------------------------------------------------------------
|
|
25205
|
+
// Module-level singleton
|
|
25206
|
+
// ---------------------------------------------------------------------------
|
|
25207
|
+
let instance$2 = null;
|
|
25208
|
+
var BlockedUserSyncEngine$1 = {
|
|
25209
|
+
getInstance: () => {
|
|
25210
|
+
if (!instance$2)
|
|
25211
|
+
instance$2 = new BlockedUserSyncEngine();
|
|
25212
|
+
return instance$2;
|
|
25213
|
+
},
|
|
25214
|
+
};
|
|
25215
|
+
|
|
25216
|
+
var blockedUserSyncEngineOnLoginHandler = () => {
|
|
25217
|
+
const blockedUserSyncEngine = BlockedUserSyncEngine$1.getInstance();
|
|
25218
|
+
onSessionStateChange(state => {
|
|
25219
|
+
if (state === "established" /* Amity.SessionStates.ESTABLISHED */) {
|
|
25220
|
+
blockedUserSyncEngine.onSessionEstablished();
|
|
25221
|
+
}
|
|
25222
|
+
else if (state === "tokenExpired" /* Amity.SessionStates.TOKEN_EXPIRED */) {
|
|
25223
|
+
blockedUserSyncEngine.onTokenExpired();
|
|
25224
|
+
}
|
|
25225
|
+
else {
|
|
25226
|
+
blockedUserSyncEngine.onSessionDestroyed();
|
|
25227
|
+
}
|
|
25228
|
+
});
|
|
25229
|
+
return () => {
|
|
25230
|
+
blockedUserSyncEngine.onSessionDestroyed();
|
|
25231
|
+
};
|
|
25232
|
+
};
|
|
25233
|
+
|
|
25130
25234
|
const EVENTS = [
|
|
25131
25235
|
'disconnected',
|
|
25132
25236
|
'error',
|
|
@@ -25292,7 +25396,7 @@ const setupLoginSubscriptions = (unsubWatcher) => {
|
|
|
25292
25396
|
// NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
|
|
25293
25397
|
// the channel because currently backend can't handle this, so every time a user is banned from
|
|
25294
25398
|
// a channel or the channel is deleted the channel's unread count will not be reset to zero
|
|
25295
|
-
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler());
|
|
25399
|
+
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler(), blockedUserSyncEngineOnLoginHandler());
|
|
25296
25400
|
if (client.useLegacyUnreadCount) {
|
|
25297
25401
|
subscriptions.push(readReceiptSyncEngineOnLoginHandler());
|
|
25298
25402
|
}
|
|
@@ -26916,140 +27020,6 @@ const setAccessTokenHandler = (accessTokenHandler) => {
|
|
|
26916
27020
|
client.accessTokenHandler = accessTokenHandler;
|
|
26917
27021
|
};
|
|
26918
27022
|
|
|
26919
|
-
function parseRolesFilter(listenFromRoleIds, ignoreFromRoleIds) {
|
|
26920
|
-
if (ignoreFromRoleIds && ignoreFromRoleIds.length > 0) {
|
|
26921
|
-
return { type: 'not', roleIds: ignoreFromRoleIds };
|
|
26922
|
-
}
|
|
26923
|
-
if (listenFromRoleIds && listenFromRoleIds.length > 0) {
|
|
26924
|
-
return { type: NotificationRolesFilterTypeEnum.ONLY, roleIds: listenFromRoleIds };
|
|
26925
|
-
}
|
|
26926
|
-
return { type: NotificationRolesFilterTypeEnum.ALL };
|
|
26927
|
-
}
|
|
26928
|
-
function serializeRolesFilter(rolesFilter) {
|
|
26929
|
-
if ((rolesFilter === null || rolesFilter === void 0 ? void 0 : rolesFilter.type) === NotificationRolesFilterTypeEnum.ONLY) {
|
|
26930
|
-
return { listenFromRoleIds: rolesFilter.roleIds };
|
|
26931
|
-
}
|
|
26932
|
-
return { listenFromRoleIds: [] };
|
|
26933
|
-
}
|
|
26934
|
-
class ChannelNotifications {
|
|
26935
|
-
constructor(channelId) {
|
|
26936
|
-
this.channelId = channelId;
|
|
26937
|
-
}
|
|
26938
|
-
async enable() {
|
|
26939
|
-
const client = getActiveClient();
|
|
26940
|
-
const body = {
|
|
26941
|
-
level: NotificationSettingsLevelEnum.CHANNEL,
|
|
26942
|
-
channelId: this.channelId,
|
|
26943
|
-
isPushNotifiable: true,
|
|
26944
|
-
};
|
|
26945
|
-
await client.http.post('/api/v3/notification/setting', body);
|
|
26946
|
-
}
|
|
26947
|
-
async disable() {
|
|
26948
|
-
const client = getActiveClient();
|
|
26949
|
-
const body = {
|
|
26950
|
-
level: NotificationSettingsLevelEnum.CHANNEL,
|
|
26951
|
-
channelId: this.channelId,
|
|
26952
|
-
isPushNotifiable: false,
|
|
26953
|
-
};
|
|
26954
|
-
await client.http.post('/api/v3/notification/setting', body);
|
|
26955
|
-
}
|
|
26956
|
-
async getSettings() {
|
|
26957
|
-
const client = getActiveClient();
|
|
26958
|
-
const { data } = await client.http.get(`/api/v3/notification/setting?level=channel&channelId=${encodeURIComponent(this.channelId)}`);
|
|
26959
|
-
return { isEnabled: data.isPushNotifiable };
|
|
26960
|
-
}
|
|
26961
|
-
}
|
|
26962
|
-
class UserNotifications {
|
|
26963
|
-
async enable(modules) {
|
|
26964
|
-
var _a;
|
|
26965
|
-
const client = getActiveClient();
|
|
26966
|
-
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 : [];
|
|
26967
|
-
const body = {
|
|
26968
|
-
level: NotificationSettingsLevelEnum.USER,
|
|
26969
|
-
isPushNotifiable: true,
|
|
26970
|
-
notifiableEvents,
|
|
26971
|
-
};
|
|
26972
|
-
await client.http.post('/api/v3/notification/setting', body);
|
|
26973
|
-
}
|
|
26974
|
-
async disableAllNotifications() {
|
|
26975
|
-
const client = getActiveClient();
|
|
26976
|
-
const body = {
|
|
26977
|
-
level: NotificationSettingsLevelEnum.USER,
|
|
26978
|
-
isPushNotifiable: false,
|
|
26979
|
-
notifiableEvents: [],
|
|
26980
|
-
};
|
|
26981
|
-
await client.http.post('/api/v3/notification/setting', body);
|
|
26982
|
-
}
|
|
26983
|
-
async getSettings() {
|
|
26984
|
-
var _a;
|
|
26985
|
-
const client = getActiveClient();
|
|
26986
|
-
const { data } = await client.http.get(`/api/v3/notification/setting?level=${NotificationSettingsLevelEnum.USER}`);
|
|
26987
|
-
const validModuleNames = Object.values(UserNotificationModuleNameEnum);
|
|
26988
|
-
const modules = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
26989
|
-
.filter(e => e.moduleName != null && validModuleNames.includes(e.moduleName))
|
|
26990
|
-
.map(e => ({
|
|
26991
|
-
moduleName: e.moduleName,
|
|
26992
|
-
isEnabled: e.isPushNotifiable,
|
|
26993
|
-
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
26994
|
-
}));
|
|
26995
|
-
return { isEnabled: data.isPushNotifiable, modules };
|
|
26996
|
-
}
|
|
26997
|
-
}
|
|
26998
|
-
class CommunityNotifications {
|
|
26999
|
-
constructor(communityId) {
|
|
27000
|
-
this.communityId = communityId;
|
|
27001
|
-
}
|
|
27002
|
-
async enable(events) {
|
|
27003
|
-
var _a;
|
|
27004
|
-
const client = getActiveClient();
|
|
27005
|
-
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 : [];
|
|
27006
|
-
const body = {
|
|
27007
|
-
level: NotificationSettingsLevelEnum.COMMUNITY,
|
|
27008
|
-
communityId: this.communityId,
|
|
27009
|
-
isPushNotifiable: true,
|
|
27010
|
-
notifiableEvents,
|
|
27011
|
-
};
|
|
27012
|
-
await client.http.post('/api/v3/notification/setting', body);
|
|
27013
|
-
}
|
|
27014
|
-
async disable() {
|
|
27015
|
-
const client = getActiveClient();
|
|
27016
|
-
const body = {
|
|
27017
|
-
level: NotificationSettingsLevelEnum.COMMUNITY,
|
|
27018
|
-
communityId: this.communityId,
|
|
27019
|
-
isPushNotifiable: false,
|
|
27020
|
-
notifiableEvents: [],
|
|
27021
|
-
};
|
|
27022
|
-
await client.http.post('/api/v3/notification/setting', body);
|
|
27023
|
-
}
|
|
27024
|
-
async getSettings() {
|
|
27025
|
-
var _a;
|
|
27026
|
-
const client = getActiveClient();
|
|
27027
|
-
const { data } = await client.http.get(`/api/v3/notification/setting?level=${NotificationSettingsLevelEnum.COMMUNITY}&communityId=${encodeURIComponent(this.communityId)}`);
|
|
27028
|
-
const validEventNames = Object.values(CommunityNotificationEventNameEnum);
|
|
27029
|
-
const events = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
27030
|
-
.filter(e => e.name != null && validEventNames.includes(e.name))
|
|
27031
|
-
.map(e => ({
|
|
27032
|
-
eventName: e.name,
|
|
27033
|
-
isEnabled: e.isPushNotifiable,
|
|
27034
|
-
isNetworkEnabled: e.isNetworkEnabled,
|
|
27035
|
-
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
27036
|
-
}));
|
|
27037
|
-
return { isEnabled: data.isPushNotifiable, events };
|
|
27038
|
-
}
|
|
27039
|
-
}
|
|
27040
|
-
class Notifications {
|
|
27041
|
-
user() {
|
|
27042
|
-
return new UserNotifications();
|
|
27043
|
-
}
|
|
27044
|
-
community(communityId) {
|
|
27045
|
-
return new CommunityNotifications(communityId);
|
|
27046
|
-
}
|
|
27047
|
-
channel(channelId) {
|
|
27048
|
-
return new ChannelNotifications(channelId);
|
|
27049
|
-
}
|
|
27050
|
-
}
|
|
27051
|
-
const notifications = () => new Notifications();
|
|
27052
|
-
|
|
27053
27023
|
/**
|
|
27054
27024
|
* ```js
|
|
27055
27025
|
* import { onChannelMarkerFetched } from '@amityco/ts-sdk-react-native'
|
|
@@ -27433,7 +27403,6 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
27433
27403
|
getCurrentUserType: getCurrentUserType,
|
|
27434
27404
|
setCurrentUserType: setCurrentUserType,
|
|
27435
27405
|
setAccessTokenHandler: setAccessTokenHandler,
|
|
27436
|
-
notifications: notifications,
|
|
27437
27406
|
onConnectionError: onConnectionError,
|
|
27438
27407
|
onClientDisconnected: onClientDisconnected,
|
|
27439
27408
|
onClientBanned: onClientBanned,
|
|
@@ -29466,7 +29435,7 @@ const getWatchSessionStorage = () => {
|
|
|
29466
29435
|
return storageInstance;
|
|
29467
29436
|
};
|
|
29468
29437
|
|
|
29469
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
29438
|
+
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-----";
|
|
29470
29439
|
/*
|
|
29471
29440
|
* The crypto algorithm used for importing key and signing string
|
|
29472
29441
|
*/
|
|
@@ -31977,6 +31946,35 @@ const isUserFlaggedByMe = async (userId) => {
|
|
|
31977
31946
|
};
|
|
31978
31947
|
/* end_public_function */
|
|
31979
31948
|
|
|
31949
|
+
/* begin_public_function
|
|
31950
|
+
id: user.get_all_blocked_users
|
|
31951
|
+
*/
|
|
31952
|
+
/**
|
|
31953
|
+
* ```js
|
|
31954
|
+
* import { UserRepository } from '@amityco/ts-sdk'
|
|
31955
|
+
* const blockedUsers = await UserRepository.getAllBlockedUsers()
|
|
31956
|
+
* ```
|
|
31957
|
+
*
|
|
31958
|
+
* Returns all blocked users as a non-paginated list (limit 100) with TTL-based caching (5-minute window).
|
|
31959
|
+
* Within the TTL window, subsequent calls resolve instantly from the local store without any server call.
|
|
31960
|
+
* After the TTL expires, the next call triggers a fresh server fetch.
|
|
31961
|
+
*
|
|
31962
|
+
* @returns A promise that resolves to an array of blocked {@link Amity.User} objects
|
|
31963
|
+
*
|
|
31964
|
+
* @category Block API
|
|
31965
|
+
* @async
|
|
31966
|
+
*/
|
|
31967
|
+
const getAllBlockedUsers = async () => {
|
|
31968
|
+
const client = getActiveClient();
|
|
31969
|
+
client.log('user/getAllBlockedUsers');
|
|
31970
|
+
const engine = BlockedUserSyncEngine$1.getInstance();
|
|
31971
|
+
// Ensure data is fetched (no-op if cache is fresh)
|
|
31972
|
+
await engine.ensureFetched();
|
|
31973
|
+
// Read from the engine's bounded ID list — O(blocked users) not O(cache size)
|
|
31974
|
+
return engine.getCachedUsers();
|
|
31975
|
+
};
|
|
31976
|
+
/* end_public_function */
|
|
31977
|
+
|
|
31980
31978
|
/**
|
|
31981
31979
|
* ```js
|
|
31982
31980
|
* import { onUserUpdated } from '@amityco/ts-sdk-react-native'
|
|
@@ -32398,14 +32396,6 @@ class BlockedUserQueryStreamController extends QueryStreamController {
|
|
|
32398
32396
|
}
|
|
32399
32397
|
}
|
|
32400
32398
|
|
|
32401
|
-
function prepareBlockedUserPayload(response) {
|
|
32402
|
-
const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
|
|
32403
|
-
return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
|
|
32404
|
-
const followUser = users.find(user => user.userId === follow.from);
|
|
32405
|
-
return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
|
|
32406
|
-
}), users: users.map(convertRawUserToInternalUser) });
|
|
32407
|
-
}
|
|
32408
|
-
|
|
32409
32399
|
const convertEventPayload = (eventHandler, sourceModelProp, destinationDomain) => (callback) => eventHandler(sourceModel => {
|
|
32410
32400
|
var _a;
|
|
32411
32401
|
if (!sourceModel) {
|
|
@@ -32792,6 +32782,7 @@ var index$q = /*#__PURE__*/Object.freeze({
|
|
|
32792
32782
|
flagUser: flagUser,
|
|
32793
32783
|
unflagUser: unflagUser,
|
|
32794
32784
|
isUserFlaggedByMe: isUserFlaggedByMe,
|
|
32785
|
+
getAllBlockedUsers: getAllBlockedUsers,
|
|
32795
32786
|
onUserUpdated: onUserUpdated,
|
|
32796
32787
|
onUserDeleted: onUserDeleted$2,
|
|
32797
32788
|
onUserFlagged: onUserFlagged,
|
|
@@ -34471,8 +34462,10 @@ const createLocalCommentEventSubscriber = (event, callback) => {
|
|
|
34471
34462
|
else {
|
|
34472
34463
|
const postCacheKey = ['post', 'get', comments[0].referenceId];
|
|
34473
34464
|
const postCache = (_d = pullFromCache(postCacheKey)) === null || _d === void 0 ? void 0 : _d.data;
|
|
34474
|
-
|
|
34475
|
-
|
|
34465
|
+
if (postCache) {
|
|
34466
|
+
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); }) });
|
|
34467
|
+
pushToCache(postCacheKey, updatedPost);
|
|
34468
|
+
}
|
|
34476
34469
|
}
|
|
34477
34470
|
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; });
|
|
34478
34471
|
queries === null || queries === void 0 ? void 0 : queries.map(({ key, data }) => upsertInCache(key, data, { cachedAt: -1 }));
|
|
@@ -39559,7 +39552,7 @@ const removeMembers = async (communityId, userIds) => {
|
|
|
39559
39552
|
*/
|
|
39560
39553
|
class CommunityMembersPaginationController extends PaginationController {
|
|
39561
39554
|
async getRequest(queryParams, token) {
|
|
39562
|
-
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted"]);
|
|
39555
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted, excludingRoles: _excludingRoles } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted", "excludingRoles"]);
|
|
39563
39556
|
const options = token ? { token } : { limit };
|
|
39564
39557
|
const isDeleted = includeDeleted === false ? false : undefined;
|
|
39565
39558
|
const { data: queryResponse } = await this.http.get(`/api/v3/communities/${params.communityId}/users`, {
|
|
@@ -39609,6 +39602,7 @@ class CommunityMembersQueryStreamController extends QueryStreamController {
|
|
|
39609
39602
|
if (!collection)
|
|
39610
39603
|
return;
|
|
39611
39604
|
communityMembers.forEach(communityMember => {
|
|
39605
|
+
var _a;
|
|
39612
39606
|
const communityMemberCacheId = getResolver('communityUsers')({
|
|
39613
39607
|
communityId: this.query.communityId,
|
|
39614
39608
|
userId: communityMember.userId,
|
|
@@ -39617,6 +39611,13 @@ class CommunityMembersQueryStreamController extends QueryStreamController {
|
|
|
39617
39611
|
collection.data = collection.data.filter(m => m !== communityMemberCacheId);
|
|
39618
39612
|
}
|
|
39619
39613
|
else if (!collection.data.includes(communityMemberCacheId)) {
|
|
39614
|
+
// Reactor-level exclusion: prevent excluded items from entering query stream
|
|
39615
|
+
if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
39616
|
+
const memberRoles = communityMember.roles || [];
|
|
39617
|
+
if (memberRoles.some(role => this.query.excludingRoles.includes(role))) {
|
|
39618
|
+
return; // Skip — don't add to query stream
|
|
39619
|
+
}
|
|
39620
|
+
}
|
|
39620
39621
|
collection.data = [communityMemberCacheId, ...collection.data];
|
|
39621
39622
|
}
|
|
39622
39623
|
});
|
|
@@ -40104,6 +40105,7 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
|
|
|
40104
40105
|
});
|
|
40105
40106
|
}
|
|
40106
40107
|
applyFilter(data) {
|
|
40108
|
+
var _a;
|
|
40107
40109
|
let communityMembers = filterByPropIntersection(data, 'roles', this.query.roles);
|
|
40108
40110
|
if (this.query.memberships) {
|
|
40109
40111
|
communityMembers = communityMembers.filter(({ communityMembership }) => {
|
|
@@ -40111,6 +40113,9 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
|
|
|
40111
40113
|
return memberships.includes(communityMembership);
|
|
40112
40114
|
});
|
|
40113
40115
|
}
|
|
40116
|
+
if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
40117
|
+
communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => this.query.excludingRoles.includes(role)));
|
|
40118
|
+
}
|
|
40114
40119
|
if (this.query.includeDeleted === false) {
|
|
40115
40120
|
communityMembers = communityMembers.filter(({ user }) => (user === null || user === void 0 ? void 0 : user.isDeleted) !== true);
|
|
40116
40121
|
}
|
|
@@ -40132,6 +40137,7 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
|
|
|
40132
40137
|
* @hidden
|
|
40133
40138
|
*/
|
|
40134
40139
|
const applyFilter = (data, params) => {
|
|
40140
|
+
var _a;
|
|
40135
40141
|
let communityMembers = filterByPropIntersection(data, 'roles', params.roles);
|
|
40136
40142
|
if (params.memberships) {
|
|
40137
40143
|
communityMembers = communityMembers.filter(({ communityMembership }) => {
|
|
@@ -40139,6 +40145,9 @@ const applyFilter = (data, params) => {
|
|
|
40139
40145
|
return membership.includes(communityMembership);
|
|
40140
40146
|
});
|
|
40141
40147
|
}
|
|
40148
|
+
if ((_a = params.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
40149
|
+
communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => params.excludingRoles.includes(role)));
|
|
40150
|
+
}
|
|
40142
40151
|
const sortBy = params.sortBy ? params.sortBy : 'lastCreated';
|
|
40143
40152
|
communityMembers = communityMembers.sort(sortBy === 'lastCreated' ? sortByLastCreated : sortByFirstCreated);
|
|
40144
40153
|
return communityMembers;
|
|
@@ -40192,7 +40201,7 @@ const getMembers = (params, callback, config) => {
|
|
|
40192
40201
|
*/
|
|
40193
40202
|
class SearchCommunityMembersPaginationController extends PaginationController {
|
|
40194
40203
|
async getRequest(queryParams, token) {
|
|
40195
|
-
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted"]);
|
|
40204
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted, excludingRoles } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted", "excludingRoles"]);
|
|
40196
40205
|
const options = token ? { token } : { limit };
|
|
40197
40206
|
const isDeleted = includeDeleted === false ? false : undefined;
|
|
40198
40207
|
const { data: queryResponse } = await this.http.get(`/api/v3/communities/${params.communityId}/users`, {
|
|
@@ -40342,6 +40351,7 @@ class SearchCommunityMembersLiveCollectionController extends LiveCollectionContr
|
|
|
40342
40351
|
});
|
|
40343
40352
|
}
|
|
40344
40353
|
applyFilter(data) {
|
|
40354
|
+
var _a;
|
|
40345
40355
|
let communityMembers = filterByPropIntersection(data, 'roles', this.query.roles);
|
|
40346
40356
|
if (this.query.memberships) {
|
|
40347
40357
|
communityMembers = communityMembers.filter(({ communityMembership }) => {
|
|
@@ -40352,6 +40362,9 @@ class SearchCommunityMembersLiveCollectionController extends LiveCollectionContr
|
|
|
40352
40362
|
if (this.query.search) {
|
|
40353
40363
|
communityMembers = filterBySearchTerm(communityMembers, this.query.search);
|
|
40354
40364
|
}
|
|
40365
|
+
if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
40366
|
+
communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => this.query.excludingRoles.includes(role)));
|
|
40367
|
+
}
|
|
40355
40368
|
if (this.query.includeDeleted === false) {
|
|
40356
40369
|
communityMembers = communityMembers.filter(({ user }) => (user === null || user === void 0 ? void 0 : user.isDeleted) !== true);
|
|
40357
40370
|
}
|
|
@@ -51664,4 +51677,4 @@ class AmityAttachmentProductTags {
|
|
|
51664
51677
|
}
|
|
51665
51678
|
}
|
|
51666
51679
|
|
|
51667
|
-
export { API_REGIONS, index$5 as AdRepository, AmityAttachmentProductTags, AmityCommunityType, AmityEventOrderOption, AmityEventOriginType, AmityEventResponseStatus, AmityEventSortOption, AmityEventStatus, AmityEventType, AnalyticsSourceTypeEnum, index$f as CategoryRepository,
|
|
51680
|
+
export { API_REGIONS, index$5 as AdRepository, AmityAttachmentProductTags, AmityCommunityType, AmityEventOrderOption, AmityEventOriginType, AmityEventResponseStatus, AmityEventSortOption, AmityEventStatus, AmityEventType, AnalyticsSourceTypeEnum, index$f as CategoryRepository, index$j as ChannelRepository, index$s as Client, index$e as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$g as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, DefaultCommunityPostSetting, index$1 as EventRepository, FeedDataTypeEnum, index$d as FeedRepository, FeedSortByEnum, FeedSourceEnum, FeedTypeEnum, FileAccessTypeEnum, index$p as FileRepository, FileType, GET_WATCHER_URLS, index$3 as InvitationRepository, InvitationSortByEnum, InvitationStatusEnum, InvitationTargetTypeEnum, InvitationTypeEnum, JoinRequestStatusEnum, JoinResultStatusEnum, index$2 as LiveReactionRepository, index$7 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$n as MessageRepository, index$8 as PollRepository, PostContentType, index$b as PostRepository, PostStructureType, index as ProductRepository, index$o as ReactionRepository, index$9 as RoomPresenceRepository, index$c as RoomRepository, SearchUsersByEnum, index$6 as StoryRepository, index$a as StreamRepository, index$m as SubChannelRepository, SubscriptionLevels, index$q as UserRepository, UserTypeEnum, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, exceedsUntilAtBoundary, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, filterByUntilAt, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveReactionTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getRoomStreamerTopic, getRoomWatcherTopic, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index$4 as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, validateUntilAt, wipeCache };
|