@amityco/ts-sdk 7.28.1-ff89ba3b.0 → 7.29.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 (98) hide show
  1. package/dist/@types/core/errors.d.ts +0 -2
  2. package/dist/@types/core/errors.d.ts.map +1 -1
  3. package/dist/@types/domains/channel.d.ts +1 -13
  4. package/dist/@types/domains/channel.d.ts.map +1 -1
  5. package/dist/@types/domains/content.d.ts +0 -11
  6. package/dist/@types/domains/content.d.ts.map +1 -1
  7. package/dist/@types/domains/user.d.ts +0 -31
  8. package/dist/@types/domains/user.d.ts.map +1 -1
  9. package/dist/channelRepository/observers/getChannels/ChannelLiveCollectionController.d.ts.map +1 -1
  10. package/dist/channelRepository/observers/searchChannels/SearchChannelLiveCollectionController.d.ts.map +1 -1
  11. package/dist/client/api/resumeSession.d.ts.map +1 -1
  12. package/dist/client/api/setupLoginSubscriptions.d.ts.map +1 -1
  13. package/dist/commentRepository/api/flagComment.d.ts +5 -72
  14. package/dist/commentRepository/api/flagComment.d.ts.map +1 -1
  15. package/dist/commentRepository/internalApi/index.d.ts +0 -2
  16. package/dist/commentRepository/internalApi/index.d.ts.map +1 -1
  17. package/dist/core/microtasks.d.ts.map +1 -1
  18. package/dist/core/query/sorting.d.ts +0 -19
  19. package/dist/core/query/sorting.d.ts.map +1 -1
  20. package/dist/index.cjs.js +77 -649
  21. package/dist/index.esm.js +78 -648
  22. package/dist/index.umd.js +2 -2
  23. package/dist/messagePreview/utils/getChannelMessagePreviewWithUser.d.ts +0 -1
  24. package/dist/messagePreview/utils/getChannelMessagePreviewWithUser.d.ts.map +1 -1
  25. package/dist/messageRepository/api/createMessage.d.ts.map +1 -1
  26. package/dist/messageRepository/api/flagMessage.d.ts +6 -73
  27. package/dist/messageRepository/api/flagMessage.d.ts.map +1 -1
  28. package/dist/postRepository/api/flagPost.d.ts +6 -73
  29. package/dist/postRepository/api/flagPost.d.ts.map +1 -1
  30. package/dist/postRepository/internalApi/index.d.ts +0 -2
  31. package/dist/postRepository/internalApi/index.d.ts.map +1 -1
  32. package/dist/userRepository/api/flagUser.d.ts +9 -50
  33. package/dist/userRepository/api/flagUser.d.ts.map +1 -1
  34. package/dist/userRepository/api/index.d.ts +0 -2
  35. package/dist/userRepository/api/index.d.ts.map +1 -1
  36. package/dist/utils/tests/dummy/channel.d.ts +0 -4
  37. package/dist/utils/tests/dummy/channel.d.ts.map +1 -1
  38. package/package.json +1 -1
  39. package/dist/channelRepository/observers/tests/integrations/getChannelsSortByLastMessage.integration.test.d.ts +0 -2
  40. package/dist/channelRepository/observers/tests/integrations/getChannelsSortByLastMessage.integration.test.d.ts.map +0 -1
  41. package/dist/channelRepository/utils/channelActivityOnLoginHandler.d.ts +0 -16
  42. package/dist/channelRepository/utils/channelActivityOnLoginHandler.d.ts.map +0 -1
  43. package/dist/channelRepository/utils/tests/integrations/channelActivity.integration.test.d.ts +0 -2
  44. package/dist/channelRepository/utils/tests/integrations/channelActivity.integration.test.d.ts.map +0 -1
  45. package/dist/channelRepository/utils/tests/updateChannelActivityTimestamps.test.d.ts +0 -2
  46. package/dist/channelRepository/utils/tests/updateChannelActivityTimestamps.test.d.ts.map +0 -1
  47. package/dist/channelRepository/utils/updateChannelActivityTimestamps.d.ts +0 -34
  48. package/dist/channelRepository/utils/updateChannelActivityTimestamps.d.ts.map +0 -1
  49. package/dist/commentRepository/internalApi/flagCommentWithOptions.d.ts +0 -13
  50. package/dist/commentRepository/internalApi/flagCommentWithOptions.d.ts.map +0 -1
  51. package/dist/commentRepository/internalApi/flagCommentWithReasonString.d.ts +0 -17
  52. package/dist/commentRepository/internalApi/flagCommentWithReasonString.d.ts.map +0 -1
  53. package/dist/commentRepository/internalApi/tests/integration/flagCommentWithOptions.integration.test.d.ts +0 -2
  54. package/dist/commentRepository/internalApi/tests/integration/flagCommentWithOptions.integration.test.d.ts.map +0 -1
  55. package/dist/commentRepository/internalApi/tests/integration/flagCommentWithReasonString.integration.test.d.ts +0 -2
  56. package/dist/commentRepository/internalApi/tests/integration/flagCommentWithReasonString.integration.test.d.ts.map +0 -1
  57. package/dist/core/query/tests/sorting.test.d.ts +0 -2
  58. package/dist/core/query/tests/sorting.test.d.ts.map +0 -1
  59. package/dist/core/tests/microtasks.test.d.ts +0 -2
  60. package/dist/core/tests/microtasks.test.d.ts.map +0 -1
  61. package/dist/core/transports/tests/integration/serverErrorCodes.integration.test.d.ts +0 -2
  62. package/dist/core/transports/tests/integration/serverErrorCodes.integration.test.d.ts.map +0 -1
  63. package/dist/messageRepository/api/tests/integration/flagMessage.overloads.integration.test.d.ts +0 -2
  64. package/dist/messageRepository/api/tests/integration/flagMessage.overloads.integration.test.d.ts.map +0 -1
  65. package/dist/messageRepository/internalApi/flagMessageWithOptions.d.ts +0 -13
  66. package/dist/messageRepository/internalApi/flagMessageWithOptions.d.ts.map +0 -1
  67. package/dist/messageRepository/internalApi/flagMessageWithReasonString.d.ts +0 -18
  68. package/dist/messageRepository/internalApi/flagMessageWithReasonString.d.ts.map +0 -1
  69. package/dist/messageRepository/internalApi/tests/integration/flagMessageWithOptions.integration.test.d.ts +0 -2
  70. package/dist/messageRepository/internalApi/tests/integration/flagMessageWithOptions.integration.test.d.ts.map +0 -1
  71. package/dist/messageRepository/internalApi/tests/integration/flagMessageWithReasonString.integration.test.d.ts +0 -2
  72. package/dist/messageRepository/internalApi/tests/integration/flagMessageWithReasonString.integration.test.d.ts.map +0 -1
  73. package/dist/postRepository/api/tests/integration/flagPost.overloads.integration.test.d.ts +0 -2
  74. package/dist/postRepository/api/tests/integration/flagPost.overloads.integration.test.d.ts.map +0 -1
  75. package/dist/postRepository/internalApi/flagPostWithOptions.d.ts +0 -13
  76. package/dist/postRepository/internalApi/flagPostWithOptions.d.ts.map +0 -1
  77. package/dist/postRepository/internalApi/flagPostWithReasonString.d.ts +0 -17
  78. package/dist/postRepository/internalApi/flagPostWithReasonString.d.ts.map +0 -1
  79. package/dist/postRepository/internalApi/tests/integration/flagPostWithOptions.integration.test.d.ts +0 -2
  80. package/dist/postRepository/internalApi/tests/integration/flagPostWithOptions.integration.test.d.ts.map +0 -1
  81. package/dist/postRepository/internalApi/tests/integration/flagPostWithReasonString.integration.test.d.ts +0 -2
  82. package/dist/postRepository/internalApi/tests/integration/flagPostWithReasonString.integration.test.d.ts.map +0 -1
  83. package/dist/userRepository/api/flagUserBehavior.d.ts +0 -29
  84. package/dist/userRepository/api/flagUserBehavior.d.ts.map +0 -1
  85. package/dist/userRepository/api/flagUserProfile.d.ts +0 -29
  86. package/dist/userRepository/api/flagUserProfile.d.ts.map +0 -1
  87. package/dist/userRepository/api/tests/integration/flagUser.overloads.integration.test.d.ts +0 -2
  88. package/dist/userRepository/api/tests/integration/flagUser.overloads.integration.test.d.ts.map +0 -1
  89. package/dist/userRepository/api/tests/integration/flagUserBehavior.integration.test.d.ts +0 -2
  90. package/dist/userRepository/api/tests/integration/flagUserBehavior.integration.test.d.ts.map +0 -1
  91. package/dist/userRepository/api/tests/integration/flagUserProfile.integration.test.d.ts +0 -2
  92. package/dist/userRepository/api/tests/integration/flagUserProfile.integration.test.d.ts.map +0 -1
  93. package/dist/userRepository/utils/submitUserReport.d.ts +0 -10
  94. package/dist/userRepository/utils/submitUserReport.d.ts.map +0 -1
  95. package/dist/userRepository/utils/userReport.d.ts +0 -35
  96. package/dist/userRepository/utils/userReport.d.ts.map +0 -1
  97. package/dist/utils/contentFlag.d.ts +0 -28
  98. package/dist/utils/contentFlag.d.ts.map +0 -1
