@amityco/ts-sdk 7.4.1-4207cb63.0 → 7.4.1-82bb9867.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 +4 -0
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/model.d.ts +2 -0
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +16 -1
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/community.d.ts +39 -2
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/@types/domains/joinRequest.d.ts +53 -0
- package/dist/@types/domains/joinRequest.d.ts.map +1 -0
- package/dist/@types/domains/notification.d.ts +4 -2
- package/dist/@types/domains/notification.d.ts.map +1 -1
- package/dist/@types/index.d.ts +1 -0
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/communityRepository/api/getCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/getCommunity.d.ts +1 -1
- package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
- package/dist/communityRepository/api/joinCommunity.d.ts +3 -0
- package/dist/communityRepository/api/joinCommunity.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/index.d.ts +1 -0
- package/dist/communityRepository/communityMembership/events/index.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityJoin.d.ts +2 -0
- package/dist/communityRepository/communityMembership/events/onLocalCommunityJoin.d.ts.map +1 -0
- package/dist/communityRepository/internalAPI/getMyJoinRequest.d.ts +16 -0
- package/dist/communityRepository/internalAPI/getMyJoinRequest.d.ts.map +1 -0
- package/dist/communityRepository/internalAPI/joinCommunity.d.ts +16 -0
- package/dist/communityRepository/internalAPI/joinCommunity.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/events/index.d.ts +4 -0
- package/dist/communityRepository/joinRequest/events/index.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestCreated.d.ts +17 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestCreated.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestDeleted.d.ts +17 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestDeleted.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestUpdated.d.ts +17 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestUpdated.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/internalAPI/approveJoinRequest.d.ts +16 -0
- package/dist/communityRepository/joinRequest/internalAPI/approveJoinRequest.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/internalAPI/cancelJoinRequest.d.ts +16 -0
- package/dist/communityRepository/joinRequest/internalAPI/cancelJoinRequest.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/internalAPI/rejectJoinRequest.d.ts +16 -0
- package/dist/communityRepository/joinRequest/internalAPI/rejectJoinRequest.d.ts.map +1 -0
- package/dist/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getCommunity.d.ts.map +1 -1
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListLiveCollectionController.d.ts +14 -0
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListLiveCollectionController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListPaginationController.d.ts +9 -0
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListPaginationController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListQueryStreamController.d.ts +15 -0
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListQueryStreamController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequestList/enum.d.ts +6 -0
- package/dist/communityRepository/observers/getJoinRequestList/enum.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequestList.d.ts +12 -0
- package/dist/communityRepository/observers/getJoinRequestList.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.d.ts +14 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.d.ts +9 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.d.ts +15 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequests/enum.d.ts +6 -0
- package/dist/communityRepository/observers/getJoinRequests/enum.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequests.d.ts +12 -0
- package/dist/communityRepository/observers/getJoinRequests.d.ts.map +1 -0
- package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/observers/index.d.ts +1 -0
- package/dist/communityRepository/observers/index.d.ts.map +1 -1
- package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesPaginationController.d.ts.map +1 -1
- package/dist/communityRepository/utils/payload.d.ts +1 -0
- 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 +997 -266
- package/dist/index.esm.js +1126 -395
- package/dist/index.umd.js +4 -4
- package/dist/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostQueryStreamController.d.ts.map +1 -1
- package/dist/postRepository/observers/getPinnedPosts/PinnedPostQueryStreamController.d.ts.map +1 -1
- package/dist/subChannelRepository/utils/prepareSubChannelPayload.d.ts.map +1 -1
- package/dist/utils/linkedObject/communityLinkedObject.d.ts.map +1 -1
- package/dist/utils/linkedObject/index.d.ts +1 -0
- package/dist/utils/linkedObject/index.d.ts.map +1 -1
- package/dist/utils/linkedObject/joinRequestLinkedObject.d.ts +2 -0
- package/dist/utils/linkedObject/joinRequestLinkedObject.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/@types/core/events.ts +7 -1
- package/src/@types/core/model.ts +3 -0
- package/src/@types/core/payload.ts +22 -1
- package/src/@types/domains/community.ts +55 -2
- package/src/@types/domains/joinRequest.ts +66 -0
- package/src/@types/domains/notification.ts +2 -0
- package/src/@types/index.ts +1 -0
- package/src/communityRepository/api/getCommunities.ts +3 -1
- package/src/communityRepository/api/getCommunity.ts +8 -0
- package/src/communityRepository/api/joinCommunity.ts +4 -1
- package/src/communityRepository/communityMembership/events/index.ts +1 -0
- package/src/communityRepository/communityMembership/events/onLocalCommunityJoin.ts +20 -0
- package/src/communityRepository/internalAPI/getMyJoinRequest.ts +43 -0
- package/src/communityRepository/internalAPI/joinCommunity.ts +66 -0
- package/src/communityRepository/joinRequest/events/index.ts +3 -0
- package/src/communityRepository/joinRequest/events/onJoinRequestCreated.ts +33 -0
- package/src/communityRepository/joinRequest/events/onJoinRequestDeleted.ts +33 -0
- package/src/communityRepository/joinRequest/events/onJoinRequestUpdated.ts +33 -0
- package/src/communityRepository/joinRequest/internalAPI/approveJoinRequest.ts +52 -0
- package/src/communityRepository/joinRequest/internalAPI/cancelJoinRequest.ts +46 -0
- package/src/communityRepository/joinRequest/internalAPI/rejectJoinRequest.ts +52 -0
- package/src/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.ts +6 -0
- package/src/communityRepository/observers/getCommunity.ts +3 -0
- package/src/communityRepository/observers/getJoinRequestList/JoinRequestListLiveCollectionController.ts +130 -0
- package/src/communityRepository/observers/getJoinRequestList/JoinRequestListPaginationController.ts +30 -0
- package/src/communityRepository/observers/getJoinRequestList/JoinRequestListQueryStreamController.ts +112 -0
- package/src/communityRepository/observers/getJoinRequestList/enum.ts +5 -0
- package/src/communityRepository/observers/getJoinRequestList.ts +51 -0
- package/src/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.ts +126 -0
- package/src/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.ts +26 -0
- package/src/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.ts +108 -0
- package/src/communityRepository/observers/getJoinRequests/enum.ts +5 -0
- package/src/communityRepository/observers/getJoinRequests.ts +44 -0
- package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesLiveCollectionController.ts +2 -1
- package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesLiveCollectionController.ts +2 -1
- package/src/communityRepository/observers/index.ts +1 -0
- package/src/communityRepository/observers/searchCommunities/SearchCommunitiesPaginationController.ts +1 -0
- package/src/communityRepository/utils/communityWithMembership.ts +1 -1
- package/src/communityRepository/utils/payload.ts +27 -1
- package/src/core/model/idResolvers.ts +1 -0
- package/src/core/model/index.ts +1 -0
- package/src/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostQueryStreamController.ts +7 -1
- package/src/postRepository/observers/getPinnedPosts/PinnedPostQueryStreamController.ts +7 -1
- package/src/subChannelRepository/utils/prepareSubChannelPayload.ts +4 -0
- package/src/utils/linkedObject/communityLinkedObject.ts +22 -0
- package/src/utils/linkedObject/index.ts +2 -0
- package/src/utils/linkedObject/joinRequestLinkedObject.ts +31 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalPinnedPostQueryStreamController.d.ts","sourceRoot":"","sources":["../../../../src/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostQueryStreamController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAKpF,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"GlobalPinnedPostQueryStreamController.d.ts","sourceRoot":"","sources":["../../../../src/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostQueryStreamController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAKpF,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,qBAAa,qCAAsC,SAAQ,qBAAqB,CAC9E,KAAK,CAAC,iBAAiB,EACvB,KAAK,CAAC,8BAA8B,CACrC;IACC,OAAO,CAAC,YAAY,CAAqD;IAEzE,OAAO,CAAC,cAAc,CAAoE;gBAGxF,KAAK,EAAE,KAAK,CAAC,8BAA8B,EAC3C,QAAQ,EAAE,MAAM,EAAE,EAClB,YAAY,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,0BAA0B,KAAK,IAAI,EAChE,cAAc,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,iBAAiB,KAAK,KAAK,CAAC,oBAAoB;IAQ7E,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,iBAAiB;IAcpD,mBAAmB,CACjB,QAAQ,EAAE,KAAK,CAAC,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,EAC7D,SAAS,EAAE,KAAK,CAAC,2BAA2B,EAC5C,OAAO,UAAQ;IAuBjB,OAAO,CAAC,MAAM,EAAE,eAAe,UACf,MAAM,YAAY;IAgBlC,YAAY,CACV,gBAAgB,EAAE;QAChB,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,KAAK,IAAI,KAAK,KAAK,CAAC,YAAY,CAAC;QACxE,MAAM,EAAE,eAAe,CAAC;KACzB,EAAE;CAIN"}
|
package/dist/postRepository/observers/getPinnedPosts/PinnedPostQueryStreamController.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PinnedPostQueryStreamController.d.ts","sourceRoot":"","sources":["../../../../src/postRepository/observers/getPinnedPosts/PinnedPostQueryStreamController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"PinnedPostQueryStreamController.d.ts","sourceRoot":"","sources":["../../../../src/postRepository/observers/getPinnedPosts/PinnedPostQueryStreamController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAOpF,qBAAa,+BAAgC,SAAQ,qBAAqB,CACxE,KAAK,CAAC,iBAAiB,EACvB,KAAK,CAAC,wBAAwB,CAC/B;IACC,OAAO,CAAC,YAAY,CAAqD;IAEzE,OAAO,CAAC,cAAc,CAAoE;gBAGxF,KAAK,EAAE,KAAK,CAAC,wBAAwB,EACrC,QAAQ,EAAE,MAAM,EAAE,EAClB,YAAY,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,0BAA0B,KAAK,IAAI,EAChE,cAAc,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,iBAAiB,KAAK,KAAK,CAAC,oBAAoB;IAQ7E,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,iBAAiB;IAcpD,mBAAmB,CACjB,QAAQ,EAAE,KAAK,CAAC,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,EAC7D,SAAS,EAAE,KAAK,CAAC,2BAA2B,EAC5C,OAAO,UAAQ;CAsBlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareSubChannelPayload.d.ts","sourceRoot":"","sources":["../../../src/subChannelRepository/utils/prepareSubChannelPayload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prepareSubChannelPayload.d.ts","sourceRoot":"","sources":["../../../src/subChannelRepository/utils/prepareSubChannelPayload.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gCAAgC,UAA6C,CAAC;AAE3F;;GAEG;AACH,eAAO,MAAM,oBAAoB,oBAAqB,KAAK,MAAM,aAAa,EAAE,aAAa,CAAC,YACtC,CAAC;AAEzD,eAAO,MAAM,wBAAwB,eAAgB,MAAM,iBAAiB,SAI3E,CAAC;AAEF,eAAO,MAAM,wBAAwB,eACvB,MAAM,iBAAiB,KAClC,QAAQ,MAAM,0BAA0B,CA+B1C,CAAC;AAEF,aAAK,mBAAmB,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,0BAA0B,CAAC,GAAG;IACpF,yBAAyB,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,0BAA0B,CAAC,CAAC;CAChF,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,EACjC,wBAAwB,EACxB,GAAG,IAAI,EACR,EAAE,KAAK,CAAC,gBAAgB,GAAG,mBAAmB,CAQ9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"communityLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/communityLinkedObject.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"communityLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/communityLinkedObject.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,qBAAqB,cAAe,MAAM,iBAAiB,KAAG,MAAM,SAiDhF,CAAC"}
|
|
@@ -14,5 +14,6 @@ export declare const LinkedObject: {
|
|
|
14
14
|
notificationTray: (noti: Amity.RawNotificationTrayItem) => Amity.NotificationTrayItem;
|
|
15
15
|
community: (community: Amity.InternalCommunity) => Amity.Community;
|
|
16
16
|
invitation: (invitation: Amity.InternalInvitation) => Amity.Invitation;
|
|
17
|
+
joinRequest: (joinRequest: Amity.InternalJoinRequest) => Amity.JoinRequest;
|
|
17
18
|
};
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/index.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;CAiBxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"joinRequestLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/joinRequestLinkedObject.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,gBACrB,MAAM,mBAAmB,KACrC,MAAM,WAsBR,CAAC"}
|
package/package.json
CHANGED
|
@@ -188,7 +188,7 @@ declare global {
|
|
|
188
188
|
};
|
|
189
189
|
|
|
190
190
|
type LocalCommunityEvents = {
|
|
191
|
-
'local.community.joined': Amity.CommunityMembershipPayload;
|
|
191
|
+
'local.community.joined': Amity.CommunityMembershipPayload; // v3 join community
|
|
192
192
|
'local.community.left': Amity.CommunityMembershipPayload;
|
|
193
193
|
'local.community.roleAdded': Amity.ProcessedCommunityPayload;
|
|
194
194
|
'local.community.roleRemoved': Amity.ProcessedCommunityPayload;
|
|
@@ -265,6 +265,12 @@ declare global {
|
|
|
265
265
|
'local.invitation.updated': Amity.InternalInvitation[];
|
|
266
266
|
'local.invitation.deleted': Amity.InternalInvitation[];
|
|
267
267
|
|
|
268
|
+
'local.community.join': Amity.InternalJoinRequest[]; // v4 join community with status
|
|
269
|
+
|
|
270
|
+
'local.joinRequest.created': Amity.InternalJoinRequest[];
|
|
271
|
+
'local.joinRequest.updated': Amity.InternalJoinRequest[];
|
|
272
|
+
'local.joinRequest.deleted': Amity.InternalJoinRequest[];
|
|
273
|
+
|
|
268
274
|
sessionStateChange: Amity.SessionStates;
|
|
269
275
|
// used by accessTokenExpiryWatcher
|
|
270
276
|
tokenExpired: Amity.SessionStates.TOKEN_EXPIRED;
|
package/src/@types/core/model.ts
CHANGED
|
@@ -62,6 +62,8 @@ declare global {
|
|
|
62
62
|
notificationTraySeen: Amity.InternalNotificationTraySeen;
|
|
63
63
|
|
|
64
64
|
invitation: Amity.InternalInvitation;
|
|
65
|
+
|
|
66
|
+
joinRequest: Amity.InternalJoinRequest;
|
|
65
67
|
};
|
|
66
68
|
|
|
67
69
|
type Model = ValueOf<Models>;
|
|
@@ -128,6 +130,7 @@ declare global {
|
|
|
128
130
|
notificationTraySeen: Pick<Amity.InternalNotificationTraySeen, 'userId'>;
|
|
129
131
|
|
|
130
132
|
invitation: Pick<Amity.InternalInvitation, '_id'>;
|
|
133
|
+
joinRequest: Pick<Amity.InternalJoinRequest, 'joinRequestId'>;
|
|
131
134
|
};
|
|
132
135
|
}
|
|
133
136
|
}
|
|
@@ -29,6 +29,7 @@ declare global {
|
|
|
29
29
|
notificationTrayItem: Amity.NotificationTrayPayload;
|
|
30
30
|
invitation: Amity.InvitationPayload;
|
|
31
31
|
myInvitation: Amity.MyInvitationsPayload;
|
|
32
|
+
joinRequest: Amity.CommunityJoinRequestPayload;
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
type UserPayload = {
|
|
@@ -227,7 +228,7 @@ declare global {
|
|
|
227
228
|
type SubChannelPayload<T extends Amity.MessageContentType = any> = {
|
|
228
229
|
messageFeeds: Amity.RawSubChannel[];
|
|
229
230
|
messages: Amity.RawMessage<T>[];
|
|
230
|
-
users: Amity.
|
|
231
|
+
users: Amity.RawUser[];
|
|
231
232
|
files: Amity.File[];
|
|
232
233
|
};
|
|
233
234
|
|
|
@@ -299,6 +300,12 @@ declare global {
|
|
|
299
300
|
files: Amity.File[];
|
|
300
301
|
};
|
|
301
302
|
|
|
303
|
+
type CommunityJoinRequestPayload = {
|
|
304
|
+
joinRequests: Amity.RawJoinRequest[];
|
|
305
|
+
users: Amity.RawUser[];
|
|
306
|
+
files: Amity.File[];
|
|
307
|
+
};
|
|
308
|
+
|
|
302
309
|
type RecommendedCommunityPayload = Amity.CommunityPayload;
|
|
303
310
|
type TrendingCommunityPayload = Amity.CommunityPayload;
|
|
304
311
|
|
|
@@ -310,6 +317,16 @@ declare global {
|
|
|
310
317
|
type ProcessedCommunityPayload = Omit<CommunityPayload, 'communities' | 'communityUsers'> & {
|
|
311
318
|
communities: Amity.InternalCommunity[];
|
|
312
319
|
communityUsers: Amity.Membership<'community'>[];
|
|
320
|
+
users: Amity.InternalUser[];
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
type ProcessedJoinRequestPayload = Omit<
|
|
324
|
+
CommunityJoinRequestPayload,
|
|
325
|
+
'communities' | 'communityUsers' | 'joinRequests' | 'users'
|
|
326
|
+
> & {
|
|
327
|
+
joinRequests: Amity.InternalJoinRequest[];
|
|
328
|
+
files: Amity.File[];
|
|
329
|
+
users: Amity.InternalUser[];
|
|
313
330
|
};
|
|
314
331
|
|
|
315
332
|
type CategoryPayload = {
|
|
@@ -567,5 +584,9 @@ declare global {
|
|
|
567
584
|
invitations: Amity.InternalInvitation[];
|
|
568
585
|
users: Amity.InternalUser[];
|
|
569
586
|
};
|
|
587
|
+
|
|
588
|
+
type JoinRequestPayload = {
|
|
589
|
+
joinRequests: Amity.RawJoinRequest[];
|
|
590
|
+
};
|
|
570
591
|
}
|
|
571
592
|
}
|
|
@@ -96,8 +96,8 @@ declare global {
|
|
|
96
96
|
|
|
97
97
|
allowCommentInStory?: boolean;
|
|
98
98
|
|
|
99
|
-
isDiscoverable
|
|
100
|
-
requiresJoinApproval
|
|
99
|
+
isDiscoverable?: boolean;
|
|
100
|
+
requiresJoinApproval?: boolean;
|
|
101
101
|
} & Amity.Taggable &
|
|
102
102
|
Amity.Metadata &
|
|
103
103
|
Amity.Timestamps &
|
|
@@ -124,6 +124,16 @@ declare global {
|
|
|
124
124
|
limit?: number;
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
+
type QueryJoinCommunity = {
|
|
128
|
+
communityId: string;
|
|
129
|
+
status: Amity.JoinRequestStatus;
|
|
130
|
+
sortBy?: Amity.CommunitySortBy | Amity.CommunitySortByEnum;
|
|
131
|
+
options?: {
|
|
132
|
+
limit?: number;
|
|
133
|
+
token?: string;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
|
|
127
137
|
type SearchQueryCommunities = {
|
|
128
138
|
displayName?: string;
|
|
129
139
|
membership?: 'all' | 'member' | 'notMember';
|
|
@@ -136,11 +146,38 @@ declare global {
|
|
|
136
146
|
includeDiscoverablePrivateCommunity?: boolean;
|
|
137
147
|
};
|
|
138
148
|
|
|
149
|
+
type QueryJoinRequest = {
|
|
150
|
+
communityId: string;
|
|
151
|
+
status: Amity.JoinRequestStatus;
|
|
152
|
+
targetType: 'community';
|
|
153
|
+
type: Amity.JoinRequestType;
|
|
154
|
+
sortBy?: Amity.CommunitySortBy | Amity.CommunitySortByEnum;
|
|
155
|
+
options?: {
|
|
156
|
+
limit?: number;
|
|
157
|
+
token?: string;
|
|
158
|
+
};
|
|
159
|
+
page?: string;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
type QueryJoinRequestList = {
|
|
163
|
+
communityIds: string[];
|
|
164
|
+
sortBy?: Amity.CommunitySortBy | Amity.CommunitySortByEnum;
|
|
165
|
+
options?: {
|
|
166
|
+
limit?: number;
|
|
167
|
+
token?: string;
|
|
168
|
+
};
|
|
169
|
+
page?: string;
|
|
170
|
+
};
|
|
171
|
+
|
|
139
172
|
type CommunityLiveCollection = Amity.LiveCollectionParams<Omit<QueryCommunities, 'page'>>;
|
|
140
173
|
|
|
141
174
|
type RecommendedCommunityLiveCollection = Amity.LiveCollectionParams<{ limit?: number }>;
|
|
142
175
|
type TrendingCommunityLiveCollection = Amity.LiveCollectionParams<{ limit?: number }>;
|
|
143
176
|
|
|
177
|
+
type JoinRequestLiveCollection = Amity.LiveCollectionParams<QueryJoinRequest>;
|
|
178
|
+
|
|
179
|
+
type JoinRequestListLiveCollection = Amity.LiveCollectionParams<QueryJoinRequestList>;
|
|
180
|
+
|
|
144
181
|
type SearchCommunityLiveCollection = Amity.LiveCollectionParams<
|
|
145
182
|
Omit<SearchQueryCommunities, 'page'>
|
|
146
183
|
>;
|
|
@@ -158,6 +195,16 @@ declare global {
|
|
|
158
195
|
Pick<SearchQueryCommunities, 'page'>
|
|
159
196
|
>;
|
|
160
197
|
|
|
198
|
+
type JoinRequestLiveCollectionCache = Amity.LiveCollectionCache<
|
|
199
|
+
Amity.JoinRequest['joinRequestId'],
|
|
200
|
+
Pick<QueryJoinRequest, 'page'>
|
|
201
|
+
>;
|
|
202
|
+
|
|
203
|
+
type JoinRequestListLiveCollectionCache = Amity.LiveCollectionCache<
|
|
204
|
+
Amity.JoinRequest['joinRequestId'],
|
|
205
|
+
Pick<QueryJoinRequestList, 'page'>
|
|
206
|
+
>;
|
|
207
|
+
|
|
161
208
|
type QueryCommunityMembers = {
|
|
162
209
|
communityId: string;
|
|
163
210
|
memberships?: ('banned' | 'member')[];
|
|
@@ -227,6 +274,12 @@ declare global {
|
|
|
227
274
|
callback: Amity.LiveCollectionCallback<Amity.Invitation>,
|
|
228
275
|
) => Amity.Unsubscriber;
|
|
229
276
|
getInvitation: () => Promise<Amity.Invitation | undefined>;
|
|
277
|
+
join: () => Promise<Amity.JoinResult>;
|
|
278
|
+
getJoinRequests: (
|
|
279
|
+
params: QueryJoinRequest,
|
|
280
|
+
callback: Amity.LiveCollectionCallback<Amity.JoinRequest>,
|
|
281
|
+
) => Amity.Unsubscriber;
|
|
282
|
+
getMyJoinRequest: () => Promise<Amity.JoinRequest | undefined>;
|
|
230
283
|
};
|
|
231
284
|
}
|
|
232
285
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
|
|
3
|
+
export const enum JoinRequestStatusEnum {
|
|
4
|
+
Pending = 'pending',
|
|
5
|
+
Approved = 'approved',
|
|
6
|
+
Rejected = 'rejected',
|
|
7
|
+
Cancelled = 'cancelled',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const enum JoinResultStatusEnum {
|
|
11
|
+
Success = 'success',
|
|
12
|
+
Pending = 'pending',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare global {
|
|
16
|
+
namespace Amity {
|
|
17
|
+
type JoinRequestStatus = JoinRequestStatusEnum;
|
|
18
|
+
|
|
19
|
+
type JoinResultStatus = JoinResultStatusEnum;
|
|
20
|
+
|
|
21
|
+
type JoinRequestType = 'communityJoinRequest';
|
|
22
|
+
|
|
23
|
+
type JoinResult = {
|
|
24
|
+
status: Amity.JoinResultStatus;
|
|
25
|
+
request?: Amity.JoinRequest;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type RawJoinRequest = {
|
|
29
|
+
_id: string;
|
|
30
|
+
createdAt: Amity.timestamp;
|
|
31
|
+
joinRequestId: string;
|
|
32
|
+
networkId: string;
|
|
33
|
+
|
|
34
|
+
requestorId: string;
|
|
35
|
+
requestorInternalId: string;
|
|
36
|
+
requestorPublicId: string;
|
|
37
|
+
|
|
38
|
+
respondedAt: Amity.timestamp | null;
|
|
39
|
+
responderId: string | null;
|
|
40
|
+
responderInternalId: string | null;
|
|
41
|
+
responderPublicId: string | null;
|
|
42
|
+
|
|
43
|
+
status: Amity.JoinRequestStatus;
|
|
44
|
+
targetId: string;
|
|
45
|
+
targetType: string;
|
|
46
|
+
type: Amity.JoinRequestType;
|
|
47
|
+
updatedAt: Amity.timestamp;
|
|
48
|
+
userId: string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
type InternalJoinRequest = Omit<RawJoinRequest, '_id'>;
|
|
52
|
+
|
|
53
|
+
type JoinRequest = Omit<Amity.InternalJoinRequest, 'responderId'> &
|
|
54
|
+
Amity.JoinRequestLinkedObject & {
|
|
55
|
+
user?: Amity.User;
|
|
56
|
+
feeds?: Amity.Feed[];
|
|
57
|
+
files?: Amity.File[];
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
type JoinRequestLinkedObject = {
|
|
61
|
+
cancel: () => Promise<void>;
|
|
62
|
+
approve: () => Promise<void>;
|
|
63
|
+
reject: () => Promise<void>;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -10,6 +10,7 @@ declare global {
|
|
|
10
10
|
POST_REACT = 'reaction_on_post',
|
|
11
11
|
COMMENT_REACT = 'reaction_on_comment',
|
|
12
12
|
REPLY_REACT = 'reaction_on_reply',
|
|
13
|
+
RESPONSE_JOIN_REQUEST = 'respond_on_join_request',
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
const enum TrayAction {
|
|
@@ -19,6 +20,7 @@ declare global {
|
|
|
19
20
|
REACTION = 'reaction',
|
|
20
21
|
MENTION = 'mention',
|
|
21
22
|
REPLY = 'reply',
|
|
23
|
+
JOIN_REQUEST = 'join_request',
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
type RawNotificationTrayItem = {
|
package/src/@types/index.ts
CHANGED
|
@@ -28,12 +28,14 @@ export const getCommunities = async (
|
|
|
28
28
|
const client = getActiveClient();
|
|
29
29
|
client.log('community/getCommunities', communityIds);
|
|
30
30
|
|
|
31
|
+
const encodedCommunityIds = communityIds.map(communityId => encodeURIComponent(communityId));
|
|
32
|
+
|
|
31
33
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
32
34
|
const { data: payload } = await client.http.get<Amity.CommunityPayload>(
|
|
33
35
|
`/api/v3/communities/list`,
|
|
34
36
|
{
|
|
35
37
|
params: {
|
|
36
|
-
communityIds,
|
|
38
|
+
communityIds: encodedCommunityIds,
|
|
37
39
|
includeDiscoverablePrivateCommunity: includeDiscoverablePrivateCommunity ?? true,
|
|
38
40
|
},
|
|
39
41
|
},
|
|
@@ -23,6 +23,8 @@ import { LinkedObject } from '~/utils/linkedObject';
|
|
|
23
23
|
*/
|
|
24
24
|
export const getCommunity = async (
|
|
25
25
|
communityId: Amity.Community['communityId'],
|
|
26
|
+
type?: Amity.JoinRequestType,
|
|
27
|
+
includeDiscoverablePrivateCommunity?: boolean,
|
|
26
28
|
): Promise<Amity.Cached<Amity.Community>> => {
|
|
27
29
|
const client = getActiveClient();
|
|
28
30
|
client.log('community/getCommunity', communityId);
|
|
@@ -30,6 +32,12 @@ export const getCommunity = async (
|
|
|
30
32
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
31
33
|
const { data: payload } = await client.http.get<Amity.CommunityPayload>(
|
|
32
34
|
`/api/v3/communities/${communityId}`,
|
|
35
|
+
{
|
|
36
|
+
params: {
|
|
37
|
+
type: 'communityJoinRequest',
|
|
38
|
+
includeDiscoverablePrivateCommunity: includeDiscoverablePrivateCommunity ?? true,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
33
41
|
);
|
|
34
42
|
|
|
35
43
|
const data = prepareCommunityPayload(payload);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { getActiveClient } from '~/client/api';
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
2
|
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
import { prepareCommunityPayload } from '~/communityRepository/utils';
|
|
5
5
|
import { fireEvent } from '~/core/events';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated This function will to be deprecated and use the new community.join().
|
|
9
|
+
*/
|
|
7
10
|
/* begin_public_function
|
|
8
11
|
id: community.join
|
|
9
12
|
*/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
import { createEventSubscriber } from '~/core/events';
|
|
3
|
+
|
|
4
|
+
export const onLocalCommunityJoin = (
|
|
5
|
+
callback: (joinRequest: Amity.InternalJoinRequest) => void,
|
|
6
|
+
) => {
|
|
7
|
+
const client = getActiveClient();
|
|
8
|
+
|
|
9
|
+
const filter = async (rawPayload: Amity.InternalJoinRequest[]) => {
|
|
10
|
+
callback(rawPayload[0]);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const disposers = [
|
|
14
|
+
createEventSubscriber(client, 'onCommunityUpdate', 'local.community.join', filter),
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
return () => {
|
|
18
|
+
disposers.forEach(fn => fn());
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
3
|
+
import { prepareCommunityJoinRequestPayload } from '~/communityRepository/utils';
|
|
4
|
+
import { joinRequestLinkedObject } from '~/utils/linkedObject/joinRequestLinkedObject';
|
|
5
|
+
|
|
6
|
+
/* begin_public_function
|
|
7
|
+
id: community.getMyJoinRequest
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* ```js
|
|
11
|
+
* import { community } from '@amityco/ts-sdk'
|
|
12
|
+
* const isJoined = await community.getMyJoinRequest('foobar')
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* Joins a {@link Amity.Community} object
|
|
16
|
+
*
|
|
17
|
+
* @param communityId the {@link Amity.Community} to join
|
|
18
|
+
* @returns A success boolean if the {@link Amity.Community} was joined
|
|
19
|
+
*
|
|
20
|
+
* @category Community API
|
|
21
|
+
* @async
|
|
22
|
+
*/
|
|
23
|
+
export const getMyJoinRequest = async (
|
|
24
|
+
communityId: Amity.Community['communityId'],
|
|
25
|
+
): Promise<Amity.Cached<Amity.JoinRequest | undefined>> => {
|
|
26
|
+
const client = getActiveClient();
|
|
27
|
+
client.log('community/myJoinRequest', communityId);
|
|
28
|
+
|
|
29
|
+
const { data: payload } = await client.http.get<Amity.CommunityJoinRequestPayload>(
|
|
30
|
+
`/api/v4/communities/${communityId}/join/me`,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const data = prepareCommunityJoinRequestPayload(payload);
|
|
34
|
+
|
|
35
|
+
const cachedAt = client.cache && Date.now();
|
|
36
|
+
if (client.cache) ingestInCache(data, { cachedAt });
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
data: data.joinRequests[0] ? joinRequestLinkedObject(data.joinRequests[0]) : undefined,
|
|
40
|
+
cachedAt,
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
/* end_public_function */
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
3
|
+
import { pullFromCache } from '~/cache/api/pullFromCache';
|
|
4
|
+
import { upsertInCache } from '~/cache/api/upsertInCache';
|
|
5
|
+
import { prepareCommunityJoinRequestPayload } from '~/communityRepository/utils';
|
|
6
|
+
import { fireEvent } from '~/core/events';
|
|
7
|
+
import { JoinRequestStatusEnum, JoinResultStatusEnum } from '~/@types/domains/joinRequest';
|
|
8
|
+
import { joinRequestLinkedObject } from '~/utils/linkedObject/joinRequestLinkedObject';
|
|
9
|
+
|
|
10
|
+
/* begin_public_function
|
|
11
|
+
id: community.join
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* ```js
|
|
15
|
+
* import { community } from '@amityco/ts-sdk'
|
|
16
|
+
* const isJoined = await community.join('foobar')
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* Joins a {@link Amity.Community} object
|
|
20
|
+
*
|
|
21
|
+
* @param communityId the {@link Amity.Community} to join
|
|
22
|
+
* @returns A status join result
|
|
23
|
+
*
|
|
24
|
+
* @category Community API
|
|
25
|
+
* @async
|
|
26
|
+
*/
|
|
27
|
+
export const joinRequest = async (
|
|
28
|
+
communityId: Amity.Community['communityId'],
|
|
29
|
+
): Promise<Amity.JoinResult> => {
|
|
30
|
+
const client = getActiveClient();
|
|
31
|
+
client.log('community/joinRequest', communityId);
|
|
32
|
+
|
|
33
|
+
const { data: payload } = await client.http.post<Amity.CommunityJoinRequestPayload>(
|
|
34
|
+
`/api/v4/communities/${communityId}/join`,
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const data = prepareCommunityJoinRequestPayload(payload);
|
|
38
|
+
|
|
39
|
+
const cachedAt = client.cache && Date.now();
|
|
40
|
+
if (client.cache) ingestInCache(data, { cachedAt });
|
|
41
|
+
|
|
42
|
+
const status =
|
|
43
|
+
data.joinRequests[0].status === JoinRequestStatusEnum.Approved
|
|
44
|
+
? JoinResultStatusEnum.Success
|
|
45
|
+
: JoinResultStatusEnum.Pending;
|
|
46
|
+
|
|
47
|
+
if (status === JoinResultStatusEnum.Success && client.cache) {
|
|
48
|
+
const community = pullFromCache<Amity.Community>(['community', 'get', communityId])?.data;
|
|
49
|
+
|
|
50
|
+
if (community) {
|
|
51
|
+
const updatedCommunity = {
|
|
52
|
+
...community,
|
|
53
|
+
isJoined: true,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
upsertInCache(['community', 'get', communityId], updatedCommunity);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
fireEvent('local.community.join', data.joinRequests);
|
|
61
|
+
|
|
62
|
+
return status === JoinResultStatusEnum.Success
|
|
63
|
+
? { status }
|
|
64
|
+
: { status, request: joinRequestLinkedObject(data.joinRequests[0]) };
|
|
65
|
+
};
|
|
66
|
+
/* end_public_function */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
import { createEventSubscriber } from '~/core/events';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ```js
|
|
6
|
+
* import { onJoinRequestCreated } from '@amityco/ts-sdk'
|
|
7
|
+
* const dispose = onJoinRequestCreated(data => {
|
|
8
|
+
* // ...
|
|
9
|
+
* })
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Fired when an {@link Amity.CommunityJoinRequestPayload} has been created
|
|
13
|
+
*
|
|
14
|
+
* @param callback The function to call when the event was fired
|
|
15
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
16
|
+
*
|
|
17
|
+
* @category JoinRequest Events
|
|
18
|
+
*/
|
|
19
|
+
export const onJoinRequestCreated = (
|
|
20
|
+
callback: Amity.Listener<Amity.InternalJoinRequest[]>,
|
|
21
|
+
): Amity.Unsubscriber => {
|
|
22
|
+
const client = getActiveClient();
|
|
23
|
+
|
|
24
|
+
const disposers = [
|
|
25
|
+
createEventSubscriber(client, 'onJoinRequestCreated', 'local.joinRequest.created', payload =>
|
|
26
|
+
callback(payload),
|
|
27
|
+
),
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
return () => {
|
|
31
|
+
disposers.forEach(fn => fn());
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
import { createEventSubscriber } from '~/core/events';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ```js
|
|
6
|
+
* import { onJoinRequestDeleted } from '@amityco/ts-sdk'
|
|
7
|
+
* const dispose = onJoinRequestDeleted(data => {
|
|
8
|
+
* // ...
|
|
9
|
+
* })
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Fired when an {@link Amity.CommunityJoinRequestPayload} has been created
|
|
13
|
+
*
|
|
14
|
+
* @param callback The function to call when the event was fired
|
|
15
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
16
|
+
*
|
|
17
|
+
* @category JoinRequest Events
|
|
18
|
+
*/
|
|
19
|
+
export const onJoinRequestDeleted = (
|
|
20
|
+
callback: Amity.Listener<Amity.InternalJoinRequest[]>,
|
|
21
|
+
): Amity.Unsubscriber => {
|
|
22
|
+
const client = getActiveClient();
|
|
23
|
+
|
|
24
|
+
const disposers = [
|
|
25
|
+
createEventSubscriber(client, 'onJoinRequestDeleted', 'local.joinRequest.deleted', payload =>
|
|
26
|
+
callback(payload),
|
|
27
|
+
),
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
return () => {
|
|
31
|
+
disposers.forEach(fn => fn());
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
import { createEventSubscriber } from '~/core/events';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ```js
|
|
6
|
+
* import { onJoinRequestUpdated } from '@amityco/ts-sdk'
|
|
7
|
+
* const dispose = onJoinRequestUpdated(data => {
|
|
8
|
+
* // ...
|
|
9
|
+
* })
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Fired when an {@link Amity.CommunityJoinRequestPayload} has been created
|
|
13
|
+
*
|
|
14
|
+
* @param callback The function to call when the event was fired
|
|
15
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
16
|
+
*
|
|
17
|
+
* @category JoinRequest Events
|
|
18
|
+
*/
|
|
19
|
+
export const onJoinRequestUpdated = (
|
|
20
|
+
callback: Amity.Listener<Amity.InternalJoinRequest[]>,
|
|
21
|
+
): Amity.Unsubscriber => {
|
|
22
|
+
const client = getActiveClient();
|
|
23
|
+
|
|
24
|
+
const disposers = [
|
|
25
|
+
createEventSubscriber(client, 'onJoinRequestUpdated', 'local.joinRequest.updated', payload =>
|
|
26
|
+
callback(payload),
|
|
27
|
+
),
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
return () => {
|
|
31
|
+
disposers.forEach(fn => fn());
|
|
32
|
+
};
|
|
33
|
+
};
|