@amityco/ts-sdk 7.3.1-e2dead4.0 → 7.4.1-4207cb63.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/core/events.d.ts +3 -0
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/model.d.ts +3 -1
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +22 -4
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/client.d.ts +10 -0
- package/dist/@types/domains/client.d.ts.map +1 -1
- package/dist/@types/domains/community.d.ts +11 -1
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/@types/domains/invitation.d.ts +88 -0
- package/dist/@types/domains/invitation.d.ts.map +1 -0
- package/dist/@types/index.d.ts +2 -0
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/commentRepository/api/flagComment.d.ts +3 -2
- package/dist/commentRepository/api/flagComment.d.ts.map +1 -1
- package/dist/communityRepository/api/createCommunity.d.ts +2 -2
- package/dist/communityRepository/api/createCommunity.d.ts.map +1 -1
- package/dist/communityRepository/api/getCommunities.d.ts +1 -1
- package/dist/communityRepository/api/getCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
- package/dist/communityRepository/api/getRecommendedCommunities.d.ts +3 -1
- package/dist/communityRepository/api/getRecommendedCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/getTrendingCommunities.d.ts +3 -1
- package/dist/communityRepository/api/getTrendingCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/queryCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/updateCommunity.d.ts +2 -2
- package/dist/communityRepository/api/updateCommunity.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityJoined.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityJoined.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityLeft.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityLeft.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserAdded.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserAdded.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserBanned.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserBanned.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserChanged.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserChanged.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRemoved.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRemoved.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRoleAdded.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRoleAdded.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserUnbanned.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserUnbanned.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityUserAdded.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityUserAdded.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onUserDeleted.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onUserDeleted.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/utils.d.ts +2 -2
- package/dist/communityRepository/communityMembership/events/utils.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.d.ts +1 -1
- package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.d.ts.map +1 -1
- package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.d.ts +1 -1
- package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.d.ts.map +1 -1
- package/dist/communityRepository/events/onCommunityCreated.d.ts +1 -1
- package/dist/communityRepository/events/onCommunityCreated.d.ts.map +1 -1
- package/dist/communityRepository/events/onCommunityDeleted.d.ts +1 -1
- package/dist/communityRepository/events/onCommunityDeleted.d.ts.map +1 -1
- package/dist/communityRepository/events/onCommunityUpdated.d.ts +1 -1
- package/dist/communityRepository/events/onCommunityUpdated.d.ts.map +1 -1
- package/dist/communityRepository/events/utils.d.ts +1 -1
- package/dist/communityRepository/events/utils.d.ts.map +1 -1
- package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/utils/communityWithMembership.d.ts +1 -1
- package/dist/communityRepository/utils/communityWithMembership.d.ts.map +1 -1
- package/dist/communityRepository/utils/payload.d.ts +1 -1
- package/dist/communityRepository/utils/payload.d.ts.map +1 -1
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.d.ts.map +1 -1
- package/dist/core/model/idResolvers.d.ts.map +1 -1
- package/dist/core/model/index.d.ts.map +1 -1
- package/dist/index.cjs.js +3234 -2474
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +3203 -2444
- package/dist/index.umd.js +4 -4
- package/dist/invitationRepository/events/index.d.ts +4 -0
- package/dist/invitationRepository/events/index.d.ts.map +1 -0
- package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts +17 -0
- package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts.map +1 -0
- package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts +17 -0
- package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts.map +1 -0
- package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts +17 -0
- package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts.map +1 -0
- package/dist/invitationRepository/index.d.ts +3 -0
- package/dist/invitationRepository/index.d.ts.map +1 -0
- package/dist/invitationRepository/internalApi/acceptInvitation.d.ts +16 -0
- package/dist/invitationRepository/internalApi/acceptInvitation.d.ts.map +1 -0
- package/dist/invitationRepository/internalApi/cancelInvitation.d.ts +16 -0
- package/dist/invitationRepository/internalApi/cancelInvitation.d.ts.map +1 -0
- package/dist/invitationRepository/internalApi/createInvitations.d.ts +21 -0
- package/dist/invitationRepository/internalApi/createInvitations.d.ts.map +1 -0
- package/dist/invitationRepository/internalApi/getInvitation.d.ts +17 -0
- package/dist/invitationRepository/internalApi/getInvitation.d.ts.map +1 -0
- package/dist/invitationRepository/internalApi/index.d.ts +5 -0
- package/dist/invitationRepository/internalApi/index.d.ts.map +1 -0
- package/dist/invitationRepository/internalApi/rejectInvitation.d.ts +16 -0
- package/dist/invitationRepository/internalApi/rejectInvitation.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.d.ts +14 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsPaginationController.d.ts +5 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsPaginationController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.d.ts +15 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getInvitations/enums.d.ts +6 -0
- package/dist/invitationRepository/observers/getInvitations/enums.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getInvitations.d.ts +12 -0
- package/dist/invitationRepository/observers/getInvitations.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getMyCommunityInvitations.d.ts +12 -0
- package/dist/invitationRepository/observers/getMyCommunityInvitations.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.d.ts +14 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.d.ts +5 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts +15 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/index.d.ts +2 -0
- package/dist/invitationRepository/observers/index.d.ts.map +1 -0
- package/dist/invitationRepository/utils/convertRawInvitationToInternalInvitation.d.ts +2 -0
- package/dist/invitationRepository/utils/convertRawInvitationToInternalInvitation.d.ts.map +1 -0
- package/dist/invitationRepository/utils/index.d.ts +2 -0
- package/dist/invitationRepository/utils/index.d.ts.map +1 -0
- package/dist/invitationRepository/utils/prepareInvitationPayload.d.ts +2 -0
- package/dist/invitationRepository/utils/prepareInvitationPayload.d.ts.map +1 -0
- package/dist/invitationRepository/utils/prepareMyInvitationsPayload.d.ts +2 -0
- package/dist/invitationRepository/utils/prepareMyInvitationsPayload.d.ts.map +1 -0
- package/dist/messageRepository/api/flagMessage.d.ts +1 -1
- package/dist/messageRepository/api/flagMessage.d.ts.map +1 -1
- package/dist/postRepository/api/flagPost.d.ts +3 -2
- package/dist/postRepository/api/flagPost.d.ts.map +1 -1
- package/dist/utils/linkedObject/communityLinkedObject.d.ts +2 -0
- package/dist/utils/linkedObject/communityLinkedObject.d.ts.map +1 -0
- package/dist/utils/linkedObject/index.d.ts +2 -0
- package/dist/utils/linkedObject/index.d.ts.map +1 -1
- package/dist/utils/linkedObject/invitationLinkedObject.d.ts +2 -0
- package/dist/utils/linkedObject/invitationLinkedObject.d.ts.map +1 -0
- package/dist/utils/tests/dummy/post.d.ts +3 -3
- package/package.json +1 -1
- package/src/@types/core/events.ts +4 -0
- package/src/@types/core/model.ts +5 -1
- package/src/@types/core/payload.ts +26 -4
- package/src/@types/domains/client.ts +12 -0
- package/src/@types/domains/community.ts +20 -1
- package/src/@types/domains/invitation.ts +116 -0
- package/src/@types/index.ts +2 -0
- package/src/commentRepository/api/flagComment.ts +20 -3
- package/src/communityRepository/api/createCommunity.ts +5 -2
- package/src/communityRepository/api/getCommunities.ts +7 -2
- package/src/communityRepository/api/getCommunity.ts +5 -2
- package/src/communityRepository/api/getRecommendedCommunities.ts +11 -4
- package/src/communityRepository/api/getTrendingCommunities.ts +11 -4
- package/src/communityRepository/api/queryCommunities.ts +6 -1
- package/src/communityRepository/api/updateCommunity.ts +13 -3
- package/src/communityRepository/communityMembership/events/onCommunityJoined.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityLeft.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserAdded.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserBanned.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserChanged.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserRemoved.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserRoleAdded.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserUnbanned.ts +1 -1
- package/src/communityRepository/communityMembership/events/onLocalCommunityJoined.ts +1 -1
- package/src/communityRepository/communityMembership/events/onLocalCommunityLeft.ts +1 -1
- package/src/communityRepository/communityMembership/events/onLocalCommunityUserAdded.ts +1 -1
- package/src/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.ts +1 -1
- package/src/communityRepository/communityMembership/events/onUserDeleted.ts +3 -1
- package/src/communityRepository/communityMembership/events/utils.ts +2 -2
- package/src/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.ts +8 -2
- package/src/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.ts +8 -2
- package/src/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.ts +1 -1
- package/src/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.ts +1 -1
- package/src/communityRepository/events/onCommunityCreated.ts +1 -1
- package/src/communityRepository/events/onCommunityDeleted.ts +1 -1
- package/src/communityRepository/events/onCommunityUpdated.ts +1 -1
- package/src/communityRepository/events/utils.ts +1 -1
- package/src/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.ts +2 -2
- package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.ts +2 -2
- package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.ts +2 -2
- package/src/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.ts +2 -2
- package/src/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.ts +2 -2
- package/src/communityRepository/utils/communityWithMembership.ts +8 -4
- package/src/communityRepository/utils/payload.ts +1 -1
- package/src/core/liveCollection/PaginationController.ts +1 -1
- package/src/core/liveCollection/PaginationNoPageController.ts +1 -1
- package/src/core/model/idResolvers.ts +2 -0
- package/src/core/model/index.ts +2 -0
- package/src/index.ts +2 -0
- package/src/invitationRepository/events/index.ts +3 -0
- package/src/invitationRepository/events/onLocalInvitationCreated.ts +33 -0
- package/src/invitationRepository/events/onLocalInvitationDeleted.ts +33 -0
- package/src/invitationRepository/events/onLocalInvitationUpdated.ts +33 -0
- package/src/invitationRepository/index.ts +2 -0
- package/src/invitationRepository/internalApi/acceptInvitation.ts +45 -0
- package/src/invitationRepository/internalApi/cancelInvitation.ts +44 -0
- package/src/invitationRepository/internalApi/createInvitations.ts +52 -0
- package/src/invitationRepository/internalApi/getInvitation.ts +47 -0
- package/src/invitationRepository/internalApi/index.ts +4 -0
- package/src/invitationRepository/internalApi/rejectInvitation.ts +45 -0
- package/src/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.ts +148 -0
- package/src/invitationRepository/observers/getInvitations/InvitationsPaginationController.ts +19 -0
- package/src/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.ts +97 -0
- package/src/invitationRepository/observers/getInvitations/enums.ts +5 -0
- package/src/invitationRepository/observers/getInvitations.ts +44 -0
- package/src/invitationRepository/observers/getMyCommunityInvitations.ts +48 -0
- package/src/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.ts +148 -0
- package/src/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.ts +22 -0
- package/src/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.ts +105 -0
- package/src/invitationRepository/observers/index.ts +1 -0
- package/src/invitationRepository/utils/convertRawInvitationToInternalInvitation.ts +8 -0
- package/src/invitationRepository/utils/index.ts +1 -0
- package/src/invitationRepository/utils/prepareInvitationPayload.ts +12 -0
- package/src/invitationRepository/utils/prepareMyInvitationsPayload.ts +12 -0
- package/src/messagePreview/utils/getChannelMessagePreviewWithUser.ts +3 -3
- package/src/messageRepository/api/flagMessage.ts +7 -5
- package/src/postRepository/api/flagPost.ts +19 -3
- package/src/utils/linkedObject/communityLinkedObject.ts +36 -0
- package/src/utils/linkedObject/index.ts +4 -0
- package/src/utils/linkedObject/invitationLinkedObject.ts +44 -0
|
@@ -27,6 +27,8 @@ declare global {
|
|
|
27
27
|
semanticSearchPost: Amity.SemanticSearchPostPayload;
|
|
28
28
|
semanticSearchCommunity: Amity.SemanticSearchCommunityPayload;
|
|
29
29
|
notificationTrayItem: Amity.NotificationTrayPayload;
|
|
30
|
+
invitation: Amity.InvitationPayload;
|
|
31
|
+
myInvitation: Amity.MyInvitationsPayload;
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
type UserPayload = {
|
|
@@ -306,7 +308,7 @@ declare global {
|
|
|
306
308
|
* - communityUsers: `Amity.RawMembership` -> `Amity.Membership` (Add user getter prop)
|
|
307
309
|
*/
|
|
308
310
|
type ProcessedCommunityPayload = Omit<CommunityPayload, 'communities' | 'communityUsers'> & {
|
|
309
|
-
communities: Amity.
|
|
311
|
+
communities: Amity.InternalCommunity[];
|
|
310
312
|
communityUsers: Amity.Membership<'community'>[];
|
|
311
313
|
};
|
|
312
314
|
|
|
@@ -333,7 +335,7 @@ declare global {
|
|
|
333
335
|
CommunityMembershipPayload,
|
|
334
336
|
'communities' | 'communityUsers'
|
|
335
337
|
> & {
|
|
336
|
-
communities: Amity.
|
|
338
|
+
communities: Amity.InternalCommunity[];
|
|
337
339
|
communityUsers: Amity.Membership<'community'>[];
|
|
338
340
|
};
|
|
339
341
|
|
|
@@ -383,7 +385,7 @@ declare global {
|
|
|
383
385
|
Amity.StoryTargetPayload;
|
|
384
386
|
|
|
385
387
|
type ProcessedGlobalStoryFeed = Omit<GlobalStoryFeedPayload, 'communities'> & {
|
|
386
|
-
communities: Amity.
|
|
388
|
+
communities: Amity.InternalCommunity[];
|
|
387
389
|
};
|
|
388
390
|
|
|
389
391
|
// Original Payload form BE
|
|
@@ -436,7 +438,7 @@ declare global {
|
|
|
436
438
|
*/
|
|
437
439
|
type ProcessedPostPayload = Omit<PostPayload, 'communities' | 'communityUsers' | 'posts'> & {
|
|
438
440
|
posts: Amity.InternalPost[];
|
|
439
|
-
communities: Amity.
|
|
441
|
+
communities: Amity.InternalCommunity[];
|
|
440
442
|
communityUsers: Amity.Membership<'community'>[];
|
|
441
443
|
};
|
|
442
444
|
|
|
@@ -545,5 +547,25 @@ declare global {
|
|
|
545
547
|
Amity.Flaggable &
|
|
546
548
|
Amity.Taggable &
|
|
547
549
|
Amity.Timestamps;
|
|
550
|
+
|
|
551
|
+
type InvitationPayload = {
|
|
552
|
+
invitations: Amity.RawInvitation[];
|
|
553
|
+
users: Amity.RawUser[];
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
type ProcessedInvitationPayload = {
|
|
557
|
+
invitations: Amity.InternalInvitation[];
|
|
558
|
+
users: Amity.InternalUser[];
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
type MyInvitationsPayload = {
|
|
562
|
+
invitations: Amity.RawInvitation[];
|
|
563
|
+
users: Amity.RawUser[];
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
type ProcessedMyInvitationsPayload = {
|
|
567
|
+
invitations: Amity.InternalInvitation[];
|
|
568
|
+
users: Amity.InternalUser[];
|
|
569
|
+
};
|
|
548
570
|
}
|
|
549
571
|
}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
2
|
import { Emitter } from 'mitt';
|
|
3
3
|
|
|
4
|
+
export const enum MembershipAcceptanceTypeEnum {
|
|
5
|
+
AUTOMATIC = 'automatic',
|
|
6
|
+
INVITATION = 'invitation',
|
|
7
|
+
}
|
|
8
|
+
|
|
4
9
|
declare global {
|
|
5
10
|
namespace Amity {
|
|
6
11
|
type Logger = (topic: string, ...args: any[]) => void;
|
|
7
12
|
|
|
13
|
+
type MembershipAcceptanceType = MembershipAcceptanceTypeEnum;
|
|
14
|
+
|
|
8
15
|
const enum TokenTerminationReason {
|
|
9
16
|
GLOBAL_BAN = 'globalBan',
|
|
10
17
|
USER_DELETED = 'userDeleted',
|
|
@@ -124,7 +131,12 @@ declare global {
|
|
|
124
131
|
showMyPost: boolean;
|
|
125
132
|
showOnlyMyFeed: boolean;
|
|
126
133
|
};
|
|
134
|
+
story: {
|
|
135
|
+
allowAllUserToCreateStory: boolean;
|
|
136
|
+
expiryTimeMinutes: number;
|
|
137
|
+
};
|
|
127
138
|
userPrivacySetting: 'public' | 'private';
|
|
139
|
+
membershipAcceptance: Amity.MembershipAcceptanceType;
|
|
128
140
|
};
|
|
129
141
|
|
|
130
142
|
type ConnectClientParams = {
|
|
@@ -95,17 +95,25 @@ declare global {
|
|
|
95
95
|
hasFlaggedPost: boolean;
|
|
96
96
|
|
|
97
97
|
allowCommentInStory?: boolean;
|
|
98
|
+
|
|
99
|
+
isDiscoverable: boolean;
|
|
100
|
+
requiresJoinApproval: boolean;
|
|
98
101
|
} & Amity.Taggable &
|
|
99
102
|
Amity.Metadata &
|
|
100
103
|
Amity.Timestamps &
|
|
101
104
|
Amity.SoftDelete &
|
|
102
105
|
Amity.Subscribable;
|
|
103
106
|
|
|
104
|
-
type
|
|
107
|
+
type InternalCommunity = Omit<
|
|
108
|
+
Amity.RawCommunity,
|
|
109
|
+
'onlyAdminCanPost' | 'needApprovalOnPostCreation'
|
|
110
|
+
> &
|
|
105
111
|
Amity.CommunityStorySettings & {
|
|
106
112
|
postSetting?: ValueOf<typeof CommunityPostSettings>;
|
|
107
113
|
};
|
|
108
114
|
|
|
115
|
+
type Community = Amity.InternalCommunity & Amity.CommunityLinkedObject;
|
|
116
|
+
|
|
109
117
|
type QueryCommunities = {
|
|
110
118
|
membership?: 'all' | 'member' | 'notMember';
|
|
111
119
|
categoryId?: Amity.InternalCategory['categoryId'];
|
|
@@ -125,6 +133,7 @@ declare global {
|
|
|
125
133
|
sortBy?: Amity.SearchCommunitySortBy | Amity.SearchCommunitySortByEnum;
|
|
126
134
|
page?: string;
|
|
127
135
|
limit?: number;
|
|
136
|
+
includeDiscoverablePrivateCommunity?: boolean;
|
|
128
137
|
};
|
|
129
138
|
|
|
130
139
|
type CommunityLiveCollection = Amity.LiveCollectionParams<Omit<QueryCommunities, 'page'>>;
|
|
@@ -197,6 +206,7 @@ declare global {
|
|
|
197
206
|
token?: string;
|
|
198
207
|
};
|
|
199
208
|
tags?: string[];
|
|
209
|
+
includeDiscoverablePrivateCommunity?: boolean;
|
|
200
210
|
};
|
|
201
211
|
|
|
202
212
|
type SemanticSearchCommunityLiveCollection = Amity.LiveCollectionParams<
|
|
@@ -209,5 +219,14 @@ declare global {
|
|
|
209
219
|
Amity.Community['communityId'], // communityId:score
|
|
210
220
|
QuerySemanticSearchCommunity
|
|
211
221
|
>;
|
|
222
|
+
|
|
223
|
+
type CommunityLinkedObject = {
|
|
224
|
+
createInvitations: (userIds: string[]) => Promise<void>;
|
|
225
|
+
getMemberInvitations: (
|
|
226
|
+
params: Pick<Amity.InvitationLiveCollection, 'limit' | 'sortBy' | 'statuses'>,
|
|
227
|
+
callback: Amity.LiveCollectionCallback<Amity.Invitation>,
|
|
228
|
+
) => Amity.Unsubscriber;
|
|
229
|
+
getInvitation: () => Promise<Amity.Invitation | undefined>;
|
|
230
|
+
};
|
|
212
231
|
}
|
|
213
232
|
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
|
|
3
|
+
export const enum InvitationTypeEnum {
|
|
4
|
+
CommunityMemberInvite = 'communityMemberInvite',
|
|
5
|
+
LivestreamInvite = 'livestreamInvite',
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const enum InvitationStatusEnum {
|
|
9
|
+
Pending = 'pending',
|
|
10
|
+
Approved = 'approved',
|
|
11
|
+
Rejected = 'rejected',
|
|
12
|
+
Cancelled = 'cancelled',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const enum InvitationSortByEnum {
|
|
16
|
+
FirstCreated = 'firstCreated',
|
|
17
|
+
LastCreated = 'lastCreated',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare global {
|
|
21
|
+
namespace Amity {
|
|
22
|
+
type InvitationType = InvitationTypeEnum;
|
|
23
|
+
|
|
24
|
+
type InvitationStatus = InvitationStatusEnum;
|
|
25
|
+
|
|
26
|
+
type InvitationTargetType = Extract<Amity.Domain, 'community'>;
|
|
27
|
+
|
|
28
|
+
type InvitationTargetMap = {
|
|
29
|
+
community: Amity.InternalCommunity;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
type InvitationTarget<T extends InvitationTargetType> = InvitationTargetMap[T];
|
|
33
|
+
|
|
34
|
+
type InvitationSortBy = InvitationSortByEnum;
|
|
35
|
+
|
|
36
|
+
type RawInvitation = {
|
|
37
|
+
_id: string;
|
|
38
|
+
networkId: string;
|
|
39
|
+
type: Amity.InvitationType;
|
|
40
|
+
targetId: string;
|
|
41
|
+
targetType: Amity.InvitationTargetType;
|
|
42
|
+
userId: string;
|
|
43
|
+
status: Amity.InvitationStatus;
|
|
44
|
+
respondedAt: Amity.timestamp;
|
|
45
|
+
createdBy: string;
|
|
46
|
+
invitationId: string;
|
|
47
|
+
invitedUserId: string;
|
|
48
|
+
invitedUserInternalId: string;
|
|
49
|
+
invitedUserPublicId: string;
|
|
50
|
+
inviterUserId: string;
|
|
51
|
+
inviterUserInternalId: string;
|
|
52
|
+
inviterUserPublicId: string;
|
|
53
|
+
} & Amity.Timestamps;
|
|
54
|
+
|
|
55
|
+
type InternalInvitation = Omit<RawInvitation, 'createdBy'> & {
|
|
56
|
+
createdById: string;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
type Invitation = Omit<Amity.InternalInvitation, 'createdBy'> &
|
|
60
|
+
Amity.InvitationLinkedObject & {
|
|
61
|
+
user?: Amity.User;
|
|
62
|
+
createdById: string;
|
|
63
|
+
createdBy?: Amity.User;
|
|
64
|
+
target?: Amity.InvitationTarget<Amity.InvitationTargetType>;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
type QueryInvitations = {
|
|
68
|
+
targetId: string;
|
|
69
|
+
statuses?: string[];
|
|
70
|
+
token?: Amity.Token;
|
|
71
|
+
type: Amity.InvitationType;
|
|
72
|
+
sortBy?: Amity.InvitationSortBy;
|
|
73
|
+
limit?: Amity.PageLimit['limit'];
|
|
74
|
+
targetType: Amity.InvitationTargetType;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
type InvitationLiveCollection = Amity.LiveCollectionParams<Omit<QueryInvitations, 'limit'>>;
|
|
78
|
+
|
|
79
|
+
type InvitationLiveCollectionCache = Amity.LiveCollectionCache<
|
|
80
|
+
Amity.InternalInvitation['_id'],
|
|
81
|
+
Pick<QueryInvitations, 'limit'>
|
|
82
|
+
>;
|
|
83
|
+
|
|
84
|
+
type QueryMyInvitations = {
|
|
85
|
+
targetId?: string;
|
|
86
|
+
token?: Amity.Token;
|
|
87
|
+
type?: Amity.InvitationType;
|
|
88
|
+
sortBy?: Amity.InvitationSortBy;
|
|
89
|
+
limit?: Amity.PageLimit['limit'];
|
|
90
|
+
statuses?: InvitationStatusEnum[];
|
|
91
|
+
targetType?: Amity.InvitationTargetType;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
type MyInvitationsLiveCollection = Amity.LiveCollectionParams<
|
|
95
|
+
Omit<QueryMyInvitations, 'limit'>
|
|
96
|
+
>;
|
|
97
|
+
|
|
98
|
+
type MyInvitationsLiveCollectionCache = Amity.LiveCollectionCache<
|
|
99
|
+
Amity.InternalInvitation['_id'],
|
|
100
|
+
Pick<QueryMyInvitations, 'limit'>
|
|
101
|
+
>;
|
|
102
|
+
|
|
103
|
+
type InvitationLinkedObject = {
|
|
104
|
+
accept: () => Promise<void>;
|
|
105
|
+
reject: () => Promise<void>;
|
|
106
|
+
cancel: () => Promise<void>;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
type CreateInvitations = {
|
|
110
|
+
type: Amity.InvitationType;
|
|
111
|
+
targetType: Amity.InvitationTargetType;
|
|
112
|
+
targetId: string;
|
|
113
|
+
userIds: string[];
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
package/src/@types/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
-
|
|
3
2
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
3
|
import { fireEvent } from '~/core/events';
|
|
4
|
+
import { prepareMembershipPayload } from '~/group/utils';
|
|
5
|
+
import { ContentFlagReasonEnum } from '~/@types';
|
|
5
6
|
|
|
6
7
|
/* begin_public_function
|
|
7
8
|
id: comment.flag
|
|
@@ -9,21 +10,37 @@ import { fireEvent } from '~/core/events';
|
|
|
9
10
|
/**
|
|
10
11
|
* ```js
|
|
11
12
|
* import { CommentRepository } from '@amityco/ts-sdk'
|
|
12
|
-
* const flagged = await CommentRepository.flagComment(
|
|
13
|
+
* const flagged = await CommentRepository.flagComment(commentId, reason)
|
|
13
14
|
* ```
|
|
14
15
|
*
|
|
15
16
|
* @param commentId The ID of the comment to flag
|
|
17
|
+
* @param reason the reason to flag the comment
|
|
16
18
|
* @returns the created report result
|
|
17
19
|
*
|
|
18
20
|
* @category Comment API
|
|
19
21
|
* @async
|
|
20
22
|
* */
|
|
21
|
-
export const flagComment = async (
|
|
23
|
+
export const flagComment = async (
|
|
24
|
+
commentId: Amity.Comment['commentId'],
|
|
25
|
+
reason?: Amity.ContentFlagReason,
|
|
26
|
+
): Promise<boolean> => {
|
|
22
27
|
const client = getActiveClient();
|
|
23
28
|
client.log('comment/flagComment', commentId);
|
|
24
29
|
|
|
30
|
+
const isPredefinedReason =
|
|
31
|
+
reason &&
|
|
32
|
+
Object.entries(ContentFlagReasonEnum).some(
|
|
33
|
+
([key, value]) => key !== ContentFlagReasonEnum.Others && value === reason,
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const body = {
|
|
37
|
+
reason: reason && isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
|
|
38
|
+
detail: reason && !isPredefinedReason ? reason : '',
|
|
39
|
+
};
|
|
40
|
+
|
|
25
41
|
const { data: payload } = await client.http.post<Amity.CommentPayload>(
|
|
26
42
|
`/api/v3/comments/${encodeURIComponent(commentId)}/flag`,
|
|
43
|
+
body,
|
|
27
44
|
);
|
|
28
45
|
|
|
29
46
|
if (client.cache) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LinkedObject } from '~/utils/linkedObject';
|
|
1
2
|
import { getActiveClient } from '~/client/api';
|
|
2
3
|
|
|
3
4
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
@@ -11,7 +12,7 @@ import { prepareCommunityPayload, prepareCommunityRequest } from '../utils';
|
|
|
11
12
|
/**
|
|
12
13
|
* ```js
|
|
13
14
|
* import { createCommunity } from '@amityco/ts-sdk'
|
|
14
|
-
* const created = await createCommunity({ communityId: 'foobar', displayName: 'foobar' })
|
|
15
|
+
* const created = await createCommunity({ communityId: 'foobar', displayName: 'foobar', isDiscoverable: true, requiresJoinApproval: false })
|
|
15
16
|
* ```
|
|
16
17
|
*
|
|
17
18
|
* Creates an {@link Amity.Community}
|
|
@@ -33,6 +34,8 @@ export const createCommunity = async (
|
|
|
33
34
|
| 'postSetting'
|
|
34
35
|
| 'tags'
|
|
35
36
|
| 'metadata'
|
|
37
|
+
| 'isDiscoverable'
|
|
38
|
+
| 'requiresJoinApproval'
|
|
36
39
|
> &
|
|
37
40
|
Amity.CommunityStorySettings & {
|
|
38
41
|
userIds?: string[];
|
|
@@ -60,7 +63,7 @@ export const createCommunity = async (
|
|
|
60
63
|
|
|
61
64
|
const { communities } = data;
|
|
62
65
|
return {
|
|
63
|
-
data: communities[0],
|
|
66
|
+
data: LinkedObject.community(communities[0]),
|
|
64
67
|
cachedAt,
|
|
65
68
|
};
|
|
66
69
|
};
|
|
@@ -5,6 +5,7 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
|
5
5
|
|
|
6
6
|
import { saveCommunityUsers } from '~/communityRepository/utils/saveCommunityUsers';
|
|
7
7
|
import { prepareCommunityPayload } from '../utils';
|
|
8
|
+
import { LinkedObject } from '~/utils/linkedObject';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* ```js
|
|
@@ -22,6 +23,7 @@ import { prepareCommunityPayload } from '../utils';
|
|
|
22
23
|
*/
|
|
23
24
|
export const getCommunities = async (
|
|
24
25
|
communityIds: Amity.Community['communityId'][],
|
|
26
|
+
includeDiscoverablePrivateCommunity?: boolean,
|
|
25
27
|
): Promise<Amity.Cached<Amity.Community[]>> => {
|
|
26
28
|
const client = getActiveClient();
|
|
27
29
|
client.log('community/getCommunities', communityIds);
|
|
@@ -30,7 +32,10 @@ export const getCommunities = async (
|
|
|
30
32
|
const { data: payload } = await client.http.get<Amity.CommunityPayload>(
|
|
31
33
|
`/api/v3/communities/list`,
|
|
32
34
|
{
|
|
33
|
-
params: {
|
|
35
|
+
params: {
|
|
36
|
+
communityIds,
|
|
37
|
+
includeDiscoverablePrivateCommunity: includeDiscoverablePrivateCommunity ?? true,
|
|
38
|
+
},
|
|
34
39
|
},
|
|
35
40
|
);
|
|
36
41
|
|
|
@@ -43,7 +48,7 @@ export const getCommunities = async (
|
|
|
43
48
|
}
|
|
44
49
|
|
|
45
50
|
return {
|
|
46
|
-
data: data.communities,
|
|
51
|
+
data: data.communities.map(community => LinkedObject.community(community)),
|
|
47
52
|
cachedAt,
|
|
48
53
|
};
|
|
49
54
|
};
|
|
@@ -5,6 +5,7 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
|
5
5
|
|
|
6
6
|
import { saveCommunityUsers } from '~/communityRepository/utils/saveCommunityUsers';
|
|
7
7
|
import { prepareCommunityPayload } from '../utils';
|
|
8
|
+
import { LinkedObject } from '~/utils/linkedObject';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* ```js
|
|
@@ -42,7 +43,9 @@ export const getCommunity = async (
|
|
|
42
43
|
const { communities } = data;
|
|
43
44
|
|
|
44
45
|
return {
|
|
45
|
-
data:
|
|
46
|
+
data: LinkedObject.community(
|
|
47
|
+
communities.find(community => community.communityId === communityId)!,
|
|
48
|
+
),
|
|
46
49
|
cachedAt,
|
|
47
50
|
};
|
|
48
51
|
};
|
|
@@ -73,7 +76,7 @@ getCommunity.locally = (
|
|
|
73
76
|
if (!cached) return;
|
|
74
77
|
|
|
75
78
|
return {
|
|
76
|
-
data: cached.data,
|
|
79
|
+
data: LinkedObject.community(cached.data),
|
|
77
80
|
cachedAt: cached.cachedAt,
|
|
78
81
|
};
|
|
79
82
|
};
|
|
@@ -4,6 +4,7 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
|
4
4
|
|
|
5
5
|
import { prepareCommunityPayload } from '../utils';
|
|
6
6
|
import { COLLECTION_DEFAULT_PAGINATION_LIMIT } from '~/utils/constants';
|
|
7
|
+
import { LinkedObject } from '~/utils/linkedObject';
|
|
7
8
|
|
|
8
9
|
/* begin_public_function
|
|
9
10
|
id: community.query.recommended_communities
|
|
@@ -24,18 +25,24 @@ import { COLLECTION_DEFAULT_PAGINATION_LIMIT } from '~/utils/constants';
|
|
|
24
25
|
* @private
|
|
25
26
|
*/
|
|
26
27
|
export const getRecommendedCommunities = async (
|
|
27
|
-
query?: Amity.PageLimit,
|
|
28
|
+
query?: Amity.PageLimit & { includeDiscoverablePrivateCommunity?: boolean },
|
|
28
29
|
): Promise<Amity.Cached<Amity.Community[]>> => {
|
|
29
30
|
const client = getActiveClient();
|
|
30
31
|
client.log('community/getRecommendedCommunities', query);
|
|
31
32
|
|
|
32
|
-
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } =
|
|
33
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDiscoverablePrivateCommunity } =
|
|
34
|
+
query ?? {};
|
|
33
35
|
|
|
34
36
|
// API-FIX: backend doesnt answer Amity.Response
|
|
35
37
|
// const { data: payload } = await client.http.get<Amity.Response<CommunityPayload>>(
|
|
36
38
|
const { data: payload } = await client.http.get<Amity.CommunityPayload>(
|
|
37
39
|
`/api/v3/communities/recommended`,
|
|
38
|
-
{
|
|
40
|
+
{
|
|
41
|
+
params: {
|
|
42
|
+
includeDiscoverablePrivateCommunity: includeDiscoverablePrivateCommunity ?? true,
|
|
43
|
+
options: { limit },
|
|
44
|
+
},
|
|
45
|
+
},
|
|
39
46
|
);
|
|
40
47
|
|
|
41
48
|
const data = prepareCommunityPayload(payload);
|
|
@@ -47,5 +54,5 @@ export const getRecommendedCommunities = async (
|
|
|
47
54
|
ingestInCache(data, { cachedAt });
|
|
48
55
|
}
|
|
49
56
|
|
|
50
|
-
return { data: communities, cachedAt };
|
|
57
|
+
return { data: communities.map(community => LinkedObject.community(community)), cachedAt };
|
|
51
58
|
};
|
|
@@ -4,6 +4,7 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
|
4
4
|
|
|
5
5
|
import { prepareCommunityPayload } from '../utils';
|
|
6
6
|
import { COLLECTION_DEFAULT_PAGINATION_LIMIT } from '~/utils/constants';
|
|
7
|
+
import { LinkedObject } from '~/utils/linkedObject';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* ```js
|
|
@@ -21,18 +22,24 @@ import { COLLECTION_DEFAULT_PAGINATION_LIMIT } from '~/utils/constants';
|
|
|
21
22
|
* @private
|
|
22
23
|
*/
|
|
23
24
|
export const getTrendingCommunities = async (
|
|
24
|
-
query?: Amity.PageLimit,
|
|
25
|
+
query?: Amity.PageLimit & { includeDiscoverablePrivateCommunity?: boolean },
|
|
25
26
|
): Promise<Amity.Cached<Amity.Community[]>> => {
|
|
26
27
|
const client = getActiveClient();
|
|
27
28
|
client.log('community/getTrendingCommunities', query);
|
|
28
29
|
|
|
29
|
-
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } =
|
|
30
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDiscoverablePrivateCommunity } =
|
|
31
|
+
query ?? {};
|
|
30
32
|
|
|
31
33
|
// API-FIX: backend doesnt answer Amity.Response
|
|
32
34
|
// const { data } = await client.http.get<Amity.Response<CommunityPayload>>(
|
|
33
35
|
const { data: payload } = await client.http.get<Amity.CommunityPayload>(
|
|
34
36
|
`/api/v3/communities/top-trending`,
|
|
35
|
-
{
|
|
37
|
+
{
|
|
38
|
+
params: {
|
|
39
|
+
includeDiscoverablePrivateCommunity: includeDiscoverablePrivateCommunity ?? true,
|
|
40
|
+
options: { limit },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
36
43
|
);
|
|
37
44
|
|
|
38
45
|
const data = prepareCommunityPayload(payload);
|
|
@@ -44,5 +51,5 @@ export const getTrendingCommunities = async (
|
|
|
44
51
|
ingestInCache(data, { cachedAt });
|
|
45
52
|
}
|
|
46
53
|
|
|
47
|
-
return { data: communities, cachedAt };
|
|
54
|
+
return { data: communities.map(community => LinkedObject.community(community)), cachedAt };
|
|
48
55
|
};
|
|
@@ -6,6 +6,7 @@ import { getResolver } from '~/core/model';
|
|
|
6
6
|
import { inferIsDeleted } from '~/utils/inferIsDeleted';
|
|
7
7
|
import { saveCommunityUsers } from '~/communityRepository/utils/saveCommunityUsers';
|
|
8
8
|
import { prepareCommunityPayload } from '../utils';
|
|
9
|
+
import { LinkedObject } from '~/utils/linkedObject';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* ```js
|
|
@@ -68,5 +69,9 @@ export const queryCommunities = async (
|
|
|
68
69
|
saveCommunityUsers(data.communities, data.communityUsers);
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
return {
|
|
72
|
+
return {
|
|
73
|
+
data: communities.map(community => LinkedObject.community(community)),
|
|
74
|
+
cachedAt,
|
|
75
|
+
paging,
|
|
76
|
+
};
|
|
72
77
|
};
|
|
@@ -5,6 +5,7 @@ import { fireEvent } from '~/core/events';
|
|
|
5
5
|
|
|
6
6
|
import { saveCommunityUsers } from '~/communityRepository/utils/saveCommunityUsers';
|
|
7
7
|
import { prepareCommunityPayload, prepareCommunityRequest } from '../utils';
|
|
8
|
+
import { LinkedObject } from '~/utils/linkedObject';
|
|
8
9
|
|
|
9
10
|
/* begin_public_function
|
|
10
11
|
id: community.update
|
|
@@ -12,7 +13,7 @@ import { prepareCommunityPayload, prepareCommunityRequest } from '../utils';
|
|
|
12
13
|
/**
|
|
13
14
|
* ```js
|
|
14
15
|
* import { updateCommunity } from '@amityco/ts-sdk'
|
|
15
|
-
* const updated = await updateCommunity(communityId, { displayName: 'foobar' })
|
|
16
|
+
* const updated = await updateCommunity(communityId, { displayName: 'foobar', isDiscoverable: true, requiresJoinApproval: false })
|
|
16
17
|
* ```
|
|
17
18
|
*
|
|
18
19
|
* Updates an {@link Amity.Community}
|
|
@@ -28,7 +29,14 @@ export const updateCommunity = async (
|
|
|
28
29
|
communityId: Amity.Community['communityId'],
|
|
29
30
|
patch: Patch<
|
|
30
31
|
Amity.Community,
|
|
31
|
-
|
|
32
|
+
| 'displayName'
|
|
33
|
+
| 'avatarFileId'
|
|
34
|
+
| 'description'
|
|
35
|
+
| 'postSetting'
|
|
36
|
+
| 'tags'
|
|
37
|
+
| 'metadata'
|
|
38
|
+
| 'isDiscoverable'
|
|
39
|
+
| 'requiresJoinApproval'
|
|
32
40
|
> &
|
|
33
41
|
Amity.CommunityStorySettings,
|
|
34
42
|
): Promise<Amity.Cached<Amity.Community>> => {
|
|
@@ -53,7 +61,9 @@ export const updateCommunity = async (
|
|
|
53
61
|
const { communities } = data;
|
|
54
62
|
|
|
55
63
|
return {
|
|
56
|
-
data:
|
|
64
|
+
data: LinkedObject.community(
|
|
65
|
+
communities.find(community => community.communityId === communityId)!,
|
|
66
|
+
),
|
|
57
67
|
cachedAt,
|
|
58
68
|
};
|
|
59
69
|
};
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityJoined = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.joined', callback);
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityLeft = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.left', callback);
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityUserAdded = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.userAdded', callback);
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityUserBanned = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.userBanned', callback);
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityUserChanged = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, members: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.userChanged', callback);
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityUserRemoved = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.userRemoved', callback);
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityUserRoleAdded = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.roleAdded', callback);
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityUserRoleRemoved = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.roleRemoved', callback);
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityUserUnbanned = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.userUnbanned', callback);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createLocalCommunityMemberEventSubscriber } from './utils';
|
|
2
2
|
|
|
3
3
|
export const onLocalCommunityJoined = (
|
|
4
|
-
callback: (community: Amity.
|
|
4
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
5
5
|
) => createLocalCommunityMemberEventSubscriber('local.community.joined', callback);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createLocalCommunityMemberEventSubscriber } from './utils';
|
|
2
2
|
|
|
3
3
|
export const onLocalCommunityLeft = (
|
|
4
|
-
callback: (community: Amity.
|
|
4
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
5
5
|
) => createLocalCommunityMemberEventSubscriber('local.community.left', callback);
|