@amityco/ts-sdk 7.5.4-2d34fd5f.0 → 7.5.4-54f750e3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/@types/domains/channel.d.ts +1 -0
  2. package/dist/@types/domains/channel.d.ts.map +1 -1
  3. package/dist/@types/domains/content.d.ts +2 -8
  4. package/dist/@types/domains/content.d.ts.map +1 -1
  5. package/dist/@types/domains/feed.d.ts +1 -2
  6. package/dist/@types/domains/feed.d.ts.map +1 -1
  7. package/dist/@types/domains/file.d.ts +1 -3
  8. package/dist/@types/domains/file.d.ts.map +1 -1
  9. package/dist/@types/domains/group.d.ts +2 -0
  10. package/dist/@types/domains/group.d.ts.map +1 -1
  11. package/dist/@types/domains/invitation.d.ts +4 -2
  12. package/dist/@types/domains/invitation.d.ts.map +1 -1
  13. package/dist/@types/domains/post.d.ts +0 -3
  14. package/dist/@types/domains/post.d.ts.map +1 -1
  15. package/dist/channelRepository/channelMembership/observers/getMembers/ChannelMemberLiveCollectionController.d.ts.map +1 -1
  16. package/dist/channelRepository/channelMembership/observers/searchMembers/SearchChannelMemberLiveCollectionController.d.ts.map +1 -1
  17. package/dist/channelRepository/channelMembership/observers/searchMembers/SearchChannelMemberQueryStreamController.d.ts +2 -2
  18. package/dist/channelRepository/channelMembership/observers/searchMembers/SearchChannelMemberQueryStreamController.d.ts.map +1 -1
  19. package/dist/client/api/index.d.ts +1 -0
  20. package/dist/client/api/index.d.ts.map +1 -1
  21. package/dist/client/api/resumeSession.d.ts +32 -0
  22. package/dist/client/api/resumeSession.d.ts.map +1 -0
  23. package/dist/client/api/tests/resumeSession.test.d.ts +2 -0
  24. package/dist/client/api/tests/resumeSession.test.d.ts.map +1 -0
  25. package/dist/feedRepository/api/getCustomRankingGlobalFeed.d.ts +1 -1
  26. package/dist/feedRepository/api/getCustomRankingGlobalFeed.d.ts.map +1 -1
  27. package/dist/feedRepository/api/queryGlobalFeed.d.ts.map +1 -1
  28. package/dist/fileRepository/api/index.d.ts +0 -1
  29. package/dist/fileRepository/api/index.d.ts.map +1 -1
  30. package/dist/index.cjs.js +223 -129
  31. package/dist/index.esm.js +222 -129
  32. package/dist/index.umd.js +4 -4
  33. package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts +1 -1
  34. package/dist/postRepository/api/index.d.ts +0 -1
  35. package/dist/postRepository/api/index.d.ts.map +1 -1
  36. package/dist/utils/linkedObject/channelLinkedObject.d.ts.map +1 -1
  37. package/dist/utils/linkedObject/channelMemberLinkedObject.d.ts +2 -0
  38. package/dist/utils/linkedObject/channelMemberLinkedObject.d.ts.map +1 -0
  39. package/dist/utils/linkedObject/index.d.ts +1 -0
  40. package/dist/utils/linkedObject/index.d.ts.map +1 -1
  41. package/dist/utils/linkedObject/invitationLinkedObject.d.ts.map +1 -1
  42. package/dist/utils/linkedObject/postLinkedObject.d.ts.map +1 -1
  43. package/dist/utils/postTypePredicate.d.ts +0 -1
  44. package/dist/utils/postTypePredicate.d.ts.map +1 -1
  45. package/dist/utils/tests/dummy/comment.d.ts +1 -1
  46. package/dist/utils/tests/dummy/community.d.ts +2 -0
  47. package/dist/utils/tests/dummy/community.d.ts.map +1 -1
  48. package/package.json +2 -1
  49. package/src/@types/domains/channel.ts +1 -0
  50. package/src/@types/domains/content.ts +0 -10
  51. package/src/@types/domains/feed.ts +1 -2
  52. package/src/@types/domains/file.ts +0 -5
  53. package/src/@types/domains/group.ts +2 -0
  54. package/src/@types/domains/invitation.ts +8 -3
  55. package/src/@types/domains/post.ts +0 -4
  56. package/src/channelRepository/channelMembership/observers/getMembers/ChannelMemberLiveCollectionController.ts +3 -1
  57. package/src/channelRepository/channelMembership/observers/searchMembers/SearchChannelMemberLiveCollectionController.ts +2 -1
  58. package/src/channelRepository/channelMembership/observers/searchMembers/SearchChannelMemberQueryStreamController.ts +2 -2
  59. package/src/client/api/index.ts +1 -0
  60. package/src/client/api/resumeSession.ts +282 -0
  61. package/src/client/api/tests/resumeSession.test.ts +173 -0
  62. package/src/feedRepository/api/getCustomRankingGlobalFeed.ts +1 -1
  63. package/src/feedRepository/api/queryGlobalFeed.ts +1 -3
  64. package/src/fileRepository/api/index.ts +0 -1
  65. package/src/postRepository/api/index.ts +0 -2
  66. package/src/postRepository/api/queryPosts.ts +1 -1
  67. package/src/postRepository/observers/getPosts/PostPaginationController.ts +1 -1
  68. package/src/utils/linkedObject/channelLinkedObject.ts +19 -0
  69. package/src/utils/linkedObject/channelMemberLinkedObject.ts +20 -0
  70. package/src/utils/linkedObject/index.ts +2 -0
  71. package/src/utils/linkedObject/invitationLinkedObject.ts +4 -2
  72. package/src/utils/linkedObject/postLinkedObject.ts +1 -12
  73. package/src/utils/postTypePredicate.ts +0 -10
  74. package/dist/fileRepository/api/uploadClip.d.ts +0 -17
  75. package/dist/fileRepository/api/uploadClip.d.ts.map +0 -1
  76. package/dist/postRepository/api/createClipPost.d.ts +0 -32
  77. package/dist/postRepository/api/createClipPost.d.ts.map +0 -1
  78. package/src/fileRepository/api/uploadClip.ts +0 -71
  79. package/src/postRepository/api/createClipPost.ts +0 -62
