@amityco/ts-sdk 7.3.1-e2dead4.0 → 7.4.1-0e170b02.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 (305) hide show
  1. package/dist/@types/core/events.d.ts +7 -0
  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 +37 -1
  10. package/dist/@types/domains/community.d.ts.map +1 -1
  11. package/dist/@types/domains/invitation.d.ts +88 -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/index.d.ts +3 -0
  16. package/dist/@types/index.d.ts.map +1 -1
  17. package/dist/commentRepository/api/flagComment.d.ts +3 -2
  18. package/dist/commentRepository/api/flagComment.d.ts.map +1 -1
  19. package/dist/communityRepository/api/createCommunity.d.ts +2 -2
  20. package/dist/communityRepository/api/createCommunity.d.ts.map +1 -1
  21. package/dist/communityRepository/api/getCommunities.d.ts +1 -1
  22. package/dist/communityRepository/api/getCommunities.d.ts.map +1 -1
  23. package/dist/communityRepository/api/getCommunity.d.ts +1 -1
  24. package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
  25. package/dist/communityRepository/api/getRecommendedCommunities.d.ts +3 -1
  26. package/dist/communityRepository/api/getRecommendedCommunities.d.ts.map +1 -1
  27. package/dist/communityRepository/api/getTrendingCommunities.d.ts +3 -1
  28. package/dist/communityRepository/api/getTrendingCommunities.d.ts.map +1 -1
  29. package/dist/communityRepository/api/joinCommunity.d.ts +3 -0
  30. package/dist/communityRepository/api/joinCommunity.d.ts.map +1 -1
  31. package/dist/communityRepository/api/queryCommunities.d.ts.map +1 -1
  32. package/dist/communityRepository/api/updateCommunity.d.ts +2 -2
  33. package/dist/communityRepository/api/updateCommunity.d.ts.map +1 -1
  34. package/dist/communityRepository/communityMembership/events/onCommunityJoined.d.ts +1 -1
  35. package/dist/communityRepository/communityMembership/events/onCommunityJoined.d.ts.map +1 -1
  36. package/dist/communityRepository/communityMembership/events/onCommunityLeft.d.ts +1 -1
  37. package/dist/communityRepository/communityMembership/events/onCommunityLeft.d.ts.map +1 -1
  38. package/dist/communityRepository/communityMembership/events/onCommunityUserAdded.d.ts +1 -1
  39. package/dist/communityRepository/communityMembership/events/onCommunityUserAdded.d.ts.map +1 -1
  40. package/dist/communityRepository/communityMembership/events/onCommunityUserBanned.d.ts +1 -1
  41. package/dist/communityRepository/communityMembership/events/onCommunityUserBanned.d.ts.map +1 -1
  42. package/dist/communityRepository/communityMembership/events/onCommunityUserChanged.d.ts +1 -1
  43. package/dist/communityRepository/communityMembership/events/onCommunityUserChanged.d.ts.map +1 -1
  44. package/dist/communityRepository/communityMembership/events/onCommunityUserRemoved.d.ts +1 -1
  45. package/dist/communityRepository/communityMembership/events/onCommunityUserRemoved.d.ts.map +1 -1
  46. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleAdded.d.ts +1 -1
  47. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleAdded.d.ts.map +1 -1
  48. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.d.ts +1 -1
  49. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.d.ts.map +1 -1
  50. package/dist/communityRepository/communityMembership/events/onCommunityUserUnbanned.d.ts +1 -1
  51. package/dist/communityRepository/communityMembership/events/onCommunityUserUnbanned.d.ts.map +1 -1
  52. package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts +1 -1
  53. package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts.map +1 -1
  54. package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts +1 -1
  55. package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts.map +1 -1
  56. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserAdded.d.ts +1 -1
  57. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserAdded.d.ts.map +1 -1
  58. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.d.ts +1 -1
  59. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.d.ts.map +1 -1
  60. package/dist/communityRepository/communityMembership/events/onUserDeleted.d.ts +1 -1
  61. package/dist/communityRepository/communityMembership/events/onUserDeleted.d.ts.map +1 -1
  62. package/dist/communityRepository/communityMembership/events/utils.d.ts +2 -2
  63. package/dist/communityRepository/communityMembership/events/utils.d.ts.map +1 -1
  64. package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts +2 -2
  65. package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts.map +1 -1
  66. package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.d.ts +2 -2
  67. package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.d.ts.map +1 -1
  68. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.d.ts +1 -1
  69. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.d.ts.map +1 -1
  70. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.d.ts +1 -1
  71. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.d.ts.map +1 -1
  72. package/dist/communityRepository/events/onCommunityCreated.d.ts +1 -1
  73. package/dist/communityRepository/events/onCommunityCreated.d.ts.map +1 -1
  74. package/dist/communityRepository/events/onCommunityDeleted.d.ts +1 -1
  75. package/dist/communityRepository/events/onCommunityDeleted.d.ts.map +1 -1
  76. package/dist/communityRepository/events/onCommunityUpdated.d.ts +1 -1
  77. package/dist/communityRepository/events/onCommunityUpdated.d.ts.map +1 -1
  78. package/dist/communityRepository/events/utils.d.ts +1 -1
  79. package/dist/communityRepository/events/utils.d.ts.map +1 -1
  80. package/dist/communityRepository/internalAPI/getMyJoinRequest.d.ts +16 -0
  81. package/dist/communityRepository/internalAPI/getMyJoinRequest.d.ts.map +1 -0
  82. package/dist/communityRepository/internalAPI/joinCommunity.d.ts +16 -0
  83. package/dist/communityRepository/internalAPI/joinCommunity.d.ts.map +1 -0
  84. package/dist/communityRepository/joinRequest/events/index.d.ts +4 -0
  85. package/dist/communityRepository/joinRequest/events/index.d.ts.map +1 -0
  86. package/dist/communityRepository/joinRequest/events/onJoinRequestCreated.d.ts +17 -0
  87. package/dist/communityRepository/joinRequest/events/onJoinRequestCreated.d.ts.map +1 -0
  88. package/dist/communityRepository/joinRequest/events/onJoinRequestDeleted.d.ts +17 -0
  89. package/dist/communityRepository/joinRequest/events/onJoinRequestDeleted.d.ts.map +1 -0
  90. package/dist/communityRepository/joinRequest/events/onJoinRequestUpdated.d.ts +17 -0
  91. package/dist/communityRepository/joinRequest/events/onJoinRequestUpdated.d.ts.map +1 -0
  92. package/dist/communityRepository/joinRequest/internalAPI/approveJoinRequest.d.ts +16 -0
  93. package/dist/communityRepository/joinRequest/internalAPI/approveJoinRequest.d.ts.map +1 -0
  94. package/dist/communityRepository/joinRequest/internalAPI/cancelJoinRequest.d.ts +16 -0
  95. package/dist/communityRepository/joinRequest/internalAPI/cancelJoinRequest.d.ts.map +1 -0
  96. package/dist/communityRepository/joinRequest/internalAPI/rejectJoinRequest.d.ts +16 -0
  97. package/dist/communityRepository/joinRequest/internalAPI/rejectJoinRequest.d.ts.map +1 -0
  98. package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts +2 -2
  99. package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts.map +1 -1
  100. package/dist/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.d.ts +14 -0
  101. package/dist/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.d.ts.map +1 -0
  102. package/dist/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.d.ts +9 -0
  103. package/dist/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.d.ts.map +1 -0
  104. package/dist/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.d.ts +15 -0
  105. package/dist/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.d.ts.map +1 -0
  106. package/dist/communityRepository/observers/getJoinRequests/enum.d.ts +6 -0
  107. package/dist/communityRepository/observers/getJoinRequests/enum.d.ts.map +1 -0
  108. package/dist/communityRepository/observers/getJoinRequests.d.ts +12 -0
  109. package/dist/communityRepository/observers/getJoinRequests.d.ts.map +1 -0
  110. package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesLiveCollectionController.d.ts.map +1 -1
  111. package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts +2 -2
  112. package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts.map +1 -1
  113. package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesLiveCollectionController.d.ts.map +1 -1
  114. package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.d.ts +2 -2
  115. package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.d.ts.map +1 -1
  116. package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesPaginationController.d.ts.map +1 -1
  117. package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts +2 -2
  118. package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts.map +1 -1
  119. package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts +2 -2
  120. package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts.map +1 -1
  121. package/dist/communityRepository/utils/communityWithMembership.d.ts +1 -1
  122. package/dist/communityRepository/utils/communityWithMembership.d.ts.map +1 -1
  123. package/dist/communityRepository/utils/payload.d.ts +2 -1
  124. package/dist/communityRepository/utils/payload.d.ts.map +1 -1
  125. package/dist/core/events.d.ts +3 -3
  126. package/dist/core/events.d.ts.map +1 -1
  127. package/dist/core/model/idResolvers.d.ts.map +1 -1
  128. package/dist/core/model/index.d.ts.map +1 -1
  129. package/dist/index.cjs.js +2686 -1421
  130. package/dist/index.d.ts +1 -0
  131. package/dist/index.d.ts.map +1 -1
  132. package/dist/index.esm.js +2948 -1684
  133. package/dist/index.umd.js +4 -4
  134. package/dist/invitationRepository/events/index.d.ts +4 -0
  135. package/dist/invitationRepository/events/index.d.ts.map +1 -0
  136. package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts +17 -0
  137. package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts.map +1 -0
  138. package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts +17 -0
  139. package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts.map +1 -0
  140. package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts +17 -0
  141. package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts.map +1 -0
  142. package/dist/invitationRepository/index.d.ts +3 -0
  143. package/dist/invitationRepository/index.d.ts.map +1 -0
  144. package/dist/invitationRepository/internalApi/acceptInvitation.d.ts +16 -0
  145. package/dist/invitationRepository/internalApi/acceptInvitation.d.ts.map +1 -0
  146. package/dist/invitationRepository/internalApi/cancelInvitation.d.ts +16 -0
  147. package/dist/invitationRepository/internalApi/cancelInvitation.d.ts.map +1 -0
  148. package/dist/invitationRepository/internalApi/createInvitations.d.ts +21 -0
  149. package/dist/invitationRepository/internalApi/createInvitations.d.ts.map +1 -0
  150. package/dist/invitationRepository/internalApi/getInvitation.d.ts +17 -0
  151. package/dist/invitationRepository/internalApi/getInvitation.d.ts.map +1 -0
  152. package/dist/invitationRepository/internalApi/index.d.ts +5 -0
  153. package/dist/invitationRepository/internalApi/index.d.ts.map +1 -0
  154. package/dist/invitationRepository/internalApi/rejectInvitation.d.ts +16 -0
  155. package/dist/invitationRepository/internalApi/rejectInvitation.d.ts.map +1 -0
  156. package/dist/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.d.ts +14 -0
  157. package/dist/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.d.ts.map +1 -0
  158. package/dist/invitationRepository/observers/getInvitations/InvitationsPaginationController.d.ts +5 -0
  159. package/dist/invitationRepository/observers/getInvitations/InvitationsPaginationController.d.ts.map +1 -0
  160. package/dist/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.d.ts +15 -0
  161. package/dist/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.d.ts.map +1 -0
  162. package/dist/invitationRepository/observers/getInvitations/enums.d.ts +6 -0
  163. package/dist/invitationRepository/observers/getInvitations/enums.d.ts.map +1 -0
  164. package/dist/invitationRepository/observers/getInvitations.d.ts +12 -0
  165. package/dist/invitationRepository/observers/getInvitations.d.ts.map +1 -0
  166. package/dist/invitationRepository/observers/getMyCommunityInvitations.d.ts +12 -0
  167. package/dist/invitationRepository/observers/getMyCommunityInvitations.d.ts.map +1 -0
  168. package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.d.ts +14 -0
  169. package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.d.ts.map +1 -0
  170. package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.d.ts +5 -0
  171. package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.d.ts.map +1 -0
  172. package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts +15 -0
  173. package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts.map +1 -0
  174. package/dist/invitationRepository/observers/index.d.ts +2 -0
  175. package/dist/invitationRepository/observers/index.d.ts.map +1 -0
  176. package/dist/invitationRepository/utils/convertRawInvitationToInternalInvitation.d.ts +2 -0
  177. package/dist/invitationRepository/utils/convertRawInvitationToInternalInvitation.d.ts.map +1 -0
  178. package/dist/invitationRepository/utils/index.d.ts +2 -0
  179. package/dist/invitationRepository/utils/index.d.ts.map +1 -0
  180. package/dist/invitationRepository/utils/prepareInvitationPayload.d.ts +2 -0
  181. package/dist/invitationRepository/utils/prepareInvitationPayload.d.ts.map +1 -0
  182. package/dist/invitationRepository/utils/prepareMyInvitationsPayload.d.ts +2 -0
  183. package/dist/invitationRepository/utils/prepareMyInvitationsPayload.d.ts.map +1 -0
  184. package/dist/messageRepository/api/flagMessage.d.ts +1 -1
  185. package/dist/messageRepository/api/flagMessage.d.ts.map +1 -1
  186. package/dist/postRepository/api/flagPost.d.ts +3 -2
  187. package/dist/postRepository/api/flagPost.d.ts.map +1 -1
  188. package/dist/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostQueryStreamController.d.ts.map +1 -1
  189. package/dist/postRepository/observers/getPinnedPosts/PinnedPostQueryStreamController.d.ts.map +1 -1
  190. package/dist/subChannelRepository/utils/prepareSubChannelPayload.d.ts.map +1 -1
  191. package/dist/utils/linkedObject/communityLinkedObject.d.ts +2 -0
  192. package/dist/utils/linkedObject/communityLinkedObject.d.ts.map +1 -0
  193. package/dist/utils/linkedObject/index.d.ts +3 -0
  194. package/dist/utils/linkedObject/index.d.ts.map +1 -1
  195. package/dist/utils/linkedObject/invitationLinkedObject.d.ts +2 -0
  196. package/dist/utils/linkedObject/invitationLinkedObject.d.ts.map +1 -0
  197. package/dist/utils/linkedObject/joinRequestLinkedObject.d.ts +2 -0
  198. package/dist/utils/linkedObject/joinRequestLinkedObject.d.ts.map +1 -0
  199. package/dist/utils/tests/dummy/comment.d.ts +1 -1
  200. package/dist/utils/tests/dummy/post.d.ts +3 -3
  201. package/package.json +1 -1
  202. package/src/@types/core/events.ts +11 -1
  203. package/src/@types/core/model.ts +8 -1
  204. package/src/@types/core/payload.ts +48 -5
  205. package/src/@types/domains/client.ts +12 -0
  206. package/src/@types/domains/community.ts +56 -1
  207. package/src/@types/domains/invitation.ts +116 -0
  208. package/src/@types/domains/joinRequest.ts +66 -0
  209. package/src/@types/index.ts +3 -0
  210. package/src/commentRepository/api/flagComment.ts +20 -3
  211. package/src/communityRepository/api/createCommunity.ts +5 -2
  212. package/src/communityRepository/api/getCommunities.ts +7 -2
  213. package/src/communityRepository/api/getCommunity.ts +13 -2
  214. package/src/communityRepository/api/getRecommendedCommunities.ts +11 -4
  215. package/src/communityRepository/api/getTrendingCommunities.ts +11 -4
  216. package/src/communityRepository/api/joinCommunity.ts +4 -1
  217. package/src/communityRepository/api/queryCommunities.ts +6 -1
  218. package/src/communityRepository/api/updateCommunity.ts +13 -3
  219. package/src/communityRepository/communityMembership/events/onCommunityJoined.ts +1 -1
  220. package/src/communityRepository/communityMembership/events/onCommunityLeft.ts +1 -1
  221. package/src/communityRepository/communityMembership/events/onCommunityUserAdded.ts +1 -1
  222. package/src/communityRepository/communityMembership/events/onCommunityUserBanned.ts +1 -1
  223. package/src/communityRepository/communityMembership/events/onCommunityUserChanged.ts +1 -1
  224. package/src/communityRepository/communityMembership/events/onCommunityUserRemoved.ts +1 -1
  225. package/src/communityRepository/communityMembership/events/onCommunityUserRoleAdded.ts +1 -1
  226. package/src/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.ts +1 -1
  227. package/src/communityRepository/communityMembership/events/onCommunityUserUnbanned.ts +1 -1
  228. package/src/communityRepository/communityMembership/events/onLocalCommunityJoined.ts +1 -1
  229. package/src/communityRepository/communityMembership/events/onLocalCommunityLeft.ts +1 -1
  230. package/src/communityRepository/communityMembership/events/onLocalCommunityUserAdded.ts +1 -1
  231. package/src/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.ts +1 -1
  232. package/src/communityRepository/communityMembership/events/onUserDeleted.ts +3 -1
  233. package/src/communityRepository/communityMembership/events/utils.ts +2 -2
  234. package/src/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.ts +8 -2
  235. package/src/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.ts +8 -2
  236. package/src/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.ts +1 -1
  237. package/src/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.ts +1 -1
  238. package/src/communityRepository/events/onCommunityCreated.ts +1 -1
  239. package/src/communityRepository/events/onCommunityDeleted.ts +1 -1
  240. package/src/communityRepository/events/onCommunityUpdated.ts +1 -1
  241. package/src/communityRepository/events/utils.ts +1 -1
  242. package/src/communityRepository/internalAPI/getMyJoinRequest.ts +43 -0
  243. package/src/communityRepository/internalAPI/joinCommunity.ts +49 -0
  244. package/src/communityRepository/joinRequest/events/index.ts +3 -0
  245. package/src/communityRepository/joinRequest/events/onJoinRequestCreated.ts +33 -0
  246. package/src/communityRepository/joinRequest/events/onJoinRequestDeleted.ts +33 -0
  247. package/src/communityRepository/joinRequest/events/onJoinRequestUpdated.ts +33 -0
  248. package/src/communityRepository/joinRequest/internalAPI/approveJoinRequest.ts +56 -0
  249. package/src/communityRepository/joinRequest/internalAPI/cancelJoinRequest.ts +51 -0
  250. package/src/communityRepository/joinRequest/internalAPI/rejectJoinRequest.ts +49 -0
  251. package/src/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.ts +2 -2
  252. package/src/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.ts +126 -0
  253. package/src/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.ts +26 -0
  254. package/src/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.ts +108 -0
  255. package/src/communityRepository/observers/getJoinRequests/enum.ts +5 -0
  256. package/src/communityRepository/observers/getJoinRequests.ts +44 -0
  257. package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesLiveCollectionController.ts +2 -1
  258. package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.ts +2 -2
  259. package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesLiveCollectionController.ts +2 -1
  260. package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.ts +2 -2
  261. package/src/communityRepository/observers/searchCommunities/SearchCommunitiesPaginationController.ts +1 -0
  262. package/src/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.ts +2 -2
  263. package/src/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.ts +2 -2
  264. package/src/communityRepository/utils/communityWithMembership.ts +9 -5
  265. package/src/communityRepository/utils/payload.ts +28 -2
  266. package/src/core/liveCollection/PaginationController.ts +1 -1
  267. package/src/core/liveCollection/PaginationNoPageController.ts +1 -1
  268. package/src/core/model/idResolvers.ts +3 -0
  269. package/src/core/model/index.ts +2 -0
  270. package/src/index.ts +2 -0
  271. package/src/invitationRepository/events/index.ts +3 -0
  272. package/src/invitationRepository/events/onLocalInvitationCreated.ts +33 -0
  273. package/src/invitationRepository/events/onLocalInvitationDeleted.ts +33 -0
  274. package/src/invitationRepository/events/onLocalInvitationUpdated.ts +33 -0
  275. package/src/invitationRepository/index.ts +2 -0
  276. package/src/invitationRepository/internalApi/acceptInvitation.ts +45 -0
  277. package/src/invitationRepository/internalApi/cancelInvitation.ts +44 -0
  278. package/src/invitationRepository/internalApi/createInvitations.ts +52 -0
  279. package/src/invitationRepository/internalApi/getInvitation.ts +47 -0
  280. package/src/invitationRepository/internalApi/index.ts +4 -0
  281. package/src/invitationRepository/internalApi/rejectInvitation.ts +45 -0
  282. package/src/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.ts +148 -0
  283. package/src/invitationRepository/observers/getInvitations/InvitationsPaginationController.ts +19 -0
  284. package/src/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.ts +97 -0
  285. package/src/invitationRepository/observers/getInvitations/enums.ts +5 -0
  286. package/src/invitationRepository/observers/getInvitations.ts +44 -0
  287. package/src/invitationRepository/observers/getMyCommunityInvitations.ts +48 -0
  288. package/src/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.ts +148 -0
  289. package/src/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.ts +22 -0
  290. package/src/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.ts +105 -0
  291. package/src/invitationRepository/observers/index.ts +1 -0
  292. package/src/invitationRepository/utils/convertRawInvitationToInternalInvitation.ts +8 -0
  293. package/src/invitationRepository/utils/index.ts +1 -0
  294. package/src/invitationRepository/utils/prepareInvitationPayload.ts +12 -0
  295. package/src/invitationRepository/utils/prepareMyInvitationsPayload.ts +12 -0
  296. package/src/messagePreview/utils/getChannelMessagePreviewWithUser.ts +3 -3
  297. package/src/messageRepository/api/flagMessage.ts +7 -5
  298. package/src/postRepository/api/flagPost.ts +19 -3
  299. package/src/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostQueryStreamController.ts +7 -1
  300. package/src/postRepository/observers/getPinnedPosts/PinnedPostQueryStreamController.ts +7 -1
  301. package/src/subChannelRepository/utils/prepareSubChannelPayload.ts +4 -0
  302. package/src/utils/linkedObject/communityLinkedObject.ts +58 -0
  303. package/src/utils/linkedObject/index.ts +6 -0
  304. package/src/utils/linkedObject/invitationLinkedObject.ts +44 -0
  305. package/src/utils/linkedObject/joinRequestLinkedObject.ts +27 -0
