@amityco/ts-sdk 7.4.1-b9f48528.0 → 7.4.1-d23fab2f.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 (175) hide show
  1. package/dist/@types/core/events.d.ts +3 -0
  2. package/dist/@types/core/events.d.ts.map +1 -1
  3. package/dist/@types/core/model.d.ts +3 -1
  4. package/dist/@types/core/model.d.ts.map +1 -1
  5. package/dist/@types/core/payload.d.ts +8 -4
  6. package/dist/@types/core/payload.d.ts.map +1 -1
  7. package/dist/@types/domains/community.d.ts +5 -1
  8. package/dist/@types/domains/community.d.ts.map +1 -1
  9. package/dist/@types/domains/invitation.d.ts +43 -0
  10. package/dist/@types/domains/invitation.d.ts.map +1 -0
  11. package/dist/@types/index.d.ts +1 -0
  12. package/dist/@types/index.d.ts.map +1 -1
  13. package/dist/communityRepository/api/createCommunity.d.ts.map +1 -1
  14. package/dist/communityRepository/api/getCommunities.d.ts.map +1 -1
  15. package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
  16. package/dist/communityRepository/api/getRecommendedCommunities.d.ts.map +1 -1
  17. package/dist/communityRepository/api/getTrendingCommunities.d.ts.map +1 -1
  18. package/dist/communityRepository/api/queryCommunities.d.ts.map +1 -1
  19. package/dist/communityRepository/api/updateCommunity.d.ts.map +1 -1
  20. package/dist/communityRepository/communityMembership/events/onCommunityJoined.d.ts +1 -1
  21. package/dist/communityRepository/communityMembership/events/onCommunityJoined.d.ts.map +1 -1
  22. package/dist/communityRepository/communityMembership/events/onCommunityLeft.d.ts +1 -1
  23. package/dist/communityRepository/communityMembership/events/onCommunityLeft.d.ts.map +1 -1
  24. package/dist/communityRepository/communityMembership/events/onCommunityUserAdded.d.ts +1 -1
  25. package/dist/communityRepository/communityMembership/events/onCommunityUserAdded.d.ts.map +1 -1
  26. package/dist/communityRepository/communityMembership/events/onCommunityUserBanned.d.ts +1 -1
  27. package/dist/communityRepository/communityMembership/events/onCommunityUserBanned.d.ts.map +1 -1
  28. package/dist/communityRepository/communityMembership/events/onCommunityUserChanged.d.ts +1 -1
  29. package/dist/communityRepository/communityMembership/events/onCommunityUserChanged.d.ts.map +1 -1
  30. package/dist/communityRepository/communityMembership/events/onCommunityUserRemoved.d.ts +1 -1
  31. package/dist/communityRepository/communityMembership/events/onCommunityUserRemoved.d.ts.map +1 -1
  32. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleAdded.d.ts +1 -1
  33. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleAdded.d.ts.map +1 -1
  34. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.d.ts +1 -1
  35. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.d.ts.map +1 -1
  36. package/dist/communityRepository/communityMembership/events/onCommunityUserUnbanned.d.ts +1 -1
  37. package/dist/communityRepository/communityMembership/events/onCommunityUserUnbanned.d.ts.map +1 -1
  38. package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts +1 -1
  39. package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts.map +1 -1
  40. package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts +1 -1
  41. package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts.map +1 -1
  42. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserAdded.d.ts +1 -1
  43. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserAdded.d.ts.map +1 -1
  44. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.d.ts +1 -1
  45. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.d.ts.map +1 -1
  46. package/dist/communityRepository/communityMembership/events/onUserDeleted.d.ts +1 -1
  47. package/dist/communityRepository/communityMembership/events/onUserDeleted.d.ts.map +1 -1
  48. package/dist/communityRepository/communityMembership/events/utils.d.ts +2 -2
  49. package/dist/communityRepository/communityMembership/events/utils.d.ts.map +1 -1
  50. package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts +2 -2
  51. package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts.map +1 -1
  52. package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.d.ts +2 -2
  53. package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.d.ts.map +1 -1
  54. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.d.ts +1 -1
  55. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.d.ts.map +1 -1
  56. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.d.ts +1 -1
  57. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.d.ts.map +1 -1
  58. package/dist/communityRepository/events/onCommunityCreated.d.ts +1 -1
  59. package/dist/communityRepository/events/onCommunityCreated.d.ts.map +1 -1
  60. package/dist/communityRepository/events/onCommunityDeleted.d.ts +1 -1
  61. package/dist/communityRepository/events/onCommunityDeleted.d.ts.map +1 -1
  62. package/dist/communityRepository/events/onCommunityUpdated.d.ts +1 -1
  63. package/dist/communityRepository/events/onCommunityUpdated.d.ts.map +1 -1
  64. package/dist/communityRepository/events/utils.d.ts +1 -1
  65. package/dist/communityRepository/events/utils.d.ts.map +1 -1
  66. package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts +2 -2
  67. package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts.map +1 -1
  68. package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts +2 -2
  69. package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts.map +1 -1
  70. package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.d.ts +2 -2
  71. package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.d.ts.map +1 -1
  72. package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts +2 -2
  73. package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts.map +1 -1
  74. package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts +2 -2
  75. package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts.map +1 -1
  76. package/dist/communityRepository/utils/communityWithMembership.d.ts +1 -1
  77. package/dist/communityRepository/utils/communityWithMembership.d.ts.map +1 -1
  78. package/dist/communityRepository/utils/payload.d.ts +1 -1
  79. package/dist/communityRepository/utils/payload.d.ts.map +1 -1
  80. package/dist/core/events.d.ts +3 -3
  81. package/dist/core/events.d.ts.map +1 -1
  82. package/dist/core/model/idResolvers.d.ts.map +1 -1
  83. package/dist/core/model/index.d.ts.map +1 -1
  84. package/dist/index.cjs.js +266 -51
  85. package/dist/index.d.ts +1 -0
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.esm.js +248 -34
  88. package/dist/index.umd.js +4 -4
  89. package/dist/invitationRepository/events/index.d.ts +2 -0
  90. package/dist/invitationRepository/events/index.d.ts.map +1 -0
  91. package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts +17 -0
  92. package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts.map +1 -0
  93. package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts +17 -0
  94. package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts.map +1 -0
  95. package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts +17 -0
  96. package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts.map +1 -0
  97. package/dist/invitationRepository/index.d.ts +2 -0
  98. package/dist/invitationRepository/index.d.ts.map +1 -0
  99. package/dist/invitationRepository/internalApi/acceptInvitation.d.ts +16 -0
  100. package/dist/invitationRepository/internalApi/acceptInvitation.d.ts.map +1 -0
  101. package/dist/invitationRepository/internalApi/cancelInvitation.d.ts +16 -0
  102. package/dist/invitationRepository/internalApi/cancelInvitation.d.ts.map +1 -0
  103. package/dist/invitationRepository/internalApi/createInvitations.d.ts +21 -0
  104. package/dist/invitationRepository/internalApi/createInvitations.d.ts.map +1 -0
  105. package/dist/invitationRepository/internalApi/index.d.ts +5 -0
  106. package/dist/invitationRepository/internalApi/index.d.ts.map +1 -0
  107. package/dist/invitationRepository/internalApi/rejectInvitation.d.ts +16 -0
  108. package/dist/invitationRepository/internalApi/rejectInvitation.d.ts.map +1 -0
  109. package/dist/utils/linkedObject/communityLinkedObject.d.ts +2 -0
  110. package/dist/utils/linkedObject/communityLinkedObject.d.ts.map +1 -0
  111. package/dist/utils/linkedObject/index.d.ts +2 -0
  112. package/dist/utils/linkedObject/index.d.ts.map +1 -1
  113. package/dist/utils/linkedObject/invitationLinkedObject.d.ts +2 -0
  114. package/dist/utils/linkedObject/invitationLinkedObject.d.ts.map +1 -0
  115. package/dist/utils/tests/dummy/post.d.ts +3 -3
  116. package/package.json +1 -1
  117. package/src/@types/core/events.ts +4 -0
  118. package/src/@types/core/model.ts +5 -1
  119. package/src/@types/core/payload.ts +9 -4
  120. package/src/@types/domains/community.ts +10 -1
  121. package/src/@types/domains/invitation.ts +52 -0
  122. package/src/@types/index.ts +1 -0
  123. package/src/communityRepository/api/createCommunity.ts +2 -1
  124. package/src/communityRepository/api/getCommunities.ts +2 -1
  125. package/src/communityRepository/api/getCommunity.ts +4 -1
  126. package/src/communityRepository/api/getRecommendedCommunities.ts +2 -1
  127. package/src/communityRepository/api/getTrendingCommunities.ts +2 -1
  128. package/src/communityRepository/api/queryCommunities.ts +6 -1
  129. package/src/communityRepository/api/updateCommunity.ts +4 -1
  130. package/src/communityRepository/communityMembership/events/onCommunityJoined.ts +1 -1
  131. package/src/communityRepository/communityMembership/events/onCommunityLeft.ts +1 -1
  132. package/src/communityRepository/communityMembership/events/onCommunityUserAdded.ts +1 -1
  133. package/src/communityRepository/communityMembership/events/onCommunityUserBanned.ts +1 -1
  134. package/src/communityRepository/communityMembership/events/onCommunityUserChanged.ts +1 -1
  135. package/src/communityRepository/communityMembership/events/onCommunityUserRemoved.ts +1 -1
  136. package/src/communityRepository/communityMembership/events/onCommunityUserRoleAdded.ts +1 -1
  137. package/src/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.ts +1 -1
  138. package/src/communityRepository/communityMembership/events/onCommunityUserUnbanned.ts +1 -1
  139. package/src/communityRepository/communityMembership/events/onLocalCommunityJoined.ts +1 -1
  140. package/src/communityRepository/communityMembership/events/onLocalCommunityLeft.ts +1 -1
  141. package/src/communityRepository/communityMembership/events/onLocalCommunityUserAdded.ts +1 -1
  142. package/src/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.ts +1 -1
  143. package/src/communityRepository/communityMembership/events/onUserDeleted.ts +3 -1
  144. package/src/communityRepository/communityMembership/events/utils.ts +2 -2
  145. package/src/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.ts +8 -2
  146. package/src/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.ts +8 -2
  147. package/src/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.ts +1 -1
  148. package/src/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.ts +1 -1
  149. package/src/communityRepository/events/onCommunityCreated.ts +1 -1
  150. package/src/communityRepository/events/onCommunityDeleted.ts +1 -1
  151. package/src/communityRepository/events/onCommunityUpdated.ts +1 -1
  152. package/src/communityRepository/events/utils.ts +1 -1
  153. package/src/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.ts +2 -2
  154. package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.ts +2 -2
  155. package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.ts +2 -2
  156. package/src/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.ts +2 -2
  157. package/src/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.ts +2 -2
  158. package/src/communityRepository/utils/communityWithMembership.ts +8 -4
  159. package/src/communityRepository/utils/payload.ts +1 -1
  160. package/src/core/model/idResolvers.ts +2 -0
  161. package/src/core/model/index.ts +2 -0
  162. package/src/index.ts +2 -0
  163. package/src/invitationRepository/events/index.ts +1 -0
  164. package/src/invitationRepository/events/onLocalInvitationCreated.ts +33 -0
  165. package/src/invitationRepository/events/onLocalInvitationDeleted.ts +33 -0
  166. package/src/invitationRepository/events/onLocalInvitationUpdated.ts +33 -0
  167. package/src/invitationRepository/index.ts +1 -0
  168. package/src/invitationRepository/internalApi/acceptInvitation.ts +45 -0
  169. package/src/invitationRepository/internalApi/cancelInvitation.ts +44 -0
  170. package/src/invitationRepository/internalApi/createInvitations.ts +46 -0
  171. package/src/invitationRepository/internalApi/index.ts +4 -0
  172. package/src/invitationRepository/internalApi/rejectInvitation.ts +45 -0
  173. package/src/utils/linkedObject/communityLinkedObject.ts +16 -0
  174. package/src/utils/linkedObject/index.ts +4 -0
  175. package/src/utils/linkedObject/invitationLinkedObject.ts +20 -0