package/dist/index.cjs.js CHANGED
@@ -10,6 +10,7 @@ var HttpAgent = require('agentkeepalive');
10
10
  var io = require('socket.io-client');
11
11
  var uuid$1 = require('react-native-uuid');
12
12
  var hash = require('object-hash');
13
+ var jwtDecode = require('jwt-decode');
13
14
  var Hls = require('hls.js');
14
15
 
15
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -21,6 +22,7 @@ var HttpAgent__default = /*#__PURE__*/_interopDefaultLegacy(HttpAgent);
21
22
  var io__default = /*#__PURE__*/_interopDefaultLegacy(io);
22
23
  var uuid__default = /*#__PURE__*/_interopDefaultLegacy(uuid$1);
23
24
  var hash__default = /*#__PURE__*/_interopDefaultLegacy(hash);
25
+ var jwtDecode__default = /*#__PURE__*/_interopDefaultLegacy(jwtDecode);
24
26
  var Hls__default = /*#__PURE__*/_interopDefaultLegacy(Hls);
25
27
 
26
28
  exports.MembershipAcceptanceTypeEnum = void 0;
@@ -33,7 +35,6 @@ const FileType = Object.freeze({
33
35
  FILE: 'file',
34
36
  IMAGE: 'image',
35
37
  VIDEO: 'video',
36
- CLIP: 'clip',
37
38
  });