@@ -33,7 +33,7 @@ declare global {
33
33
  feedMarker: Amity.FeedMarker;
34
34
  userMarker: Amity.UserMarker;
35
35
 
36
- community: Amity.Community;
36
+ community: Amity.InternalCommunity;
37
37
  category: Amity.InternalCategory;
38
38
  communityUsers: Amity.Membership<'community'>;
39
39
  post: Amity.InternalPost;
@@ -60,6 +60,10 @@ declare global {
60
60
 
61
61
  notificationTrayItem: Amity.InternalNotificationTrayItem;
62
62
  notificationTraySeen: Amity.InternalNotificationTraySeen;
63
+
64
+ invitation: Amity.InternalInvitation;
65
+
66
+ joinRequest: Amity.InternalJoinRequest;
63
67
  };
64
68
 
65
69
  type Model = ValueOf<Models>;
@@ -124,6 +128,9 @@ declare global {
124
128
 
125
129
  notificationTrayItem: Pick<Amity.InternalNotificationTrayItem, '_id'>;
126
130
  notificationTraySeen: Pick<Amity.InternalNotificationTraySeen, 'userId'>;
131
+
132
+ invitation: Pick<Amity.InternalInvitation, '_id'>;
133
+ joinRequest: Pick<Amity.InternalJoinRequest, 'joinRequestId'>;
127
134
  };
128
135
  }
