@amityco/ts-sdk 7.5.1-1d67f17.0 → 7.5.1-3566b16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/dist/@types/core/events.d.ts +8 -1
  2. package/dist/@types/core/events.d.ts.map +1 -1
  3. package/dist/@types/core/model.d.ts +5 -1
  4. package/dist/@types/core/model.d.ts.map +1 -1
  5. package/dist/@types/core/payload.d.ts +38 -5
  6. package/dist/@types/core/payload.d.ts.map +1 -1
  7. package/dist/@types/domains/client.d.ts +10 -0
  8. package/dist/@types/domains/client.d.ts.map +1 -1
  9. package/dist/@types/domains/community.d.ts +48 -1
  10. package/dist/@types/domains/community.d.ts.map +1 -1
  11. package/dist/@types/domains/invitation.d.ts +92 -0
  12. package/dist/@types/domains/invitation.d.ts.map +1 -0
  13. package/dist/@types/domains/joinRequest.d.ts +53 -0
  14. package/dist/@types/domains/joinRequest.d.ts.map +1 -0
  15. package/dist/@types/domains/notification.d.ts +4 -2
  16. package/dist/@types/domains/notification.d.ts.map +1 -1
  17. package/dist/@types/index.d.ts +3 -0
  18. package/dist/@types/index.d.ts.map +1 -1
  19. package/dist/channelRepository/observers/getChannel.d.ts.map +1 -1
  20. package/dist/channelRepository/observers/getChannels/ChannelLiveCollectionController.d.ts.map +1 -1
  21. package/dist/channelRepository/observers/getTotalChannelsUnread.d.ts.map +1 -1
  22. package/dist/channelRepository/utils/prepareChannelPayload.d.ts.map +1 -1
  23. package/dist/communityRepository/api/createCommunity.d.ts +2 -2
  24. package/dist/communityRepository/api/createCommunity.d.ts.map +1 -1
  25. package/dist/communityRepository/api/getCommunities.d.ts +1 -1
  26. package/dist/communityRepository/api/getCommunities.d.ts.map +1 -1
  27. package/dist/communityRepository/api/getCommunity.d.ts +1 -1
  28. package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
  29. package/dist/communityRepository/api/getRecommendedCommunities.d.ts +3 -1
  30. package/dist/communityRepository/api/getRecommendedCommunities.d.ts.map +1 -1
  31. package/dist/communityRepository/api/getTrendingCommunities.d.ts +3 -1
  32. package/dist/communityRepository/api/getTrendingCommunities.d.ts.map +1 -1
  33. package/dist/communityRepository/api/joinCommunity.d.ts +3 -0
  34. package/dist/communityRepository/api/joinCommunity.d.ts.map +1 -1
  35. package/dist/communityRepository/api/queryCommunities.d.ts.map +1 -1
  36. package/dist/communityRepository/api/updateCommunity.d.ts +2 -2
  37. package/dist/communityRepository/api/updateCommunity.d.ts.map +1 -1
  38. package/dist/communityRepository/communityMembership/events/index.d.ts +1 -0
  39. package/dist/communityRepository/communityMembership/events/index.d.ts.map +1 -1
  40. package/dist/communityRepository/communityMembership/events/onCommunityJoined.d.ts +1 -1
  41. package/dist/communityRepository/communityMembership/events/onCommunityJoined.d.ts.map +1 -1
  42. package/dist/communityRepository/communityMembership/events/onCommunityLeft.d.ts +1 -1
  43. package/dist/communityRepository/communityMembership/events/onCommunityLeft.d.ts.map +1 -1
  44. package/dist/communityRepository/communityMembership/events/onCommunityUserAdded.d.ts +1 -1
  45. package/dist/communityRepository/communityMembership/events/onCommunityUserAdded.d.ts.map +1 -1
  46. package/dist/communityRepository/communityMembership/events/onCommunityUserBanned.d.ts +1 -1
  47. package/dist/communityRepository/communityMembership/events/onCommunityUserBanned.d.ts.map +1 -1
  48. package/dist/communityRepository/communityMembership/events/onCommunityUserChanged.d.ts +1 -1
  49. package/dist/communityRepository/communityMembership/events/onCommunityUserChanged.d.ts.map +1 -1
  50. package/dist/communityRepository/communityMembership/events/onCommunityUserRemoved.d.ts +1 -1
  51. package/dist/communityRepository/communityMembership/events/onCommunityUserRemoved.d.ts.map +1 -1
  52. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleAdded.d.ts +1 -1
  53. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleAdded.d.ts.map +1 -1
  54. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.d.ts +1 -1
  55. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.d.ts.map +1 -1
  56. package/dist/communityRepository/communityMembership/events/onCommunityUserUnbanned.d.ts +1 -1
  57. package/dist/communityRepository/communityMembership/events/onCommunityUserUnbanned.d.ts.map +1 -1
  58. package/dist/communityRepository/communityMembership/events/onLocalCommunityJoin.d.ts +2 -0
  59. package/dist/communityRepository/communityMembership/events/onLocalCommunityJoin.d.ts.map +1 -0
  60. package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts +1 -1
  61. package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts.map +1 -1
  62. package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts +1 -1
  63. package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts.map +1 -1
  64. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserAdded.d.ts +1 -1
  65. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserAdded.d.ts.map +1 -1
  66. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.d.ts +1 -1
  67. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.d.ts.map +1 -1
  68. package/dist/communityRepository/communityMembership/events/onUserDeleted.d.ts +1 -1
  69. package/dist/communityRepository/communityMembership/events/onUserDeleted.d.ts.map +1 -1
  70. package/dist/communityRepository/communityMembership/events/utils.d.ts +2 -2
  71. package/dist/communityRepository/communityMembership/events/utils.d.ts.map +1 -1
  72. package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts +2 -2
  73. package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts.map +1 -1
  74. package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.d.ts +2 -2
  75. package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.d.ts.map +1 -1
  76. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.d.ts +1 -1
  77. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.d.ts.map +1 -1
  78. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.d.ts +1 -1
  79. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.d.ts.map +1 -1
  80. package/dist/communityRepository/events/onCommunityCreated.d.ts +1 -1
  81. package/dist/communityRepository/events/onCommunityCreated.d.ts.map +1 -1
  82. package/dist/communityRepository/events/onCommunityDeleted.d.ts +1 -1
  83. package/dist/communityRepository/events/onCommunityDeleted.d.ts.map +1 -1
  84. package/dist/communityRepository/events/onCommunityUpdated.d.ts +1 -1
  85. package/dist/communityRepository/events/onCommunityUpdated.d.ts.map +1 -1
  86. package/dist/communityRepository/events/utils.d.ts +1 -1
  87. package/dist/communityRepository/events/utils.d.ts.map +1 -1
  88. package/dist/communityRepository/internalAPI/getMyJoinRequest.d.ts +16 -0
  89. package/dist/communityRepository/internalAPI/getMyJoinRequest.d.ts.map +1 -0
  90. package/dist/communityRepository/internalAPI/joinCommunity.d.ts +16 -0
  91. package/dist/communityRepository/internalAPI/joinCommunity.d.ts.map +1 -0
  92. package/dist/communityRepository/joinRequest/events/index.d.ts +4 -0
  93. package/dist/communityRepository/joinRequest/events/index.d.ts.map +1 -0
  94. package/dist/communityRepository/joinRequest/events/onJoinRequestCreated.d.ts +17 -0
  95. package/dist/communityRepository/joinRequest/events/onJoinRequestCreated.d.ts.map +1 -0
  96. package/dist/communityRepository/joinRequest/events/onJoinRequestDeleted.d.ts +17 -0
  97. package/dist/communityRepository/joinRequest/events/onJoinRequestDeleted.d.ts.map +1 -0
  98. package/dist/communityRepository/joinRequest/events/onJoinRequestUpdated.d.ts +17 -0
  99. package/dist/communityRepository/joinRequest/events/onJoinRequestUpdated.d.ts.map +1 -0
  100. package/dist/communityRepository/joinRequest/internalAPI/approveJoinRequest.d.ts +16 -0
  101. package/dist/communityRepository/joinRequest/internalAPI/approveJoinRequest.d.ts.map +1 -0
  102. package/dist/communityRepository/joinRequest/internalAPI/cancelJoinRequest.d.ts +16 -0
  103. package/dist/communityRepository/joinRequest/internalAPI/cancelJoinRequest.d.ts.map +1 -0
  104. package/dist/communityRepository/joinRequest/internalAPI/rejectJoinRequest.d.ts +16 -0
  105. package/dist/communityRepository/joinRequest/internalAPI/rejectJoinRequest.d.ts.map +1 -0
  106. package/dist/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.d.ts.map +1 -1
  107. package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts +2 -2
  108. package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts.map +1 -1
  109. package/dist/communityRepository/observers/getCommunity.d.ts.map +1 -1
  110. package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListLiveCollectionController.d.ts +14 -0
  111. package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListLiveCollectionController.d.ts.map +1 -0
  112. package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListPaginationController.d.ts +9 -0
  113. package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListPaginationController.d.ts.map +1 -0
  114. package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListQueryStreamController.d.ts +15 -0
  115. package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListQueryStreamController.d.ts.map +1 -0
  116. package/dist/communityRepository/observers/getJoinRequestList/enum.d.ts +6 -0
  117. package/dist/communityRepository/observers/getJoinRequestList/enum.d.ts.map +1 -0
  118. package/dist/communityRepository/observers/getJoinRequestList.d.ts +12 -0
  119. package/dist/communityRepository/observers/getJoinRequestList.d.ts.map +1 -0
  120. package/dist/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.d.ts +14 -0
  121. package/dist/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.d.ts.map +1 -0
  122. package/dist/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.d.ts +9 -0
  123. package/dist/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.d.ts.map +1 -0
  124. package/dist/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.d.ts +15 -0
  125. package/dist/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.d.ts.map +1 -0
  126. package/dist/communityRepository/observers/getJoinRequests/enum.d.ts +6 -0
  127. package/dist/communityRepository/observers/getJoinRequests/enum.d.ts.map +1 -0
  128. package/dist/communityRepository/observers/getJoinRequests.d.ts +12 -0
  129. package/dist/communityRepository/observers/getJoinRequests.d.ts.map +1 -0
  130. package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesLiveCollectionController.d.ts.map +1 -1
  131. package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts +2 -2
  132. package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts.map +1 -1
  133. package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesLiveCollectionController.d.ts.map +1 -1
  134. package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.d.ts +2 -2
  135. package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.d.ts.map +1 -1
  136. package/dist/communityRepository/observers/index.d.ts +1 -0
  137. package/dist/communityRepository/observers/index.d.ts.map +1 -1
  138. package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesPaginationController.d.ts.map +1 -1
  139. package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts +2 -2
  140. package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts.map +1 -1
  141. package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts +2 -2
  142. package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts.map +1 -1
  143. package/dist/communityRepository/utils/communityWithMembership.d.ts +1 -1
  144. package/dist/communityRepository/utils/communityWithMembership.d.ts.map +1 -1
  145. package/dist/communityRepository/utils/payload.d.ts +2 -1
  146. package/dist/communityRepository/utils/payload.d.ts.map +1 -1
  147. package/dist/core/events.d.ts +3 -3
  148. package/dist/core/events.d.ts.map +1 -1
  149. package/dist/core/model/idResolvers.d.ts.map +1 -1
  150. package/dist/core/model/index.d.ts.map +1 -1
  151. package/dist/index.cjs.js +2945 -1494
  152. package/dist/index.d.ts +1 -0
  153. package/dist/index.d.ts.map +1 -1
  154. package/dist/index.esm.js +3131 -1681
  155. package/dist/index.umd.js +4 -4
  156. package/dist/invitationRepository/events/index.d.ts +4 -0
  157. package/dist/invitationRepository/events/index.d.ts.map +1 -0
  158. package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts +17 -0
  159. package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts.map +1 -0
  160. package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts +17 -0
  161. package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts.map +1 -0
  162. package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts +17 -0
  163. package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts.map +1 -0
  164. package/dist/invitationRepository/index.d.ts +3 -0
  165. package/dist/invitationRepository/index.d.ts.map +1 -0
  166. package/dist/invitationRepository/internalApi/acceptInvitation.d.ts +16 -0
  167. package/dist/invitationRepository/internalApi/acceptInvitation.d.ts.map +1 -0
  168. package/dist/invitationRepository/internalApi/createInvitations.d.ts +21 -0
  169. package/dist/invitationRepository/internalApi/createInvitations.d.ts.map +1 -0
  170. package/dist/invitationRepository/internalApi/getInvitation.d.ts +17 -0
  171. package/dist/invitationRepository/internalApi/getInvitation.d.ts.map +1 -0
  172. package/dist/invitationRepository/internalApi/index.d.ts +4 -0
  173. package/dist/invitationRepository/internalApi/index.d.ts.map +1 -0
  174. package/dist/invitationRepository/internalApi/rejectInvitation.d.ts +16 -0
  175. package/dist/invitationRepository/internalApi/rejectInvitation.d.ts.map +1 -0
  176. package/dist/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.d.ts +14 -0
  177. package/dist/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.d.ts.map +1 -0
  178. package/dist/invitationRepository/observers/getInvitations/InvitationsPaginationController.d.ts +5 -0
  179. package/dist/invitationRepository/observers/getInvitations/InvitationsPaginationController.d.ts.map +1 -0
  180. package/dist/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.d.ts +15 -0
  181. package/dist/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.d.ts.map +1 -0
  182. package/dist/invitationRepository/observers/getInvitations/enums.d.ts +6 -0
  183. package/dist/invitationRepository/observers/getInvitations/enums.d.ts.map +1 -0
  184. package/dist/invitationRepository/observers/getInvitations.d.ts +12 -0
  185. package/dist/invitationRepository/observers/getInvitations.d.ts.map +1 -0
  186. package/dist/invitationRepository/observers/getMyCommunityInvitations.d.ts +12 -0
  187. package/dist/invitationRepository/observers/getMyCommunityInvitations.d.ts.map +1 -0
  188. package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.d.ts +14 -0
  189. package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.d.ts.map +1 -0
  190. package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.d.ts +5 -0
  191. package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.d.ts.map +1 -0
  192. package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts +15 -0
  193. package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts.map +1 -0
  194. package/dist/invitationRepository/observers/index.d.ts +2 -0
  195. package/dist/invitationRepository/observers/index.d.ts.map +1 -0
  196. package/dist/invitationRepository/utils/convertRawInvitationToInternalInvitation.d.ts +2 -0
  197. package/dist/invitationRepository/utils/convertRawInvitationToInternalInvitation.d.ts.map +1 -0
  198. package/dist/invitationRepository/utils/index.d.ts +2 -0
  199. package/dist/invitationRepository/utils/index.d.ts.map +1 -0
  200. package/dist/invitationRepository/utils/prepareInvitationPayload.d.ts +2 -0
  201. package/dist/invitationRepository/utils/prepareInvitationPayload.d.ts.map +1 -0
  202. package/dist/invitationRepository/utils/prepareMyInvitationsPayload.d.ts +2 -0
  203. package/dist/invitationRepository/utils/prepareMyInvitationsPayload.d.ts.map +1 -0
  204. package/dist/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostQueryStreamController.d.ts.map +1 -1
  205. package/dist/postRepository/observers/getPinnedPosts/PinnedPostQueryStreamController.d.ts.map +1 -1
  206. package/dist/subChannelRepository/utils/prepareSubChannelPayload.d.ts.map +1 -1
  207. package/dist/utils/linkedObject/communityLinkedObject.d.ts +2 -0
  208. package/dist/utils/linkedObject/communityLinkedObject.d.ts.map +1 -0
  209. package/dist/utils/linkedObject/index.d.ts +3 -0
  210. package/dist/utils/linkedObject/index.d.ts.map +1 -1
  211. package/dist/utils/linkedObject/invitationLinkedObject.d.ts +2 -0
  212. package/dist/utils/linkedObject/invitationLinkedObject.d.ts.map +1 -0
  213. package/dist/utils/linkedObject/joinRequestLinkedObject.d.ts +2 -0
  214. package/dist/utils/linkedObject/joinRequestLinkedObject.d.ts.map +1 -0
  215. package/dist/utils/tests/dummy/post.d.ts +3 -3
  216. package/package.json +1 -1
  217. package/src/@types/core/events.ts +11 -1
  218. package/src/@types/core/model.ts +8 -1
  219. package/src/@types/core/payload.ts +48 -5
  220. package/src/@types/domains/client.ts +12 -0
  221. package/src/@types/domains/community.ts +73 -1
  222. package/src/@types/domains/invitation.ts +119 -0
  223. package/src/@types/domains/joinRequest.ts +66 -0
  224. package/src/@types/domains/notification.ts +2 -0
  225. package/src/@types/index.ts +3 -0
  226. package/src/channelRepository/observers/getChannel.ts +11 -1
  227. package/src/channelRepository/observers/getChannels/ChannelLiveCollectionController.ts +10 -1
  228. package/src/channelRepository/observers/getTotalChannelsUnread.ts +3 -1
  229. package/src/channelRepository/utils/prepareChannelPayload.ts +6 -1
  230. package/src/client/utils/ReadReceiptSync/readReceiptSyncEngine.ts +1 -1
  231. package/src/communityRepository/api/createCommunity.ts +5 -2
  232. package/src/communityRepository/api/getCommunities.ts +9 -2
  233. package/src/communityRepository/api/getCommunity.ts +13 -2
  234. package/src/communityRepository/api/getRecommendedCommunities.ts +11 -4
  235. package/src/communityRepository/api/getTrendingCommunities.ts +11 -4
  236. package/src/communityRepository/api/joinCommunity.ts +4 -1
  237. package/src/communityRepository/api/queryCommunities.ts +6 -1
  238. package/src/communityRepository/api/updateCommunity.ts +13 -3
  239. package/src/communityRepository/communityMembership/events/index.ts +1 -0
  240. package/src/communityRepository/communityMembership/events/onCommunityJoined.ts +1 -1
  241. package/src/communityRepository/communityMembership/events/onCommunityLeft.ts +1 -1
  242. package/src/communityRepository/communityMembership/events/onCommunityUserAdded.ts +1 -1
  243. package/src/communityRepository/communityMembership/events/onCommunityUserBanned.ts +1 -1
  244. package/src/communityRepository/communityMembership/events/onCommunityUserChanged.ts +1 -1
  245. package/src/communityRepository/communityMembership/events/onCommunityUserRemoved.ts +1 -1
  246. package/src/communityRepository/communityMembership/events/onCommunityUserRoleAdded.ts +1 -1
  247. package/src/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.ts +1 -1
  248. package/src/communityRepository/communityMembership/events/onCommunityUserUnbanned.ts +1 -1
  249. package/src/communityRepository/communityMembership/events/onLocalCommunityJoin.ts +20 -0
  250. package/src/communityRepository/communityMembership/events/onLocalCommunityJoined.ts +1 -1
  251. package/src/communityRepository/communityMembership/events/onLocalCommunityLeft.ts +1 -1
  252. package/src/communityRepository/communityMembership/events/onLocalCommunityUserAdded.ts +1 -1
  253. package/src/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.ts +1 -1
  254. package/src/communityRepository/communityMembership/events/onUserDeleted.ts +3 -1
  255. package/src/communityRepository/communityMembership/events/utils.ts +2 -2
  256. package/src/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.ts +8 -2
  257. package/src/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.ts +8 -2
  258. package/src/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.ts +1 -1
  259. package/src/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.ts +1 -1
  260. package/src/communityRepository/events/onCommunityCreated.ts +1 -1
  261. package/src/communityRepository/events/onCommunityDeleted.ts +1 -1
  262. package/src/communityRepository/events/onCommunityUpdated.ts +1 -1
  263. package/src/communityRepository/events/utils.ts +1 -1
  264. package/src/communityRepository/internalAPI/getMyJoinRequest.ts +43 -0
  265. package/src/communityRepository/internalAPI/joinCommunity.ts +66 -0
  266. package/src/communityRepository/joinRequest/events/index.ts +3 -0
  267. package/src/communityRepository/joinRequest/events/onJoinRequestCreated.ts +33 -0
  268. package/src/communityRepository/joinRequest/events/onJoinRequestDeleted.ts +33 -0
  269. package/src/communityRepository/joinRequest/events/onJoinRequestUpdated.ts +33 -0
  270. package/src/communityRepository/joinRequest/internalAPI/approveJoinRequest.ts +52 -0
  271. package/src/communityRepository/joinRequest/internalAPI/cancelJoinRequest.ts +46 -0
  272. package/src/communityRepository/joinRequest/internalAPI/rejectJoinRequest.ts +52 -0
  273. package/src/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.ts +6 -0
  274. package/src/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.ts +2 -2
  275. package/src/communityRepository/observers/getCommunity.ts +3 -0
  276. package/src/communityRepository/observers/getJoinRequestList/JoinRequestListLiveCollectionController.ts +130 -0
  277. package/src/communityRepository/observers/getJoinRequestList/JoinRequestListPaginationController.ts +30 -0
  278. package/src/communityRepository/observers/getJoinRequestList/JoinRequestListQueryStreamController.ts +112 -0
  279. package/src/communityRepository/observers/getJoinRequestList/enum.ts +5 -0
  280. package/src/communityRepository/observers/getJoinRequestList.ts +51 -0
  281. package/src/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.ts +126 -0
  282. package/src/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.ts +26 -0
  283. package/src/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.ts +108 -0
  284. package/src/communityRepository/observers/getJoinRequests/enum.ts +5 -0
  285. package/src/communityRepository/observers/getJoinRequests.ts +44 -0
  286. package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesLiveCollectionController.ts +2 -1
  287. package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.ts +2 -2
  288. package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesLiveCollectionController.ts +2 -1
  289. package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.ts +2 -2
  290. package/src/communityRepository/observers/index.ts +1 -0
  291. package/src/communityRepository/observers/searchCommunities/SearchCommunitiesPaginationController.ts +1 -0
  292. package/src/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.ts +2 -2
  293. package/src/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.ts +2 -2
  294. package/src/communityRepository/utils/communityWithMembership.ts +9 -5
  295. package/src/communityRepository/utils/payload.ts +28 -2
  296. package/src/core/liveCollection/PaginationController.ts +1 -1
  297. package/src/core/liveCollection/PaginationNoPageController.ts +1 -1
  298. package/src/core/model/idResolvers.ts +3 -0
  299. package/src/core/model/index.ts +3 -0
  300. package/src/index.ts +2 -0
  301. package/src/invitationRepository/events/index.ts +3 -0
  302. package/src/invitationRepository/events/onLocalInvitationCreated.ts +33 -0
  303. package/src/invitationRepository/events/onLocalInvitationDeleted.ts +33 -0
  304. package/src/invitationRepository/events/onLocalInvitationUpdated.ts +33 -0
  305. package/src/invitationRepository/index.ts +2 -0
  306. package/src/invitationRepository/internalApi/acceptInvitation.ts +45 -0
  307. package/src/invitationRepository/internalApi/createInvitations.ts +52 -0
  308. package/src/invitationRepository/internalApi/getInvitation.ts +47 -0
  309. package/src/invitationRepository/internalApi/index.ts +3 -0
  310. package/src/invitationRepository/internalApi/rejectInvitation.ts +45 -0
  311. package/src/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.ts +148 -0
  312. package/src/invitationRepository/observers/getInvitations/InvitationsPaginationController.ts +19 -0
  313. package/src/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.ts +97 -0
  314. package/src/invitationRepository/observers/getInvitations/enums.ts +5 -0
  315. package/src/invitationRepository/observers/getInvitations.ts +44 -0
  316. package/src/invitationRepository/observers/getMyCommunityInvitations.ts +48 -0
  317. package/src/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.ts +148 -0
  318. package/src/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.ts +22 -0
  319. package/src/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.ts +105 -0
  320. package/src/invitationRepository/observers/index.ts +1 -0
  321. package/src/invitationRepository/utils/convertRawInvitationToInternalInvitation.ts +8 -0
  322. package/src/invitationRepository/utils/index.ts +1 -0
  323. package/src/invitationRepository/utils/prepareInvitationPayload.ts +12 -0
  324. package/src/invitationRepository/utils/prepareMyInvitationsPayload.ts +12 -0
  325. package/src/messagePreview/utils/getChannelMessagePreviewWithUser.ts +3 -3
  326. package/src/messageRepository/events/onMessageCreated.ts +1 -1
  327. package/src/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostQueryStreamController.ts +7 -1
  328. package/src/postRepository/observers/getPinnedPosts/PinnedPostQueryStreamController.ts +7 -1
  329. package/src/subChannelRepository/utils/prepareSubChannelPayload.ts +4 -0
  330. package/src/utils/linkedObject/communityLinkedObject.ts +57 -0
  331. package/src/utils/linkedObject/index.ts +6 -0
  332. package/src/utils/linkedObject/invitationLinkedObject.ts +37 -0
  333. package/src/utils/linkedObject/joinRequestLinkedObject.ts +31 -0