38
39
  const VideoResolution = Object.freeze({
39
40
  '1080P': '1080p',
@@ -117,7 +118,6 @@ const PostContentType = Object.freeze({
117
118
  VIDEO: 'video',
118
119
  LIVESTREAM: 'liveStream',
119
120
  POLL: 'poll',
120
- CLIP: 'clip',
121
121
  });
122
122
 
123
123
  exports.InvitationTypeEnum = void 0;
@@ -6693,13 +6693,6 @@ function isAmityVideoPost(post) {
6693
6693
  'videoFileId' in post.data &&
6694
6694
  'thumbnailFileId' in post.data &&
6695
6695
  post.dataType === 'video');
6696
- }
6697
- function isAmityClipPost(post) {
6698
- return !!(post.data &&
6699
- typeof post.data !== 'string' &&
6700
- 'fileId' in post.data &&
6701
- 'thumbnailFileId' in post.data &&
6702
- post.dataType === 'clip');
6703
6696
  }
6704
6697
 
6705
6698
  const postLinkedObject = (post) => {
@@ -6754,12 +6747,6 @@ const postLinkedObject = (post) => {
6754
6747
  return isAmityFilePost(post)
6755
6748
  ? (_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data
6756
6749
  : undefined;
6757
- },
6758
- getClipInfo() {
6759
- var _a, _b;
6760
- return isAmityClipPost(post)
6761
- ? (_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data
6762
- : undefined;
6763
6750
  } });
6764
6751
  };
6765
6752
 
@@ -7309,9 +7296,35 @@ const markAsRead = async (channelId) => {
7309
7296
  return true;
7310
7297
  };
7311
7298
 
7299
+ const channelMemberLinkedObject = (channelMember) => {
7300
+ const getUser = () => {
7301
+ var _a;
7302
+ const cacheKey = ['user', 'get', channelMember.userId];
7303
+ const internalUser = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
7304
+ return internalUser ? userLinkedObject(internalUser) : undefined;
7305
+ };
7306
+ return Object.assign(Object.assign({}, channelMember), { get user() {
7307
+ return getUser();
7308
+ } });
7309
+ };
7310
+
7312
7311
  const channelLinkedObject = (channel) => {
7312
+ var _a;
7313
+ let previewMembers = [];
7314
+ if (channel.type === 'conversation') {
7315
+ const channelUsers = queryCache(['channelUsers', 'get']);
7316
+ if (channelUsers && (channelUsers === null || channelUsers === void 0 ? void 0 : channelUsers.length) > 0) {
7317
+ previewMembers = ((_a = channelUsers === null || channelUsers === void 0 ? void 0 : channelUsers.filter(({ data }) => data.channelId === channel.channelId)) !== null && _a !== void 0 ? _a : [])
7318
+ // sort in ascending order by userInternalId
7319
+ .sort((a, b) => a.data.userInternalId.localeCompare(b.data.userInternalId))
7320
+ // Select only first 4 members
7321
+ .slice(0, 4)
7322
+ .map(({ data }) => channelMemberLinkedObject(data));
7323
+ }
7324
+ }
7313
7325
  return shallowClone(channel, {
7314
7326
  markAsRead: () => markAsRead(channel.channelInternalId),
7327
+ previewMembers,
7315
7328
  });
7316
7329
  };
7317
7330
 
@@ -8280,9 +8293,10 @@ const invitationLinkedObject = (invitation) => {
8280
8293
  'get',
8281
8294
  invitation.targetId,
8282
8295
  ]);
8283
- if (cacheData === null || cacheData === void 0 ? void 0 : cacheData.data)
8284
- return cacheData.data;
8285
- return undefined;
8296
+ return {
8297
+ community: cacheData === null || cacheData === void 0 ? void 0 : cacheData.data,
8298
+ communityId: invitation.communityId,
8299
+ };
8286
8300
  }
8287
8301
  return undefined;
