@amityco/ts-sdk-react-native 6.20.1 → 6.21.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 +12 -7
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/model.d.ts +3 -3
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +2 -2
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/channel.d.ts +3 -0
- package/dist/@types/domains/channel.d.ts.map +1 -1
- package/dist/@types/domains/reaction.d.ts +8 -4
- package/dist/@types/domains/reaction.d.ts.map +1 -1
- package/dist/channelRepository/api/getChannel.d.ts +2 -2
- package/dist/channelRepository/api/getChannel.d.ts.map +1 -1
- package/dist/channelRepository/api/getChannelByIds.d.ts +2 -2
- package/dist/channelRepository/api/getChannelByIds.d.ts.map +1 -1
- package/dist/channelRepository/events/onChannelResolved.d.ts +12 -0
- package/dist/channelRepository/events/onChannelResolved.d.ts.map +1 -0
- package/dist/channelRepository/observers/getChannel.d.ts.map +1 -1
- package/dist/channelRepository/observers/getChannels/ChannelLiveCollectionController.d.ts.map +1 -1
- package/dist/channelRepository/observers/getChannels/ChannelQueryStreamController.d.ts.map +1 -1
- package/dist/channelRepository/observers/observeChannel.d.ts +1 -1
- package/dist/channelRepository/observers/observeChannel.d.ts.map +1 -1
- package/dist/channelRepository/utils/getSubChannelsUnreadCount.d.ts.map +1 -1
- package/dist/channelRepository/utils/prepateUnreadCountInfo.d.ts.map +1 -1
- package/dist/channelRepository/utils/resolveChannels.d.ts +2 -0
- package/dist/channelRepository/utils/resolveChannels.d.ts.map +1 -0
- package/dist/client/api/login.d.ts.map +1 -1
- package/dist/client/utils/ObjectResolver/objectResolverEngine.d.ts.map +1 -1
- package/dist/client/utils/onOffline.d.ts.map +1 -1
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.d.ts.map +1 -1
- package/dist/index.cjs.js +199 -155
- package/dist/index.esm.js +199 -155
- package/dist/index.umd.js +2 -2
- package/dist/marker/events/onUserMessageFeedMarkerResolved.d.ts +12 -0
- package/dist/marker/events/onUserMessageFeedMarkerResolved.d.ts.map +1 -0
- package/dist/marker/utils/resolveUserMessageFeedMakers.d.ts +2 -0
- package/dist/marker/utils/resolveUserMessageFeedMakers.d.ts.map +1 -0
- package/dist/messageRepository/utils/prepareMessagePayload.d.ts +1 -1
- package/dist/messageRepository/utils/prepareMessagePayload.d.ts.map +1 -1
- package/dist/reactionRepository/api/addReaction.d.ts +2 -2
- package/dist/reactionRepository/api/addReaction.d.ts.map +1 -1
- package/dist/reactionRepository/api/queryReactor.d.ts +3 -3
- package/dist/reactionRepository/api/queryReactor.d.ts.map +1 -1
- package/dist/reactionRepository/api/removeReaction.d.ts +2 -2
- package/dist/reactionRepository/api/removeReaction.d.ts.map +1 -1
- package/dist/reactionRepository/events/onReactorAdded.d.ts +2 -2
- package/dist/reactionRepository/events/onReactorAdded.d.ts.map +1 -1
- package/dist/reactionRepository/events/onReactorRemoved.d.ts +2 -2
- package/dist/reactionRepository/events/onReactorRemoved.d.ts.map +1 -1
- package/dist/reactionRepository/observers/getReactions.d.ts +1 -1
- package/dist/reactionRepository/observers/getReactions.d.ts.map +1 -1
- package/dist/reactionRepository/utils/prepareMessagePayloadForCache.d.ts +1 -1
- package/dist/reactionRepository/utils/prepareMessagePayloadForCache.d.ts.map +1 -1
- package/dist/streamRepository/events/onStreamStopped.d.ts.map +1 -1
- package/dist/utils/linkedObject/index.d.ts +1 -0
- package/dist/utils/linkedObject/index.d.ts.map +1 -1
- package/dist/utils/linkedObject/reactorLinkedObject.d.ts +2 -0
- package/dist/utils/linkedObject/reactorLinkedObject.d.ts.map +1 -0
- package/dist/utils/tests/dummy/reaction.d.ts +1 -1
- package/dist/utils/tests/dummy/reaction.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/core/events.ts +13 -7
- package/src/@types/core/model.ts +3 -3
- package/src/@types/core/payload.ts +2 -2
- package/src/@types/domains/channel.ts +3 -0
- package/src/@types/domains/reaction.ts +10 -4
- package/src/analytic/api/queryReachUser.ts +1 -1
- package/src/channelRepository/api/getChannel.ts +11 -7
- package/src/channelRepository/api/getChannelByIds.ts +13 -7
- package/src/channelRepository/events/onChannelResolved.ts +22 -0
- package/src/channelRepository/observers/getChannel.ts +2 -0
- package/src/channelRepository/observers/getChannels/ChannelLiveCollectionController.ts +14 -10
- package/src/channelRepository/observers/getChannels/ChannelQueryStreamController.ts +4 -5
- package/src/channelRepository/utils/getChannelIsMentioned.ts +2 -2
- package/src/channelRepository/utils/getSubChannelsUnreadCount.ts +3 -2
- package/src/channelRepository/utils/prepareChannelPayload.ts +2 -2
- package/src/channelRepository/utils/prepateUnreadCountInfo.ts +2 -1
- package/src/channelRepository/utils/resolveChannels.ts +8 -0
- package/src/client/api/login.ts +1 -3
- package/src/client/utils/ObjectResolver/objectResolverEngine.ts +5 -4
- package/src/client/utils/hasPermission/checkUserPermission.ts +1 -1
- package/src/client/utils/onOffline.ts +17 -0
- package/src/commentRepository/events/onCommentReactionAdded.ts +1 -1
- package/src/commentRepository/events/onCommentReactionRemoved.ts +1 -1
- package/src/commentRepository/observers/tests/getComment.test.ts +2 -2
- package/src/core/events.ts +4 -0
- package/src/core/model/idResolvers.ts +1 -1
- package/src/core/query/filtering.ts +1 -1
- package/src/marker/events/onUserMessageFeedMarkerResolved.ts +29 -0
- package/src/marker/utils/resolveUserMessageFeedMakers.ts +17 -0
- package/src/messageRepository/utils/prepareMessagePayload.ts +2 -2
- package/src/postRepository/observers/tests/getPost.test.ts +1 -1
- package/src/postRepository/observers/tests/getPosts.test.ts +1 -1
- package/src/reactionRepository/api/addReaction.ts +2 -2
- package/src/reactionRepository/api/queryReactor.ts +3 -3
- package/src/reactionRepository/api/removeReaction.ts +2 -2
- package/src/reactionRepository/events/onReactorAdded.ts +5 -5
- package/src/reactionRepository/events/onReactorRemoved.ts +5 -5
- package/src/reactionRepository/observers/getReactions.ts +18 -16
- package/src/reactionRepository/utils/prepareMessagePayloadForCache.ts +1 -1
- package/src/streamRepository/events/onStreamRecorded.ts +1 -1
- package/src/streamRepository/events/onStreamStarted.ts +1 -1
- package/src/streamRepository/events/onStreamStopped.ts +6 -1
- package/src/utils/linkedObject/index.ts +2 -0
- package/src/utils/linkedObject/reactorLinkedObject.ts +13 -0
- package/src/utils/tests/dummy/reaction.ts +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -118,8 +118,8 @@ const PostContentType = Object.freeze({
|
|
|
118
118
|
|
|
119
119
|
function getVersion() {
|
|
120
120
|
try {
|
|
121
|
-
// the string ''v6.
|
|
122
|
-
return 'v6.
|
|
121
|
+
// the string ''v6.21.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
122
|
+
return 'v6.21.0-cjs';
|
|
123
123
|
}
|
|
124
124
|
catch (error) {
|
|
125
125
|
return '__dev__';
|
|
@@ -524,7 +524,7 @@ const idResolvers = {
|
|
|
524
524
|
user: ({ userId }) => userId,
|
|
525
525
|
file: ({ fileId }) => fileId,
|
|
526
526
|
role: ({ roleId }) => roleId,
|
|
527
|
-
channel: ({
|
|
527
|
+
channel: ({ channelInternalId }) => channelInternalId,
|
|
528
528
|
subChannel: ({ subChannelId }) => subChannelId,
|
|
529
529
|
channelUsers: ({ channelId, userId }) => `${channelId}#${userId}`,
|
|
530
530
|
message: ({ messageId }) => messageId,
|
|
@@ -1087,7 +1087,7 @@ const filterByChannelMembership = (collection, membership, userId) => {
|
|
|
1087
1087
|
return true;
|
|
1088
1088
|
// get resolver for the channel by user
|
|
1089
1089
|
const channelUserCacheKey = getResolver('channelUsers')({
|
|
1090
|
-
channelId: c.
|
|
1090
|
+
channelId: c.channelPublicId,
|
|
1091
1091
|
userId,
|
|
1092
1092
|
});
|
|
1093
1093
|
const channelUser = (_a = pullFromCache([
|
|
@@ -1328,6 +1328,9 @@ const WS_EVENTS = [
|
|
|
1328
1328
|
'sessionStateChange',
|
|
1329
1329
|
// for internal use by accessTokenExpiryWatcher
|
|
1330
1330
|
'tokenExpired',
|
|
1331
|
+
'v3.video-streaming.didRecord',
|
|
1332
|
+
'v3.video-streaming.didStart',
|
|
1333
|
+
'v3.video-streaming.didStop',
|
|
1331
1334
|
];
|
|
1332
1335
|
const MQTT_EVENTS = [
|
|
1333
1336
|
'connect',
|
|
@@ -5675,6 +5678,16 @@ const messageLinkedObject = (message) => {
|
|
|
5675
5678
|
} });
|
|
5676
5679
|
};
|
|
5677
5680
|
|
|
5681
|
+
const reactorLinkedObject = (reactor) => {
|
|
5682
|
+
return Object.assign(Object.assign({}, reactor), { get user() {
|
|
5683
|
+
var _a;
|
|
5684
|
+
const user = (_a = pullFromCache(['user', 'get', reactor.userId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
5685
|
+
if (!user)
|
|
5686
|
+
return undefined;
|
|
5687
|
+
return userLinkedObject(user);
|
|
5688
|
+
} });
|
|
5689
|
+
};
|
|
5690
|
+
|
|
5678
5691
|
const LinkedObject = {
|
|
5679
5692
|
comment: commentLinkedObject,
|
|
5680
5693
|
post: postLinkedObject,
|
|
@@ -5683,6 +5696,7 @@ const LinkedObject = {
|
|
|
5683
5696
|
story: storyLinkedObject,
|
|
5684
5697
|
storyTarget: storyTargetLinkedObject,
|
|
5685
5698
|
message: messageLinkedObject,
|
|
5699
|
+
reactor: reactorLinkedObject,
|
|
5686
5700
|
};
|
|
5687
5701
|
|
|
5688
5702
|
const getChannelMessagePreviewWithUser = (channel) => {
|
|
@@ -6004,7 +6018,8 @@ const getSubChannelsUnreadCount = (channel, marker) => {
|
|
|
6004
6018
|
var _a, _b, _c, _d, _e;
|
|
6005
6019
|
const client = getActiveClient();
|
|
6006
6020
|
if (client.isUnreadCountEnabled && client.getMarkerSyncConsistentMode()) {
|
|
6007
|
-
|
|
6021
|
+
// Marker service API uses channelInternalId as channelId
|
|
6022
|
+
return (_b = (_a = getUnreadInfoCached$1(channel.channelInternalId)) === null || _a === void 0 ? void 0 : _a.unreadCount) !== null && _b !== void 0 ? _b : 0;
|
|
6008
6023
|
}
|
|
6009
6024
|
if (marker === null || marker === void 0 ? void 0 : marker.isDeleted) {
|
|
6010
6025
|
// NOTE: This is a temporary solution to handle the channel marker when the user is forced to
|
|
@@ -6012,7 +6027,7 @@ const getSubChannelsUnreadCount = (channel, marker) => {
|
|
|
6012
6027
|
// from a channel or the channel is deleted the channel's unread count will reset to zero
|
|
6013
6028
|
return 0;
|
|
6014
6029
|
}
|
|
6015
|
-
return (_e = (_c = marker === null || marker === void 0 ? void 0 : marker.unreadCount) !== null && _c !== void 0 ? _c : (_d = getCachedMarker$1(channel.
|
|
6030
|
+
return (_e = (_c = marker === null || marker === void 0 ? void 0 : marker.unreadCount) !== null && _c !== void 0 ? _c : (_d = getCachedMarker$1(channel.channelInternalId)) === null || _d === void 0 ? void 0 : _d.unreadCount) !== null && _e !== void 0 ? _e : 0;
|
|
6016
6031
|
};
|
|
6017
6032
|
|
|
6018
6033
|
const getCachedMarker = (entityId) => {
|
|
@@ -6043,11 +6058,11 @@ const getChannelIsMentioned = (channel, marker) => {
|
|
|
6043
6058
|
var _a, _b, _c, _d;
|
|
6044
6059
|
const client = getActiveClient();
|
|
6045
6060
|
if (client.isUnreadCountEnabled && client.getMarkerSyncConsistentMode()) {
|
|
6046
|
-
return (_b = (_a = getUnreadInfoCached(channel.
|
|
6061
|
+
return (_b = (_a = getUnreadInfoCached(channel.channelPublicId)) === null || _a === void 0 ? void 0 : _a.isMentioned) !== null && _b !== void 0 ? _b : false;
|
|
6047
6062
|
}
|
|
6048
6063
|
return (marker === null || marker === void 0 ? void 0 : marker.hasMentioned) !== undefined
|
|
6049
6064
|
? marker === null || marker === void 0 ? void 0 : marker.hasMentioned
|
|
6050
|
-
: (_d = (_c = getCachedMarker(channel.
|
|
6065
|
+
: (_d = (_c = getCachedMarker(channel.channelPublicId)) === null || _c === void 0 ? void 0 : _c.hasMentioned) !== null && _d !== void 0 ? _d : false;
|
|
6051
6066
|
};
|
|
6052
6067
|
|
|
6053
6068
|
const MARKER_INCLUDED_CHANNEL_TYPE = ['broadcast', 'conversation', 'community'];
|
|
@@ -6074,7 +6089,7 @@ function convertFromRaw$2(channel, options = { isMessagePreviewUpdated: true })
|
|
|
6074
6089
|
},
|
|
6075
6090
|
get subChannelsUnreadCount() {
|
|
6076
6091
|
return getSubChannelsUnreadCount(channel);
|
|
6077
|
-
} }, channel), { defaultSubChannelId: channel.
|
|
6092
|
+
} }, channel), { defaultSubChannelId: channel.channelInternalId, isUnreadCountSupport: isUnreadCountSupport$2(channel), messagePreviewId });
|
|
6078
6093
|
}
|
|
6079
6094
|
const preUpdateChannelCache = (rawPayload, options = { isMessagePreviewUpdated: true }) => {
|
|
6080
6095
|
ingestInCache({
|
|
@@ -6093,7 +6108,7 @@ const prepareChannelPayload = async (rawPayload, options = { isMessagePreviewUpd
|
|
|
6093
6108
|
const markerIds = rawPayload.channels
|
|
6094
6109
|
// filter channel by type. Only conversation, community and broadcast type are included.
|
|
6095
6110
|
.filter(isUnreadCountSupport$2)
|
|
6096
|
-
.map(({
|
|
6111
|
+
.map(({ channelInternalId }) => channelInternalId);
|
|
6097
6112
|
if (markerIds.length > 0) {
|
|
6098
6113
|
// since the get markers method requires a channel cache to function with the reducer.
|
|
6099
6114
|
preUpdateChannelCache(rawPayload, { isMessagePreviewUpdated: options.isMessagePreviewUpdated });
|
|
@@ -6113,6 +6128,85 @@ const prepareChannelPayload = async (rawPayload, options = { isMessagePreviewUpd
|
|
|
6113
6128
|
channelUsers });
|
|
6114
6129
|
};
|
|
6115
6130
|
|
|
6131
|
+
/**
|
|
6132
|
+
* ```js
|
|
6133
|
+
* import { getSubChannelMarkers } from '@amityco/ts-sdk-react-native'
|
|
6134
|
+
* const subChannelMarkers = await getSubChannelMarkers(['sch1', 'sch2'])
|
|
6135
|
+
* ```
|
|
6136
|
+
*
|
|
6137
|
+
* Fetches a paginable list of {@link Amity.SubChannelMarker} objects
|
|
6138
|
+
*
|
|
6139
|
+
* @param messageFeedIds the feed IDs of the {@link Amity.RawSubChannel} marker to fetch
|
|
6140
|
+
* @param page
|
|
6141
|
+
* @returns A page of {@link Amity.SubChannelMarker} objects
|
|
6142
|
+
*
|
|
6143
|
+
* @category Channel API
|
|
6144
|
+
* @async
|
|
6145
|
+
* @private
|
|
6146
|
+
*/
|
|
6147
|
+
const getUserMessageFeedMakers = async (channelIds) => {
|
|
6148
|
+
const client = getActiveClient();
|
|
6149
|
+
client.log('channel/getUserMessageFeedMakers', channelIds);
|
|
6150
|
+
const { data } = await client.http.get(`/api/v1/markers/user-message-feed`, {
|
|
6151
|
+
params: {
|
|
6152
|
+
channelIds,
|
|
6153
|
+
},
|
|
6154
|
+
});
|
|
6155
|
+
fireEvent('local.userMessageFeedMarker.fetched', { userMessageFeedMarker: data });
|
|
6156
|
+
return data;
|
|
6157
|
+
};
|
|
6158
|
+
|
|
6159
|
+
const persistUnreadCountInfo = (payload) => {
|
|
6160
|
+
const { feedMarkers, userFeedMarkers } = payload;
|
|
6161
|
+
// calculate sub channel unread info and channel unread info
|
|
6162
|
+
if (feedMarkers.length > 0 && userFeedMarkers.length > 0) {
|
|
6163
|
+
const channelIds = [];
|
|
6164
|
+
const feedMarkerMap = new Map(feedMarkers.map(fm => [fm.feedId, fm]));
|
|
6165
|
+
userFeedMarkers.forEach(userFeedMarker => {
|
|
6166
|
+
const feedMarker = feedMarkerMap.get(userFeedMarker.feedId);
|
|
6167
|
+
if (!feedMarker)
|
|
6168
|
+
return;
|
|
6169
|
+
if (feedMarker.feedId === userFeedMarker.feedId) {
|
|
6170
|
+
const unreadCount = feedMarker.lastSegment - userFeedMarker.readToSegment;
|
|
6171
|
+
const subChannelUnreadInfo = {
|
|
6172
|
+
subChannelId: feedMarker.feedId,
|
|
6173
|
+
channelId: feedMarker.entityId,
|
|
6174
|
+
readToSegment: userFeedMarker.readToSegment,
|
|
6175
|
+
lastSegment: feedMarker.lastSegment,
|
|
6176
|
+
lastMentionSegment: userFeedMarker.lastMentionSegment,
|
|
6177
|
+
unreadCount: Math.max(0, unreadCount),
|
|
6178
|
+
isMentioned: userFeedMarker.isMentioned,
|
|
6179
|
+
isDeleted: feedMarker.isDeleted,
|
|
6180
|
+
createdAt: userFeedMarker.createdAt,
|
|
6181
|
+
updatedAt: userFeedMarker.updatedAt,
|
|
6182
|
+
};
|
|
6183
|
+
// update sub channel unread info in cache
|
|
6184
|
+
ingestInCache({ subChannelUnreadInfo: [subChannelUnreadInfo] });
|
|
6185
|
+
if (!channelIds.includes(feedMarker.entityId)) {
|
|
6186
|
+
channelIds.push(feedMarker.entityId);
|
|
6187
|
+
}
|
|
6188
|
+
}
|
|
6189
|
+
});
|
|
6190
|
+
// re-calculate channel unread info in cache
|
|
6191
|
+
channelIds.forEach(channelId => {
|
|
6192
|
+
reCalculateChannelUnreadInfo(channelId);
|
|
6193
|
+
});
|
|
6194
|
+
}
|
|
6195
|
+
};
|
|
6196
|
+
|
|
6197
|
+
const prepareUnreadCountInfo = async (rawPayload) => {
|
|
6198
|
+
const client = getActiveClient();
|
|
6199
|
+
// if consistent mode is enabled, persist the unread count info to the cache
|
|
6200
|
+
// Marker service API uses channelInternalId as channelId
|
|
6201
|
+
const queryPayload = await getUserMessageFeedMakers(rawPayload.channels.map(({ channelInternalId }) => channelInternalId));
|
|
6202
|
+
const { feedMarkers, userFeedMarkers } = queryPayload;
|
|
6203
|
+
persistUnreadCountInfo({
|
|
6204
|
+
feedMarkers,
|
|
6205
|
+
userFeedMarkers,
|
|
6206
|
+
});
|
|
6207
|
+
client.log('channel/prepareUnreadCountInfo', rawPayload.channels);
|
|
6208
|
+
};
|
|
6209
|
+
|
|
6116
6210
|
/**
|
|
6117
6211
|
* ```js
|
|
6118
6212
|
* import { getChannelByIds } from '@amityco/ts-sdk-react-native'
|
|
@@ -6142,12 +6236,16 @@ const getChannelByIds = async (channelIds) => {
|
|
|
6142
6236
|
catch (error) {
|
|
6143
6237
|
channelIds.forEach(channelId => {
|
|
6144
6238
|
if (checkIfShouldGoesToTombstone(error === null || error === void 0 ? void 0 : error.code)) {
|
|
6239
|
+
// NOTE: use channelPublicId as tombstone cache key since we cannot get the channelPrivateId that come along with channel data from server
|
|
6145
6240
|
pushToTombstone('channel', channelId);
|
|
6146
6241
|
}
|
|
6147
6242
|
});
|
|
6148
6243
|
throw error;
|
|
6149
6244
|
}
|
|
6150
6245
|
const data = await prepareChannelPayload(payload);
|
|
6246
|
+
if (client.isUnreadCountEnabled && client.getMarkerSyncConsistentMode()) {
|
|
6247
|
+
await prepareUnreadCountInfo(payload);
|
|
6248
|
+
}
|
|
6151
6249
|
const cachedAt = client.cache && Date.now();
|
|
6152
6250
|
if (client.cache)
|
|
6153
6251
|
ingestInCache(data, { cachedAt });
|
|
@@ -6171,18 +6269,18 @@ const getChannelByIds = async (channelIds) => {
|
|
|
6171
6269
|
* @category Channel API
|
|
6172
6270
|
*/
|
|
6173
6271
|
getChannelByIds.locally = (channelIds) => {
|
|
6174
|
-
var _a;
|
|
6272
|
+
var _a, _b;
|
|
6175
6273
|
const client = getActiveClient();
|
|
6176
6274
|
client.log('channel/getChannelByIds.locally', channelIds);
|
|
6177
6275
|
if (!client.cache)
|
|
6178
6276
|
return;
|
|
6179
|
-
const cached =
|
|
6180
|
-
.
|
|
6181
|
-
|
|
6182
|
-
if ((cached === null || cached === void 0 ? void 0 : cached.length) < channelIds.length)
|
|
6277
|
+
const cached = (_a = queryCache(['channel', 'get'])) === null || _a === void 0 ? void 0 : _a.filter(({ data }) => {
|
|
6278
|
+
return channelIds.includes(data.channelPublicId);
|
|
6279
|
+
});
|
|
6280
|
+
if (!cached || (cached === null || cached === void 0 ? void 0 : cached.length) < channelIds.length)
|
|
6183
6281
|
return;
|
|
6184
6282
|
const channels = cached.map(({ data }) => data);
|
|
6185
|
-
const oldest = (
|
|
6283
|
+
const oldest = (_b = cached.sort((a, b) => (a.cachedAt < b.cachedAt ? -1 : 1))) === null || _b === void 0 ? void 0 : _b[0];
|
|
6186
6284
|
return {
|
|
6187
6285
|
data: channels,
|
|
6188
6286
|
cachedAt: oldest.cachedAt,
|
|
@@ -6222,44 +6320,6 @@ const getMessageMarkers = async (messageIds) => {
|
|
|
6222
6320
|
return { data: contentMarkers, cachedAt };
|
|
6223
6321
|
};
|
|
6224
6322
|
|
|
6225
|
-
const persistUnreadCountInfo = (payload) => {
|
|
6226
|
-
const { feedMarkers, userFeedMarkers } = payload;
|
|
6227
|
-
// calculate sub channel unread info and channel unread info
|
|
6228
|
-
if (feedMarkers.length > 0 && userFeedMarkers.length > 0) {
|
|
6229
|
-
const channelIds = [];
|
|
6230
|
-
const feedMarkerMap = new Map(feedMarkers.map(fm => [fm.feedId, fm]));
|
|
6231
|
-
userFeedMarkers.forEach(userFeedMarker => {
|
|
6232
|
-
const feedMarker = feedMarkerMap.get(userFeedMarker.feedId);
|
|
6233
|
-
if (!feedMarker)
|
|
6234
|
-
return;
|
|
6235
|
-
if (feedMarker.feedId === userFeedMarker.feedId) {
|
|
6236
|
-
const unreadCount = feedMarker.lastSegment - userFeedMarker.readToSegment;
|
|
6237
|
-
const subChannelUnreadInfo = {
|
|
6238
|
-
subChannelId: feedMarker.feedId,
|
|
6239
|
-
channelId: feedMarker.entityId,
|
|
6240
|
-
readToSegment: userFeedMarker.readToSegment,
|
|
6241
|
-
lastSegment: feedMarker.lastSegment,
|
|
6242
|
-
lastMentionSegment: userFeedMarker.lastMentionSegment,
|
|
6243
|
-
unreadCount: Math.max(0, unreadCount),
|
|
6244
|
-
isMentioned: userFeedMarker.isMentioned,
|
|
6245
|
-
isDeleted: feedMarker.isDeleted,
|
|
6246
|
-
createdAt: userFeedMarker.createdAt,
|
|
6247
|
-
updatedAt: userFeedMarker.updatedAt,
|
|
6248
|
-
};
|
|
6249
|
-
// update sub channel unread info in cache
|
|
6250
|
-
ingestInCache({ subChannelUnreadInfo: [subChannelUnreadInfo] });
|
|
6251
|
-
if (!channelIds.includes(feedMarker.entityId)) {
|
|
6252
|
-
channelIds.push(feedMarker.entityId);
|
|
6253
|
-
}
|
|
6254
|
-
}
|
|
6255
|
-
});
|
|
6256
|
-
// re-calculate channel unread info in cache
|
|
6257
|
-
channelIds.forEach(channelId => {
|
|
6258
|
-
reCalculateChannelUnreadInfo(channelId);
|
|
6259
|
-
});
|
|
6260
|
-
}
|
|
6261
|
-
};
|
|
6262
|
-
|
|
6263
6323
|
/**
|
|
6264
6324
|
* ```js
|
|
6265
6325
|
* import { getSubChannelMarkers } from '@amityco/ts-sdk-react-native'
|
|
@@ -7188,7 +7248,7 @@ const getSocialSettings = async () => {
|
|
|
7188
7248
|
|
|
7189
7249
|
const checkUserPermission = (userId, permission) => {
|
|
7190
7250
|
var _a;
|
|
7191
|
-
const user = (_a = pullFromCache(['
|
|
7251
|
+
const user = (_a = pullFromCache(['user', 'get', userId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
7192
7252
|
if (!user)
|
|
7193
7253
|
return false;
|
|
7194
7254
|
return user.permissions.some(x => x === permission);
|
|
@@ -7559,37 +7619,39 @@ const onOffline = (callback) => {
|
|
|
7559
7619
|
document.addEventListener('offline', callback);
|
|
7560
7620
|
return () => document.removeEventListener('offline', callback);
|
|
7561
7621
|
}
|
|
7622
|
+
// @TODO: Please update code below to follow our coding conventions and our TS rules
|
|
7623
|
+
if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
|
|
7624
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
7625
|
+
let unsubscribeFn = () => { };
|
|
7626
|
+
Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@react-native-community/netinfo')); }).then(NetInfo => {
|
|
7627
|
+
unsubscribeFn = NetInfo.addEventListener(state => {
|
|
7628
|
+
if (state.isConnected)
|
|
7629
|
+
return;
|
|
7630
|
+
callback();
|
|
7631
|
+
});
|
|
7632
|
+
});
|
|
7633
|
+
return () => {
|
|
7634
|
+
unsubscribeFn();
|
|
7635
|
+
};
|
|
7636
|
+
}
|
|
7562
7637
|
// Handle unsupported environment
|
|
7563
7638
|
console.error('Unsupported environment');
|
|
7564
7639
|
return () => console.error('Unsupported environment');
|
|
7565
7640
|
};
|
|
7566
7641
|
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
*
|
|
7579
|
-
* @category Channel API
|
|
7580
|
-
* @async
|
|
7581
|
-
* @private
|
|
7582
|
-
*/
|
|
7583
|
-
const getUserMessageFeedMakers = async (channelIds) => {
|
|
7584
|
-
const client = getActiveClient();
|
|
7585
|
-
client.log('channel/getUserMessageFeedMakers', channelIds);
|
|
7586
|
-
const { data } = await client.http.get(`/api/v1/markers/user-message-feed`, {
|
|
7587
|
-
params: {
|
|
7588
|
-
channelIds,
|
|
7589
|
-
},
|
|
7642
|
+
const resolveChannels = async (channelIds) => {
|
|
7643
|
+
const { data: channels } = await getChannelByIds(channelIds);
|
|
7644
|
+
fireEvent('local.channel.resolved', channels);
|
|
7645
|
+
};
|
|
7646
|
+
|
|
7647
|
+
const resolveUserMessageFeedMarkers = async (channelIds) => {
|
|
7648
|
+
const queryPayload = await getUserMessageFeedMakers(channelIds);
|
|
7649
|
+
const { feedMarkers, userFeedMarkers } = queryPayload;
|
|
7650
|
+
persistUnreadCountInfo({
|
|
7651
|
+
feedMarkers,
|
|
7652
|
+
userFeedMarkers,
|
|
7590
7653
|
});
|
|
7591
|
-
fireEvent('local.
|
|
7592
|
-
return data;
|
|
7654
|
+
fireEvent('local.userMessageFeedMarkers.resolved', { feedMarkers, userFeedMarkers });
|
|
7593
7655
|
};
|
|
7594
7656
|
|
|
7595
7657
|
class ObjectResolverEngine {
|
|
@@ -7656,9 +7718,9 @@ class ObjectResolverEngine {
|
|
|
7656
7718
|
// Incase of failure: Ignore
|
|
7657
7719
|
// Incase of success: Persist in Domain DB & Notify Live collection
|
|
7658
7720
|
if (channelIds.length > 0)
|
|
7659
|
-
|
|
7721
|
+
resolveChannels(channelIds);
|
|
7660
7722
|
if (userMessageFeedMarkerIds.length > 0)
|
|
7661
|
-
|
|
7723
|
+
resolveUserMessageFeedMarkers(userMessageFeedMarkerIds);
|
|
7662
7724
|
// After sending request
|
|
7663
7725
|
this.isResolvingTask = false;
|
|
7664
7726
|
}
|
|
@@ -8728,9 +8790,7 @@ const login = async (params, sessionHandler, config) => {
|
|
|
8728
8790
|
// FIXME: events are duplicated if connectClient is called few times without disconnectClient
|
|
8729
8791
|
// wire websocket events to our event emitter
|
|
8730
8792
|
proxyWebsocketEvents(client.ws, client.emitter);
|
|
8731
|
-
client.ws.
|
|
8732
|
-
client.ws.open();
|
|
8733
|
-
});
|
|
8793
|
+
client.ws.open();
|
|
8734
8794
|
client.userId = user.userId;
|
|
8735
8795
|
client.sessionHandler = sessionHandler;
|
|
8736
8796
|
/*
|
|
@@ -13146,7 +13206,7 @@ const onReactionRemoved = (referenceType, referenceId, callback) => {
|
|
|
13146
13206
|
* })
|
|
13147
13207
|
* ```
|
|
13148
13208
|
*
|
|
13149
|
-
* Fired when an {@link Amity.
|
|
13209
|
+
* Fired when an {@link Amity.InternalReactor} has been added
|
|
13150
13210
|
*
|
|
13151
13211
|
* @param {@link Amity.ReactableType} referenceType
|
|
13152
13212
|
* @param {string} referenceId
|
|
@@ -13209,7 +13269,7 @@ const onReactorAdded = (referenceType, referenceId, callback) => {
|
|
|
13209
13269
|
* })
|
|
13210
13270
|
* ```
|
|
13211
13271
|
*
|
|
13212
|
-
* Fired when an {@link Amity.
|
|
13272
|
+
* Fired when an {@link Amity.InternalReactor} has been removed
|
|
13213
13273
|
*
|
|
13214
13274
|
* @param {@link Amity.ReactableType} referenceType
|
|
13215
13275
|
* @param {string} referenceId
|
|
@@ -13316,10 +13376,10 @@ const queryReactions = async (query) => {
|
|
|
13316
13376
|
* })
|
|
13317
13377
|
* ```
|
|
13318
13378
|
*
|
|
13319
|
-
* Queries a paginable list of {@link Amity.
|
|
13379
|
+
* Queries a paginable list of {@link Amity.InternalReactor} objects
|
|
13320
13380
|
*
|
|
13321
13381
|
* @param query The query parameters
|
|
13322
|
-
* @returns A page of {@link Amity.
|
|
13382
|
+
* @returns A page of {@link Amity.InternalReactor} objects
|
|
13323
13383
|
*
|
|
13324
13384
|
* @reaction Reaction API
|
|
13325
13385
|
* @async
|
|
@@ -13345,7 +13405,7 @@ const queryReactor = async (query) => {
|
|
|
13345
13405
|
* }, response => merge(reactions, response.data))
|
|
13346
13406
|
* ```
|
|
13347
13407
|
*
|
|
13348
|
-
* Observe all mutations on a list of {@link Amity.
|
|
13408
|
+
* Observe all mutations on a list of {@link Amity.InternalReactor} for a given target object
|
|
13349
13409
|
*
|
|
13350
13410
|
* @param params for querying reactions
|
|
13351
13411
|
* @param callback the function to call when new data are available
|
|
@@ -13375,7 +13435,7 @@ const getReactions = (params, callback, config) => {
|
|
|
13375
13435
|
const reactions = (_a = data.data
|
|
13376
13436
|
.map(reactorId => pullFromCache(['reactor', 'get', reactorId]))
|
|
13377
13437
|
.filter(Boolean)
|
|
13378
|
-
.map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
|
|
13438
|
+
.map(({ data }) => LinkedObject.reactor(data))) !== null && _a !== void 0 ? _a : [];
|
|
13379
13439
|
callback({
|
|
13380
13440
|
onNextPage: onFetch,
|
|
13381
13441
|
data: reactions,
|
|
@@ -13650,18 +13710,6 @@ const updateChannel = async (channelId, patch) => {
|
|
|
13650
13710
|
};
|
|
13651
13711
|
/* end_public_function */
|
|
13652
13712
|
|
|
13653
|
-
const prepareUnreadCountInfo = async (rawPayload) => {
|
|
13654
|
-
const client = getActiveClient();
|
|
13655
|
-
// if consistent mode is enabled, persist the unread count info to the cache
|
|
13656
|
-
const queryPayload = await getUserMessageFeedMakers(rawPayload.channels.map(({ channelId }) => channelId));
|
|
13657
|
-
const { feedMarkers, userFeedMarkers } = queryPayload;
|
|
13658
|
-
persistUnreadCountInfo({
|
|
13659
|
-
feedMarkers,
|
|
13660
|
-
userFeedMarkers,
|
|
13661
|
-
});
|
|
13662
|
-
client.log('channel/prepareUnreadCountInfo', rawPayload.channels);
|
|
13663
|
-
};
|
|
13664
|
-
|
|
13665
13713
|
/**
|
|
13666
13714
|
* ```js
|
|
13667
13715
|
* import { getChannel } from '@amityco/ts-sdk-react-native'
|
|
@@ -13690,6 +13738,7 @@ const getChannel$1 = async (channelId) => {
|
|
|
13690
13738
|
}
|
|
13691
13739
|
catch (error) {
|
|
13692
13740
|
if (checkIfShouldGoesToTombstone(error === null || error === void 0 ? void 0 : error.code)) {
|
|
13741
|
+
// NOTE: use channelPublicId as tombstone cache key since we cannot get the channelPrivateId that come along with channel data from server
|
|
13693
13742
|
pushToTombstone('channel', channelId);
|
|
13694
13743
|
}
|
|
13695
13744
|
throw error;
|
|
@@ -13717,16 +13766,20 @@ const getChannel$1 = async (channelId) => {
|
|
|
13717
13766
|
* @category Channel API
|
|
13718
13767
|
*/
|
|
13719
13768
|
getChannel$1.locally = (channelId) => {
|
|
13769
|
+
var _a;
|
|
13720
13770
|
const client = getActiveClient();
|
|
13721
13771
|
client.log('channel/getChannel.locally', channelId);
|
|
13722
13772
|
if (!client.cache)
|
|
13723
13773
|
return;
|
|
13724
|
-
|
|
13725
|
-
|
|
13774
|
+
// use queryCache to get all channel caches and filter by channelPublicId since we use channelPrivateId as cache key
|
|
13775
|
+
const cached = (_a = queryCache(['channel', 'get'])) === null || _a === void 0 ? void 0 : _a.filter(({ data }) => {
|
|
13776
|
+
return data.channelPublicId === channelId;
|
|
13777
|
+
});
|
|
13778
|
+
if (!cached || (cached === null || cached === void 0 ? void 0 : cached.length) === 0)
|
|
13726
13779
|
return;
|
|
13727
13780
|
return {
|
|
13728
|
-
data: cached.data,
|
|
13729
|
-
cachedAt: cached.cachedAt,
|
|
13781
|
+
data: cached[0].data,
|
|
13782
|
+
cachedAt: cached[0].cachedAt,
|
|
13730
13783
|
};
|
|
13731
13784
|
};
|
|
13732
13785
|
|
|
@@ -16370,6 +16423,7 @@ const getChannel = (channelId, callback) => {
|
|
|
16370
16423
|
await handleMessageCreated(message);
|
|
16371
16424
|
if (message.channelId !== channelId)
|
|
16372
16425
|
return;
|
|
16426
|
+
// channelId from message is channelInternalId
|
|
16373
16427
|
const channel = (_a = pullFromCache(['channel', 'get', channelId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
16374
16428
|
if (!channel)
|
|
16375
16429
|
return;
|
|
@@ -16389,6 +16443,7 @@ const getChannel = (channelId, callback) => {
|
|
|
16389
16443
|
await handleMessageCreated(message);
|
|
16390
16444
|
if (message.channelId !== channelId)
|
|
16391
16445
|
return;
|
|
16446
|
+
// channelId from message is channelInternalId
|
|
16392
16447
|
const channel = (_a = pullFromCache(['channel', 'get', channelId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
16393
16448
|
if (!channel)
|
|
16394
16449
|
return;
|
|
@@ -16552,15 +16607,15 @@ class ChannelQueryStreamController extends QueryStreamController {
|
|
|
16552
16607
|
if ([
|
|
16553
16608
|
"onCreate" /* Amity.ChannelActionType.OnCreate */,
|
|
16554
16609
|
"onJoin" /* Amity.ChannelActionType.OnJoin */,
|
|
16555
|
-
"
|
|
16556
|
-
"onUserMessageFeedMarkerFetch" /* Amity.ChannelActionType.OnUserMessageFeedMarkerFetch */,
|
|
16610
|
+
"onResolve" /* Amity.ChannelActionType.OnResolve */,
|
|
16557
16611
|
].includes(action)) {
|
|
16558
|
-
if (Array.isArray(payload))
|
|
16612
|
+
if (Array.isArray(payload)) {
|
|
16559
16613
|
collection.data = [
|
|
16560
|
-
...new Set([...payload.map((
|
|
16614
|
+
...new Set([...payload.map(getResolver('channel')), ...collection.data]),
|
|
16561
16615
|
];
|
|
16616
|
+
}
|
|
16562
16617
|
else
|
|
16563
|
-
collection.data = [...new Set([payload.
|
|
16618
|
+
collection.data = [...new Set([payload.channelInternalId, ...collection.data])];
|
|
16564
16619
|
}
|
|
16565
16620
|
pushToCache(this.cacheKey, collection);
|
|
16566
16621
|
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
@@ -16571,62 +16626,50 @@ class ChannelQueryStreamController extends QueryStreamController {
|
|
|
16571
16626
|
}
|
|
16572
16627
|
}
|
|
16573
16628
|
|
|
16629
|
+
const resolveUnreadInfoOnChannelEvent = (channel, callback) => {
|
|
16630
|
+
const client = getActiveClient();
|
|
16631
|
+
if (client.isUnreadCountEnabled && client.getMarkerSyncConsistentMode()) {
|
|
16632
|
+
const objectResolverEngine = ObjectResolverEngine$1.getInstance();
|
|
16633
|
+
objectResolverEngine.resolve(channel.channelId, "userMessageFeedMarker" /* Amity.ReferenceType.USER_MESSAGE_FEED_MARKER */);
|
|
16634
|
+
}
|
|
16635
|
+
else
|
|
16636
|
+
callback(channel);
|
|
16637
|
+
};
|
|
16638
|
+
|
|
16574
16639
|
/**
|
|
16575
|
-
*
|
|
16576
|
-
* import { onChannelFetched } from '@amityco/ts-sdk-react-native'
|
|
16577
|
-
* const dispose = onChannelFetched(channel => {
|
|
16578
|
-
* // ...
|
|
16579
|
-
* })
|
|
16580
|
-
* ```
|
|
16640
|
+
* Internal used only
|
|
16581
16641
|
*
|
|
16582
|
-
* Fired when any {@link Amity.Channel}
|
|
16642
|
+
* Fired when any {@link Amity.Channel} have been resolved by Object resolver
|
|
16583
16643
|
*
|
|
16584
16644
|
* @param callback The function to call when the event was fired
|
|
16585
16645
|
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
16586
16646
|
*
|
|
16587
16647
|
* @category Channel Events
|
|
16588
16648
|
*/
|
|
16589
|
-
const
|
|
16649
|
+
const onChannelResolved = (callback) => {
|
|
16590
16650
|
const client = getActiveClient();
|
|
16591
16651
|
const filter = async (payload) => {
|
|
16592
16652
|
callback(payload);
|
|
16593
16653
|
};
|
|
16594
|
-
return createEventSubscriber(client, '
|
|
16654
|
+
return createEventSubscriber(client, 'onChannelResolved', 'local.channel.resolved', filter);
|
|
16595
16655
|
};
|
|
16596
16656
|
|
|
16597
16657
|
/**
|
|
16598
|
-
*
|
|
16599
|
-
* import { onFeedMarkerUpdated } from '@amityco/ts-sdk-react-native'
|
|
16600
|
-
* const dispose = onFeedMarkerUpdated(feedMarker => {
|
|
16601
|
-
* // ...
|
|
16602
|
-
* })
|
|
16603
|
-
* ```
|
|
16658
|
+
* Internal used only
|
|
16604
16659
|
*
|
|
16605
|
-
* Fired when an {@link Amity.
|
|
16660
|
+
* Fired when an {@link Amity.userMessageFeedMarkers} has been resolved by Object Rsesolver
|
|
16606
16661
|
*
|
|
16607
16662
|
* @param callback The function to call when the event was fired
|
|
16608
16663
|
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
16609
16664
|
*
|
|
16610
|
-
* @category
|
|
16665
|
+
* @category MessageMarker Events
|
|
16611
16666
|
*/
|
|
16612
|
-
const
|
|
16667
|
+
const onUserMessageFeedMarkerResolved = (callback) => {
|
|
16613
16668
|
const client = getActiveClient();
|
|
16614
16669
|
const filter = (payload) => {
|
|
16615
|
-
|
|
16616
|
-
persistUnreadCountInfo(payload.userMessageFeedMarker);
|
|
16617
|
-
callback(payload.userMessageFeedMarker);
|
|
16670
|
+
callback(payload);
|
|
16618
16671
|
};
|
|
16619
|
-
return createEventSubscriber(client, '
|
|
16620
|
-
};
|
|
16621
|
-
|
|
16622
|
-
const resolveUnreadInfoOnChannelEvent = (channel, callback) => {
|
|
16623
|
-
const client = getActiveClient();
|
|
16624
|
-
if (client.isUnreadCountEnabled && client.getMarkerSyncConsistentMode()) {
|
|
16625
|
-
const objectResolverEngine = ObjectResolverEngine$1.getInstance();
|
|
16626
|
-
objectResolverEngine.resolve(channel.channelId, "userMessageFeedMarker" /* Amity.ReferenceType.USER_MESSAGE_FEED_MARKER */);
|
|
16627
|
-
}
|
|
16628
|
-
else
|
|
16629
|
-
callback(channel);
|
|
16672
|
+
return createEventSubscriber(client, 'userMessageFeedMarker/onUserMessageFeedMarkerResolved', 'local.userMessageFeedMarkers.resolved', filter);
|
|
16630
16673
|
};
|
|
16631
16674
|
|
|
16632
16675
|
/* eslint-disable no-use-before-define */
|
|
@@ -16763,7 +16806,6 @@ class ChannelLiveCollectionController extends LiveCollectionController {
|
|
|
16763
16806
|
getSubscriptions() {
|
|
16764
16807
|
const subscriptions = [
|
|
16765
16808
|
{
|
|
16766
|
-
// TODO: merge this code to another onMessageCreated in this file
|
|
16767
16809
|
fn: convertEventPayload((callback) => {
|
|
16768
16810
|
return onMessageCreatedMqtt(message => {
|
|
16769
16811
|
var _a;
|
|
@@ -16774,6 +16816,7 @@ class ChannelLiveCollectionController extends LiveCollectionController {
|
|
|
16774
16816
|
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
16775
16817
|
if (!cacheData) {
|
|
16776
16818
|
const objectResolverEngine = ObjectResolverEngine$1.getInstance();
|
|
16819
|
+
// channelId from message event payload is channelInternalId
|
|
16777
16820
|
objectResolverEngine.resolve(message.channelId, "channel" /* Amity.ReferenceType.CHANNEL */);
|
|
16778
16821
|
}
|
|
16779
16822
|
else {
|
|
@@ -16787,7 +16830,6 @@ class ChannelLiveCollectionController extends LiveCollectionController {
|
|
|
16787
16830
|
action: "onUpdate" /* Amity.ChannelActionType.OnUpdate */,
|
|
16788
16831
|
},
|
|
16789
16832
|
{
|
|
16790
|
-
// TODO: merge this code to another onMessageCreated in this file
|
|
16791
16833
|
fn: convertEventPayload((callback) => {
|
|
16792
16834
|
return onMessageCreatedLocal(message => {
|
|
16793
16835
|
var _a;
|
|
@@ -16979,23 +17021,25 @@ class ChannelLiveCollectionController extends LiveCollectionController {
|
|
|
16979
17021
|
action: "onUpdate" /* Amity.ChannelActionType.OnUpdate */,
|
|
16980
17022
|
},
|
|
16981
17023
|
{
|
|
16982
|
-
fn:
|
|
16983
|
-
action: "
|
|
17024
|
+
fn: onChannelResolved,
|
|
17025
|
+
action: "onResolve" /* Amity.ChannelActionType.OnResolve */,
|
|
16984
17026
|
},
|
|
16985
17027
|
{
|
|
16986
17028
|
fn: (callback) => {
|
|
16987
|
-
const
|
|
17029
|
+
const handleUserFeedMarkerResolved = async (marker) => {
|
|
16988
17030
|
if (marker.feedMarkers) {
|
|
16989
|
-
const channelIds =
|
|
17031
|
+
const channelIds = [
|
|
17032
|
+
...new Set(marker.feedMarkers.map(feedMarker => feedMarker.entityId)),
|
|
17033
|
+
];
|
|
16990
17034
|
const channels = channelIds
|
|
16991
17035
|
.map(channelId => { var _a; return (_a = pullFromCache(['channel', 'get', channelId])) === null || _a === void 0 ? void 0 : _a.data; })
|
|
16992
17036
|
.filter(Boolean);
|
|
16993
17037
|
callback(channels);
|
|
16994
17038
|
}
|
|
16995
17039
|
};
|
|
16996
|
-
return
|
|
17040
|
+
return onUserMessageFeedMarkerResolved(handleUserFeedMarkerResolved);
|
|
16997
17041
|
},
|
|
16998
|
-
action: "
|
|
17042
|
+
action: "onResolve" /* Amity.ChannelActionType.OnResolve */,
|
|
16999
17043
|
},
|
|
17000
17044
|
];
|
|
17001
17045
|
if (this.paginationController instanceof PaginationController) {
|
|
@@ -21619,7 +21663,7 @@ const onStreamStarted = (callback) => {
|
|
|
21619
21663
|
ingestInCache(payload);
|
|
21620
21664
|
callback(payload.videoStreamings[0]);
|
|
21621
21665
|
};
|
|
21622
|
-
return createEventSubscriber(client, 'stream/onStreamStarted', 'video-streaming.didStart', filter);
|
|
21666
|
+
return createEventSubscriber(client, 'stream/onStreamStarted', 'v3.video-streaming.didStart', filter);
|
|
21623
21667
|
};
|
|
21624
21668
|
|
|
21625
21669
|
/**
|
|
@@ -21643,7 +21687,7 @@ const onStreamStopped = (callback) => {
|
|
|
21643
21687
|
ingestInCache(payload);
|
|
21644
21688
|
callback(payload.videoStreamings[0]);
|
|
21645
21689
|
};
|
|
21646
|
-
return createEventSubscriber(client, 'stream/
|
|
21690
|
+
return createEventSubscriber(client, 'stream/onStreamStropped', 'v3.video-streaming.didStop', filter);
|
|
21647
21691
|
};
|
|
21648
21692
|
|
|
21649
21693
|
/**
|
|
@@ -21667,7 +21711,7 @@ const onStreamRecorded = (callback) => {
|
|
|
21667
21711
|
ingestInCache(payload);
|
|
21668
21712
|
callback(payload.videoStreamings[0]);
|
|
21669
21713
|
};
|
|
21670
|
-
return createEventSubscriber(client, 'stream/onStreamRecorded', 'video-streaming.didRecord', filter);
|
|
21714
|
+
return createEventSubscriber(client, 'stream/onStreamRecorded', 'v3.video-streaming.didRecord', filter);
|
|
21671
21715
|
};
|
|
21672
21716
|
|
|
21673
21717
|
/* eslint-disable no-use-before-define */
|