package/dist/index.esm.js CHANGED
@@ -103,6 +103,19 @@ const PostContentType = Object.freeze({
103
103
  POLL: 'poll',
104
104
  });
105
105
 
106
+ var InvitationTypeEnum;
107
+ (function (InvitationTypeEnum) {
108
+ InvitationTypeEnum["CommunityMemberInvite"] = "communityMemberInvite";
109
+ InvitationTypeEnum["LivestreamInvite"] = "livestreamInvite";
110
+ })(InvitationTypeEnum || (InvitationTypeEnum = {}));
111
+ var InvitationStatusEnum;
112
+ (function (InvitationStatusEnum) {
113
+ InvitationStatusEnum["Pending"] = "pending";
114
+ InvitationStatusEnum["Approved"] = "approved";
115
+ InvitationStatusEnum["Rejected"] = "rejected";
116
+ InvitationStatusEnum["Cancelled"] = "cancelled";
117
+ })(InvitationStatusEnum || (InvitationStatusEnum = {}));
118
+
106
119
  function getVersion() {
107
120
  try {
108
121
  // the string ''v7.4.0-esm'' should be replaced by actual value by @rollup/plugin-replace
@@ -549,6 +562,7 @@ const idResolvers = {
549
562
  pinTarget: ({ targetId }) => targetId,
550
563
  notificationTrayItem: ({ _id }) => _id,
551
564
  notificationTraySeen: ({ userId }) => userId,
565
+ invitation: ({ _id }) => _id,
552
566
  };
553
567
  /**
554
568
  * Retrieve the id resolver matching a domain name
@@ -601,6 +615,7 @@ const PAYLOAD2MODEL = {
601
615
  pinTargets: 'pinTarget',
602
616
  pins: 'pin',
603
617
  notificationTrayItems: 'notificationTrayItem',
618
+ invitations: 'invitation',
604
619
  };
605
620
  /** hidden */
606
621
  const isOutdated = (prevData, nextData) => {
@@ -22387,6 +22402,169 @@ const notificationTrayLinkedObject = (noti) => {
22387
22402
  .map(user => userLinkedObject(user)) });
22388
22403
  };
22389
22404
 
22405
+ /* begin_public_function
22406
+ id: invitation.createInvitations
22407
+ */
22408
+ /**
22409
+ * ```js
22410
+ * import { createInvitations } from '@amityco/ts-sdk'
22411
+ * const created = await createInvitations({
22412
+ * type: string,
22413
+ * targetType: string,
22414
+ * targetId: string,
22415
+ * userIds: string[]
22416
+ * }))
22417
+ * ```
22418
+ *
22419
+ * Creates an {@link Amity.Invitation}
22420
+ *
22421
+ * @param bundle The data necessary to create a new {@link Amity.Invitation}
22422
+ * @returns The newly created {@link Amity.Invitation}
22423
+ *
22424
+ * @category Invitation API
22425
+ * @async
22426
+ */
22427
+ const createInvitations = async (bundle) => {
22428
+ const client = getActiveClient();
22429
+ client.log('invitation/createInvitations', bundle);
22430
+ const { data } = await client.http.post('/api/v1/invitations', bundle);
22431
+ const cachedAt = client.cache && Date.now();
22432
+ if (client.cache)
22433
+ ingestInCache(data, { cachedAt });
22434
+ fireEvent('local.invitation.created', data);
22435
+ return {
22436
+ data: data.invitations,
22437
+ cachedAt,
22438
+ };
22439
+ };
22440
+ /* end_public_function */
22441
+
22442
+ /* begin_public_function
22443
+ id: invitation.accept
22444
+ */
22445
+ /**
22446
+ * ```js
22447
+ * import { acceptInvitation } from '@amityco/ts-sdk'
22448
+ * const isAccepted = await acceptInvitation(invitationId)
22449
+ * ```
22450
+ *
22451
+ * Accepts a {@link Amity.Invitation} object
22452
+ *
22453
+ * @param invitationId the {@link Amity.Invitation} to accept
22454
+ * @returns A success boolean if the {@link Amity.Invitation} was accepted
22455
+ *
22456
+ * @category Invitation API
22457
+ * @async
22458
+ */
22459
+ const acceptInvitation = async (invitationId) => {
22460
+ var _a;
22461
+ const client = getActiveClient();
22462
+ client.log('invitation/acceptInvitation', invitationId);
22463
+ const { data } = await client.http.post(`/api/v1/invitations/${invitationId}/accept`);
22464
+ const invitation = (_a = pullFromCache([
22465
+ 'invitation',
22466
+ 'get',
22467
+ invitationId,
22468
+ ])) === null || _a === void 0 ? void 0 : _a.data;
22469
+ if (invitation) {
22470
+ upsertInCache(['invitation', 'get', invitationId], { status: "approved" /* InvitationStatusEnum.Approved */ });
22471
+ fireEvent('local.invitation.updated', { invitations: [invitation] });
22472
+ }
22473
+ return data.success;
22474
+ };
22475
+ /* end_public_function */
22476
+
22477
+ /* begin_public_function
22478
+ id: invitation.reject
22479
+ */
22480
+ /**
22481
+ * ```js
22482
+ * import { rejectInvitation } from '@amityco/ts-sdk'
22483
+ * const isRejected = await rejectInvitation(invitationId)
22484
+ * ```
22485
+ *
22486
+ * Rejects a {@link Amity.Invitation} object
22487
+ *
22488
+ * @param invitationId the {@link Amity.Invitation} to reject
22489
+ * @returns A success boolean if the {@link Amity.Invitation} was rejected
22490
+ *
22491
+ * @category Invitation API
22492
+ * @async
22493
+ */
22494
+ const rejectInvitation = async (invitationId) => {
22495
+ var _a;
22496
+ const client = getActiveClient();
22497
+ client.log('invitation/rejectInvitation', invitationId);
22498
+ const { data } = await client.http.post(`/api/v1/invitations/${invitationId}/reject`);
22499
+ const invitation = (_a = pullFromCache([
22500
+ 'invitation',
22501
+ 'get',
22502
+ invitationId,
22503
+ ])) === null || _a === void 0 ? void 0 : _a.data;
22504
+ if (invitation) {
22505
+ upsertInCache(['invitation', 'get', invitationId], { status: "rejected" /* InvitationStatusEnum.Rejected */ });
22506
+ fireEvent('local.invitation.updated', { invitations: [invitation] });
22507
+ }
22508
+ return data.success;
22509
+ };
22510
+ /* end_public_function */
22511
+
22512
+ /* begin_public_function
22513
+ id: invitation.cancel
22514
+ */
22515
+ /**
22516
+ * ```js
22517
+ * import { cancelInvitation } from '@amityco/ts-sdk'
22518
+ * const isCanceled = await cancelInvitation(invitationId)
22519
+ * ```
22520
+ *
22521
+ * Cancels a {@link Amity.Invitation} object
22522
+ *
22523
+ * @param invitationId the {@link Amity.Invitation} to cancel
22524
+ * @returns A success boolean if the {@link Amity.Invitation} was canceled
22525
+ *
22526
+ * @category Invitation API
22527
+ * @async
22528
+ */
22529
+ const cancelInvitation = async (invitationId) => {
22530
+ var _a;
22531
+ const client = getActiveClient();
22532
+ client.log('invitation/cancelInvitation', invitationId);
22533
+ const { data } = await client.http.delete(`/api/v1/invitations/${invitationId}`);
22534
+ const invitation = (_a = pullFromCache([
22535
+ 'invitation',
22536
+ 'get',
22537
+ invitationId,
22538
+ ])) === null || _a === void 0 ? void 0 : _a.data;
22539
+ if (invitation) {
22540
+ dropFromCache(['invitation', 'get', invitationId]);
22541
+ fireEvent('local.invitation.deleted', { invitations: [invitation] });
22542
+ }
22543
+ return data.success;
22544
+ };
22545
+ /* end_public_function */
22546
+
22547
+ const communityLinkedObject = (community) => {
22548
+ return Object.assign(Object.assign({}, community), { createInvitations: async (userIds) => {
22549
+ await createInvitations({
22550
+ type: "communityMemberInvite" /* InvitationTypeEnum.CommunityMemberInvite */,
22551
+ targetType: 'community',
22552
+ targetId: community.communityId,
22553
+ userIds,
22554
+ });
22555
+ } });
22556
+ };
22557
+
22558
+ const invitationLinkedObject = (invitation) => {
22559
+ return Object.assign(Object.assign({}, invitation), { accept: async () => {
22560
+ await acceptInvitation(invitation._id);
22561
+ }, reject: async () => {
22562
+ await rejectInvitation(invitation._id);
22563
+ }, cancel: async () => {
22564
+ await cancelInvitation(invitation._id);
22565
+ } });
22566
+ };
22567
+
22390
22568
  const LinkedObject = {
22391
22569
  ad: adLinkedObject,
22392
22570
  comment: commentLinkedObject,
@@ -22401,6 +22579,8 @@ const LinkedObject = {
22401
22579
  channel: channelLinkedObject,
22402
22580
  pinnedPost: pinnedPostLinkedObject,
22403
22581
  notificationTray: notificationTrayLinkedObject,
22582
+ community: communityLinkedObject,
22583
+ invitation: invitationLinkedObject,
22404
22584
  };
22405
22585
 
22406
22586
  const getChannelMessagePreviewWithUser = (channel) => {
@@ -26302,7 +26482,7 @@ const getUserUnread = (callback) => {
26302
26482
  };
26303
26483
  };
26304
26484
 
26305
- var index$m = /*#__PURE__*/Object.freeze({
26485
+ var index$n = /*#__PURE__*/Object.freeze({
26306
26486
  __proto__: null,
26307
26487
  getActiveClient: getActiveClient,
26308
26488
  getActiveUser: getActiveUser,
@@ -27509,7 +27689,7 @@ const getMyFollowInfo = (callback) => {
27509
27689
  };
27510
27690
  /* end_public_function */
27511
27691
 
27512
- var index$l = /*#__PURE__*/Object.freeze({
27692
+ var index$m = /*#__PURE__*/Object.freeze({
27513
27693
  __proto__: null,
27514
27694
  blockUser: blockUser,
27515
27695
  unBlockUser: unBlockUser,
@@ -28524,9 +28704,9 @@ var AmityUserSearchMatchType;
28524
28704
  AmityUserSearchMatchType["PARTIAL"] = "partial";
28525
28705
  })(AmityUserSearchMatchType || (AmityUserSearchMatchType = {}));
28526
28706
 
28527
- var index$k = /*#__PURE__*/Object.freeze({
28707
+ var index$l = /*#__PURE__*/Object.freeze({
28528
28708
  __proto__: null,
28529
- Relationship: index$l,
28709
+ Relationship: index$m,
28530
28710
  getUserByIds: getUserByIds,
28531
28711
  updateUser: updateUser,
28532
28712
  flagUser: flagUser,
@@ -28834,7 +29014,7 @@ const updateAltText = async (fileId, altText) => {
28834
29014
  };
28835
29015
  /* end_public_function */
28836
29016
 
28837
- var index$j = /*#__PURE__*/Object.freeze({
29017
+ var index$k = /*#__PURE__*/Object.freeze({
28838
29018
  __proto__: null,
28839
29019
  getFile: getFile,
28840
29020
  uploadFile: uploadFile,
@@ -29205,7 +29385,11 @@ function isCurrentUserPartOfCommunity(c, m) {
29205
29385
  */
29206
29386
  function updateMembershipStatus(communities, communityUsers) {
29207
29387
  return communities.map(c => {
29208
- const cachedCommunity = pullFromCache(['community', 'get', c.communityId]);
29388
+ const cachedCommunity = pullFromCache([
29389
+ 'community',
29390
+ 'get',
29391
+ c.communityId,
29392
+ ]);
29209
29393
  if ((cachedCommunity === null || cachedCommunity === void 0 ? void 0 : cachedCommunity.data) && (cachedCommunity === null || cachedCommunity === void 0 ? void 0 : cachedCommunity.data.hasOwnProperty('isJoined'))) {
29210
29394
  return Object.assign(Object.assign({}, cachedCommunity.data), c);
29211
29395
  }
@@ -30702,7 +30886,7 @@ const getReactions = (params, callback, config) => {
30702
30886
  };
30703
30887
  /* end_public_function */
30704
30888
 
30705
- var index$i = /*#__PURE__*/Object.freeze({
30889
+ var index$j = /*#__PURE__*/Object.freeze({
30706
30890
  __proto__: null,
30707
30891
  addReaction: addReaction,
30708
30892
  removeReaction: removeReaction,
@@ -32525,7 +32709,7 @@ const getMessages = (params, callback, config) => {
32525
32709
  };
32526
32710
  /* end_public_function */
32527
32711
 
32528
- var index$h = /*#__PURE__*/Object.freeze({
32712
+ var index$i = /*#__PURE__*/Object.freeze({
32529
32713
  __proto__: null,
32530
32714
  createMessage: createMessage,
32531
32715
  updateMessage: updateMessage,
@@ -33051,7 +33235,7 @@ const stopMessageReceiptSync = (subChannelId) => {
33051
33235
  };
33052
33236
  /* end_public_function */
33053
33237
 
33054
- var index$g = /*#__PURE__*/Object.freeze({
33238
+ var index$h = /*#__PURE__*/Object.freeze({
33055
33239
  __proto__: null,
33056
33240
  getSubChannelByIds: getSubChannels$1,
33057
33241
  createSubChannel: createSubChannel,
@@ -34365,7 +34549,7 @@ const searchMembers$1 = (params, callback, config) => {
34365
34549
  };
34366
34550
  /* end_public_function */
34367
34551
 
34368
- var index$f = /*#__PURE__*/Object.freeze({
34552
+ var index$g = /*#__PURE__*/Object.freeze({
34369
34553
  __proto__: null,
34370
34554
  addMembers: addMembers$1,
34371
34555
  removeMembers: removeMembers$1,
@@ -34568,7 +34752,7 @@ const unmuteMembers = async (channelId, userIds) => {
34568
34752
  };
34569
34753
  /* end_public_function */
34570
34754
 
34571
- var index$e = /*#__PURE__*/Object.freeze({
34755
+ var index$f = /*#__PURE__*/Object.freeze({
34572
34756
  __proto__: null,
34573
34757
  addRole: addRole,
34574
34758
  removeRole: removeRole,
@@ -34578,10 +34762,10 @@ var index$e = /*#__PURE__*/Object.freeze({
34578
34762
  unmuteMembers: unmuteMembers
34579
34763
  });
34580
34764
 
34581
- var index$d = /*#__PURE__*/Object.freeze({
34765
+ var index$e = /*#__PURE__*/Object.freeze({
34582
34766
  __proto__: null,
34583
- Membership: index$f,
34584
- Moderation: index$e,
34767
+ Membership: index$g,
34768
+ Moderation: index$f,
34585
34769
  getChannelByIds: getChannelByIds$1,
34586
34770
  createChannel: createChannel,
34587
34771
  updateChannel: updateChannel,
@@ -34649,7 +34833,7 @@ const getCommunities$1 = async (communityIds) => {
34649
34833
  saveCommunityUsers(data.communities, data.communityUsers);
34650
34834
  }
34651
34835
  return {
34652
- data: data.communities,
34836
+ data: data.communities.map(community => LinkedObject.community(community)),
34653
34837
  cachedAt,
34654
34838
  };
34655
34839
  };
@@ -34715,7 +34899,7 @@ const createCommunity = async (bundle) => {
34715
34899
  }
34716
34900
  const { communities } = data;
34717
34901
  return {
34718
- data: communities[0],
34902
+ data: LinkedObject.community(communities[0]),
34719
34903
  cachedAt,
34720
34904
  };
34721
34905
  };
@@ -34752,7 +34936,7 @@ const updateCommunity = async (communityId, patch) => {
34752
34936
  }
34753
34937
  const { communities } = data;
34754
34938
  return {
34755
- data: communities.find(community => community.communityId === communityId),
34939
+ data: LinkedObject.community(communities.find(community => community.communityId === communityId)),
34756
34940
  cachedAt,
34757
34941
  };
34758
34942
  };
@@ -34785,7 +34969,7 @@ const getCommunity$1 = async (communityId) => {
34785
34969
  }
34786
34970
  const { communities } = data;
34787
34971
  return {
34788
- data: communities.find(community => community.communityId === communityId),
34972
+ data: LinkedObject.community(communities.find(community => community.communityId === communityId)),
34789
34973
  cachedAt,
34790
34974
  };
34791
34975
  };
@@ -35961,7 +36145,7 @@ const searchMembers = (params, callback, config) => {
35961
36145
  };
35962
36146
  /* end_public_function */
35963
36147
 
35964
- var index$c = /*#__PURE__*/Object.freeze({
36148
+ var index$d = /*#__PURE__*/Object.freeze({
35965
36149
  __proto__: null,
35966
36150
  addMembers: addMembers,
35967
36151
  removeMembers: removeMembers,
@@ -36986,7 +37170,7 @@ const unbanMembers = async (communityId, userIds) => {
36986
37170
  };
36987
37171
  /* end_public_function */
36988
37172
 
36989
- var index$b = /*#__PURE__*/Object.freeze({
37173
+ var index$c = /*#__PURE__*/Object.freeze({
36990
37174
  __proto__: null,
36991
37175
  addRoles: addRoles,
36992
37176
  removeRoles: removeRoles,
@@ -36994,10 +37178,10 @@ var index$b = /*#__PURE__*/Object.freeze({
36994
37178
  unbanMembers: unbanMembers
36995
37179
  });
36996
37180
 
36997
- var index$a = /*#__PURE__*/Object.freeze({
37181
+ var index$b = /*#__PURE__*/Object.freeze({
36998
37182
  __proto__: null,
36999
- Moderation: index$b,
37000
- Membership: index$c,
37183
+ Moderation: index$c,
37184
+ Membership: index$d,
37001
37185
  getCommunityByIds: getCommunities$1,
37002
37186
  createCommunity: createCommunity,
37003
37187
  updateCommunity: updateCommunity,
@@ -37230,7 +37414,7 @@ const getCategories = (params, callback, config) => {
37230
37414
  };
37231
37415
  /* end_public_function */
37232
37416
 
37233
- var index$9 = /*#__PURE__*/Object.freeze({
37417
+ var index$a = /*#__PURE__*/Object.freeze({
37234
37418
  __proto__: null,
37235
37419
  getCategory: getCategory,
37236
37420
  getCategories: getCategories
@@ -37398,7 +37582,7 @@ getCustomRankingGlobalFeed.locally = (query) => {
37398
37582
  : undefined;
37399
37583
  };
37400
37584
 
37401
- var index$8 = /*#__PURE__*/Object.freeze({
37585
+ var index$9 = /*#__PURE__*/Object.freeze({
37402
37586
  __proto__: null,
37403
37587
  queryGlobalFeed: queryGlobalFeed,
37404
37588
  getCustomRankingGlobalFeed: getCustomRankingGlobalFeed
@@ -38727,7 +38911,7 @@ const getComments = (params, callback, config) => {
38727
38911
  };
38728
38912
  /* end_public_function */
38729
38913
 
38730
- var index$7 = /*#__PURE__*/Object.freeze({
38914
+ var index$8 = /*#__PURE__*/Object.freeze({
38731
38915
  __proto__: null,
38732
38916
  getCommentByIds: getCommentByIds,
38733
38917
  createComment: createComment,
@@ -39734,7 +39918,7 @@ const semanticSearchPosts = (params, callback, config) => {
39734
39918
  };
39735
39919
  };
39736
39920
 
39737
- var index$6 = /*#__PURE__*/Object.freeze({
39921
+ var index$7 = /*#__PURE__*/Object.freeze({
39738
39922
  __proto__: null,
39739
39923
  getPostByIds: getPostByIds,
39740
39924
  createPost: createPost,
@@ -40268,7 +40452,7 @@ const getStreams = (params, callback, config) => {
40268
40452
  };
40269
40453
  };
40270
40454
 
40271
- var index$5 = /*#__PURE__*/Object.freeze({
40455
+ var index$6 = /*#__PURE__*/Object.freeze({
40272
40456
  __proto__: null,
40273
40457
  createStream: createStream,
40274
40458
  updateStream: updateStream,
@@ -40555,7 +40739,7 @@ const getPoll = (pollId, callback) => {
40555
40739
  };
40556
40740
  /* end_public_function */
40557
40741
 
40558
- var index$4 = /*#__PURE__*/Object.freeze({
40742
+ var index$5 = /*#__PURE__*/Object.freeze({
40559
40743
  __proto__: null,
40560
40744
  createPoll: createPoll,
40561
40745
  closePoll: closePoll,
@@ -40926,7 +41110,7 @@ const getPlayer = async (parameters) => {
40926
41110
  return video;
40927
41111
  };
40928
41112
 
40929
- var index$3 = /*#__PURE__*/Object.freeze({
41113
+ var index$4 = /*#__PURE__*/Object.freeze({
40930
41114
  __proto__: null,
40931
41115
  getPlayer: getPlayer
40932
41116
  });
@@ -42099,7 +42283,7 @@ const getGlobalStoryTargets = (params, callback, config) => {
42099
42283
  };
42100
42284
  };
42101
42285
 
42102
- var index$2 = /*#__PURE__*/Object.freeze({
42286
+ var index$3 = /*#__PURE__*/Object.freeze({
42103
42287
  __proto__: null,
42104
42288
  createImageStory: createImageStory,
42105
42289
  createVideoStory: createVideoStory,
@@ -42136,7 +42320,7 @@ const getNetworkAds = async () => {
42136
42320
  };
42137
42321
  };
42138
42322
 
42139
- var index$1 = /*#__PURE__*/Object.freeze({
42323
+ var index$2 = /*#__PURE__*/Object.freeze({
42140
42324
  __proto__: null,
42141
42325
  getNetworkAds: getNetworkAds
42142
42326
  });
@@ -42527,7 +42711,7 @@ const markTraySeen = async (lastSeenAt) => {
42527
42711
  };
42528
42712
  /* end_public_function */
42529
42713
 
42530
- var index = /*#__PURE__*/Object.freeze({
42714
+ var index$1 = /*#__PURE__*/Object.freeze({
42531
42715
  __proto__: null,
42532
42716
  getNotificationTraySeen: getNotificationTraySeen,
42533
42717
  getNotificationTrayItems: getNotificationTrayItems,
@@ -42536,4 +42720,34 @@ var index = /*#__PURE__*/Object.freeze({
42536
42720
  onNotificationTraySeenUpdated: onNotificationTraySeenUpdated
42537
42721
  });
42538
42722
 
42539
- export { API_REGIONS, index$1 as AdRepository, index$9 as CategoryRepository, index$d as ChannelRepository, index$m as Client, index$7 as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$a as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, DefaultCommunityPostSetting, index$8 as FeedRepository, FileAccessTypeEnum, index$j as FileRepository, FileType, index$3 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$h as MessageRepository, index$4 as PollRepository, PostContentType, index$6 as PostRepository, index$i as ReactionRepository, index$2 as StoryRepository, index$5 as StreamRepository, index$g as SubChannelRepository, SubscriptionLevels, index$k as UserRepository, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, wipeCache };
42723
+ /**
42724
+ * ```js
42725
+ * import { onLocalInvitationCreated } from '@amityco/ts-sdk'
42726
+ * const dispose = onLocalInvitationCreated(data => {
42727
+ * // ...
42728
+ * })
42729
+ * ```
42730
+ *
42731
+ * Fired when an {@link Amity.InvitationPayload} has been created
42732
+ *
42733
+ * @param callback The function to call when the event was fired
42734
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
42735
+ *
42736
+ * @category Invitation Events
42737
+ */
42738
+ const onLocalInvitationCreated = (callback) => {
42739
+ const client = getActiveClient();
42740
+ const disposers = [
42741
+ createEventSubscriber(client, 'onLocalInvitationCreated', 'local.invitation.created', payload => callback(payload)),
42742
+ ];
42743
+ return () => {
42744
+ disposers.forEach(fn => fn());
42745
+ };
42746
+ };
42747
+
42748
+ var index = /*#__PURE__*/Object.freeze({
42749
+ __proto__: null,
42750
+ onLocalInvitationCreated: onLocalInvitationCreated
42751
+ });
42752
+
42753
+ export { API_REGIONS, index$2 as AdRepository, index$a as CategoryRepository, index$e as ChannelRepository, index$n as Client, index$8 as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$b as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, DefaultCommunityPostSetting, index$9 as FeedRepository, FileAccessTypeEnum, index$k as FileRepository, FileType, index as InvitationRepository, InvitationStatusEnum, InvitationTypeEnum, index$4 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$i as MessageRepository, index$5 as PollRepository, PostContentType, index$7 as PostRepository, index$j as ReactionRepository, index$3 as StoryRepository, index$6 as StreamRepository, index$h as SubChannelRepository, SubscriptionLevels, index$l as UserRepository, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index$1 as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, wipeCache };