8288
8302
  }, accept: async () => {
@@ -8634,6 +8648,7 @@ const LinkedObject = {
8634
8648
  community: communityLinkedObject,
8635
8649
  invitation: invitationLinkedObject,
8636
8650
  joinRequest: joinRequestLinkedObject,
8651
+ channelMember: channelMemberLinkedObject,
8637
8652
  };
8638
8653
 
8639
8654
  const constructChannelObject = (channel) => {
@@ -9916,8 +9931,8 @@ const removeChannelMarkerCache = (channel) => {
9916
9931
  * than the one already connected, in which case the existing subscriptions need
9917
9932
  * to be cleared
9918
9933
  */
9919
- let subscriptions = [];
9920
- async function runMqtt() {
9934
+ let subscriptions$1 = [];
9935
+ async function runMqtt$1() {
9921
9936
  await modifyMqttConnection();
9922
9937
  }
9923
9938
  /* begin_public_function
@@ -9952,8 +9967,8 @@ const login = async (params, sessionHandler, config) => {
9952
9967
  if (client.userId && client.userId !== params.userId) {
9953
9968
  await logout();
9954
9969
  // Remove subscription to ban and delete
9955
- subscriptions.forEach(fn => fn());
9956
- subscriptions = [];
9970
+ subscriptions$1.forEach(fn => fn());
9971
+ subscriptions$1 = [];
9957
9972
  }
9958
9973
  // default values
9959
9974
  const defaultDeviceId = await getDeviceId();
@@ -9999,40 +10014,40 @@ const login = async (params, sessionHandler, config) => {
9999
10014
  throw error;
10000
10015
  }
10001
10016
  if ((config === null || config === void 0 ? void 0 : config.disableRTE) !== true) {
10002
- runMqtt();
10017
+ runMqtt$1();
10003
10018
  }
10004
10019
  await initializeMessagePreviewSetting();
10005
- if (subscriptions.length === 0) {
10006
- subscriptions.push(
10020
+ if (subscriptions$1.length === 0) {
10021
+ subscriptions$1.push(
10007
10022
  // GLOBAL_BAN
10008
10023
  onClientBanned((_) => {
10009
10024
  terminateClient("globalBan" /* Amity.TokenTerminationReason.GLOBAL_BAN */);
10010
- subscriptions.forEach(fn => fn());
10025
+ subscriptions$1.forEach(fn => fn());
10011
10026
  unsubWatcher();
10012
10027
  }), onTokenTerminated(_ => {
10013
10028
  terminateClient();
10014
- subscriptions.forEach(fn => fn());
10029
+ subscriptions$1.forEach(fn => fn());
10015
10030
  unsubWatcher();
10016
10031
  }), onUserDeleted$2((user) => {
10017
10032
  if (user.userId === client.userId) {
10018
10033
  terminateClient("userDeleted" /* Amity.TokenTerminationReason.USER_DELETED */);
10019
- subscriptions.forEach(fn => fn());
10034
+ subscriptions$1.forEach(fn => fn());
10020
10035
  unsubWatcher();
10021
10036
  }
10022
10037
  }), onTokenExpired(state => {
10023
10038
  SessionWatcher$1.getInstance().setSessionState(state);
10024
10039
  logout();
10025
- subscriptions.forEach(fn => fn());
10040
+ subscriptions$1.forEach(fn => fn());
10026
10041
  }),
10027
10042
  // NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
10028
10043
  // the channel because currently backend can't handle this, so every time a user is banned from
10029
10044
  // a channel or the channel is deleted the channel's unread count will not be reset to zero
10030
10045
  onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler());
10031
10046
  if (client.useLegacyUnreadCount) {
10032
- subscriptions.push(readReceiptSyncEngineOnLoginHandler());
10047
+ subscriptions$1.push(readReceiptSyncEngineOnLoginHandler());
10033
10048
  }
10034
10049
  else
10035
- subscriptions.push(legacyReadReceiptSyncEngineOnLoginHandler());
10050
+ subscriptions$1.push(legacyReadReceiptSyncEngineOnLoginHandler());
10036
10051
  }
10037
10052
  return true;
10038
10053
  };
@@ -10957,6 +10972,176 @@ const secureLogout = async () => {
10957
10972
  };
10958
10973
  /* end_public_function */
10959
10974
 