package/dist/index.cjs.js CHANGED
@@ -58,18 +58,6 @@ exports.UserReportTypeEnum = void 0;
58
58
  UserReportTypeEnum["AVATAR"] = "avatarFileId";
59
59
  UserReportTypeEnum["BEHAVIOR"] = "behavior";
60
60
  })(exports.UserReportTypeEnum || (exports.UserReportTypeEnum = {}));
61
- /**
62
- * The profile field a user is reported for in `UserRepository.flagUserProfile`.
63
- * Each member is the backend `reportType` wire value. There is deliberately no
64
- * behavior member: behavior reports need a reason and go through
65
- * `UserRepository.flagUserBehavior`.
66
- */
67
- exports.UserProfileFieldEnum = void 0;
68
- (function (UserProfileFieldEnum) {
69
- UserProfileFieldEnum["DISPLAY_NAME"] = "displayName";
70
- UserProfileFieldEnum["DESCRIPTION"] = "description";
71
- UserProfileFieldEnum["AVATAR"] = "avatarFileId";
72
- })(exports.UserProfileFieldEnum || (exports.UserProfileFieldEnum = {}));
73
61
 
74
62
  const FileType = Object.freeze({
75
63
  FILE: 'file',
@@ -344,8 +332,8 @@ exports.AmityLiveViewerCountMode = void 0;
344
332
 
345
333
  function getVersion() {
346
334
  try {
347
- // the string ''v7.28.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
348
- return 'v7.28.0-cjs';
335
+ // the string ''v7.29.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
336
+ return 'v7.29.0-cjs';
349
337
  }
350
338
  catch (error) {
351
339
  return '__dev__';
@@ -846,18 +834,6 @@ class AmityModuleNotEntitledError extends ASCApiError {
846
834
  this.type = 'AmityModuleNotEntitledError';
847
835
  }
848
836
  }
849
- /**
850
- * Input sanitization related error
851
- * @category Errors
852
- */
853
- class ASCInvalidParameterError extends ASCError {
854
- /**
855
- * @param message A custom error message
856
- */
857
- constructor(message) {
858
- super(message, 800110 /* Amity.ClientError.INVALID_PARAMETERS */, "error" /* Amity.ErrorLevel.ERROR */);
859
- }
860
- }
861
837
 
862
838
  let activeClient = null;
863
839
  /**
@@ -1631,41 +1607,6 @@ const sortByLastUpdated = ({ updatedAt: a = 0 }, { updatedAt: b = 0 }) => new Da
1631
1607
  * Sorting a collection by the items with most recent activity
1632
1608
  */
1633
1609
  const sortByLastActivity = ({ lastActivity: a }, { lastActivity: b }) => new Date(b).valueOf() - new Date(a).valueOf();
1634
- /**
1635
- * Sorting a channel collection by the time of its newest message (newest first).
1636
- * Channels whose `lastMessageAt` is `null` sort last, ordered by `createdAt`
1637
- * (newest first) among themselves, matching the server's `sortBy=lastMessage`
1638
- * order so the local sort agrees with the page order.
1639
- */
1640
- const sortByLastMessage = (a, b) => {
1641
- var _a, _b;
1642
- const aAt = (_a = a.lastMessageAt) !== null && _a !== void 0 ? _a : null;
1643
- const bAt = (_b = b.lastMessageAt) !== null && _b !== void 0 ? _b : null;
1644
- if (aAt !== null && bAt !== null)
1645
- return new Date(bAt).valueOf() - new Date(aAt).valueOf();
1646
- if (aAt !== null)
1647
- return -1;
1648
- if (bAt !== null)
1649
- return 1;
1650
- return new Date(b.createdAt).valueOf() - new Date(a.createdAt).valueOf();
1651
- };
1652
- /**
1653
- * Code-point ordering of objects having a displayName, empty or missing names
1654
- * first. This is the server's `sortBy=displayName` order for channels
1655
- * (case-sensitive, uppercase before lowercase); a localized or case-insensitive
1656
- * comparison would disagree with the page order.
1657
- */
1658
- const sortByDisplayNameCodePoint = ({ displayName: a }, { displayName: b }) => {
1659
- const x = a !== null && a !== void 0 ? a : '';
1660
- const y = b !== null && b !== void 0 ? b : '';
1661
- if (x === y)
1662
- return 0;
1663
- if (!x)
1664
- return -1;
1665
- if (!y)
1666
- return 1;
1667
- return x < y ? -1 : 1;
1668
- };
1669
1610
  /**
1670
1611
  * Filter items by untilAt timestamp based on sort direction
1671
1612
  * - For 'lastCreated' (newest first): untilAt acts as lower bound, excludes items older than boundary
@@ -1750,13 +1691,8 @@ const scheduleTask = (task) => {
1750
1691
  clearTimeout(timer);
1751
1692
  tasks.push(task);
1752
1693
  timer = setTimeout(() => {
1753
- // Swap the queue out before running it. A task that schedules another task
1754
- // while the batch runs (an event handler that fires an event) must land in
1755
- // a fresh queue and its own timer, not in the array being drained and then
1756
- // discarded.
1757
- const batch = tasks;
1694
+ tasks.forEach(fn => fn());
1758
1695
  tasks = [];
1759
- batch.forEach(fn => fn());
1760
1696
  }, 0);
1761
1697
  };
1762
1698
 
@@ -8106,140 +8042,6 @@ const postCommentCountEngineOnLoginHandler = () => onSessionStateChange(state =>
8106
8042
  }
8107
8043
  });
8108
8044
 
8109
- const BOTH_FIELDS = { lastActivity: true, lastMessageAt: true };
8110
- /**
8111
- * The channel cache is keyed by `channelInternalId`, but a message names its
8112
- * channel by whichever id the producer had: the raw MQTT payload carries the
8113
- * internal id, a converted `Amity.InternalMessage` carries the public id, and
8114
- * the optimistic message carries the sub-channel's `channelId`. Try the direct
8115
- * key first, then match any of the three ids.
8116
- */
8117
- const findCachedChannel = (channelId) => {
8118
- var _a, _b, _c;
8119
- const direct = (_a = pullFromCache(['channel', 'get', channelId])) === null || _a === void 0 ? void 0 : _a.data;
8120
- if (direct)
8121
- return direct;
8122
- return (_c = (_b = queryCache(['channel', 'get'])) === null || _b === void 0 ? void 0 : _b.find(({ data }) => data.channelInternalId === channelId ||
8123
- data.channelId === channelId ||
8124
- data.channelPublicId === channelId)) === null || _c === void 0 ? void 0 : _c.data;
8125
- };
8126
- const isNewer = (stored, at) => !stored || convertDateStringToTimestamp(stored) < convertDateStringToTimestamp(at);
8127
- const isSameInstant = (stored, at) => !!stored && convertDateStringToTimestamp(stored) === convertDateStringToTimestamp(at);
8128
- /** Pushes the changed fields in one write and emits one `local.channel.updated`. */
8129
- const commit = (channel, changes) => {
8130
- if (Object.keys(changes).length === 0)
8131
- return false;
8132
- const updated = shallowClone(channel, changes);
8133
- // Write back under the key the cache actually uses (the resolver key), not
8134
- // under `channel.channelId`, which can differ from `channelInternalId`.
8135
- pushToCache(['channel', 'get', getResolver('channel')(updated)], updated);
8136
- fireEvent('local.channel.updated', {
8137
- channels: [updated],
8138
- channelUsers: [],
8139
- users: [],
8140
- files: [],
8141
- });
8142
- return true;
8143
- };
8144
- /**
8145
- * Single owner of every local write to a channel's ordering timestamps,
8146
- * `lastActivity` and `lastMessageAt` (ChannelActivityService v1).
8147
- *
8148
- * - Monotonic per field: a field moves only when `at` is newer than the stored
8149
- * value (or the stored value is `null`), so a late or replayed event never
8150
- * moves a channel down the list.
8151
- * - One write: both fields are read, compared and pushed in a single cache
8152
- * update, followed by one `local.channel.updated` event so every open channel
8153
- * collection re-sorts once.
8154
- * - Server channel payloads never go through here; they overwrite unguarded.
8155
- *
8156
- * @returns `true` when at least one field moved
8157
- * @category private
8158
- */
8159
- const updateChannelActivityTimestamps = (channelId, at, fields = BOTH_FIELDS) => {
8160
- const client = getActiveClient();
8161
- if (!client.cache || !channelId || !at)
8162
- return false;
8163
- const channel = findCachedChannel(channelId);
8164
- if (!channel)
8165
- return false;
8166
- const changes = {};
8167
- if (fields.lastActivity && isNewer(channel.lastActivity, at))
8168
- changes.lastActivity = at;
8169
- if (fields.lastMessageAt && isNewer(channel.lastMessageAt, at))
8170
- changes.lastMessageAt = at;
8171
- return commit(channel, changes);
8172
- };
8173
- /**
8174
- * Local correction for the current user's own send (ChannelActivityService v1
8175
- * REQ-009, Trigger Matrix row 1b). Once the server confirms the message, each
8176
- * field that still holds the device-clock `localAt` written at send time is
8177
- * replaced by the server's `serverAt`, even when that is older. A field a newer
8178
- * message has already moved is left alone. One write, one change notification,
8179
- * nothing when neither field still holds `localAt`.
8180
- *
8181
- * @returns `true` when at least one field was replaced
8182
- * @category private
8183
- */
8184
- const confirmOwnMessage = (channelId, localAt, serverAt) => {
8185
- const client = getActiveClient();
8186
- if (!client.cache || !channelId || !localAt || !serverAt)
8187
- return false;
8188
- if (isSameInstant(localAt, serverAt))
8189
- return false;
8190
- const channel = findCachedChannel(channelId);
8191
- if (!channel)
8192
- return false;
8193
- const changes = {};
8194
- if (isSameInstant(channel.lastActivity, localAt))
8195
- changes.lastActivity = serverAt;
8196
- if (isSameInstant(channel.lastMessageAt, localAt))
8197
- changes.lastMessageAt = serverAt;
8198
- return commit(channel, changes);
8199
- };
8200
-
8201
- /**
8202
- * Session-wide owner of the local `lastActivity` / `lastMessageAt` updates
8203
- * (ChannelActivityService v1, Web migration rows W1 – W5).
8204
- *
8205
- * Registered once per session from `setupLoginSubscriptions` and
8206
- * `resumeSession`, so the update runs whether or not a channel collection is
8207
- * open, and exactly once per message however many collections are open.
8208
- *
8209
- * It listens to the raw events rather than `onMessageCreatedMqtt`, so it does
8210
- * not duplicate that subscriber's side effects (mark-read, unread recount).
8211
- *
8212
- * @category private
8213
- */
8214
- const channelActivityOnLoginHandler = () => {
8215
- const client = getActiveClient();
8216
- const disposers = [
8217
- // Any user's new message, in any message feed of the channel. The raw
8218
- // payload's `channelId` is the channel's internal id.
8219
- createEventSubscriber(client, 'channelActivity', 'message.created', payload => {
8220
- payload.messages.forEach(message => {
8221
- updateChannelActivityTimestamps(message.channelId, message.createdAt);
8222
- });
8223
- }),
8224
- // The current user's own send fires this three times: with the optimistic
8225
- // message at send time (Syncing), on the create response (Synced), and on
8226
- // failure (Error). The device-clock time of the Syncing / Error fires was
8227
- // already applied synchronously in createMessageOptimistic, and replaying it
8228
- // here could undo the server correction made on the response
8229
- // (confirmOwnMessage). Only the server-confirmed fire goes through the guard.
8230
- createEventSubscriber(client, 'channelActivity', 'local.message.created', payload => {
8231
- payload.messages.forEach(message => {
8232
- if (message.syncState !== "synced" /* Amity.SyncState.Synced */)
8233
- return;
8234
- updateChannelActivityTimestamps(message.channelId, message.createdAt);
8235
- });
8236
- }),
8237
- ];
8238
- return () => {
8239
- disposers.forEach(fn => fn());
8240
- };
8241
- };
8242
-
8243
8045
  const EVENTS = [
8244
8046
  'disconnected',
8245
8047
  'error',
@@ -8429,7 +8231,7 @@ const setupLoginSubscriptions = (unsubWatcher) => {
8429
8231
  // NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
8430
8232
  // the channel because currently backend can't handle this, so every time a user is banned from
8431
8233
  // a channel or the channel is deleted the channel's unread count will not be reset to zero
8432
- onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler(), blockedUserSyncEngineOnLoginHandler(), blockingUserSyncEngineOnLoginHandler(), blockRealtimeOnLoginHandler(), resetAutoSubscriptionsOnLogout(), CursorController.clearOnLogout(), postCommentCountEngineOnLoginHandler(), channelActivityOnLoginHandler());
8234
+ onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler(), blockedUserSyncEngineOnLoginHandler(), blockingUserSyncEngineOnLoginHandler(), blockRealtimeOnLoginHandler(), resetAutoSubscriptionsOnLogout(), CursorController.clearOnLogout(), postCommentCountEngineOnLoginHandler());
8433
8235
  if (client.useLegacyUnreadCount) {
8434
8236
  subscriptions.push(readReceiptSyncEngineOnLoginHandler());
8435
8237
  }
@@ -9690,7 +9492,7 @@ const resumeSession = async (params, sessionHandler, config) => {
9690
9492
  // NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
9691
9493
  // the channel because currently backend can't handle this, so every time a user is banned from
9692
9494
  // a channel or the channel is deleted the channel's unread count will not be reset to zero
9693
- onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), channelActivityOnLoginHandler());
9495
+ onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler());
9694
9496
  if (client.useLegacyUnreadCount) {
9695
9497
  subscriptions$1.push(readReceiptSyncEngineOnLoginHandler());
9696
9498
  }
@@ -13649,7 +13451,7 @@ const getWatchSessionStorage = () => {
13649
13451
  return storageInstance;
13650
13452
  };
13651
13453
 
13652
- const privateKey = "MIIEpQIBAAKCAQEAwAEc/oZgYIvKSUG/C3mONYLR4ZPgAjMEX4bJ+xqqakUDRtqlNO+eZs2blQ1Ko0DBkqPExyQezvjibH5W2UZBV5RaBTlTcNVKTToMBEGesAfaEcM3qUyQHxdbFYZv6P4sb14dcwxTQ8usmaV8ooiR1Fcaso5ZWYcZ8Hb46FbQ7OoVumsBtPWwfZ4f003o5VCl6AIM6lcLv9UDLlFVYhE+PeXpRHtfWlGqxMvqC9oinlwhL6nWv6VjQXW4nhcib72dPBzfHT7k/PMKto2SxALYdb68ENiAGuJLWi3AUHSyYCJK2w7wIlWfJUAI0v26ub10IpExr6D5QuW2577jjP93iwIDAQABAoIBAFWfqXhwIIatkFY+9Z1+ZcbDQimgsmMIsUiQaX6Lk7e0cxOj6czDlxYtVtaPiNtow2pLkjNkjkCqiP7tEHnwdK9DvylZOTa2R15NJpK3WLcTqVIGhsn/FL5owfvFah6zSsmXZParZm5zY9NZE03ALZhOB9/cz0e3kf/EbpfeL2mW7MApyiUt5i09ycchroOpcWp73ipIxvgigtZyUGFmsQicWhUs28F0D7w4Qfk76yG3nqXeb+BAMhCaIaa/k/aAxhiZG/ygEQWQrcC8gfe+jyicMAQPDEVS9YuUMGsLjIjKuVLZzp2xirQnhc2i2zVNEIvG6soprPOBEMQugzrtX5ECgYEA3b7KAbBIbDl1e4ZSCWhHdHkiWVZHaopsR/LhqDDNhXjWjq3AesgV6k0j9EdziMn/HmmOso0bz99GTV3JZf4A9ztTLumJlkHbdVtlgOqSjrFLj12rH9KXTheyIhWSpUmm8+WB1xasFbqpvJaGo7F3pd2Fqj1XR4mp5BO7c/t7LJ0CgYEA3aouEzXQ9THRKYocdfY69EI1Il1t/d/RSqqd9BxEjxBgxkM13ZiYIn/R4WW/nCUrlmhxG44Aa2Gob4Ahfsui2xKTg/g/3Zk/rAxAEGkfOLGoenaJMD41fH4wUq3FRYwkvnaMb9Hd6f/TlBHslIRa2NN58bSBGJCyBP2b59+2+EcCgYEAixDVRXvV37GlYUOa/XVdosk5Zoe6oDGRuQm0xbNdoUBoZvDHDvme7ONWEiQha/8qtVsD+CyQ7awcPfb8kK9c0bBt+bTS6d4BkTcxkEkMgtrkBVR8Nqfu5jXsLH4VCv4G61zbMhZw8+ut+az5YX2yCN7Frj9sFlxapMRPQmzMEe0CgYEAumsAzM8ZqNv4mAK65Mnr0rhLj1cbxcKRdUYACOgtEFQpzxN/HZnTeFAe5nx3pI3uFlRHq3DFEYnT6dHMWaJQmAULYpVIwMi9L6gtyJ9fzoI6uqMtxRDMUqKdaSsTGOY/kJ6KhQ/unXi1K3XXjR+yd1+C0q+HUm1+CYxvrZYLfskCgYEArsEy+IQOiqniJ0NE2vVUF+UK/IRZaic9YKcpov5Ot7Vvzm/MnnW4N1ljVskocETBWMmPUvNSExVjPebi+rxd8fa5kY8BJScPTzMFbunZn/wjtGdcM10qdlVQ9doG61A/9P3ezFKCfS4AvF/H/59LcSx2Bh28fp3/efiVIOpVd4Y=";
13454
+ const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHo80SecH7FuF2\nhFYnb+l26/VN8UMLXAQFLnxciNTEwkGVFMpdezlH8rU2HtUJL4RETogbAOLVY0XM\njs6sPn8G1nALmh9qeDpUtVqFOVtBHxEZ910TLOtQiunjqJKO5nWdqZ71EC3OFluR\niGQkO84BiIFbv37ub7xl3S8XarbtKoLcyVpkDHi+1wx1pgCAn6gtBUgckPL5NR8j\nLseabl3HAXQfhTCKo4tmOFM2Dxwl1IUMmIJrJg/aIU/U0tj/1Eoo7mG0JcNWX19l\nW3EecCbi0ncCJOrkUdwlBrcjaMayaX/ubEwyUeTGiLdyc4L3GRLHjyK8xgVNXRMH\nbZWJ2a5NAgMBAAECggEASxuE+35zTFO/XydKgmvIGcWL9FbgMlXb7Vcf0nBoG945\nbiz0NVc2paraIhJXc608xbYF3qLmtAE1MVBI0ORyRdBHNxY024l/6H6SH60Ed+uI\nM4ysp5ourY6Vj+DLwpdRiI9YDjqYAQDIUmhNxJP7XPhOMoZI6st+xZQBM34ic/bv\nAMSJm9OZphSp3+qXVkFZztr2mxD2EZSJJLYxi8BCdgM2qhazalbcJ6zDKHCZWVWm\n8RRxDGldyMb/237JxETzP40tAlzOZDmBAbUgEnurDJ93RVDIE3rbZUshwgeQd18a\nem096mWgvB1AIKYgsTAR3pw+V19YWAjq/glP6fz8wQKBgQD/oQq+ukKF0PRgBeM5\ngeTjSwsdGppQLmf5ndujvoiz/TpdjDEPu6R8kigQr1rG2t4K/yfdZoI8RdmJD1al\n3Q7N9hofooSy4rj6E3txzWZCHJjHad2cnCp/O26HiReGAl7wTcfTmNdiFHhZQzm5\nJBkvWAiwuvQMNfEbnXxw6/vIDwKBgQDH7fX8gsc77JLvAWgp1MaQN/sbqVb6JeT1\nFQfR8E/WFCSmzQBtNzd5KgYuCeelwr/8DyYytvN2BzCYZXp73gI1jF3YlW5jVn74\nOY6TwQ095digwo6Z0yuxopdIOApKgAkL9PRKgNrqAf3NAyMua6lOGifzjDojC3KU\nfylQmxMn4wKBgHp2B9O/H0dEBw5JQ8W0+JX6yWQz7mEjGiR2/1W+XXb8hQ1zr709\nw1r6Gb+EghRpnZ3fBpYGGbYOMFx8wKHM+N6qW3F0ReX8v2juFGE8aRSa5oYBrWzt\nU16Idjbv8hj84cZ1PJmdyvDtpYn9rpWHOZl4rxEbPvbqkIsOMyNVqdT5AoGAOSge\nmwIIU2le2FVeohbibXiToWTYKMuMmURZ5/r72AgKMmWJKbAPe+Q3wBG01/7FRBpQ\noU8Ma0HC8s6QJbliiEyIx9JwrJWd1vkdecBHONrtA4ibm/5zD2WcOllLF+FitLhi\n3qnX6+6F0IaFGFBPJrTzlv0P4dTz/OAdv52V7GECgYEA2TttOKBAqWllgOaZOkql\nLVMJVmgR7s6tLi1+cEP8ZcapV9aRbRzTAKXm4f8AEhtlG9F9kCOvHYCYGi6JaiWJ\nZkHjeex3T+eE6Di6y5Bm/Ift5jtVhJ4jCVwHOKTMej79NPUFTJfv8hCo29haBDv6\nRXFrv+T21KCcw8k3sJeJWWQ=\n-----END PRIVATE KEY-----";
13653
13455
  /*
13654
13456
  * The crypto algorithm used for importing key and signing string
13655
13457
  */
@@ -15448,18 +15250,18 @@ const buildFlagUserBody = (options) => {
15448
15250
  /**
15449
15251
  * ```js
15450
15252
  * import { UserRepository } from '@amityco/ts-sdk'
15451
- *
15452
- * // Typeless report (supported).
15453
15253
  * const flagged = await UserRepository.flagUser('userId')
15254
+ * const flaggedBehavior = await UserRepository.flagUser('userId', {
15255
+ * reportType: 'behavior',
15256
+ * reason: 'Harassment or bullying',
15257
+ * comment: 'optional free-text',
15258
+ * })
15454
15259
  * ```
15455
15260
  *
15456
- * Flags a user. Two call shapes are accepted (see the overloads): id-only, which
15457
- * sends no body and stays supported, and the deprecated structured options object,
15458
- * whose request mapping is unchanged. New code reporting a profile field or behavior
15459
- * should use `flagUserProfile` or `flagUserBehavior`.
15460
- *
15461
15261
  * @param userId The ID of the user to be flagged
15462
- * @param options Deprecated report metadata; omit for a typeless report
15262
+ * @param options Optional report metadata forwarded to the server as the request
15263
+ * body: `reportType`, `reason`, `comment`. Only non-null fields are included.
15264
+ * All validation is server-side; a bodyless call produces a typeless report.
15463
15265
  * @returns the flagged {@link Amity.User}
15464
15266
  *
15465
15267
  * @category User API
@@ -15480,156 +15282,6 @@ const flagUser = async (userId, options) => {
15480
15282
  };
15481
15283
  /* end_public_function */
15482
15284
 
15483
- /**
15484
- * Sends a validated split user report (`flagUserProfile` / `flagUserBehavior`) to the
15485
- * same endpoint as `flagUser`, then persists the returned user and fires `user.flagged`
15486
- * exactly as `flagUser` does, so all three calls share return, cache and event behaviour.
15487
- *
15488
- * Not exported from the public API.
15489
- */
15490
- const submitUserReport = async (apiName, userId, body) => {
15491
- var _a;
15492
- const client = getActiveClient();
15493
- client.log(`user/${apiName}`, { userId, body });
15494
- const { data } = await client.http.post(`/api/v4/me/flags/${encodeURIComponent(userId)}`, body);
15495
- const payload = prepareUserPayload(data);
15496
- if (client.cache) {
15497
- ingestInCache(payload);
15498
- }
15499
- fireEvent('user.flagged', data);
15500
- return (_a = payload.users.find(user => user.userId === userId)) !== null && _a !== void 0 ? _a : payload.users[0];
15501
- };
15502
-
15503
- /** Maximum `comment` length, in string length units, after trimming. */
15504
- const USER_REPORT_COMMENT_MAX_LENGTH = 300;
15505
- const PROFILE_FIELDS = Object.values(exports.UserProfileFieldEnum);
15506
- const BEHAVIOR_REASONS = Object.values(exports.ContentFlagReasonEnum);
15507
- const assertOptionsObject = (apiName, options, shape) => {
15508
- if (typeof options !== 'object' || options === null || Array.isArray(options)) {
15509
- throw new ASCInvalidParameterError(`${apiName}: expected an options object \`${shape}\``);
15510
- }
15511
- return options;
15512
- };
15513
- /**
15514
- * Normalizes an optional reporter `comment`: it must be a string when supplied (`null`
15515
- * is not a valid supplied comment); it is trimmed; a blank result is omitted (the
15516
- * backend rejects `""`); a result longer than 300 characters is rejected before any
15517
- * request. Otherwise the trimmed text is returned unchanged.
15518
- *
15519
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` for a non-string or over-length comment
15520
- */
15521
- const normalizeUserReportComment = (apiName, comment) => {
15522
- if (comment === undefined)
15523
- return undefined;
15524
- if (typeof comment !== 'string') {
15525
- throw new ASCInvalidParameterError(`${apiName}: \`comment\` must be a string when supplied`);
15526
- }
15527
- const trimmed = comment.trim();
15528
- if (trimmed.length === 0)
15529
- return undefined;
15530
- if (trimmed.length > USER_REPORT_COMMENT_MAX_LENGTH) {
15531
- throw new ASCInvalidParameterError(`${apiName}: \`comment\` must be at most ${USER_REPORT_COMMENT_MAX_LENGTH} characters after trimming`);
15532
- }
15533
- return trimmed;
15534
- };
15535
- const withComment = (body, comment) => comment === undefined ? body : Object.assign(Object.assign({}, body), { comment });
15536
- /**
15537
- * Validates `flagUserProfile` options and builds its request body. Untyped callers can
15538
- * pass anything at runtime, so nothing is trusted from the declared type. Any `reason`
15539
- * key is ignored and never sent.
15540
- *
15541
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when the options are malformed
15542
- */
15543
- const toUserProfileReportBody = (options) => {
15544
- const apiName = 'flagUserProfile';
15545
- const { field, comment } = assertOptionsObject(apiName, options, '{ field, comment? }');
15546
- if (typeof field !== 'string' || !PROFILE_FIELDS.includes(field)) {
15547
- throw new ASCInvalidParameterError(`${apiName}: \`field\` must be a \`UserProfileFieldEnum\` value`);
15548
- }
15549
- return withComment({ reportType: field }, normalizeUserReportComment(apiName, comment));
15550
- };
15551
- /**
15552
- * Validates `flagUserBehavior` options and builds its request body. `reason` must be one
15553
- * of the nine `ContentFlagReasonEnum` values and is sent as that canonical label;
15554
- * `reportType` is always `behavior`.
15555
- *
15556
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when the options are malformed
15557
- */
15558
- const toUserBehaviorReportBody = (options) => {
15559
- const apiName = 'flagUserBehavior';
15560
- const { reason, comment } = assertOptionsObject(apiName, options, '{ reason, comment? }');
15561
- if (typeof reason !== 'string' || !BEHAVIOR_REASONS.includes(reason)) {
15562
- throw new ASCInvalidParameterError(`${apiName}: \`reason\` must be a \`ContentFlagReasonEnum\` value`);
15563
- }
15564
- return withComment({ reportType: 'behavior', reason }, normalizeUserReportComment(apiName, comment));
15565
- };
15566
-
15567
- /* begin_public_function
15568
- id: user.flag_profile
15569
- */
15570
- /**
15571
- * ```js
15572
- * import { UserRepository, UserProfileFieldEnum } from '@amityco/ts-sdk'
15573
- * const flagged = await UserRepository.flagUserProfile('userId', {
15574
- * field: UserProfileFieldEnum.AVATAR,
15575
- * comment: 'Nudity in profile photo',
15576
- * })
15577
- * ```
15578
- *
15579
- * Reports one of a user's profile fields (display name, description or avatar). The
15580
- * call has no reason: profile reports never carry one, so the backend's reason rules
15581
- * cannot be violated from here. A `reason` key passed at runtime is ignored and never sent.
15582
- *
15583
- * `comment` is trimmed; a blank comment is omitted from the request; a comment longer
15584
- * than 300 characters after trimming is rejected before any request. Otherwise the
15585
- * trimmed text is sent unchanged.
15586
- *
15587
- * Sends `POST /api/v4/me/flags/:userId` with `{ reportType: <field>, comment? }`.
15588
- *
15589
- * @param userId The ID of the user to be reported
15590
- * @param options `field` is a `UserProfileFieldEnum` value; `comment` is optional free text
15591
- * @returns the flagged {@link Amity.User}
15592
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when `options` is missing or malformed, or `comment` is over 300 characters, before any request is made
15593
- *
15594
- * @category User API
15595
- * @async
15596
- * */
15597
- const flagUserProfile = async (userId, options) => submitUserReport('flagUserProfile', userId, toUserProfileReportBody(options));
15598
- /* end_public_function */
15599
-
15600
- /* begin_public_function
15601
- id: user.flag_behavior
15602
- */
15603
- /**
15604
- * ```js
15605
- * import { UserRepository, ContentFlagReasonEnum } from '@amityco/ts-sdk'
15606
- * const flagged = await UserRepository.flagUserBehavior('userId', {
15607
- * reason: ContentFlagReasonEnum.Others,
15608
- * comment: 'Impersonating our brand',
15609
- * })
15610
- * ```
15611
- *
15612
- * Reports a user's behavior. `reason` is required and is one of the nine
15613
- * `ContentFlagReasonEnum` values, sent as its canonical label. Reporter text, including
15614
- * the explanation for `Others`, always travels in `comment`; the reason never carries text.
15615
- *
15616
- * `comment` is trimmed; a blank comment is omitted from the request; a comment longer
15617
- * than 300 characters after trimming is rejected before any request. Otherwise the
15618
- * trimmed text is sent unchanged.
15619
- *
15620
- * Sends `POST /api/v4/me/flags/:userId` with `{ reportType: 'behavior', reason, comment? }`.
15621
- *
15622
- * @param userId The ID of the user to be reported
15623
- * @param options `reason` is a `ContentFlagReasonEnum` value; `comment` is optional free text
15624
- * @returns the flagged {@link Amity.User}
15625
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when `options` is missing or malformed, `reason` is missing or unknown, or `comment` is over 300 characters, before any request is made
15626
- *
15627
- * @category User API
15628
- * @async
15629
- * */
15630
- const flagUserBehavior = async (userId, options) => submitUserReport('flagUserBehavior', userId, toUserBehaviorReportBody(options));
15631
- /* end_public_function */
15632
-
15633
15285
  /* begin_public_function
15634
15286
  id: user.unflag
15635
15287
  */
@@ -16804,8 +16456,6 @@ var index$r = /*#__PURE__*/Object.freeze({
16804
16456
  getUserByIds: getUserByIds,
16805
16457
  updateUser: updateUser,
16806
16458
  flagUser: flagUser,
16807
- flagUserProfile: flagUserProfile,
16808
- flagUserBehavior: flagUserBehavior,
16809
16459
  unflagUser: unflagUser,
16810
16460
  isUserFlaggedByMe: isUserFlaggedByMe,
16811
16461
  getAllBlockedUsers: getAllBlockedUsers,
@@ -19875,16 +19525,9 @@ const createMessageOptimistic = (bundle) => {
19875
19525
  }
19876
19526
  // as reused to update created and updated time, which should be the same
19877
19527
  const createdTime = new Date().toISOString();
19878
- const message = Object.assign({
19879
- // The optimistic message must name its channel so the session-wide channel
19880
- // activity handler can move lastActivity / lastMessageAt at send time.
19881
- channelId: subChannel === null || subChannel === void 0 ? void 0 : subChannel.data.channelId, creatorId: client.userId, creatorPrivateId: getActiveUser()._id, channelSegment: ((_b = subChannel === null || subChannel === void 0 ? void 0 : subChannel.data.messageCount) !== null && _b !== void 0 ? _b : 0) + 1, childrenNumber: 0, createdAt: createdTime, updatedAt: createdTime, syncState: "syncing" /* Amity.SyncState.Syncing */, isDeleted: false }, bundleWithMessageId);
19528
+ const message = Object.assign({ creatorId: client.userId, creatorPrivateId: getActiveUser()._id, channelSegment: ((_b = subChannel === null || subChannel === void 0 ? void 0 : subChannel.data.messageCount) !== null && _b !== void 0 ? _b : 0) + 1, childrenNumber: 0, createdAt: createdTime, updatedAt: createdTime, syncState: "syncing" /* Amity.SyncState.Syncing */, isDeleted: false }, bundleWithMessageId);
19882
19529
  const cachedAt = UNSYNCED_OBJECT_CACHED_AT_VALUE;
19883
19530
  pushToCache(['message', 'get', message.messageId], message, { cachedAt });
19884
- // Own-send update (ChannelActivityService row 1): move the channel at send
19885
- // time, synchronously, so the confirmation on the send response always sees
19886
- // this value rather than racing the scheduled local event below.
19887
- updateChannelActivityTimestamps(message.channelId, message.createdAt);
19888
19531
  fireEvent('local.message.created', { messages: [message] });
19889
19532
  return message;
19890
19533
  };
@@ -19924,9 +19567,6 @@ const createMessage = async (bundle) => {
19924
19567
  if (client.cache) {
19925
19568
  ingestInCache(data, { cachedAt });
19926
19569
  }
19927
- // The own-send update wrote the device-clock createdAt; replace it with the
19928
- // server's now that the message is confirmed (ChannelActivityService REQ-009).
19929
- confirmOwnMessage(optimisticData === null || optimisticData === void 0 ? void 0 : optimisticData.channelId, optimisticData === null || optimisticData === void 0 ? void 0 : optimisticData.createdAt, messages[0].createdAt);
19930
19570
  fireEvent('local.message.created', {
19931
19571
  messages: [Object.assign(Object.assign({}, messages[0]), { syncState: "synced" /* Amity.SyncState.Synced */ })],
19932
19572
  });
@@ -20520,85 +20160,23 @@ getDeliveredUsers.locally = (query) => {
20520
20160
  return { data: users, cachedAt, prevPage, nextPage };
20521
20161
  };
20522
20162
 
20523
- const CONTENT_FLAG_REASONS = Object.values(exports.ContentFlagReasonEnum);
20524
- /**
20525
- * True when a public `flagX(id, input)` argument is the legacy shape (a reason string
20526
- * or nothing). Anything else is routed to the `Amity.ContentFlagOptions` path, whose
20527
- * validation rejects malformed values before any request is made.
20528
- */
20529
- const isLegacyContentFlagReason = (input) => input === undefined || typeof input === 'string';
20530
- /**
20531
- * Validates an `Amity.ContentFlagOptions` argument. Untyped (plain JS) callers can pass
20532
- * anything at runtime, so the checks do not trust the declared type: the value must be a
20533
- * plain object, `reason` must be one of the nine `ContentFlagReasonEnum` values and
20534
- * `detail`, when supplied, must be a string (`null` is not a valid supplied detail).
20535
- *
20536
- * @param apiName used in the error message, e.g. `flagPost`
20537
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when the options are malformed
20538
- */
20539
- const validateContentFlagOptions = (apiName, options) => {
20540
- if (typeof options !== 'object' || options === null || Array.isArray(options)) {
20541
- throw new ASCInvalidParameterError(`${apiName}: expected an options object \`{ reason, detail? }\``);
20542
- }
20543
- const { reason, detail } = options;
20544
- if (typeof reason !== 'string' || !CONTENT_FLAG_REASONS.includes(reason)) {
20545
- throw new ASCInvalidParameterError(`${apiName}: \`reason\` must be a \`ContentFlagReasonEnum\` value`);
20546
- }
20547
- if (detail !== undefined && typeof detail !== 'string') {
20548
- throw new ASCInvalidParameterError(`${apiName}: \`detail\` must be a string when supplied`);
20549
- }
20550
- return { reason: reason, detail };
20551
- };
20552
- /**
20553
- * Builds the request body for validated options. `detail` is forwarded unchanged (empty
20554
- * and whitespace-only strings included) and omitted from the body when `undefined`; the
20555
- * backend enforces the 300-character limit.
20556
- */
20557
- const toContentFlagBody = ({ reason, detail }) => detail === undefined ? { reason } : { reason, detail };
20558
-
20559
- /**
20560
- * New `flagMessage(messageId, { reason, detail? })` implementation. Any category,
20561
- * including `Others`, may carry a `detail`. `detail` is forwarded unchanged (empty and
20562
- * whitespace-only strings included) and omitted from the request body when `undefined`;
20563
- * the backend enforces the 300-character limit.
20564
- *
20565
- * Not exported from the public API. It is reached through the
20566
- * `MessageRepository.flagMessage(messageId, options)` overload; see `api/flagMessage.ts`.
20567
- *
20568
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when `options` is malformed, before any request is made
20569
- */
20570
- const flagMessageWithOptions = async (messageId, options) => {
20571
- // Validate first: an input error must surface as INVALID_PARAMETERS regardless of
20572
- // whether a client is active, and validation needs nothing from the client.
20573
- const body = toContentFlagBody(validateContentFlagOptions('flagMessage', options));
20574
- const client = getActiveClient();
20575
- client.log('message/flag', messageId);
20576
- const { data: payload } = await client.http.post(`/api/v5/messages/${encodeURIComponent(messageId)}/flags`, body);
20577
- if (client.cache) {
20578
- const messagePayload = await prepareMessagePayload(payload);
20579
- ingestInCache(messagePayload);
20580
- }
20581
- fireEvent('message.flagged', payload);
20582
- return !!payload;
20583
- };
20584
-
20163
+ /* begin_public_function
20164
+ id: message.flag
20165
+ */
20585
20166
  /**
20586
- * Legacy `flagMessage(messageId, reason?)` implementation, kept verbatim so existing
20587
- * callers keep the exact request body they had before the options contract existed:
20588
- *
20589
- * - predefined `ContentFlagReasonEnum` value → `{ reason: <value>, detail: '' }`
20590
- * - any other non-empty string (including the literal `'Others'`) → `{ reason: 'Others', detail: <string> }`
20591
- * - `undefined` or `''` → `{ reason: 'Others', detail: '' }`
20592
- * (for `undefined` the message body carries `detail: undefined`, which JSON serialization omits)
20167
+ * ```js
20168
+ * import { MessageRepository } from '@amityco/ts-sdk'
20169
+ * const flagged = await MessageRepository.flagMessage(messageId, reason)
20170
+ * ```
20593
20171
  *
20594
- * Not exported from the public API. It is reached through the deprecated
20595
- * `MessageRepository.flagMessage(messageId, reason)` overload; see `api/flagMessage.ts`.
20172
+ * @param messageId of the message to flag
20173
+ * @param reason the reason to flag the message
20174
+ * @returns the created report result
20596
20175
  *
20597
- * Not itself deprecated: it implements the deprecated legacy-string overload of the public
20598
- * `flagMessage`, which carries the deprecation tag. New code should use `flagMessageWithOptions`
20599
- * (the `{ reason, detail? }` contract). This path stays available throughout the current major version.
20600
- */
20601
- const flagMessageWithReasonString = async (messageId, reason) => {
20176
+ * @category Message API
20177
+ * @async
20178
+ * */
20179
+ const flagMessage = async (messageId, reason) => {
20602
20180
  const client = getActiveClient();
20603
20181
  client.log('message/flag', messageId);
20604
20182
  const isPredefinedReason = reason &&
@@ -20615,42 +20193,6 @@ const flagMessageWithReasonString = async (messageId, reason) => {
20615
20193
  fireEvent('message.flagged', payload);
20616
20194
  return !!payload;
20617
20195
  };
20618
-
20619
- /* begin_public_function
20620
- id: message.flag
20621
- */
20622
- /**
20623
- * ```js
20624
- * import { MessageRepository, ContentFlagReasonEnum } from '@amityco/ts-sdk'
20625
- *
20626
- * // No reason.
20627
- * await MessageRepository.flagMessage(messageId)
20628
- *
20629
- * // Category plus optional reporter context (any category, including Others).
20630
- * await MessageRepository.flagMessage(messageId, {
20631
- * reason: ContentFlagReasonEnum.SpamOrScams,
20632
- * detail: 'Repeated promotional links',
20633
- * })
20634
- * ```
20635
- *
20636
- * Reports a message to moderation. Three call shapes are accepted (see the overloads):
20637
- * id-only, an options object, and the deprecated legacy reason string. The public
20638
- * name only dispatches on the input shape; the two implementations are kept separate
20639
- * so the legacy path is untouched by the new contract:
20640
- *
20641
- * - `undefined` or a string → `flagMessageWithReasonString` (unchanged legacy mapping)
20642
- * - anything else → `flagMessageWithOptions` (validated `{ reason, detail? }`)
20643
- *
20644
- * @param messageId The ID of the message to flag
20645
- * @param input an options object `{ reason, detail? }`, a legacy reason string, or nothing
20646
- * @returns `true` when the report was created
20647
- *
20648
- * @category Message API
20649
- * @async
20650
- * */
20651
- const flagMessage = (messageId, input) => isLegacyContentFlagReason(input)
20652
- ? flagMessageWithReasonString(messageId, input)
20653
- : flagMessageWithOptions(messageId, input);
20654
20196
  /* end_public_function */
20655
20197
 
20656
20198
  /* begin_public_function
@@ -22370,16 +21912,17 @@ class ChannelLiveCollectionController extends LiveCollectionController {
22370
21912
  case 'lastCreated':
22371
21913
  channels = channels.sort(sortByLastCreated);
22372
21914
  break;
22373
- case 'lastMessage':
22374
- channels = channels.sort(sortByLastMessage);
22375
- break;
22376
21915
  case 'displayName':
22377
21916
  /*
22378
- * The server returns channels with empty | null displayName's first, then
22379
- * the rest in code-point order (case-sensitive). The comparator mirrors
22380
- * that so the local order agrees with the page order.
21917
+ * The server returns channels with empty | null displayName's first before
21918
+ * returning sorted list of channels with displayNames
21919
+ *
21920
+ * This section needs to be updated as displayNames can be null as well
22381
21921
  */
22382
- channels = channels.sort(sortByDisplayNameCodePoint);
21922
+ channels = channels
21923
+ // this needs to be aligned with the backend data type
21924
+ .map(c => (c.displayName ? c : Object.assign(Object.assign({}, c), { displayName: '' })))
21925
+ .sort(sortByDisplayName);
22383
21926
  break;
22384
21927
  default:
22385
21928
  channels = channels.sort(sortByLastActivity);
@@ -22429,8 +21972,9 @@ class ChannelLiveCollectionController extends LiveCollectionController {
22429
21972
  objectResolverEngine.resolve(message.channelId, "channel" /* Amity.ReferenceType.CHANNEL */);
22430
21973
  }
22431
21974
  else {
22432
- // lastActivity / lastMessageAt are moved by channelActivityOnLoginHandler
22433
- // (session-wide, monotonic, one write). This listener only re-sorts.
21975
+ updateChannelCache(channelCache, {
21976
+ lastActivity: message.createdAt,
21977
+ });
22434
21978
  callback(message);
22435
21979
  }
22436
21980
  });
@@ -22448,7 +21992,9 @@ class ChannelLiveCollectionController extends LiveCollectionController {
22448
21992
  ])) === null || _a === void 0 ? void 0 : _a.data;
22449
21993
  if (!cacheData)
22450
21994
  return;
22451
- // Timestamps are moved by channelActivityOnLoginHandler; only re-sort here.
21995
+ updateChannelCache(cacheData, {
21996
+ lastActivity: message.createdAt,
21997
+ });
22452
21998
  callback(message);
22453
21999
  });
