@amityco/ts-sdk 7.11.1-78c2ad3f.0 → 7.11.1-80963acf.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/core/events.d.ts +4 -3
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/model.d.ts +2 -2
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +20 -4
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/community.d.ts +10 -7
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/@types/domains/event.d.ts +20 -8
- package/dist/@types/domains/event.d.ts.map +1 -1
- package/dist/@types/domains/room.d.ts +11 -0
- package/dist/@types/domains/room.d.ts.map +1 -1
- package/dist/client/api/getPresenceSetting.d.ts +2 -0
- package/dist/client/api/getPresenceSetting.d.ts.map +1 -0
- package/dist/client/api/resumeSession.d.ts.map +1 -1
- package/dist/client/events/onUserDeleted.d.ts +17 -0
- package/dist/client/events/onUserDeleted.d.ts.map +1 -0
- package/dist/client/services/ObjectResolver/objectResolverEngine.d.ts.map +1 -0
- package/dist/client/services/ObjectResolver/objectResolverEngineOnLoginHandler.d.ts.map +1 -0
- package/dist/client/services/ReadReceiptSync/legacyReadReceiptSyncEngine.d.ts.map +1 -0
- package/dist/client/services/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.d.ts.map +1 -0
- package/dist/client/services/ReadReceiptSync/readReceiptSyncEngine.d.ts.map +1 -0
- package/dist/client/services/ReadReceiptSync/readReceiptSyncEngineOnLoginHandler.d.ts.map +1 -0
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.d.ts.map +1 -1
- package/dist/core/model/idResolvers.d.ts.map +1 -1
- package/dist/core/model/index.d.ts.map +1 -1
- package/dist/eventRepository/observers/index.d.ts +0 -1
- package/dist/eventRepository/observers/index.d.ts.map +1 -1
- package/dist/index.cjs.js +457 -282
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +443 -269
- package/dist/index.umd.js +3 -3
- package/dist/invitationRepository/api/index.d.ts +0 -1
- package/dist/invitationRepository/api/index.d.ts.map +1 -1
- package/dist/invitationRepository/internalObservers/getInvitations/InvitationsLiveCollectionController.d.ts.map +1 -0
- package/dist/invitationRepository/internalObservers/getInvitations/InvitationsPaginationController.d.ts.map +1 -0
- package/dist/invitationRepository/internalObservers/getInvitations/InvitationsQueryStreamController.d.ts.map +1 -0
- package/dist/invitationRepository/internalObservers/getInvitations/enums.d.ts.map +1 -0
- package/dist/invitationRepository/internalObservers/getInvitations.d.ts +12 -0
- package/dist/invitationRepository/internalObservers/getInvitations.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getInvitations.d.ts +28 -6
- package/dist/invitationRepository/observers/getInvitations.d.ts.map +1 -1
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts +1 -1
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts.map +1 -1
- package/dist/invitationRepository/observers/index.d.ts +1 -1
- package/dist/invitationRepository/observers/index.d.ts.map +1 -1
- package/dist/liveReactionRepository/internalApi/createLiveReaction.d.ts +2 -2
- package/dist/liveReactionRepository/internalApi/createLiveReaction.d.ts.map +1 -1
- package/dist/roomPresenceRepository/api/getRoomOnlineUsers.d.ts +18 -0
- package/dist/roomPresenceRepository/api/getRoomOnlineUsers.d.ts.map +1 -0
- package/dist/roomPresenceRepository/api/getRoomUserCount.d.ts +17 -0
- package/dist/roomPresenceRepository/api/getRoomUserCount.d.ts.map +1 -0
- package/dist/roomPresenceRepository/api/index.d.ts +5 -0
- package/dist/roomPresenceRepository/api/index.d.ts.map +1 -0
- package/dist/roomPresenceRepository/api/startHeartbeat.d.ts +15 -0
- package/dist/roomPresenceRepository/api/startHeartbeat.d.ts.map +1 -0
- package/dist/roomPresenceRepository/api/stopHeartbeat.d.ts +15 -0
- package/dist/roomPresenceRepository/api/stopHeartbeat.d.ts.map +1 -0
- package/dist/roomPresenceRepository/index.d.ts +2 -0
- package/dist/roomPresenceRepository/index.d.ts.map +1 -0
- package/dist/roomPresenceRepository/services/RoomPresenceSyncEngine/RoomPresenceSyncEngine.d.ts +38 -0
- package/dist/roomPresenceRepository/services/RoomPresenceSyncEngine/RoomPresenceSyncEngine.d.ts.map +1 -0
- package/dist/roomPresenceRepository/services/RoomPresenceSyncEngine/index.d.ts +2 -0
- package/dist/roomPresenceRepository/services/RoomPresenceSyncEngine/index.d.ts.map +1 -0
- package/dist/roomPresenceRepository/services/RoomPresenceSyncEngine/roomPresenceSyncEngineFactory.d.ts +32 -0
- package/dist/roomPresenceRepository/services/RoomPresenceSyncEngine/roomPresenceSyncEngineFactory.d.ts.map +1 -0
- package/dist/roomPresenceRepository/services/index.d.ts +2 -0
- package/dist/roomPresenceRepository/services/index.d.ts.map +1 -0
- package/dist/roomRepository/api/removeParticipant.d.ts.map +1 -1
- package/dist/roomRepository/events/onRoomCoHostInviteAccepted.d.ts +1 -1
- package/dist/roomRepository/events/onRoomCoHostInviteAccepted.d.ts.map +1 -1
- package/dist/roomRepository/events/onRoomEndBroadcasting.d.ts +1 -1
- package/dist/roomRepository/events/onRoomEndBroadcasting.d.ts.map +1 -1
- package/dist/roomRepository/events/onRoomParticipantJoined.d.ts +1 -1
- package/dist/roomRepository/events/onRoomParticipantJoined.d.ts.map +1 -1
- package/dist/roomRepository/events/onRoomParticipantLeft.d.ts +1 -1
- package/dist/roomRepository/events/onRoomParticipantLeft.d.ts.map +1 -1
- package/dist/roomRepository/events/onRoomParticipantRemovedLocal.d.ts +17 -0
- package/dist/roomRepository/events/onRoomParticipantRemovedLocal.d.ts.map +1 -0
- package/dist/roomRepository/events/onRoomRecordedAvailable.d.ts +1 -1
- package/dist/roomRepository/events/onRoomRecordedAvailable.d.ts.map +1 -1
- package/dist/roomRepository/events/onRoomStartBroadcasting.d.ts +1 -1
- package/dist/roomRepository/events/onRoomStartBroadcasting.d.ts.map +1 -1
- package/dist/roomRepository/events/onRoomWaitingReconnect.d.ts +1 -1
- package/dist/roomRepository/events/onRoomWaitingReconnect.d.ts.map +1 -1
- package/dist/roomRepository/observers/getRoom.d.ts.map +1 -1
- package/dist/roomRepository/observers/utils.d.ts +1 -1
- package/dist/utils/linkedObject/eventLinkObject.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/client/utils/ObjectResolver/objectResolverEngine.d.ts.map +0 -1
- package/dist/client/utils/ObjectResolver/objectResolverEngineOnLoginHandler.d.ts.map +0 -1
- package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine.d.ts.map +0 -1
- package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.d.ts.map +0 -1
- package/dist/client/utils/ReadReceiptSync/readReceiptSyncEngine.d.ts.map +0 -1
- package/dist/client/utils/ReadReceiptSync/readReceiptSyncEngineOnLoginHandler.d.ts.map +0 -1
- package/dist/eventRepository/observers/getMyEvents/LiveCollectionController.d.ts +0 -13
- package/dist/eventRepository/observers/getMyEvents/LiveCollectionController.d.ts.map +0 -1
- package/dist/eventRepository/observers/getMyEvents/PaginationController.d.ts +0 -5
- package/dist/eventRepository/observers/getMyEvents/PaginationController.d.ts.map +0 -1
- package/dist/eventRepository/observers/getMyEvents/QueryStreamController.d.ts +0 -15
- package/dist/eventRepository/observers/getMyEvents/QueryStreamController.d.ts.map +0 -1
- package/dist/eventRepository/observers/getMyEvents.d.ts +0 -12
- package/dist/eventRepository/observers/getMyEvents.d.ts.map +0 -1
- package/dist/invitationRepository/api/acceptInvitation.d.ts +0 -16
- package/dist/invitationRepository/api/acceptInvitation.d.ts.map +0 -1
- package/dist/invitationRepository/api/getMyInvitation.d.ts +0 -16
- package/dist/invitationRepository/api/getMyInvitation.d.ts.map +0 -1
- package/dist/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.d.ts.map +0 -1
- package/dist/invitationRepository/observers/getInvitations/InvitationsPaginationController.d.ts.map +0 -1
- package/dist/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.d.ts.map +0 -1
- package/dist/invitationRepository/observers/getInvitations/enums.d.ts.map +0 -1
- package/dist/invitationRepository/observers/observeInvitations.d.ts +0 -34
- package/dist/invitationRepository/observers/observeInvitations.d.ts.map +0 -1
- /package/dist/client/{utils → services}/ObjectResolver/objectResolverEngine.d.ts +0 -0
- /package/dist/client/{utils → services}/ObjectResolver/objectResolverEngineOnLoginHandler.d.ts +0 -0
- /package/dist/client/{utils → services}/ReadReceiptSync/legacyReadReceiptSyncEngine.d.ts +0 -0
- /package/dist/client/{utils → services}/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.d.ts +0 -0
- /package/dist/client/{utils → services}/ReadReceiptSync/readReceiptSyncEngine.d.ts +0 -0
- /package/dist/client/{utils → services}/ReadReceiptSync/readReceiptSyncEngineOnLoginHandler.d.ts +0 -0
- /package/dist/invitationRepository/{observers → internalObservers}/getInvitations/InvitationsLiveCollectionController.d.ts +0 -0
- /package/dist/invitationRepository/{observers → internalObservers}/getInvitations/InvitationsPaginationController.d.ts +0 -0
- /package/dist/invitationRepository/{observers → internalObservers}/getInvitations/InvitationsQueryStreamController.d.ts +0 -0
- /package/dist/invitationRepository/{observers → internalObservers}/getInvitations/enums.d.ts +0 -0
package/dist/index.esm.js
CHANGED
|
@@ -73,6 +73,11 @@ const CommunityPostSettingMaps = Object.freeze({
|
|
|
73
73
|
},
|
|
74
74
|
});
|
|
75
75
|
const DefaultCommunityPostSetting = 'ONLY_ADMIN_CAN_POST';
|
|
76
|
+
var AmityCommunityType;
|
|
77
|
+
(function (AmityCommunityType) {
|
|
78
|
+
AmityCommunityType["Default"] = "default";
|
|
79
|
+
AmityCommunityType["Event"] = "event";
|
|
80
|
+
})(AmityCommunityType || (AmityCommunityType = {}));
|
|
76
81
|
|
|
77
82
|
const ContentFeedType = Object.freeze({
|
|
78
83
|
STORY: 'story',
|
|
@@ -207,6 +212,16 @@ var AmityEventResponseStatus;
|
|
|
207
212
|
AmityEventResponseStatus["Interested"] = "interested";
|
|
208
213
|
AmityEventResponseStatus["NotGoing"] = "not_going";
|
|
209
214
|
})(AmityEventResponseStatus || (AmityEventResponseStatus = {}));
|
|
215
|
+
var AmityEventSortOption;
|
|
216
|
+
(function (AmityEventSortOption) {
|
|
217
|
+
AmityEventSortOption["StartTime"] = "startTime";
|
|
218
|
+
AmityEventSortOption["CreatedAt"] = "createdAt";
|
|
219
|
+
})(AmityEventSortOption || (AmityEventSortOption = {}));
|
|
220
|
+
var AmityEventOrderOption;
|
|
221
|
+
(function (AmityEventOrderOption) {
|
|
222
|
+
AmityEventOrderOption["Ascending"] = "asc";
|
|
223
|
+
AmityEventOrderOption["Descending"] = "desc";
|
|
224
|
+
})(AmityEventOrderOption || (AmityEventOrderOption = {}));
|
|
210
225
|
|
|
211
226
|
function getVersion() {
|
|
212
227
|
try {
|
|
@@ -658,7 +673,6 @@ const idResolvers = {
|
|
|
658
673
|
joinRequest: ({ joinRequestId }) => joinRequestId,
|
|
659
674
|
room: ({ roomId }) => roomId,
|
|
660
675
|
event: ({ eventId }) => eventId,
|
|
661
|
-
discussionCommunity: ({ communityId }) => communityId,
|
|
662
676
|
};
|
|
663
677
|
/**
|
|
664
678
|
* Retrieve the id resolver matching a domain name
|
|
@@ -716,7 +730,7 @@ const PAYLOAD2MODEL = {
|
|
|
716
730
|
joinRequests: 'joinRequest',
|
|
717
731
|
rooms: 'room',
|
|
718
732
|
events: 'event',
|
|
719
|
-
|
|
733
|
+
viewers: 'viewer',
|
|
720
734
|
};
|
|
721
735
|
/** hidden */
|
|
722
736
|
const isOutdated = (prevData, nextData) => {
|
|
@@ -1447,14 +1461,12 @@ const createEventEmitter = () => {
|
|
|
1447
1461
|
const proxyMqttEvents = (mqttClient, emitter) => {
|
|
1448
1462
|
MQTT_EVENTS.forEach(event => {
|
|
1449
1463
|
mqttClient === null || mqttClient === void 0 ? void 0 : mqttClient.on(event, (...params) => {
|
|
1450
|
-
console.log('global event received => ', event);
|
|
1451
1464
|
emitter.emit(event, params.length === 1 ? params[0] : params);
|
|
1452
1465
|
});
|
|
1453
1466
|
});
|
|
1454
1467
|
// @ts-ignore
|
|
1455
1468
|
mqttClient.on('message', (topic, payload) => {
|
|
1456
1469
|
const message = JSON.parse(payload.toString());
|
|
1457
|
-
console.log('message event received => ', message.eventType, message.data);
|
|
1458
1470
|
emitter.emit(message.eventType, message.data);
|
|
1459
1471
|
});
|
|
1460
1472
|
};
|
|
@@ -24603,11 +24615,11 @@ var objectResolverEngineOnLoginHandler = () => {
|
|
|
24603
24615
|
* @category Live Reaction API
|
|
24604
24616
|
* @async
|
|
24605
24617
|
*/
|
|
24606
|
-
const createLiveReaction = async ({ reactions,
|
|
24618
|
+
const createLiveReaction = async ({ reactions, liveStreamId, }) => {
|
|
24607
24619
|
const client = getActiveClient();
|
|
24608
24620
|
client.log('live_reaction/addReaction', reactions);
|
|
24609
24621
|
const { data } = await client.http.post(`/api/v1/reactions/live`, {
|
|
24610
|
-
|
|
24622
|
+
liveStreamId,
|
|
24611
24623
|
reactions,
|
|
24612
24624
|
});
|
|
24613
24625
|
return data;
|
|
@@ -24677,7 +24689,7 @@ class LiveReactionSyncEngine {
|
|
|
24677
24689
|
// Call server api `POST /api/v1/reactions/live` to sync live reactions
|
|
24678
24690
|
Object.entries(payloads).forEach(([roomId, reactions]) => {
|
|
24679
24691
|
createLiveReaction({
|
|
24680
|
-
roomId,
|
|
24692
|
+
liveStreamId: roomId,
|
|
24681
24693
|
reactions,
|
|
24682
24694
|
});
|
|
24683
24695
|
});
|
|
@@ -26599,7 +26611,7 @@ const getUserUnread = (callback) => {
|
|
|
26599
26611
|
};
|
|
26600
26612
|
};
|
|
26601
26613
|
|
|
26602
|
-
var index$
|
|
26614
|
+
var index$r = /*#__PURE__*/Object.freeze({
|
|
26603
26615
|
__proto__: null,
|
|
26604
26616
|
getActiveClient: getActiveClient,
|
|
26605
26617
|
getActiveUser: getActiveUser,
|
|
@@ -27818,7 +27830,7 @@ const getMyFollowInfo = (callback) => {
|
|
|
27818
27830
|
};
|
|
27819
27831
|
/* end_public_function */
|
|
27820
27832
|
|
|
27821
|
-
var index$
|
|
27833
|
+
var index$q = /*#__PURE__*/Object.freeze({
|
|
27822
27834
|
__proto__: null,
|
|
27823
27835
|
blockUser: blockUser,
|
|
27824
27836
|
unBlockUser: unBlockUser,
|
|
@@ -28463,7 +28475,7 @@ const createInvitations = async (bundle) => {
|
|
|
28463
28475
|
* @category Invitation API
|
|
28464
28476
|
* @async
|
|
28465
28477
|
*/
|
|
28466
|
-
const acceptInvitation
|
|
28478
|
+
const acceptInvitation = async (invitationId) => {
|
|
28467
28479
|
var _a;
|
|
28468
28480
|
const client = getActiveClient();
|
|
28469
28481
|
client.log('invitation/acceptInvitation', invitationId);
|
|
@@ -28549,7 +28561,7 @@ const invitationLinkedObject = (invitation) => {
|
|
|
28549
28561
|
}
|
|
28550
28562
|
return undefined;
|
|
28551
28563
|
}, accept: async () => {
|
|
28552
|
-
await acceptInvitation
|
|
28564
|
+
await acceptInvitation(invitation._id);
|
|
28553
28565
|
}, reject: async () => {
|
|
28554
28566
|
await rejectInvitation(invitation._id);
|
|
28555
28567
|
} });
|
|
@@ -28800,7 +28812,7 @@ class InvitationsLiveCollectionController extends LiveCollectionController {
|
|
|
28800
28812
|
* @category Invitation Live Collection
|
|
28801
28813
|
*
|
|
28802
28814
|
*/
|
|
28803
|
-
const getInvitations = (params, callback, config) => {
|
|
28815
|
+
const getInvitations$1 = (params, callback, config) => {
|
|
28804
28816
|
const { log, cache } = getActiveClient();
|
|
28805
28817
|
if (!cache) {
|
|
28806
28818
|
console.log(ENABLE_CACHE_MESSAGE);
|
|
@@ -28899,7 +28911,7 @@ const roomLinkedObject = (room) => {
|
|
|
28899
28911
|
targetType: 'room',
|
|
28900
28912
|
targetId: room.roomId,
|
|
28901
28913
|
userIds: [userId],
|
|
28902
|
-
}), getInvitations: (params, callback) => getInvitations(Object.assign(Object.assign({}, params), { targetId: room.roomId, targetType: 'room', type: "livestreamCohostInvite" /* InvitationTypeEnum.LivestreamCohostInvite */ }), callback), getMyInvitation: async () => {
|
|
28914
|
+
}), getInvitations: (params, callback) => getInvitations$1(Object.assign(Object.assign({}, params), { targetId: room.roomId, targetType: 'room', type: "livestreamCohostInvite" /* InvitationTypeEnum.LivestreamCohostInvite */ }), callback), getMyInvitation: async () => {
|
|
28903
28915
|
const { data } = await getInvitation({
|
|
28904
28916
|
targetId: room.roomId,
|
|
28905
28917
|
targetType: 'room',
|
|
@@ -29898,7 +29910,7 @@ const communityLinkedObject = (community) => {
|
|
|
29898
29910
|
userIds,
|
|
29899
29911
|
});
|
|
29900
29912
|
}, getMemberInvitations: (params, callback) => {
|
|
29901
|
-
return getInvitations(Object.assign(Object.assign({}, params), { targetId: community.communityId, targetType: 'community', type: "communityMemberInvite" /* InvitationTypeEnum.CommunityMemberInvite */ }), callback);
|
|
29913
|
+
return getInvitations$1(Object.assign(Object.assign({}, params), { targetId: community.communityId, targetType: 'community', type: "communityMemberInvite" /* InvitationTypeEnum.CommunityMemberInvite */ }), callback);
|
|
29902
29914
|
}, getInvitation: async () => {
|
|
29903
29915
|
const { data } = await getInvitation({
|
|
29904
29916
|
targetType: 'community',
|
|
@@ -29920,18 +29932,6 @@ const eventLinkedObject = (event) => {
|
|
|
29920
29932
|
return;
|
|
29921
29933
|
return userLinkedObject(cacheData.data);
|
|
29922
29934
|
},
|
|
29923
|
-
get discussionCommunity() {
|
|
29924
|
-
if (!event.discussionCommunityId)
|
|
29925
|
-
return;
|
|
29926
|
-
const cacheData = pullFromCache([
|
|
29927
|
-
'discussionCommunity',
|
|
29928
|
-
'get',
|
|
29929
|
-
event.discussionCommunityId,
|
|
29930
|
-
]);
|
|
29931
|
-
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
29932
|
-
return;
|
|
29933
|
-
return communityLinkedObject(cacheData.data);
|
|
29934
|
-
},
|
|
29935
29935
|
get targetCommunity() {
|
|
29936
29936
|
if (!event.originId)
|
|
29937
29937
|
return;
|
|
@@ -29948,13 +29948,22 @@ const eventLinkedObject = (event) => {
|
|
|
29948
29948
|
return;
|
|
29949
29949
|
return cacheData.data;
|
|
29950
29950
|
},
|
|
29951
|
-
get
|
|
29952
|
-
if (!event.
|
|
29951
|
+
get post() {
|
|
29952
|
+
if (!event.postId)
|
|
29953
29953
|
return;
|
|
29954
|
-
const cacheData = pullFromCache(['
|
|
29954
|
+
const cacheData = pullFromCache(['post', 'get', event.postId]);
|
|
29955
29955
|
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
29956
29956
|
return;
|
|
29957
|
-
return cacheData.data;
|
|
29957
|
+
return postLinkedObject(cacheData.data);
|
|
29958
|
+
},
|
|
29959
|
+
get room() {
|
|
29960
|
+
var _a;
|
|
29961
|
+
if (!event.postId)
|
|
29962
|
+
return;
|
|
29963
|
+
const cacheData = (_a = queryCache(['room', 'get'])) === null || _a === void 0 ? void 0 : _a.filter(room => room.data.referenceId === event.postId);
|
|
29964
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.length) || !cacheData[0].data)
|
|
29965
|
+
return;
|
|
29966
|
+
return roomLinkedObject(cacheData[0].data);
|
|
29958
29967
|
} });
|
|
29959
29968
|
};
|
|
29960
29969
|
|
|
@@ -30968,9 +30977,9 @@ var AmityUserSearchMatchType;
|
|
|
30968
30977
|
AmityUserSearchMatchType["PARTIAL"] = "partial";
|
|
30969
30978
|
})(AmityUserSearchMatchType || (AmityUserSearchMatchType = {}));
|
|
30970
30979
|
|
|
30971
|
-
var index$
|
|
30980
|
+
var index$p = /*#__PURE__*/Object.freeze({
|
|
30972
30981
|
__proto__: null,
|
|
30973
|
-
Relationship: index$
|
|
30982
|
+
Relationship: index$q,
|
|
30974
30983
|
getUserByIds: getUserByIds,
|
|
30975
30984
|
updateUser: updateUser,
|
|
30976
30985
|
flagUser: flagUser,
|
|
@@ -31373,7 +31382,7 @@ const uploadAudio = async (formData, onProgress) => {
|
|
|
31373
31382
|
};
|
|
31374
31383
|
/* end_public_function */
|
|
31375
31384
|
|
|
31376
|
-
var index$
|
|
31385
|
+
var index$o = /*#__PURE__*/Object.freeze({
|
|
31377
31386
|
__proto__: null,
|
|
31378
31387
|
getFile: getFile,
|
|
31379
31388
|
uploadFile: uploadFile,
|
|
@@ -33185,7 +33194,7 @@ const getReactions$1 = (params, callback, config) => {
|
|
|
33185
33194
|
};
|
|
33186
33195
|
/* end_public_function */
|
|
33187
33196
|
|
|
33188
|
-
var index$
|
|
33197
|
+
var index$n = /*#__PURE__*/Object.freeze({
|
|
33189
33198
|
__proto__: null,
|
|
33190
33199
|
addReaction: addReaction,
|
|
33191
33200
|
removeReaction: removeReaction,
|
|
@@ -34957,7 +34966,7 @@ const getMessages = (params, callback, config) => {
|
|
|
34957
34966
|
};
|
|
34958
34967
|
/* end_public_function */
|
|
34959
34968
|
|
|
34960
|
-
var index$
|
|
34969
|
+
var index$m = /*#__PURE__*/Object.freeze({
|
|
34961
34970
|
__proto__: null,
|
|
34962
34971
|
createMessage: createMessage,
|
|
34963
34972
|
updateMessage: updateMessage,
|
|
@@ -35483,7 +35492,7 @@ const stopMessageReceiptSync = (subChannelId) => {
|
|
|
35483
35492
|
};
|
|
35484
35493
|
/* end_public_function */
|
|
35485
35494
|
|
|
35486
|
-
var index$
|
|
35495
|
+
var index$l = /*#__PURE__*/Object.freeze({
|
|
35487
35496
|
__proto__: null,
|
|
35488
35497
|
getSubChannelByIds: getSubChannels$1,
|
|
35489
35498
|
createSubChannel: createSubChannel,
|
|
@@ -36810,7 +36819,7 @@ const searchMembers$1 = (params, callback, config) => {
|
|
|
36810
36819
|
};
|
|
36811
36820
|
/* end_public_function */
|
|
36812
36821
|
|
|
36813
|
-
var index$
|
|
36822
|
+
var index$k = /*#__PURE__*/Object.freeze({
|
|
36814
36823
|
__proto__: null,
|
|
36815
36824
|
addMembers: addMembers$1,
|
|
36816
36825
|
removeMembers: removeMembers$1,
|
|
@@ -37013,7 +37022,7 @@ const unmuteMembers = async (channelId, userIds) => {
|
|
|
37013
37022
|
};
|
|
37014
37023
|
/* end_public_function */
|
|
37015
37024
|
|
|
37016
|
-
var index$
|
|
37025
|
+
var index$j = /*#__PURE__*/Object.freeze({
|
|
37017
37026
|
__proto__: null,
|
|
37018
37027
|
addRole: addRole,
|
|
37019
37028
|
removeRole: removeRole,
|
|
@@ -37023,10 +37032,10 @@ var index$i = /*#__PURE__*/Object.freeze({
|
|
|
37023
37032
|
unmuteMembers: unmuteMembers
|
|
37024
37033
|
});
|
|
37025
37034
|
|
|
37026
|
-
var index$
|
|
37035
|
+
var index$i = /*#__PURE__*/Object.freeze({
|
|
37027
37036
|
__proto__: null,
|
|
37028
|
-
Membership: index$
|
|
37029
|
-
Moderation: index$
|
|
37037
|
+
Membership: index$k,
|
|
37038
|
+
Moderation: index$j,
|
|
37030
37039
|
getChannelByIds: getChannelByIds$1,
|
|
37031
37040
|
createChannel: createChannel,
|
|
37032
37041
|
updateChannel: updateChannel,
|
|
@@ -38429,7 +38438,7 @@ const searchMembers = (params, callback, config) => {
|
|
|
38429
38438
|
};
|
|
38430
38439
|
/* end_public_function */
|
|
38431
38440
|
|
|
38432
|
-
var index$
|
|
38441
|
+
var index$h = /*#__PURE__*/Object.freeze({
|
|
38433
38442
|
__proto__: null,
|
|
38434
38443
|
addMembers: addMembers,
|
|
38435
38444
|
removeMembers: removeMembers,
|
|
@@ -39680,7 +39689,7 @@ const unbanMembers = async (communityId, userIds) => {
|
|
|
39680
39689
|
};
|
|
39681
39690
|
/* end_public_function */
|
|
39682
39691
|
|
|
39683
|
-
var index$
|
|
39692
|
+
var index$g = /*#__PURE__*/Object.freeze({
|
|
39684
39693
|
__proto__: null,
|
|
39685
39694
|
addRoles: addRoles,
|
|
39686
39695
|
removeRoles: removeRoles,
|
|
@@ -39688,10 +39697,10 @@ var index$f = /*#__PURE__*/Object.freeze({
|
|
|
39688
39697
|
unbanMembers: unbanMembers
|
|
39689
39698
|
});
|
|
39690
39699
|
|
|
39691
|
-
var index$
|
|
39700
|
+
var index$f = /*#__PURE__*/Object.freeze({
|
|
39692
39701
|
__proto__: null,
|
|
39693
|
-
Moderation: index$
|
|
39694
|
-
Membership: index$
|
|
39702
|
+
Moderation: index$g,
|
|
39703
|
+
Membership: index$h,
|
|
39695
39704
|
getCommunityByIds: getCommunities$1,
|
|
39696
39705
|
createCommunity: createCommunity,
|
|
39697
39706
|
updateCommunity: updateCommunity,
|
|
@@ -39925,7 +39934,7 @@ const getCategories = (params, callback, config) => {
|
|
|
39925
39934
|
};
|
|
39926
39935
|
/* end_public_function */
|
|
39927
39936
|
|
|
39928
|
-
var index$
|
|
39937
|
+
var index$e = /*#__PURE__*/Object.freeze({
|
|
39929
39938
|
__proto__: null,
|
|
39930
39939
|
getCategory: getCategory,
|
|
39931
39940
|
getCategories: getCategories
|
|
@@ -40984,7 +40993,7 @@ const getComments = (params, callback, config) => {
|
|
|
40984
40993
|
};
|
|
40985
40994
|
/* end_public_function */
|
|
40986
40995
|
|
|
40987
|
-
var index$
|
|
40996
|
+
var index$d = /*#__PURE__*/Object.freeze({
|
|
40988
40997
|
__proto__: null,
|
|
40989
40998
|
getCommentByIds: getCommentByIds,
|
|
40990
40999
|
createComment: createComment,
|
|
@@ -41655,7 +41664,7 @@ const getUserFeed = (params, callback, config) => {
|
|
|
41655
41664
|
};
|
|
41656
41665
|
/* end_public_function */
|
|
41657
41666
|
|
|
41658
|
-
var index$
|
|
41667
|
+
var index$c = /*#__PURE__*/Object.freeze({
|
|
41659
41668
|
__proto__: null,
|
|
41660
41669
|
queryGlobalFeed: queryGlobalFeed,
|
|
41661
41670
|
getCustomRankingGlobalFeed: getCustomRankingGlobalFeed,
|
|
@@ -43336,7 +43345,7 @@ const searchPostsByHashtag = (params, callback, config) => {
|
|
|
43336
43345
|
};
|
|
43337
43346
|
/* end_public_function */
|
|
43338
43347
|
|
|
43339
|
-
var index$
|
|
43348
|
+
var index$b = /*#__PURE__*/Object.freeze({
|
|
43340
43349
|
__proto__: null,
|
|
43341
43350
|
getPostByIds: getPostByIds,
|
|
43342
43351
|
createPost: createPost,
|
|
@@ -43944,7 +43953,7 @@ const getStreams = (params, callback, config) => {
|
|
|
43944
43953
|
};
|
|
43945
43954
|
};
|
|
43946
43955
|
|
|
43947
|
-
var index$
|
|
43956
|
+
var index$a = /*#__PURE__*/Object.freeze({
|
|
43948
43957
|
__proto__: null,
|
|
43949
43958
|
createStream: createStream,
|
|
43950
43959
|
updateStream: updateStream,
|
|
@@ -44159,9 +44168,7 @@ const getRecordedUrl = async (roomId) => {
|
|
|
44159
44168
|
const removeParticipant = async (roomId, participantUserId) => {
|
|
44160
44169
|
const client = getActiveClient();
|
|
44161
44170
|
client.log('room/removeParticipant', { roomId, participantUserId });
|
|
44162
|
-
await client.http.delete(`/api/v1/rooms/${roomId}/participants
|
|
44163
|
-
data: { participantUserId },
|
|
44164
|
-
});
|
|
44171
|
+
await client.http.delete(`/api/v1/rooms/${roomId}/participants/${participantUserId}`);
|
|
44165
44172
|
fireEvent('local.room.participantRemoved', {
|
|
44166
44173
|
rooms: [{ _id: roomId }],
|
|
44167
44174
|
users: [{ _id: participantUserId }],
|
|
@@ -44317,6 +44324,46 @@ const onRoomCoHostInvited = (callback) => {
|
|
|
44317
44324
|
return createEventSubscriber(client, 'room/onRoomCoHostInvited', 'room.didCohostInvite', filter);
|
|
44318
44325
|
};
|
|
44319
44326
|
|
|
44327
|
+
const getRoomById = async (roomId) => {
|
|
44328
|
+
const client = getActiveClient();
|
|
44329
|
+
client.log('room/getRoomById', roomId);
|
|
44330
|
+
// Check if room is in tombstone
|
|
44331
|
+
isInTombstone('room', roomId);
|
|
44332
|
+
let data;
|
|
44333
|
+
try {
|
|
44334
|
+
const response = await client.http.get(`/api/v1/rooms/${roomId}`);
|
|
44335
|
+
data = response.data;
|
|
44336
|
+
}
|
|
44337
|
+
catch (error) {
|
|
44338
|
+
if (checkIfShouldGoesToTombstone(error === null || error === void 0 ? void 0 : error.code)) {
|
|
44339
|
+
pushToTombstone('room', roomId);
|
|
44340
|
+
}
|
|
44341
|
+
throw error;
|
|
44342
|
+
}
|
|
44343
|
+
const cachedAt = client.cache && Date.now();
|
|
44344
|
+
if (client.cache) {
|
|
44345
|
+
ingestInCache(data, { cachedAt });
|
|
44346
|
+
}
|
|
44347
|
+
return {
|
|
44348
|
+
data: data.rooms[0],
|
|
44349
|
+
cachedAt,
|
|
44350
|
+
};
|
|
44351
|
+
};
|
|
44352
|
+
getRoomById.locally = (roomId) => {
|
|
44353
|
+
const client = getActiveClient();
|
|
44354
|
+
client.log('room/getRoomById.locally', roomId);
|
|
44355
|
+
// Check if room is in tombstone
|
|
44356
|
+
isInTombstone('room', roomId);
|
|
44357
|
+
const cachedAt = client.cache && Date.now();
|
|
44358
|
+
const roomCache = pullFromCache(['room', 'get', roomId]);
|
|
44359
|
+
if (!roomCache)
|
|
44360
|
+
return;
|
|
44361
|
+
return {
|
|
44362
|
+
data: roomCache.data,
|
|
44363
|
+
cachedAt,
|
|
44364
|
+
};
|
|
44365
|
+
};
|
|
44366
|
+
|
|
44320
44367
|
/**
|
|
44321
44368
|
* ```js
|
|
44322
44369
|
* import { onRoomCoHostInviteAccepted } from '@amityco/ts-sdk'
|
|
@@ -44334,12 +44381,14 @@ const onRoomCoHostInvited = (callback) => {
|
|
|
44334
44381
|
*/
|
|
44335
44382
|
const onRoomCoHostInviteAccepted = (callback) => {
|
|
44336
44383
|
const client = getActiveClient();
|
|
44337
|
-
const filter = (payload) => {
|
|
44384
|
+
const filter = async (payload) => {
|
|
44385
|
+
var _a;
|
|
44338
44386
|
const data = prepareMyInvitationsPayload(payload);
|
|
44387
|
+
await getRoomById((_a = data.invitations) === null || _a === void 0 ? void 0 : _a[0].targetId);
|
|
44339
44388
|
ingestInCache(data);
|
|
44340
|
-
callback(data.invitations);
|
|
44389
|
+
callback(data.invitations[0]);
|
|
44341
44390
|
};
|
|
44342
|
-
return createEventSubscriber(client, 'room/onRoomCoHostInviteAccepted', 'room.
|
|
44391
|
+
return createEventSubscriber(client, 'room/onRoomCoHostInviteAccepted', 'room.didCohostInviteAccept', filter);
|
|
44343
44392
|
};
|
|
44344
44393
|
|
|
44345
44394
|
/**
|
|
@@ -44364,7 +44413,7 @@ const onRoomCoHostInviteRejected = (callback) => {
|
|
|
44364
44413
|
ingestInCache(data);
|
|
44365
44414
|
callback(data.invitations);
|
|
44366
44415
|
};
|
|
44367
|
-
return createEventSubscriber(client, 'room/onRoomCoHostInviteRejected', 'room.
|
|
44416
|
+
return createEventSubscriber(client, 'room/onRoomCoHostInviteRejected', 'room.didCohostInviteReject', filter);
|
|
44368
44417
|
};
|
|
44369
44418
|
|
|
44370
44419
|
/**
|
|
@@ -44389,7 +44438,7 @@ const onRoomCoHostInviteCanceled = (callback) => {
|
|
|
44389
44438
|
ingestInCache(data);
|
|
44390
44439
|
callback(data.invitations);
|
|
44391
44440
|
};
|
|
44392
|
-
return createEventSubscriber(client, 'room/onRoomCoHostInviteCanceled', 'room.
|
|
44441
|
+
return createEventSubscriber(client, 'room/onRoomCoHostInviteCanceled', 'room.didCohostInviteCancel', filter);
|
|
44393
44442
|
};
|
|
44394
44443
|
|
|
44395
44444
|
/**
|
|
@@ -44557,7 +44606,7 @@ const onRoomParticipantRemoved = (callback) => {
|
|
|
44557
44606
|
ingestInCache(payload);
|
|
44558
44607
|
callback(payload.rooms[0]);
|
|
44559
44608
|
};
|
|
44560
|
-
return createEventSubscriber(client, 'room/onRoomParticipantRemoved', '
|
|
44609
|
+
return createEventSubscriber(client, 'room/onRoomParticipantRemoved', 'room.participantRemoved', filter);
|
|
44561
44610
|
};
|
|
44562
44611
|
|
|
44563
44612
|
/**
|
|
@@ -44584,44 +44633,28 @@ const onRoomLeft = (callback) => {
|
|
|
44584
44633
|
return createEventSubscriber(client, 'room/onRoomLeft', 'local.room.left', filter);
|
|
44585
44634
|
};
|
|
44586
44635
|
|
|
44587
|
-
|
|
44588
|
-
|
|
44589
|
-
|
|
44590
|
-
|
|
44591
|
-
|
|
44592
|
-
|
|
44593
|
-
|
|
44594
|
-
|
|
44595
|
-
|
|
44596
|
-
|
|
44597
|
-
|
|
44598
|
-
|
|
44599
|
-
|
|
44600
|
-
|
|
44601
|
-
|
|
44602
|
-
|
|
44603
|
-
const cachedAt = client.cache && Date.now();
|
|
44604
|
-
if (client.cache) {
|
|
44605
|
-
ingestInCache(data, { cachedAt });
|
|
44606
|
-
}
|
|
44607
|
-
return {
|
|
44608
|
-
data: data.rooms[0],
|
|
44609
|
-
cachedAt,
|
|
44610
|
-
};
|
|
44611
|
-
};
|
|
44612
|
-
getRoomById.locally = (roomId) => {
|
|
44636
|
+
/**
|
|
44637
|
+
* ```js
|
|
44638
|
+
* import { onRoomParticipantRemoved } from '@amityco/ts-sdk'
|
|
44639
|
+
* const dispose = onRoomParticipantRemoved(room => {
|
|
44640
|
+
* // ...
|
|
44641
|
+
* })
|
|
44642
|
+
* ```
|
|
44643
|
+
*
|
|
44644
|
+
* Fired when a participant has been removed from a {@link Amity.Room} locally
|
|
44645
|
+
*
|
|
44646
|
+
* @param callback The function to call when the event was fired
|
|
44647
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
44648
|
+
*
|
|
44649
|
+
* @category Room Events
|
|
44650
|
+
*/
|
|
44651
|
+
const onRoomParticipantRemovedLocal = (callback) => {
|
|
44613
44652
|
const client = getActiveClient();
|
|
44614
|
-
|
|
44615
|
-
|
|
44616
|
-
|
|
44617
|
-
const cachedAt = client.cache && Date.now();
|
|
44618
|
-
const roomCache = pullFromCache(['room', 'get', roomId]);
|
|
44619
|
-
if (!roomCache)
|
|
44620
|
-
return;
|
|
44621
|
-
return {
|
|
44622
|
-
data: roomCache.data,
|
|
44623
|
-
cachedAt,
|
|
44653
|
+
const filter = (payload) => {
|
|
44654
|
+
ingestInCache(payload);
|
|
44655
|
+
callback(payload.rooms[0]);
|
|
44624
44656
|
};
|
|
44657
|
+
return createEventSubscriber(client, 'room/onRoomParticipantRemoved', 'local.room.participantRemoved', filter);
|
|
44625
44658
|
};
|
|
44626
44659
|
|
|
44627
44660
|
const getRoom = (roomId, callback) => {
|
|
@@ -44631,6 +44664,11 @@ const getRoom = (roomId, callback) => {
|
|
|
44631
44664
|
onRoomStartBroadcasting,
|
|
44632
44665
|
onRoomWaitingReconnect,
|
|
44633
44666
|
onRoomRecordedAvailable,
|
|
44667
|
+
onRoomParticipantJoined,
|
|
44668
|
+
onRoomParticipantLeft,
|
|
44669
|
+
onRoomParticipantRemoved,
|
|
44670
|
+
onRoomParticipantRemovedLocal,
|
|
44671
|
+
convertEventPayload(onRoomCoHostInviteAccepted, 'targetId', 'room'),
|
|
44634
44672
|
], {
|
|
44635
44673
|
callbackDataSelector: (data) => {
|
|
44636
44674
|
if (!data)
|
|
@@ -44850,7 +44888,7 @@ const getRooms = (params, callback, config) => {
|
|
|
44850
44888
|
};
|
|
44851
44889
|
/* end_public_function */
|
|
44852
44890
|
|
|
44853
|
-
var index$
|
|
44891
|
+
var index$9 = /*#__PURE__*/Object.freeze({
|
|
44854
44892
|
__proto__: null,
|
|
44855
44893
|
createRoom: createRoom,
|
|
44856
44894
|
updateRoom: updateRoom,
|
|
@@ -44880,6 +44918,300 @@ var index$8 = /*#__PURE__*/Object.freeze({
|
|
|
44880
44918
|
getRooms: getRooms
|
|
44881
44919
|
});
|
|
44882
44920
|
|
|
44921
|
+
/* begin_public_function
|
|
44922
|
+
id: roomPresence.getRoomOnlineUsers
|
|
44923
|
+
*/
|
|
44924
|
+
/**
|
|
44925
|
+
* ```js
|
|
44926
|
+
* import { getRoomOnlineUsers } from '@amityco/ts-sdk'
|
|
44927
|
+
* const result = await getRoomOnlineUsers('roomId')
|
|
44928
|
+
* ```
|
|
44929
|
+
*
|
|
44930
|
+
* Retrieves the list of users currently online in a specific room.
|
|
44931
|
+
* This function fetches all users who are actively watching or present in the room,
|
|
44932
|
+
* handling pagination automatically for large numbers of users.
|
|
44933
|
+
*
|
|
44934
|
+
* @param roomId The ID of the room to get online users for
|
|
44935
|
+
* @returns Promise that resolves with a cached list of online users
|
|
44936
|
+
*
|
|
44937
|
+
* @category Room Presence API
|
|
44938
|
+
* @async
|
|
44939
|
+
*/
|
|
44940
|
+
const getRoomOnlineUsers = async (roomId) => {
|
|
44941
|
+
var _a, _b, _c;
|
|
44942
|
+
const client = getActiveClient();
|
|
44943
|
+
client.log('room/getWatchingUsers', { roomId });
|
|
44944
|
+
const { data } = await client.http.get(`/api/v1/presence/rooms/${roomId}/users`);
|
|
44945
|
+
const viewerIds = (_a = data === null || data === void 0 ? void 0 : data.viewers.map(viewer => viewer.userId)) !== null && _a !== void 0 ? _a : [];
|
|
44946
|
+
// getUserByIds has a maximum limit of 100 users per call
|
|
44947
|
+
// Split into chunks of 100 if we have more than 100 users
|
|
44948
|
+
const BATCH_SIZE = 100;
|
|
44949
|
+
const batches = [];
|
|
44950
|
+
for (let i = 0; i < viewerIds.length; i += BATCH_SIZE) {
|
|
44951
|
+
batches.push(viewerIds.slice(i, i + BATCH_SIZE));
|
|
44952
|
+
}
|
|
44953
|
+
// Fetch all batches in parallel
|
|
44954
|
+
const batchResults = await Promise.all(batches.map(batch => getUserByIds(batch)));
|
|
44955
|
+
// Merge all results
|
|
44956
|
+
const allViewers = [];
|
|
44957
|
+
batchResults.forEach(result => {
|
|
44958
|
+
if (result.data) {
|
|
44959
|
+
allViewers.push(...result.data);
|
|
44960
|
+
}
|
|
44961
|
+
});
|
|
44962
|
+
// Return in the same format as getUserByIds
|
|
44963
|
+
return {
|
|
44964
|
+
data: allViewers,
|
|
44965
|
+
cachedAt: (_c = (_b = batchResults[0]) === null || _b === void 0 ? void 0 : _b.cachedAt) !== null && _c !== void 0 ? _c : Date.now(),
|
|
44966
|
+
};
|
|
44967
|
+
};
|
|
44968
|
+
/* end_public_function */
|
|
44969
|
+
|
|
44970
|
+
/* begin_public_function
|
|
44971
|
+
id: roomPresence.getRoomUserCount
|
|
44972
|
+
*/
|
|
44973
|
+
/**
|
|
44974
|
+
* ```js
|
|
44975
|
+
* import { getRoomUserCount } from '@amityco/ts-sdk'
|
|
44976
|
+
* const count = await getRoomUserCount('roomId')
|
|
44977
|
+
* ```
|
|
44978
|
+
*
|
|
44979
|
+
* Retrieves the count of users currently watching or present in a specific room.
|
|
44980
|
+
* This function returns the total number of online users without fetching their full user data.
|
|
44981
|
+
*
|
|
44982
|
+
* @param roomId The ID of the room to get the user count for
|
|
44983
|
+
* @returns Promise that resolves with the room watching count data
|
|
44984
|
+
*
|
|
44985
|
+
* @category Room Presence API
|
|
44986
|
+
* @async
|
|
44987
|
+
*/
|
|
44988
|
+
const getRoomUserCount = async (roomId) => {
|
|
44989
|
+
const client = getActiveClient();
|
|
44990
|
+
client.log('roomPresence/getRoomUserCount', { roomId });
|
|
44991
|
+
const { data } = await client.http.get(`/api/v1/presence/rooms/${roomId}/users/count`);
|
|
44992
|
+
pushToCache(['get', 'watchingCount', roomId], data);
|
|
44993
|
+
fireEvent('local.room.watchingCountUpdated', data);
|
|
44994
|
+
return data;
|
|
44995
|
+
};
|
|
44996
|
+
/* end_public_function */
|
|
44997
|
+
|
|
44998
|
+
const getPresenceSetting = async () => {
|
|
44999
|
+
const client = getActiveClient();
|
|
45000
|
+
client.log('presence/getPresenceSetting');
|
|
45001
|
+
const { data } = await client.http.get('/api/v1/presence/settings');
|
|
45002
|
+
pushToCache(['get', 'presenceSetting'], data);
|
|
45003
|
+
return data;
|
|
45004
|
+
};
|
|
45005
|
+
|
|
45006
|
+
class RoomPresenceSyncEngine {
|
|
45007
|
+
constructor(roomId) {
|
|
45008
|
+
this.isEnabled = false;
|
|
45009
|
+
this.config = {
|
|
45010
|
+
heartbeatInterval: 30 * SECOND$1,
|
|
45011
|
+
};
|
|
45012
|
+
this.roomId = roomId;
|
|
45013
|
+
// Initialize config asynchronously - don't await in constructor
|
|
45014
|
+
this.initializeConfig().catch(error => {
|
|
45015
|
+
console.error('Failed to initialize RoomPresenceSyncEngine config in constructor:', error);
|
|
45016
|
+
});
|
|
45017
|
+
}
|
|
45018
|
+
async initializeConfig() {
|
|
45019
|
+
try {
|
|
45020
|
+
// Get presence settings from API with retry logic
|
|
45021
|
+
const presenceSettings = await RoomPresenceSyncEngine.getPresenceSettingWithRetry();
|
|
45022
|
+
if (presenceSettings) {
|
|
45023
|
+
// Set intervals from network settings (convert from minutes to milliseconds)
|
|
45024
|
+
this.config = {
|
|
45025
|
+
heartbeatInterval: (presenceSettings.network.heartbeatInterval || 5) * 60 * 1000,
|
|
45026
|
+
};
|
|
45027
|
+
}
|
|
45028
|
+
else {
|
|
45029
|
+
// Use default intervals if all retries failed
|
|
45030
|
+
this.config.heartbeatInterval = 5 * 60 * 1000; // 5 minutes
|
|
45031
|
+
}
|
|
45032
|
+
}
|
|
45033
|
+
catch (error) {
|
|
45034
|
+
console.error('Failed to initialize RoomPresenceSyncEngine config:', error);
|
|
45035
|
+
// Use default intervals if settings fetch fails
|
|
45036
|
+
this.config.heartbeatInterval = 5 * 60 * 1000; // 5 minutes
|
|
45037
|
+
}
|
|
45038
|
+
}
|
|
45039
|
+
static async getPresenceSettingWithRetry(maxRetries = 5) {
|
|
45040
|
+
for (let attempt = 0; attempt < maxRetries; attempt += 1) {
|
|
45041
|
+
try {
|
|
45042
|
+
// eslint-disable-next-line no-await-in-loop
|
|
45043
|
+
const presenceSettings = await getPresenceSetting();
|
|
45044
|
+
return presenceSettings;
|
|
45045
|
+
}
|
|
45046
|
+
catch (error) {
|
|
45047
|
+
if (attempt >= maxRetries - 1) {
|
|
45048
|
+
console.error(`Failed to get presence setting after ${maxRetries} attempts:`, error);
|
|
45049
|
+
return null;
|
|
45050
|
+
}
|
|
45051
|
+
// Calculate delay: 20 seconds + random jitter (0-5 seconds)
|
|
45052
|
+
const jitter = Math.random() * 5000; // 0-5 seconds in milliseconds
|
|
45053
|
+
const delay = 20000 + jitter; // 20 seconds + jitter
|
|
45054
|
+
console.warn(`Failed to get presence setting (attempt ${attempt + 1}/${maxRetries}), retrying in ${Math.round(delay / 1000)}s:`, error);
|
|
45055
|
+
// Wait before retry
|
|
45056
|
+
// eslint-disable-next-line no-await-in-loop
|
|
45057
|
+
await new Promise(resolve => {
|
|
45058
|
+
setTimeout(resolve, delay);
|
|
45059
|
+
});
|
|
45060
|
+
}
|
|
45061
|
+
}
|
|
45062
|
+
return null;
|
|
45063
|
+
}
|
|
45064
|
+
/**
|
|
45065
|
+
* Start heartbeat for the room
|
|
45066
|
+
*/
|
|
45067
|
+
start() {
|
|
45068
|
+
if (this.isEnabled)
|
|
45069
|
+
return;
|
|
45070
|
+
this.isEnabled = true;
|
|
45071
|
+
// Send immediate heartbeat
|
|
45072
|
+
this.sendHeartbeat();
|
|
45073
|
+
// Start heartbeat timer
|
|
45074
|
+
this.heartbeatTimer = setInterval(() => {
|
|
45075
|
+
this.sendHeartbeat();
|
|
45076
|
+
}, this.config.heartbeatInterval);
|
|
45077
|
+
}
|
|
45078
|
+
/**
|
|
45079
|
+
* Stop heartbeat for the room
|
|
45080
|
+
*/
|
|
45081
|
+
stop() {
|
|
45082
|
+
this.isEnabled = false;
|
|
45083
|
+
// Stop heartbeat timer
|
|
45084
|
+
if (this.heartbeatTimer) {
|
|
45085
|
+
clearInterval(this.heartbeatTimer);
|
|
45086
|
+
this.heartbeatTimer = undefined;
|
|
45087
|
+
}
|
|
45088
|
+
}
|
|
45089
|
+
/**
|
|
45090
|
+
* Send heartbeat to the room
|
|
45091
|
+
*/
|
|
45092
|
+
async sendHeartbeat() {
|
|
45093
|
+
try {
|
|
45094
|
+
const client = getActiveClient();
|
|
45095
|
+
await client.http.post(`/api/v1/presence/rooms/${this.roomId}/heartbeat`);
|
|
45096
|
+
}
|
|
45097
|
+
catch (error) {
|
|
45098
|
+
console.error(`Heartbeat failed for room ${this.roomId}:`, error);
|
|
45099
|
+
}
|
|
45100
|
+
}
|
|
45101
|
+
/**
|
|
45102
|
+
* Get the room ID
|
|
45103
|
+
*/
|
|
45104
|
+
getRoomId() {
|
|
45105
|
+
return this.roomId;
|
|
45106
|
+
}
|
|
45107
|
+
/**
|
|
45108
|
+
* Check if the engine is enabled
|
|
45109
|
+
*/
|
|
45110
|
+
isActive() {
|
|
45111
|
+
return this.isEnabled;
|
|
45112
|
+
}
|
|
45113
|
+
/**
|
|
45114
|
+
* Cleanup method to stop all timers and release resources
|
|
45115
|
+
* Call this when the engine instance is no longer needed
|
|
45116
|
+
*/
|
|
45117
|
+
destroy() {
|
|
45118
|
+
// Stop the engine
|
|
45119
|
+
this.stop();
|
|
45120
|
+
}
|
|
45121
|
+
// Session Management
|
|
45122
|
+
onSessionDestroyed() {
|
|
45123
|
+
// Stop all timers when session is destroyed and cleanup
|
|
45124
|
+
this.destroy();
|
|
45125
|
+
}
|
|
45126
|
+
onTokenExpired() {
|
|
45127
|
+
// Stop engine when token expires
|
|
45128
|
+
this.stop();
|
|
45129
|
+
}
|
|
45130
|
+
}
|
|
45131
|
+
|
|
45132
|
+
// Map to store engine instances per roomId
|
|
45133
|
+
const engineInstances = new Map();
|
|
45134
|
+
/**
|
|
45135
|
+
* Get or create a RoomPresenceSyncEngine instance for a specific room
|
|
45136
|
+
*
|
|
45137
|
+
* @param roomId The room ID to get/create engine for
|
|
45138
|
+
* @returns RoomPresenceSyncEngine instance for the room
|
|
45139
|
+
*/
|
|
45140
|
+
const getRoomPresenceSyncEngine = (roomId) => {
|
|
45141
|
+
let engine = engineInstances.get(roomId);
|
|
45142
|
+
if (!engine) {
|
|
45143
|
+
engine = new RoomPresenceSyncEngine(roomId);
|
|
45144
|
+
engineInstances.set(roomId, engine);
|
|
45145
|
+
}
|
|
45146
|
+
return engine;
|
|
45147
|
+
};
|
|
45148
|
+
/**
|
|
45149
|
+
* Destroy the engine instance for a specific room
|
|
45150
|
+
*
|
|
45151
|
+
* @param roomId The room ID to destroy engine for
|
|
45152
|
+
*/
|
|
45153
|
+
const destroyRoomPresenceSyncEngine = (roomId) => {
|
|
45154
|
+
const engine = engineInstances.get(roomId);
|
|
45155
|
+
if (engine) {
|
|
45156
|
+
engine.destroy();
|
|
45157
|
+
engineInstances.delete(roomId);
|
|
45158
|
+
}
|
|
45159
|
+
};
|
|
45160
|
+
|
|
45161
|
+
/* begin_public_function
|
|
45162
|
+
id: roomPresence.startHeartbeat
|
|
45163
|
+
*/
|
|
45164
|
+
/**
|
|
45165
|
+
* ```js
|
|
45166
|
+
* import { startHeartbeat } from '@amityco/ts-sdk'
|
|
45167
|
+
* startHeartbeat('roomId')
|
|
45168
|
+
* ```
|
|
45169
|
+
*
|
|
45170
|
+
* Starts sending heartbeat signals for a specific room to maintain presence status.
|
|
45171
|
+
* This enables the room presence tracking and notifies the server that the user is actively viewing the room.
|
|
45172
|
+
*
|
|
45173
|
+
* @param roomId The ID of the room to start heartbeat for
|
|
45174
|
+
*
|
|
45175
|
+
* @category Room Presence API
|
|
45176
|
+
*/
|
|
45177
|
+
const startHeartbeat = (roomId) => {
|
|
45178
|
+
const engine = getRoomPresenceSyncEngine(roomId);
|
|
45179
|
+
engine.start();
|
|
45180
|
+
};
|
|
45181
|
+
/* end_public_function */
|
|
45182
|
+
|
|
45183
|
+
/* begin_public_function
|
|
45184
|
+
id: roomPresence.stopHeartbeat
|
|
45185
|
+
*/
|
|
45186
|
+
/**
|
|
45187
|
+
* ```js
|
|
45188
|
+
* import { stopHeartbeat } from '@amityco/ts-sdk'
|
|
45189
|
+
* stopHeartbeat('roomId')
|
|
45190
|
+
* ```
|
|
45191
|
+
*
|
|
45192
|
+
* Stops sending heartbeat signals for a specific room.
|
|
45193
|
+
* This disables the room presence tracking for the specified room and stops notifying the server of the user's presence.
|
|
45194
|
+
*
|
|
45195
|
+
* @param roomId The ID of the room to stop heartbeat for
|
|
45196
|
+
*
|
|
45197
|
+
* @category Room Presence API
|
|
45198
|
+
*/
|
|
45199
|
+
const stopHeartbeat = (roomId) => {
|
|
45200
|
+
const engine = getRoomPresenceSyncEngine(roomId);
|
|
45201
|
+
engine.stop();
|
|
45202
|
+
// Clean up the engine instance
|
|
45203
|
+
destroyRoomPresenceSyncEngine(roomId);
|
|
45204
|
+
};
|
|
45205
|
+
/* end_public_function */
|
|
45206
|
+
|
|
45207
|
+
var index$8 = /*#__PURE__*/Object.freeze({
|
|
45208
|
+
__proto__: null,
|
|
45209
|
+
getRoomOnlineUsers: getRoomOnlineUsers,
|
|
45210
|
+
getRoomUserCount: getRoomUserCount,
|
|
45211
|
+
startHeartbeat: startHeartbeat,
|
|
45212
|
+
stopHeartbeat: stopHeartbeat
|
|
45213
|
+
});
|
|
45214
|
+
|
|
44883
45215
|
/* begin_public_function
|
|
44884
45216
|
id: poll.create
|
|
44885
45217
|
*/
|
|
@@ -47207,28 +47539,6 @@ const cancelInvitation = async (invitationId) => {
|
|
|
47207
47539
|
};
|
|
47208
47540
|
/* end_public_function */
|
|
47209
47541
|
|
|
47210
|
-
/* begin_public_function
|
|
47211
|
-
id: invitation.accept
|
|
47212
|
-
*/
|
|
47213
|
-
/**
|
|
47214
|
-
* ```js
|
|
47215
|
-
* import { acceptInvitation } from '@amityco/ts-sdk'
|
|
47216
|
-
* const isAccepted = await acceptInvitation(invitationId)
|
|
47217
|
-
* ```
|
|
47218
|
-
*
|
|
47219
|
-
* Accepts a {@link Amity.Invitation} object
|
|
47220
|
-
*
|
|
47221
|
-
* @param invitationId the {@link Amity.Invitation} to accept
|
|
47222
|
-
* @returns A success boolean if the {@link Amity.Invitation} was accepted
|
|
47223
|
-
*
|
|
47224
|
-
* @category Invitation API
|
|
47225
|
-
* @async
|
|
47226
|
-
*/
|
|
47227
|
-
const acceptInvitation = async (invitationId) => {
|
|
47228
|
-
return acceptInvitation$1(invitationId);
|
|
47229
|
-
};
|
|
47230
|
-
/* end_public_function */
|
|
47231
|
-
|
|
47232
47542
|
class MyInvitationsPaginationController extends PaginationController {
|
|
47233
47543
|
async getRequest(queryParams, token) {
|
|
47234
47544
|
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
|
|
@@ -47289,7 +47599,7 @@ class MyInvitationsQueryStreamController extends QueryStreamController {
|
|
|
47289
47599
|
]),
|
|
47290
47600
|
];
|
|
47291
47601
|
}
|
|
47292
|
-
if (action === InvitationActionsEnum.
|
|
47602
|
+
if (action === InvitationActionsEnum.OnLocalInvitationCanceled) {
|
|
47293
47603
|
collection.data = collection.data.filter(id => id !== invitations[0].invitationId);
|
|
47294
47604
|
}
|
|
47295
47605
|
pushToCache(this.cacheKey, collection);
|
|
@@ -47421,13 +47731,16 @@ const getMyCommunityInvitations = (params, callback, config) => {
|
|
|
47421
47731
|
};
|
|
47422
47732
|
};
|
|
47423
47733
|
|
|
47734
|
+
/* begin_public_function
|
|
47735
|
+
id: invitation.get_invitations
|
|
47736
|
+
*/
|
|
47424
47737
|
/**
|
|
47425
47738
|
*
|
|
47426
47739
|
* ```js
|
|
47427
|
-
* import {
|
|
47740
|
+
* import { InvitationRepository } from '@amityco/ts-sdk';
|
|
47428
47741
|
*
|
|
47429
47742
|
* // For room invitations
|
|
47430
|
-
* const unsubscribe =
|
|
47743
|
+
* const unsubscribe = InvitationRepository.getInvitations(
|
|
47431
47744
|
* { targetId: 'room123', targetType: 'room' },
|
|
47432
47745
|
* response => {
|
|
47433
47746
|
* console.log('Room invitation event:', response.room, response.users, response.eventType)
|
|
@@ -47451,7 +47764,7 @@ const getMyCommunityInvitations = (params, callback, config) => {
|
|
|
47451
47764
|
*
|
|
47452
47765
|
* @category Invitation Observable
|
|
47453
47766
|
*/
|
|
47454
|
-
const
|
|
47767
|
+
const getInvitations = (params, callback) => {
|
|
47455
47768
|
const { _id: userId } = getCurrentUser();
|
|
47456
47769
|
if (!userId)
|
|
47457
47770
|
throw new ASCError('The _id has not been defined in ActiveUser', 800000 /* Amity.ClientError.UNKNOWN_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
@@ -47464,7 +47777,7 @@ const observeInvitations = (params, callback) => {
|
|
|
47464
47777
|
callback(data.map(LinkedObject.invitation));
|
|
47465
47778
|
};
|
|
47466
47779
|
const realtimeRouter = (data) => {
|
|
47467
|
-
const invitations = data.filter(({ targetId, targetType }) => targetId === params.targetId && targetType === params.targetType);
|
|
47780
|
+
const invitations = (Array.isArray(data) ? data : [data]).filter(({ targetId, targetType }) => targetId === params.targetId && targetType === params.targetType);
|
|
47468
47781
|
dispatcher(invitations);
|
|
47469
47782
|
};
|
|
47470
47783
|
// Only subscribe to room co-host events for now (since that's what we have implemented)
|
|
@@ -47476,7 +47789,7 @@ const observeInvitations = (params, callback) => {
|
|
|
47476
47789
|
disposers.push(onRoomCoHostInviteCanceled(realtimeRouter));
|
|
47477
47790
|
}
|
|
47478
47791
|
return () => {
|
|
47479
|
-
log(`
|
|
47792
|
+
log(`getInvitations(tmpid: ${timestamp}) > dispose for ${targetType}: ${targetId}`);
|
|
47480
47793
|
disposers.forEach(fn => fn());
|
|
47481
47794
|
};
|
|
47482
47795
|
};
|
|
@@ -47484,12 +47797,11 @@ const observeInvitations = (params, callback) => {
|
|
|
47484
47797
|
var index$2 = /*#__PURE__*/Object.freeze({
|
|
47485
47798
|
__proto__: null,
|
|
47486
47799
|
cancelInvitation: cancelInvitation,
|
|
47487
|
-
acceptInvitation: acceptInvitation,
|
|
47488
47800
|
onLocalInvitationCreated: onLocalInvitationCreated,
|
|
47489
47801
|
onLocalInvitationUpdated: onLocalInvitationUpdated,
|
|
47490
47802
|
onLocalInvitationCanceled: onLocalInvitationCanceled,
|
|
47491
47803
|
getMyCommunityInvitations: getMyCommunityInvitations,
|
|
47492
|
-
|
|
47804
|
+
getInvitations: getInvitations
|
|
47493
47805
|
});
|
|
47494
47806
|
|
|
47495
47807
|
// TODO: confirm id
|
|
@@ -47808,9 +48120,9 @@ const deleteEvent = async (eventId) => {
|
|
|
47808
48120
|
users: [],
|
|
47809
48121
|
files: [],
|
|
47810
48122
|
communities: [],
|
|
47811
|
-
|
|
48123
|
+
posts: [],
|
|
48124
|
+
rooms: [],
|
|
47812
48125
|
events: [deletedEvent],
|
|
47813
|
-
discussionCommunities: [],
|
|
47814
48126
|
});
|
|
47815
48127
|
};
|
|
47816
48128
|
/* end_public_function */
|
|
@@ -48087,143 +48399,6 @@ const getEvents = (params, callback, config) => {
|
|
|
48087
48399
|
};
|
|
48088
48400
|
};
|
|
48089
48401
|
|
|
48090
|
-
class MyEventPaginationController extends PaginationController {
|
|
48091
|
-
async getRequest(queryParams, token) {
|
|
48092
|
-
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
|
|
48093
|
-
const options = token ? { token } : { limit };
|
|
48094
|
-
const { data: response } = await this.http.get(`/api/v1/events/me/rsvps`, { params: Object.assign(Object.assign({}, params), { options }) });
|
|
48095
|
-
return response;
|
|
48096
|
-
}
|
|
48097
|
-
}
|
|
48098
|
-
|
|
48099
|
-
class MyEventQueryStreamController extends QueryStreamController {
|
|
48100
|
-
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
48101
|
-
super(query, cacheKey);
|
|
48102
|
-
this.notifyChange = notifyChange;
|
|
48103
|
-
this.preparePayload = preparePayload;
|
|
48104
|
-
}
|
|
48105
|
-
async saveToMainDB(response) {
|
|
48106
|
-
const processedPayload = this.preparePayload(response);
|
|
48107
|
-
const client = getActiveClient();
|
|
48108
|
-
const cachedAt = client.cache && Date.now();
|
|
48109
|
-
if (client.cache)
|
|
48110
|
-
ingestInCache(processedPayload, { cachedAt });
|
|
48111
|
-
}
|
|
48112
|
-
appendToQueryStream(response, direction, refresh = false) {
|
|
48113
|
-
var _a, _b;
|
|
48114
|
-
if (refresh) {
|
|
48115
|
-
pushToCache(this.cacheKey, { data: response.events.map(getResolver('event')) });
|
|
48116
|
-
}
|
|
48117
|
-
else {
|
|
48118
|
-
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
48119
|
-
const events = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
48120
|
-
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...events, ...response.events.map(getResolver('event'))])] }));
|
|
48121
|
-
}
|
|
48122
|
-
}
|
|
48123
|
-
reactor(action) {
|
|
48124
|
-
return (event) => {
|
|
48125
|
-
var _a;
|
|
48126
|
-
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
48127
|
-
if (!collection)
|
|
48128
|
-
return;
|
|
48129
|
-
if (action === EventActionsEnum.OnEventCreated) {
|
|
48130
|
-
const client = getActiveClient();
|
|
48131
|
-
if (client.userId !== event.userId)
|
|
48132
|
-
return;
|
|
48133
|
-
collection.data = [...new Set([event.eventId, ...collection.data])];
|
|
48134
|
-
}
|
|
48135
|
-
if (action === EventActionsEnum.OnEventDeleted) {
|
|
48136
|
-
collection.data = collection.data.filter(eventId => eventId !== event.eventId);
|
|
48137
|
-
}
|
|
48138
|
-
pushToCache(this.cacheKey, collection);
|
|
48139
|
-
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
48140
|
-
};
|
|
48141
|
-
}
|
|
48142
|
-
subscribeRTE(createSubscriber) {
|
|
48143
|
-
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
48144
|
-
}
|
|
48145
|
-
}
|
|
48146
|
-
|
|
48147
|
-
class MyEventLiveCollectionController extends LiveCollectionController {
|
|
48148
|
-
constructor(query, callback) {
|
|
48149
|
-
const queryStreamId = hash(query);
|
|
48150
|
-
const cacheKey = ['event', 'collection', queryStreamId];
|
|
48151
|
-
const paginationController = new MyEventPaginationController(query);
|
|
48152
|
-
super(paginationController, queryStreamId, cacheKey, callback);
|
|
48153
|
-
this.query = query;
|
|
48154
|
-
this.queryStreamController = new MyEventQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareEventPayload);
|
|
48155
|
-
this.callback = callback.bind(this);
|
|
48156
|
-
this.loadPage({ initial: true });
|
|
48157
|
-
}
|
|
48158
|
-
setup() {
|
|
48159
|
-
var _a;
|
|
48160
|
-
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
48161
|
-
if (!collection)
|
|
48162
|
-
pushToCache(this.cacheKey, { data: [], params: {} });
|
|
48163
|
-
}
|
|
48164
|
-
async persistModel(queryPayload) {
|
|
48165
|
-
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
48166
|
-
}
|
|
48167
|
-
persistQueryStream({ response, direction, refresh, }) {
|
|
48168
|
-
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
48169
|
-
}
|
|
48170
|
-
startSubscription() {
|
|
48171
|
-
return this.queryStreamController.subscribeRTE([
|
|
48172
|
-
{ fn: onEventCreated, action: EventActionsEnum.OnEventCreated },
|
|
48173
|
-
{ fn: onEventUpdated, action: EventActionsEnum.OnEventUpdated },
|
|
48174
|
-
{ fn: onEventDeleted, action: EventActionsEnum.OnEventDeleted },
|
|
48175
|
-
{ fn: onLocalEventCreated, action: EventActionsEnum.OnEventCreated },
|
|
48176
|
-
{ fn: onLocalEventUpdated, action: EventActionsEnum.OnEventUpdated },
|
|
48177
|
-
{ fn: onLocalEventDeleted, action: EventActionsEnum.OnEventDeleted },
|
|
48178
|
-
]);
|
|
48179
|
-
}
|
|
48180
|
-
notifyChange({ origin, loading, error }) {
|
|
48181
|
-
var _a, _b;
|
|
48182
|
-
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
48183
|
-
if (!collection)
|
|
48184
|
-
return;
|
|
48185
|
-
const data = ((_b = collection.data
|
|
48186
|
-
.map(eventId => pullFromCache(['event', 'get', eventId]))
|
|
48187
|
-
.filter(isNonNullable)
|
|
48188
|
-
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.event);
|
|
48189
|
-
if (!this.shouldNotify(data) && origin === "event" /* Amity.LiveDataOrigin.EVENT */)
|
|
48190
|
-
return;
|
|
48191
|
-
this.callback({
|
|
48192
|
-
data,
|
|
48193
|
-
error,
|
|
48194
|
-
loading,
|
|
48195
|
-
hasNextPage: !!this.paginationController.getNextToken(),
|
|
48196
|
-
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
48197
|
-
});
|
|
48198
|
-
}
|
|
48199
|
-
}
|
|
48200
|
-
|
|
48201
|
-
/**
|
|
48202
|
-
* Get my events
|
|
48203
|
-
*
|
|
48204
|
-
* @param params the query parameters
|
|
48205
|
-
* @param callback the callback to be called when the events are updated
|
|
48206
|
-
* @returns events
|
|
48207
|
-
*
|
|
48208
|
-
* @category Event Live Collection
|
|
48209
|
-
*
|
|
48210
|
-
*/
|
|
48211
|
-
const getMyEvents = (params, callback, config) => {
|
|
48212
|
-
const { log, cache } = getActiveClient();
|
|
48213
|
-
if (!cache)
|
|
48214
|
-
console.log(ENABLE_CACHE_MESSAGE);
|
|
48215
|
-
const timestamp = Date.now();
|
|
48216
|
-
log(`getMyEvents: (tmpid: ${timestamp}) > listen`);
|
|
48217
|
-
const myEventLiveCollection = new MyEventLiveCollectionController(params, callback);
|
|
48218
|
-
const disposers = myEventLiveCollection.startSubscription();
|
|
48219
|
-
const cacheKey = myEventLiveCollection.getCacheKey();
|
|
48220
|
-
disposers.push(() => dropFromCache(cacheKey));
|
|
48221
|
-
return () => {
|
|
48222
|
-
log(`getMyEvents (tmpid: ${timestamp}) > dispose`);
|
|
48223
|
-
disposers.forEach(fn => fn());
|
|
48224
|
-
};
|
|
48225
|
-
};
|
|
48226
|
-
|
|
48227
48402
|
var index = /*#__PURE__*/Object.freeze({
|
|
48228
48403
|
__proto__: null,
|
|
48229
48404
|
createEvent: createEvent,
|
|
@@ -48236,8 +48411,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
48236
48411
|
onLocalEventUpdated: onLocalEventUpdated,
|
|
48237
48412
|
onLocalEventDeleted: onLocalEventDeleted,
|
|
48238
48413
|
getEvent: getEvent,
|
|
48239
|
-
getEvents: getEvents
|
|
48240
|
-
getMyEvents: getMyEvents
|
|
48414
|
+
getEvents: getEvents
|
|
48241
48415
|
});
|
|
48242
48416
|
|
|
48243
|
-
export { API_REGIONS, index$4 as AdRepository, AmityEventOriginType, AmityEventResponseStatus, AmityEventStatus, AmityEventType, index$
|
|
48417
|
+
export { API_REGIONS, index$4 as AdRepository, AmityCommunityType, AmityEventOrderOption, AmityEventOriginType, AmityEventResponseStatus, AmityEventSortOption, AmityEventStatus, AmityEventType, index$e as CategoryRepository, index$i as ChannelRepository, index$r as Client, index$d as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$f as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, DefaultCommunityPostSetting, index as EventRepository, FeedDataTypeEnum, index$c as FeedRepository, FeedSortByEnum, FeedSourceEnum, FileAccessTypeEnum, index$o as FileRepository, FileType, GET_WATCHER_URLS, index$2 as InvitationRepository, InvitationSortByEnum, InvitationStatusEnum, InvitationTargetTypeEnum, InvitationTypeEnum, JoinRequestStatusEnum, JoinResultStatusEnum, index$1 as LiveReactionRepository, index$6 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$m as MessageRepository, index$7 as PollRepository, PostContentType, index$b as PostRepository, PostStructureType, index$n as ReactionRepository, index$8 as RoomPresenceRepository, index$9 as RoomRepository, index$5 as StoryRepository, index$a as StreamRepository, index$l as SubChannelRepository, SubscriptionLevels, index$p as UserRepository, UserTypeEnum, 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, getLiveReactionTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getRoomStreamerTopic, getRoomWatcherTopic, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index$3 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 };
|