10975
+ /*
10976
+ * declared earlier to accomodate case when logging in with a different user
10977
+ * than the one already connected, in which case the existing subscriptions need
10978
+ * to be cleared
10979
+ */
10980
+ let subscriptions = [];
10981
+ async function runMqtt() {
10982
+ await modifyMqttConnection();
10983
+ }
10984
+ const isSameUserId = (token) => {
10985
+ var _a;
10986
+ const client = getActiveClient();
10987
+ const decoded = jwtDecode__default["default"](token);
10988
+ return ((_a = decoded === null || decoded === void 0 ? void 0 : decoded.user) === null || _a === void 0 ? void 0 : _a.publicUserId) === client.userId;
10989
+ };
10990
+ const validateAccessToken = async ({ token, userId }) => {
10991
+ const client = getActiveClient();
10992
+ // begin establishing session
10993
+ setSessionState("establishing" /* Amity.SessionStates.ESTABLISHING */);
10994
+ const { data: { users }, } = await client.http.get(`/api/v3/users/${userId}`, {
10995
+ headers: {
10996
+ Authorization: `Bearer ${token.accessToken}`,
10997
+ },
10998
+ });
10999
+ const user = users.find((u) => u.userId === userId);
11000
+ client.http.defaults.headers.common.Authorization = `Bearer ${token.accessToken}`;
11001
+ client.http.defaults.metadata = {
11002
+ tokenExpiry: token.expiresAt,
11003
+ isGlobalBanned: false,
11004
+ isUserDeleted: false,
11005
+ };
11006
+ client.upload.defaults.headers.common.Authorization = `Bearer ${token.accessToken}`;
11007
+ client.upload.defaults.metadata = {
11008
+ tokenExpiry: token.expiresAt,
11009
+ isGlobalBanned: false,
11010
+ isUserDeleted: false,
11011
+ };
11012
+ // manually setup the token for ws transport
11013
+ if (client.ws)
11014
+ client.ws.io.opts.query = { token: token.accessToken };
11015
+ client.token = token;
11016
+ setSessionState("established" /* Amity.SessionStates.ESTABLISHED */);
11017
+ return user;
11018
+ };
11019
+ /* begin_public_function
11020
+ id: client.resumeSession
11021
+ */
11022
+ /**
11023
+ * ```js
11024
+ * import { resumeSession } from '@amityco/ts-sdk/client/api'
11025
+ * const success = await resumeSession({
11026
+ * userId: 'XYZ123456789',
11027
+ * token: { accessToken: 'abc123', issuedAt: '2023-01-01T00:00:00Z', expiresAt: '2023-01-02T00:00:00Z' }
11028
+ * })
11029
+ * ```
11030
+ *
11031
+ * Connects an {@link Amity.Client} instance to ASC servers using an existing access token
11032
+ *
11033
+ * @param params the connect parameters
11034
+ * @param params.userId the user ID for the current session
11035
+ * @param params.token the existing access token with its metadata
11036
+ * @param sessionHandler the session handler for token renewal
11037
+ * @param config optional configuration
11038
+ * @returns a success boolean if connected
11039
+ *
11040
+ * @category Client API
11041
+ * @async
11042
+ */
11043
+ const resumeSession = async (params, sessionHandler, config) => {
11044
+ var _a;
11045
+ const client = getActiveClient();
11046
+ let unsubWatcher;
11047
+ client.log('client/api/resumeSession', Object.assign({ apiKey: client.apiKey, sessionState: client.sessionState }, params));
11048
+ // Handle existing connected user
11049
+ if (client.userId) {
11050
+ if (client.userId === params.userId && isSameUserId(params.token.accessToken)) {
11051
+ // Clear connections and listeners but preserve cache
11052
+ if (client.mqtt && client.mqtt.connected) {
11053
+ client.mqtt.disconnect();
11054
+ }
11055
+ if (client.ws && client.ws.connected) {
11056
+ client.ws.disconnect();
11057
+ }
11058
+ // Clear existing subscriptions
11059
+ subscriptions.forEach(fn => fn());
11060
+ subscriptions = [];
11061
+ }
11062
+ else {
11063
+ // Different user - do full logout
11064
+ await logout();
11065
+ // Remove subscription to ban and delete
11066
+ subscriptions.forEach(fn => fn());
11067
+ subscriptions = [];
11068
+ }
11069
+ }
11070
+ try {
11071
+ const user = await validateAccessToken(params);
11072
+ if (user == null) {
11073
+ throw new ASCError(`${params.userId} has not been found`, 800000 /* Amity.ClientError.UNKNOWN_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
11074
+ }
11075
+ if (user.isDeleted) {
11076
+ terminateClient("userDeleted" /* Amity.TokenTerminationReason.USER_DELETED */);
11077
+ return false;
11078
+ }
11079
+ if (user.isGlobalBanned) {
11080
+ terminateClient("globalBan" /* Amity.TokenTerminationReason.GLOBAL_BAN */);
11081
+ return false;
11082
+ }
11083
+ // FIXME: events are duplicated if connectClient is called few times without disconnectClient
11084
+ // wire websocket events to our event emitter
11085
+ proxyWebsocketEvents(client.ws, client.emitter);
11086
+ (_a = client.ws) === null || _a === void 0 ? void 0 : _a.open();
11087
+ client.userId = user.userId;
11088
+ client.sessionHandler = sessionHandler;
11089
+ /*
11090
+ * Cannot push to subscriptions as watcher needs to continue working even if
11091
+ * token expires
11092
+ */
11093
+ unsubWatcher = client.accessTokenExpiryWatcher(sessionHandler);
11094
+ setActiveUser(user);
11095
+ }
11096
+ catch (error) {
11097
+ /*
11098
+ * if getting token failed session state reverts to initial state when app
11099
+ * is first launched
11100
+ */
11101
+ SessionWatcher$1.getInstance().setSessionState("notLoggedIn" /* Amity.SessionStates.NOT_LOGGED_IN */);
11102
+ // pass error down tree so the calling function handle it
11103
+ throw error;
11104
+ }
11105
+ if ((config === null || config === void 0 ? void 0 : config.disableRTE) !== true) {
11106
+ runMqtt();
11107
+ }
11108
+ await initializeMessagePreviewSetting();
11109
+ if (subscriptions.length === 0) {
11110
+ subscriptions.push(
11111
+ // GLOBAL_BAN
11112
+ onClientBanned((_) => {
11113
+ terminateClient("globalBan" /* Amity.TokenTerminationReason.GLOBAL_BAN */);
11114
+ subscriptions.forEach(fn => fn());
11115
+ unsubWatcher();
11116
+ }), onTokenTerminated(_ => {
11117
+ terminateClient();
11118
+ subscriptions.forEach(fn => fn());
11119
+ unsubWatcher();
11120
+ }), onUserDeleted$2((user) => {
11121
+ if (user.userId === client.userId) {
11122
+ terminateClient("userDeleted" /* Amity.TokenTerminationReason.USER_DELETED */);
11123
+ subscriptions.forEach(fn => fn());
11124
+ unsubWatcher();
11125
+ }
11126
+ }), onTokenExpired(state => {
11127
+ SessionWatcher$1.getInstance().setSessionState(state);
11128
+ logout();
11129
+ subscriptions.forEach(fn => fn());
11130
+ }),
11131
+ // NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
11132
+ // the channel because currently backend can't handle this, so every time a user is banned from
11133
+ // a channel or the channel is deleted the channel's unread count will not be reset to zero
11134
+ onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler());
11135
+ if (client.useLegacyUnreadCount) {
11136
+ subscriptions.push(readReceiptSyncEngineOnLoginHandler());
11137
+ }
11138
+ else
11139
+ subscriptions.push(legacyReadReceiptSyncEngineOnLoginHandler());
11140
+ }
11141
+ return true;
11142
+ };
11143
+ /* end_public_function */
11144
+
10960
11145
  /**
10961
11146
  * ```js
10962
11147
  * import { isConnected } from '@amityco/ts-sdk'
@@ -11362,6 +11547,7 @@ var index$n = /*#__PURE__*/Object.freeze({
11362
11547
  login: login,
11363
11548
  logout: logout,
11364
11549
  secureLogout: secureLogout,
11550
+ resumeSession: resumeSession,
11365
11551
  isConnected: isConnected,
11366
11552
  getFeedSettings: getFeedSettings,
11367
11553
  renewal: renewal,
@@ -13730,57 +13916,6 @@ const updateAltText = async (fileId, altText) => {
13730
13916
  };
13731
13917
  /* end_public_function */
13732
13918
 
13733
- /* begin_public_function
13734
- id: file.upload.clip
13735
- */
13736
- /**
13737
- * ```js
13738
- * import { FileRepository } from '@amityco/ts-sdk'
13739
- * const created = await FileRepository.uploadClip(formData)
13740
- * ```
13741
- *
13742
- * Creates an {@link Amity.File}
13743
- *
13744
- * @param formData The data necessary to create a new {@link Amity.File}
13745
- * @param onProgress The callback to track the upload progress
13746
- * @returns The newly created {@link Amity.File}
13747
- *
13748
- * @category File API
13749
- * @async
13750
- */
13751
- const uploadClip = async (formData, feedType, onProgress) => {
13752
- const client = getActiveClient();
13753
- client.log('file/uploadClip', formData);
13754
- const file = formData.get('files');
13755
- if (!file)
13756
- throw new Error('The formData object must have a `files` key.');
13757
- const accessType = GlobalFileAccessType$1.getInstance().getFileAccessType();
13758
- formData.append('accessType', accessType);
13759
- formData.append('preferredFilename', file.name);
13760
- if (feedType) {
13761
- formData.append('feedType', feedType);
13762
- }
13763
- const headers = 'getHeaders' in formData
13764
- ? formData.getHeaders()
13765
- : { 'content-type': 'multipart/form-data' };
13766
- const { data } = await client.upload.post('/api/v4/clips', formData, {
13767
- headers,
13768
- onUploadProgress({ loaded, total = 100 }) {
13769
- onProgress && onProgress(Math.round((loaded * 100) / total));
13770
- },
13771
- });
13772
- // API-FIX: payload should be serialized properly
13773
- // const { files } = data
13774
- const cachedAt = client.cache && Date.now();
13775
- if (client.cache)
13776
- ingestInCache({ files: data }, { cachedAt });
13777
- return {
13778
- data,
13779
- cachedAt,
13780
- };
13781
- };
13782
- /* end_public_function */
13783
-
13784
13919
  var index$k = /*#__PURE__*/Object.freeze({
13785
13920
  __proto__: null,
13786
13921
  getFile: getFile,
@@ -13789,8 +13924,7 @@ var index$k = /*#__PURE__*/Object.freeze({
13789
13924
  fileUrlWithSize: fileUrlWithSize,
13790
13925
  uploadVideo: uploadVideo,
13791
13926
  uploadImage: uploadImage,
13792
- updateAltText: updateAltText,
13793
- uploadClip: uploadClip
13927
+ updateAltText: updateAltText
13794
13928
  });
13795
13929
 
13796
13930
  /**
@@ -19108,7 +19242,8 @@ class ChannelMemberLiveCollectionController extends LiveCollectionController {
19108
19242
  const data = this.applyFilter((_b = collection.data
19109
19243
  .map(id => pullFromCache(['channelUsers', 'get', id]))
19110
19244
  .filter(Boolean)
19111
- .map(({ data }) => data)) !== null && _b !== void 0 ? _b : []);
19245
+ .map(({ data }) => data)
19246
+ .map(LinkedObject.channelMember)) !== null && _b !== void 0 ? _b : []);
19112
19247
  if (!this.shouldNotify(data) && origin === 'event')
19113
19248
  return;
19114
19249
  this.callback({
@@ -22390,14 +22525,14 @@ var index$a = /*#__PURE__*/Object.freeze({
22390
22525
  const queryGlobalFeed = async (query) => {
22391
22526
  const client = getActiveClient();
22392
22527
  client.log('feed/queryGlobalFeed', query);
22393
- const _a = query !== null && query !== void 0 ? query : {}, { queryToken, dataTypes, resolveParent } = _a, params = __rest(_a, ["queryToken", "dataTypes", "resolveParent"]);
22528
+ const _a = query !== null && query !== void 0 ? query : {}, { queryToken } = _a, params = __rest(_a, ["queryToken"]);
22394
22529
  const options = (() => {
22395
22530
  if (queryToken)
22396
22531
  return { token: queryToken };
22397
22532
  return undefined;
22398
22533
  })();
22399
22534
  const { data: queryPayload } = await client.http.get(`/api/v4/me/global-feeds`, {
22400
- params: Object.assign(Object.assign({}, params), { dataTypes, resolveParent: resolveParent !== null && resolveParent !== void 0 ? resolveParent : true, options }),
22535
+ params: Object.assign(Object.assign({}, params), { options }),
22401
22536
  });
22402
22537
  const { paging } = queryPayload, payload = __rest(queryPayload, ["paging"]);
22403
22538
  const data = prepareMembershipPayload(payload, 'communityUsers');
@@ -22983,46 +23118,6 @@ const isPostFlaggedByMe = async (postId) => {
22983
23118
  };
22984
23119
  /* end_public_function */
22985
23120
 
22986
- /* begin_public_function
22987
- id: post.create.clip_post
22988
- */
22989
- /**
22990
- * ```js
22991
- * import { PostRepository } from '@amityco/ts-sdk'
22992
- * const created = await PostRepository.createClipPost({
22993
- * targetType: 'user',
22994
- * targetId: 'foobar',
22995
- * dataType: 'clip',
22996
- * data: { text: 'hello world' },
22997
- * attachments: [{ type: 'clip', fileId: 'fileId123', displayMode: 'fill', isMuted: false }]
22998
- * }))
22999
- * ```
23000
- *
23001
- * Creates an {@link Amity.Post}
23002
- *
23003
- * @param bundle The data necessary to create a new {@link Amity.Post}
23004
- * @returns The newly created {@link Amity.Post}
23005
- *
23006
- * @category Post API
23007
- * @async
23008
- */
23009
- const createClipPost = async (bundle) => {
23010
- const client = getActiveClient();
23011
- client.log('post/createPost', bundle);
23012
- const { data: payload } = await client.http.post('/api/v4/posts', bundle);
23013
- fireEvent('post.created', payload);
23014
- const data = prepareMembershipPayload(payload, 'communityUsers');
23015
- const cachedAt = client.cache && Date.now();
23016
- if (client.cache)
23017
- ingestInCache(data, { cachedAt });
23018
- const { posts } = data;
23019
- return {
23020
- data: LinkedObject.post(posts[0]),
23021
- cachedAt,
23022
- };
23023
- };
23024
- /* end_public_function */
23025
-
23026
23121
  /* begin_public_function
23027
23122
  id: comment.get_by_ids
23028
23123
  */
@@ -24111,7 +24206,7 @@ class PostPaginationController extends PaginationController {
24111
24206
  type: params.sortBy || queryParams.limit ? 'pagination' : undefined,
24112
24207
  };
24113
24208
  const options = token ? Object.assign(Object.assign({}, baseOptions), { token }) : Object.assign(Object.assign({}, baseOptions), { limit });
24114
- const { data: queryResponse } = await this.http.get(`/api/v5/posts`, {
24209
+ const { data: queryResponse } = await this.http.get(`/api/v4/posts`, {
24115
24210
  params: Object.assign(Object.assign({}, params), { isDeleted: inferIsDeleted(includeDeleted),
24116
24211
  /*
24117
24212
  * when creating post like image, file, video BE will create 2 posts
@@ -24923,7 +25018,6 @@ var index$7 = /*#__PURE__*/Object.freeze({
24923
25018
  flagPost: flagPost,
24924
25019
  unflagPost: unflagPost,
24925
25020
  isPostFlaggedByMe: isPostFlaggedByMe,
24926
- createClipPost: createClipPost,
24927
25021
  onPostCreated: onPostCreated,
24928
25022
  onPostUpdated: onPostUpdated,
24929
25023
  onPostDeleted: onPostDeleted,