22454
22000
  }, 'channelId', 'channel'),
@@ -23186,7 +22732,9 @@ class SearchChannelLiveCollectionController extends LiveCollectionController {
23186
22732
  ])) === null || _a === void 0 ? void 0 : _a.data;
23187
22733
  if (!cacheData)
23188
22734
  return;
23189
- // Timestamps are moved by channelActivityOnLoginHandler; only re-sort here.
22735
+ updateChannelCache(cacheData, {
22736
+ lastActivity: message.createdAt,
22737
+ });
23190
22738
  callback(message);
23191
22739
  });
23192
22740
  }, 'channelId', 'channel'),
@@ -23203,7 +22751,9 @@ class SearchChannelLiveCollectionController extends LiveCollectionController {
23203
22751
  ])) === null || _a === void 0 ? void 0 : _a.data;
23204
22752
  if (!cacheData)
23205
22753
  return;
23206
- // Timestamps are moved by channelActivityOnLoginHandler; only re-sort here.
22754
+ updateChannelCache(cacheData, {
22755
+ lastActivity: message.createdAt,
22756
+ });
23207
22757
  callback(message);
23208
22758
  });
23209
22759
  }, 'channelId', 'channel'),
@@ -27788,22 +27338,23 @@ const declineComment = async (commentId, reason) => {
27788
27338
  };