129
136
  }
@@ -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,20 @@ 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;
128
160
  };
129
161
 
130
162
  type CommunityLiveCollection = Amity.LiveCollectionParams<Omit<QueryCommunities, 'page'>>;
@@ -132,6 +164,8 @@ declare global {
132
164
  type RecommendedCommunityLiveCollection = Amity.LiveCollectionParams<{ limit?: number }>;
133
165
  type TrendingCommunityLiveCollection = Amity.LiveCollectionParams<{ limit?: number }>;
134
166
 
167
+ type JoinRequestLiveCollection = Amity.LiveCollectionParams<QueryJoinRequest>;
168
+
135
169
  type SearchCommunityLiveCollection = Amity.LiveCollectionParams<
136
170
  Omit<SearchQueryCommunities, 'page'>
137
171
  >;
@@ -149,6 +183,11 @@ declare global {
149
183
  Pick<SearchQueryCommunities, 'page'>
150
184
  >;
151
185
 
186
+ type JoinRequestLiveCollectionCache = Amity.LiveCollectionCache<
187
+ Amity.JoinRequest['joinRequestId'],
188
+ Pick<QueryJoinRequest, 'page'>
189
+ >;
190
+
152
191
  type QueryCommunityMembers = {
153
192
  communityId: string;
154
193
  memberships?: ('banned' | 'member')[];
@@ -197,6 +236,7 @@ declare global {
197
236
  token?: string;
198
237
  };
199
238
  tags?: string[];
239
+ includeDiscoverablePrivateCommunity?: boolean;
200
240
  };
201
241
 
202
242
  type SemanticSearchCommunityLiveCollection = Amity.LiveCollectionParams<
@@ -209,5 +249,20 @@ declare global {
209
249
  Amity.Community['communityId'], // communityId:score
210
250
  QuerySemanticSearchCommunity
211
251
  >;
252
+
253
+ type CommunityLinkedObject = {
254
+ createInvitations: (userIds: string[]) => Promise<void>;
255
+ getMemberInvitations: (
256
+ params: Pick<Amity.InvitationLiveCollection, 'limit' | 'sortBy' | 'statuses'>,
257
+ callback: Amity.LiveCollectionCallback<Amity.Invitation>,
258
+ ) => Amity.Unsubscriber;
259
+ getInvitation: () => Promise<Amity.Invitation | undefined>;
260
+ join: () => Promise<Amity.JoinResult>;
261
+ getJoinRequests: (
262
+ params: QueryJoinRequest,
263
+ callback: Amity.LiveCollectionCallback<Amity.JoinRequest>,
264
+ ) => Amity.Unsubscriber;
265
+ getMyJoinRequest: () => Promise<Amity.JoinRequest | undefined>;
266
+ };
212
267
  }
213
268
  }
@@ -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
+ }
@@ -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;
39
+ responderId: string;
40
+ responderInternalId: string;
41
+ responderPublicId: string;
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
+ }
@@ -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';
@@ -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('commentId')
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 (commentId: Amity.Comment['commentId']): Promise<boolean> => {
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: { communityIds },
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
@@ -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
  };
@@ -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 } = query ?? {};
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
- { params: { options: { limit } } },
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
  };