@@ -27,6 +27,9 @@ 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;
32
+ joinRequest: Amity.CommunityJoinRequestPayload;
30
33
  };
31
34
 
32
35
  type UserPayload = {
@@ -225,7 +228,7 @@ declare global {
225
228
  type SubChannelPayload<T extends Amity.MessageContentType = any> = {
226
229
  messageFeeds: Amity.RawSubChannel[];
227
230
  messages: Amity.RawMessage<T>[];
228
- users: Amity.InternalUser[];
231
+ users: Amity.RawUser[];
229
232
  files: Amity.File[];
230
233
  };
231
234
 
@@ -297,6 +300,12 @@ declare global {
297
300
  files: Amity.File[];
298
301
  };
299
302
 
303
+ type CommunityJoinRequestPayload = {
304
+ joinRequests: Amity.RawJoinRequest[];
305
+ users: Amity.RawUser[];
306
+ files: Amity.File[];
307
+ };
308
+
300
309
  type RecommendedCommunityPayload = Amity.CommunityPayload;
301
310
  type TrendingCommunityPayload = Amity.CommunityPayload;
302
311
 
@@ -306,8 +315,18 @@ declare global {
306
315
  * - communityUsers: `Amity.RawMembership` -> `Amity.Membership` (Add user getter prop)
307
316
  */
308
317
  type ProcessedCommunityPayload = Omit<CommunityPayload, 'communities' | 'communityUsers'> & {
309
- communities: Amity.Community[];
318
+ communities: Amity.InternalCommunity[];
310
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[];
311
330
  };
312
331
 
313
332
  type CategoryPayload = {
@@ -333,7 +352,7 @@ declare global {
333
352
  CommunityMembershipPayload,
334
353
  'communities' | 'communityUsers'
335
354
  > & {
336
- communities: Amity.Community[];
355
+ communities: Amity.InternalCommunity[];
337
356
  communityUsers: Amity.Membership<'community'>[];
338
357
  };
339
358
 
@@ -383,7 +402,7 @@ declare global {
383
402
  Amity.StoryTargetPayload;
384
403
 
385
404
  type ProcessedGlobalStoryFeed = Omit<GlobalStoryFeedPayload, 'communities'> & {
386
- communities: Amity.Community[];
405
+ communities: Amity.InternalCommunity[];
387
406
  };
388
407
 
389
408
  // Original Payload form BE
@@ -436,7 +455,7 @@ declare global {
436
455
  */
437
456
  type ProcessedPostPayload = Omit<PostPayload, 'communities' | 'communityUsers' | 'posts'> & {
438
457
  posts: Amity.InternalPost[];
439
- communities: Amity.Community[];
458
+ communities: Amity.InternalCommunity[];
440
459
  communityUsers: Amity.Membership<'community'>[];
441
460
  };
442
461
 
@@ -545,5 +564,29 @@ declare global {
545
564
  Amity.Flaggable &
546
565
  Amity.Taggable &
547
566
  Amity.Timestamps;
567
+
568
+ type InvitationPayload = {
569
+ invitations: Amity.RawInvitation[];
570
+ users: Amity.RawUser[];
571
+ };
572
+
573
+ type ProcessedInvitationPayload = {
574
+ invitations: Amity.InternalInvitation[];
575
+ users: Amity.InternalUser[];
576
+ };
577
+
578
+ type MyInvitationsPayload = {
579
+ invitations: Amity.RawInvitation[];
580
+ users: Amity.RawUser[];
581
+ };
582
+
583
+ type ProcessedMyInvitationsPayload = {
584
+ invitations: Amity.InternalInvitation[];
585
+ users: Amity.InternalUser[];
586
+ };
587
+
588
+ type JoinRequestPayload = {
589
+ joinRequests: Amity.RawJoinRequest[];
590
+ };
548
591
  }
549
592
  }
@@ -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 Community = Omit<Amity.RawCommunity, 'onlyAdminCanPost' | 'needApprovalOnPostCreation'> &
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'];
@@ -116,6 +124,16 @@ declare global {
116
124
  limit?: number;
117
125
  };
118
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
+
119
137
  type SearchQueryCommunities = {
120
138
  displayName?: string;
121
139
  membership?: 'all' | 'member' | 'notMember';
@@ -125,6 +143,30 @@ declare global {
125
143
  sortBy?: Amity.SearchCommunitySortBy | Amity.SearchCommunitySortByEnum;
126
144
  page?: string;
127
145
  limit?: number;
146
+ includeDiscoverablePrivateCommunity?: boolean;
147
+ };
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;
128
170
  };
129
171
 
130
172
  type CommunityLiveCollection = Amity.LiveCollectionParams<Omit<QueryCommunities, 'page'>>;
@@ -132,6 +174,10 @@ declare global {
132
174
  type RecommendedCommunityLiveCollection = Amity.LiveCollectionParams<{ limit?: number }>;
133
175
  type TrendingCommunityLiveCollection = Amity.LiveCollectionParams<{ limit?: number }>;
134
176
 
177
+ type JoinRequestLiveCollection = Amity.LiveCollectionParams<QueryJoinRequest>;
178
+
179
+ type JoinRequestListLiveCollection = Amity.LiveCollectionParams<QueryJoinRequestList>;
180
+
135
181
  type SearchCommunityLiveCollection = Amity.LiveCollectionParams<
136
182
  Omit<SearchQueryCommunities, 'page'>
137
183
  >;
@@ -149,6 +195,16 @@ declare global {
149
195
  Pick<SearchQueryCommunities, 'page'>
150
196
  >;
151
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
+
152
208
  type QueryCommunityMembers = {
153
209
  communityId: string;
154
210
  memberships?: ('banned' | 'member')[];
@@ -197,6 +253,7 @@ declare global {
197
253
  token?: string;
198
254
  };
199
255
  tags?: string[];
256
+ includeDiscoverablePrivateCommunity?: boolean;
200
257
  };
201
258
 
202
259
  type SemanticSearchCommunityLiveCollection = Amity.LiveCollectionParams<
@@ -209,5 +266,20 @@ declare global {
209
266
  Amity.Community['communityId'], // communityId:score
210
267
  QuerySemanticSearchCommunity
211
268
  >;
269
+
270
+ type CommunityLinkedObject = {
271
+ createInvitations: (userIds: string[]) => Promise<void>;
272
+ getMemberInvitations: (
273
+ params: Pick<Amity.InvitationLiveCollection, 'limit' | 'sortBy' | 'statuses'>,
274
+ callback: Amity.LiveCollectionCallback<Amity.Invitation>,
275
+ ) => Amity.Unsubscriber;
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>;
283
+ };
212
284
  }
213
285
  }
@@ -0,0 +1,119 @@
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 InvitationDomain<T extends Amity.InvitationTargetType = Amity.InvitationTargetType> =
37
+ T extends 'community' ? { communityId: string } : { communityId?: string };
38
+
39
+ type RawInvitation = {
40
+ _id: string;
41
+ networkId: string;
42
+ type: Amity.InvitationType;
43
+ targetId: string;
44
+ targetType: Amity.InvitationTargetType;
45
+ userId: string;
46
+ status: Amity.InvitationStatus;
47
+ respondedAt: Amity.timestamp;
48
+ createdBy: string;
49
+ invitationId: string;
50
+ invitedUserId: string;
51
+ invitedUserInternalId: string;
52
+ invitedUserPublicId: string;
53
+ inviterUserId: string;
54
+ inviterUserInternalId: string;
55
+ inviterUserPublicId: string;
56
+ } & Amity.Timestamps &
57
+ Amity.InvitationDomain<Amity.InvitationTargetType>;
58
+
59
+ type InternalInvitation = Omit<RawInvitation, 'createdBy'> & {
60
+ createdById: string;
61
+ };
62
+
63
+ type Invitation = Omit<Amity.InternalInvitation, 'createdBy'> &
64
+ Amity.InvitationLinkedObject & {
65
+ user?: Amity.User;
66
+ createdById: string;
67
+ createdBy?: Amity.User;
68
+ target?: Amity.InvitationTarget<Amity.InvitationTargetType>;
69
+ };
70
+
71
+ type QueryInvitations = {
72
+ targetId: string;
73
+ statuses?: string[];
74
+ token?: Amity.Token;
75
+ type: Amity.InvitationType;
76
+ sortBy?: Amity.InvitationSortBy;
77
+ limit?: Amity.PageLimit['limit'];
78
+ targetType: Amity.InvitationTargetType;
79
+ };
80
+
81
+ type InvitationLiveCollection = Amity.LiveCollectionParams<Omit<QueryInvitations, 'limit'>>;
82
+
83
+ type InvitationLiveCollectionCache = Amity.LiveCollectionCache<
84
+ Amity.InternalInvitation['_id'],
85
+ Pick<QueryInvitations, 'limit'>
86
+ >;
87
+
88
+ type QueryMyInvitations = {
89
+ targetId?: string;
90
+ token?: Amity.Token;
91
+ type?: Amity.InvitationType;
92
+ sortBy?: Amity.InvitationSortBy;
93
+ limit?: Amity.PageLimit['limit'];
94
+ statuses?: InvitationStatusEnum[];
95
+ targetType?: Amity.InvitationTargetType;
96
+ };
97
+
98
+ type MyInvitationsLiveCollection = Amity.LiveCollectionParams<
99
+ Omit<QueryMyInvitations, 'limit'>
100
+ >;
101
+
102
+ type MyInvitationsLiveCollectionCache = Amity.LiveCollectionCache<
103
+ Amity.InternalInvitation['_id'],
104
+ Pick<QueryMyInvitations, 'limit'>
105
+ >;
106
+
107
+ type InvitationLinkedObject = {
108
+ accept: () => Promise<void>;
109
+ reject: () => Promise<void>;
110
+ };
111
+
112
+ type CreateInvitations = {
113
+ type: Amity.InvitationType;
114
+ targetType: Amity.InvitationTargetType;
115
+ targetId: string;
116
+ userIds: string[];
117
+ };
118
+ }
119
+ }
@@ -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 = {
@@ -38,3 +38,6 @@ export * from './domains/post';
38
38
  export * from './domains/story';
39
39
  export * from './domains/ad';
40
40
  export * from './domains/notification';
41
+ export * from './domains/client';
42
+ export * from './domains/invitation';
43
+ export * from './domains/joinRequest';
@@ -297,7 +297,17 @@ export const getChannel = (
297
297
  ),
298
298
  convertEventPayload(onSubChannelCreated, 'channelId', 'channel'),
299
299
  convertEventPayload(onChannelUnreadInfoUpdatedLocal, 'channelId', 'channel'),
300
- convertEventPayload(onChannelUnreadUpdatedLocal, 'channelId', 'channel'),
300
+ convertEventPayload(
301
+ (callback: Amity.Listener<Amity.ChannelUnread>) => {
302
+ const processPayload = (payloads: Amity.ChannelUnread[]) => {
303
+ payloads.forEach(callback);
304
+ };
305
+
306
+ return onChannelUnreadUpdatedLocal(processPayload);
307
+ },
308
+ 'channelId',
309
+ 'channel',
310
+ ),
301
311
  ],
302
312
  {
303
313
  forceDispatch: true,
@@ -572,7 +572,16 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
572
572
  action: Amity.ChannelActionType.OnUpdate,
573
573
  },
574
574
  {
575
- fn: convertEventPayload(onChannelUnreadUpdatedLocal, 'channelId', 'channel'),
575
+ fn: convertEventPayload(
576
+ (callback: Amity.Listener<Amity.ChannelUnread>) => {
577
+ const processPayload = (payloads: Amity.ChannelUnread[]) => {
578
+ payloads.forEach(callback);
579
+ };
580
+ return onChannelUnreadUpdatedLocal(processPayload);
581
+ },
582
+ 'channelId',
583
+ 'channel',
584
+ ),
576
585
  action: Amity.ChannelActionType.OnUpdate,
577
586
  },
578
587
  ];
@@ -82,7 +82,9 @@ export const getTotalChannelsUnread = (
82
82
  });
83
83
  };
84
84
 
85
- const realtimeRouter = (userUnread: Amity.UserUnread) => {
85
+ const realtimeRouter = (_: Amity.ChannelUnread[]) => {
86
+ const { data: userUnread } = _getTotalChannelsUnread();
87
+
86
88
  if (isEqual(model, userUnread)) return;
87
89
 
88
90
  dispatcher({
@@ -7,6 +7,7 @@ import { getActiveClient } from '~/client/api/activeClient';
7
7
  import { pullFromCache } from '~/cache/api/pullFromCache';
8
8
  import { convertRawUserToInternalUser } from '~/userRepository/utils/convertRawUserToInternalUser';
9
9
  import { pushToCache } from '~/cache/api';
10
+ import { fireEvent } from '~/core/events';
10
11
 
11
12
  export const MARKER_INCLUDED_CHANNEL_TYPE = ['broadcast', 'conversation', 'community'];
12
13
  export const isUnreadCountSupport = ({ type }: Pick<Amity.RawChannel, 'type'>) =>
@@ -56,6 +57,8 @@ const updateChannelUnread = ({
56
57
  channels: Amity.RawChannel[];
57
58
  channelUsers: Amity.RawMembership<'channel'>[];
58
59
  }) => {
60
+ const channelsUnread: Amity.ChannelUnread[] = [];
61
+
59
62
  for (let i = 0; i < channels.length; i += 1) {
60
63
  const cacheKey = ['channelUnread', 'get', channels[i].channelId];
61
64
  const channelUser = channelUsers.find(
@@ -84,9 +87,11 @@ const updateChannelUnread = ({
84
87
  isMentioned,
85
88
  isDeleted: channels[i].isDeleted || false,
86
89
  };
87
-
88
90
  pushToCache(cacheKey, cacheChannelUnread);
91
+
92
+ channelsUnread.push(cacheChannelUnread);
89
93
  }
94
+ fireEvent('local.channelUnread.updated', channelsUnread);
90
95
  };
91
96
 
92
97
  export const prepareChannelPayload = async (
@@ -167,7 +167,7 @@ export class MessageReadReceiptSyncEngine {
167
167
  channelUnread.unreadCount = Math.max(channelUnread.lastSegment - segment, 0);
168
168
 
169
169
  pushToCache(cacheKey, channelUnread);
170
- fireEvent('local.channelUnread.updated', channelUnread);
170
+ fireEvent('local.channelUnread.updated', [channelUnread]);
171
171
  }
172
172
 
173
173
  // Step 2: Enqueue the read receipt
@@ -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,15 +23,21 @@ 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);
28
30
 
31
+ const encodedCommunityIds = communityIds.map(communityId => encodeURIComponent(communityId));
32
+
29
33
  // API-FIX: endpoint should not be /list, parameters should be querystring.
30
34
  const { data: payload } = await client.http.get<Amity.CommunityPayload>(
31
35
  `/api/v3/communities/list`,
32
36
  {
33
- params: { communityIds },
37
+ params: {
38
+ communityIds: encodedCommunityIds,
39
+ includeDiscoverablePrivateCommunity: includeDiscoverablePrivateCommunity ?? true,
40
+ },
34
41
  },
35
42
  );
36
43
 
@@ -43,7 +50,7 @@ export const getCommunities = async (
43
50
  }
44
51
 
45
52
  return {
46
- data: data.communities,
53
+ data: data.communities.map(community => LinkedObject.community(community)),
47
54
  cachedAt,
48
55
  };
49
56
  };
@@ -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,8 @@ import { prepareCommunityPayload } from '../utils';
22
23
  */
23
24
  export const getCommunity = async (
24
25
  communityId: Amity.Community['communityId'],
26
+ type?: Amity.JoinRequestType,
27
+ includeDiscoverablePrivateCommunity?: boolean,
25
28
  ): Promise<Amity.Cached<Amity.Community>> => {
26
29
  const client = getActiveClient();
27
30
  client.log('community/getCommunity', communityId);
@@ -29,6 +32,12 @@ export const getCommunity = async (
29
32
  // API-FIX: endpoint should not be /list, parameters should be querystring.
30
33
  const { data: payload } = await client.http.get<Amity.CommunityPayload>(
31
34
  `/api/v3/communities/${communityId}`,
35
+ {
36
+ params: {
37
+ type: 'communityJoinRequest',
38
+ includeDiscoverablePrivateCommunity: includeDiscoverablePrivateCommunity ?? true,
39
+ },
40
+ },
32
41
  );
33
42
 
34
43
  const data = prepareCommunityPayload(payload);
@@ -42,7 +51,9 @@ export const getCommunity = async (
42
51
  const { communities } = data;
43
52
 
44
53
  return {
45
- data: communities.find(community => community.communityId === communityId)!,
54
+ data: LinkedObject.community(
55
+ communities.find(community => community.communityId === communityId)!,
56
+ ),
46
57
  cachedAt,
47
58
  };
48
59
  };
@@ -73,7 +84,7 @@ getCommunity.locally = (
73
84
  if (!cached) return;
74
85
 
75
86
  return {
76
- data: cached.data,
87
+ data: LinkedObject.community(cached.data),
77
88
  cachedAt: cached.cachedAt,
78
89
  };
79
90
  };