27789
27339
  /* end_public_function */
27790
27340
 
27341
+ /* begin_public_function
27342
+ id: comment.flag
27343
+ */
27791
27344
  /**
27792
- * Legacy `flagComment(commentId, reason?)` implementation, kept verbatim so existing
27793
- * callers keep the exact request body they had before the options contract existed:
27794
- *
27795
- * - predefined `ContentFlagReasonEnum` value → `{ reason: <value>, detail: '' }`
27796
- * - any other non-empty string (including the literal `'Others'`) → `{ reason: 'Others', detail: <string> }`
27797
- * - `undefined` or `''` → `{ reason: 'Others', detail: '' }`
27345
+ * ```js
27346
+ * import { CommentRepository } from '@amityco/ts-sdk'
27347
+ * const flagged = await CommentRepository.flagComment(commentId, reason)
27348
+ * ```
27798
27349
  *
27799
- * Not exported from the public API. It is reached through the deprecated
27800
- * `CommentRepository.flagComment(commentId, reason)` overload; see `api/flagComment.ts`.
27350
+ * @param commentId The ID of the comment to flag
27351
+ * @param reason the reason to flag the comment
27352
+ * @returns the created report result
27801
27353
  *
27802
- * Not itself deprecated: it implements the deprecated legacy-string overload of the public
27803
- * `flagComment`, which carries the deprecation tag. New code should use `flagCommentWithOptions`
27804
- * (the `{ reason, detail? }` contract). This path stays available throughout the current major version.
27805
- */
27806
- const flagCommentWithReasonString = async (commentId, reason) => {
27354
+ * @category Comment API
27355
+ * @async
27356
+ * */
27357
+ const flagComment = async (commentId, reason) => {
27807
27358
  const client = getActiveClient();
27808
27359
  client.log('comment/flagComment', commentId);
27809
27360
  const isPredefinedReason = reason &&
@@ -27819,67 +27370,6 @@ const flagCommentWithReasonString = async (commentId, reason) => {
27819
27370
  fireEvent('comment.flagged', payload);
27820
27371
  return !!payload;
27821
27372
  };
27822
-
27823
- /**
27824
- * New `flagComment(commentId, { reason, detail? })` implementation. Any category,
27825
- * including `Others`, may carry a `detail`. `detail` is forwarded unchanged (empty and
27826
- * whitespace-only strings included) and omitted from the request body when `undefined`;
27827
- * the backend enforces the 300-character limit.
27828
- *
27829
- * Not exported from the public API. It is reached through the
27830
- * `CommentRepository.flagComment(commentId, options)` overload; see `api/flagComment.ts`.
27831
- *
27832
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when `options` is malformed, before any request is made
27833
- */
27834
- const flagCommentWithOptions = async (commentId, options) => {
27835
- // Validate first: an input error must surface as INVALID_PARAMETERS regardless of
27836
- // whether a client is active, and validation needs nothing from the client.
27837
- const body = toContentFlagBody(validateContentFlagOptions('flagComment', options));
27838
- const client = getActiveClient();
27839
- client.log('comment/flagComment', commentId);
27840
- const { data: payload } = await client.http.post(`/api/v3/comments/${encodeURIComponent(commentId)}/flag`, body);
27841
- if (client.cache) {
27842
- ingestInCache(payload);
27843
- }
27844
- fireEvent('comment.flagged', payload);
27845
- return !!payload;
27846
- };
27847
-
27848
- /* begin_public_function
27849
- id: comment.flag
27850
- */
27851
- /**
27852
- * ```js
27853
- * import { CommentRepository, ContentFlagReasonEnum } from '@amityco/ts-sdk'
27854
- *
27855
- * // No reason: sent as Others with an empty detail.
27856
- * await CommentRepository.flagComment(commentId)
27857
- *
27858
- * // Category plus optional reporter context (any category, including Others).
27859
- * await CommentRepository.flagComment(commentId, {
27860
- * reason: ContentFlagReasonEnum.SpamOrScams,
27861
- * detail: 'Repeated promotional links',
27862
- * })
27863
- * ```
27864
- *
27865
- * Reports a comment to moderation. Three call shapes are accepted (see the overloads):
27866
- * id-only, an options object, and the deprecated legacy reason string. The public
27867
- * name only dispatches on the input shape; the two implementations are kept separate
27868
- * so the legacy path is untouched by the new contract:
27869
- *
27870
- * - `undefined` or a string → `flagCommentWithReasonString` (unchanged legacy mapping)
27871
- * - anything else → `flagCommentWithOptions` (validated `{ reason, detail? }`)
27872
- *
27873
- * @param commentId The ID of the comment to flag
27874
- * @param input an options object `{ reason, detail? }`, a legacy reason string, or nothing
27875
- * @returns `true` when the report was created
27876
- *
27877
- * @category Comment API
27878
- * @async
27879
- * */
27880
- const flagComment = (commentId, input) => isLegacyContentFlagReason(input)
27881
- ? flagCommentWithReasonString(commentId, input)
27882
- : flagCommentWithOptions(commentId, input);
27883
27373
  /* end_public_function */
27884
27374
 
27885
27375
  /* begin_public_function
@@ -30233,47 +29723,23 @@ const declinePost = async (postId) => {
30233
29723
  };
30234
29724
  /* end_public_function */
30235
29725
 
29726
+ /* begin_public_function
29727
+ id: post.flag
29728
+ */
30236
29729
  /**
30237
- * New `flagPost(postId, { reason, detail? })` implementation. Any category, including
30238
- * `Others`, may carry a `detail`. `detail` is forwarded unchanged (empty and
30239
- * whitespace-only strings included) and omitted from the request body when `undefined`;
30240
- * the backend enforces the 300-character limit.
30241
- *
30242
- * Not exported from the public API. It is reached through the
30243
- * `PostRepository.flagPost(postId, options)` overload; see `api/flagPost.ts`.
30244
- *
30245
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when `options` is malformed, before any request is made
30246
- */
30247
- const flagPostWithOptions = async (postId, options) => {
30248
- // Validate first: an input error must surface as INVALID_PARAMETERS regardless of
30249
- // whether a client is active, and validation needs nothing from the client.
30250
- const body = toContentFlagBody(validateContentFlagOptions('flagPost', options));
30251
- const client = getActiveClient();
30252
- client.log('post/flagPost', postId);
30253
- const { data: payload } = await client.http.post(`/api/v3/posts/${encodeURIComponent(postId)}/flag`, body);
30254
- if (client.cache) {
30255
- ingestInCache(prepareMembershipPayload(payload, 'communityUsers'));
30256
- }
30257
- fireEvent('post.flagged', payload);
30258
- return !!payload;
30259
- };
30260
-
30261
- /**
30262
- * Legacy `flagPost(postId, reason?)` implementation, kept verbatim so existing
30263
- * callers keep the exact request body they had before the options contract existed:
30264
- *
30265
- * - predefined `ContentFlagReasonEnum` value → `{ reason: <value>, detail: '' }`
30266
- * - any other non-empty string (including the literal `'Others'`) → `{ reason: 'Others', detail: <string> }`
30267
- * - `undefined` or `''` → `{ reason: 'Others', detail: '' }`
29730
+ * ```js
29731
+ * import { PostRepository } from '@amityco/ts-sdk'
29732
+ * const flagged = await PostRepository.flagPost(postId, reason)
29733
+ * ```
30268
29734
  *
30269
- * Not exported from the public API. It is reached through the deprecated
30270
- * `PostRepository.flagPost(postId, reason)` overload; see `api/flagPost.ts`.
29735
+ * @param postId of the post to flag
29736
+ * @param reason the reason to flag the post
29737
+ * @returns a boolean
30271
29738
  *
30272
- * Not itself deprecated: it implements the deprecated legacy-string overload of the public
30273
- * `flagPost`, which carries the deprecation tag. New code should use `flagPostWithOptions`
30274
- * (the `{ reason, detail? }` contract). This path stays available throughout the current major version.
30275
- */
30276
- const flagPostWithReasonString = async (postId, reason) => {
29739
+ * @category Post API
29740
+ * @async
29741
+ * */
29742
+ const flagPost = async (postId, reason) => {
30277
29743
  const client = getActiveClient();
30278
29744
  client.log('post/flagPost', postId);
30279
29745
  const isPredefinedReason = reason &&
@@ -30289,42 +29755,6 @@ const flagPostWithReasonString = async (postId, reason) => {
30289
29755
  fireEvent('post.flagged', payload);
30290
29756
  return !!payload;
30291
29757
  };
30292
-
30293
- /* begin_public_function
30294
- id: post.flag
30295
- */
30296
- /**
30297
- * ```js
30298
- * import { PostRepository, ContentFlagReasonEnum } from '@amityco/ts-sdk'
30299
- *
30300
- * // No reason.
30301
- * await PostRepository.flagPost(postId)
30302
- *
30303
- * // Category plus optional reporter context (any category, including Others).
30304
- * await PostRepository.flagPost(postId, {
30305
- * reason: ContentFlagReasonEnum.SpamOrScams,
30306
- * detail: 'Repeated promotional links',
30307
- * })
30308
- * ```
30309
- *
30310
- * Reports a post to moderation. Three call shapes are accepted (see the overloads):
30311
- * id-only, an options object, and the deprecated legacy reason string. The public
30312
- * name only dispatches on the input shape; the two implementations are kept separate
30313
- * so the legacy path is untouched by the new contract:
30314
- *
30315
- * - `undefined` or a string → `flagPostWithReasonString` (unchanged legacy mapping)
30316
- * - anything else → `flagPostWithOptions` (validated `{ reason, detail? }`)
30317
- *
30318
- * @param postId The ID of the post to flag
30319
- * @param input an options object `{ reason, detail? }`, a legacy reason string, or nothing
30320
- * @returns `true` when the report was created
30321
- *
30322
- * @category Post API
30323
- * @async
30324
- * */
30325
- const flagPost = (postId, input) => isLegacyContentFlagReason(input)
30326
- ? flagPostWithReasonString(postId, input)
30327
- : flagPostWithOptions(postId, input);
30328
29758
  /* end_public_function */
30329
29759
 
30330
29760
  /* begin_public_function
@@ -37822,12 +37252,10 @@ exports.restoreCache = restoreCache;
37822
37252
  exports.runQuery = runQuery;
37823
37253
  exports.sortByChannelSegment = sortByChannelSegment;
37824
37254
  exports.sortByDisplayName = sortByDisplayName;
37825
- exports.sortByDisplayNameCodePoint = sortByDisplayNameCodePoint;
37826
37255
  exports.sortByFirstCreated = sortByFirstCreated;
37827
37256
  exports.sortByFirstUpdated = sortByFirstUpdated;
37828
37257
  exports.sortByLastActivity = sortByLastActivity;
37829
37258
  exports.sortByLastCreated = sortByLastCreated;
37830
- exports.sortByLastMessage = sortByLastMessage;
37831
37259
  exports.sortByLastUpdated = sortByLastUpdated;
37832
37260
  exports.sortByLocalSortingDate = sortByLocalSortingDate;
37833
37261
  exports.sortByName = sortByName;