@amityco/ts-sdk 7.26.1-86b52c8a.0 → 7.26.1-89ec2db2.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 (49) hide show
  1. package/dist/@types/core/payload.d.ts +0 -5
  2. package/dist/@types/core/payload.d.ts.map +1 -1
  3. package/dist/@types/core/permissions.d.ts +3 -7
  4. package/dist/@types/core/permissions.d.ts.map +1 -1
  5. package/dist/@types/core/transport.d.ts +3 -1
  6. package/dist/@types/core/transport.d.ts.map +1 -1
  7. package/dist/@types/domains/analytics.d.ts +1 -3
  8. package/dist/@types/domains/analytics.d.ts.map +1 -1
  9. package/dist/@types/domains/client.d.ts +7 -0
  10. package/dist/@types/domains/client.d.ts.map +1 -1
  11. package/dist/@types/domains/content.d.ts +6 -1
  12. package/dist/@types/domains/content.d.ts.map +1 -1
  13. package/dist/@types/index.d.ts +0 -1
  14. package/dist/@types/index.d.ts.map +1 -1
  15. package/dist/analytic/service/analytic/AnalyticsEngine.d.ts +0 -3
  16. package/dist/analytic/service/analytic/AnalyticsEngine.d.ts.map +1 -1
  17. package/dist/analytic/service/analytic/AnalyticsEventCapturer.d.ts +0 -3
  18. package/dist/analytic/service/analytic/AnalyticsEventCapturer.d.ts.map +1 -1
  19. package/dist/cache/utils/index.d.ts.map +1 -1
  20. package/dist/client/api/loginWithAccessToken.d.ts.map +1 -1
  21. package/dist/client/api/resumeSession.d.ts.map +1 -1
  22. package/dist/client/api/tests/validateAccessToken.test.d.ts +2 -0
  23. package/dist/client/api/tests/validateAccessToken.test.d.ts.map +1 -0
  24. package/dist/client/api/validateAccessToken.d.ts +1 -1
  25. package/dist/client/api/validateAccessToken.d.ts.map +1 -1
  26. package/dist/core/transports/mqtt.d.ts.map +1 -1
  27. package/dist/index.cjs.js +139 -208
  28. package/dist/index.d.ts +0 -1
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.esm.js +116 -184
  31. package/dist/index.umd.js +2 -2
  32. package/dist/utils/linkedObject/index.d.ts +0 -1
  33. package/dist/utils/linkedObject/index.d.ts.map +1 -1
  34. package/dist/utils/linkedObject/postLinkedObject.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/dist/@types/domains/curatedContent.d.ts +0 -25
  37. package/dist/@types/domains/curatedContent.d.ts.map +0 -1
  38. package/dist/curatedContentRepository/api/getPool.d.ts +0 -2
  39. package/dist/curatedContentRepository/api/getPool.d.ts.map +0 -1
  40. package/dist/curatedContentRepository/api/index.d.ts +0 -2
  41. package/dist/curatedContentRepository/api/index.d.ts.map +0 -1
  42. package/dist/curatedContentRepository/api/tests/getPool.test.d.ts +0 -2
  43. package/dist/curatedContentRepository/api/tests/getPool.test.d.ts.map +0 -1
  44. package/dist/curatedContentRepository/api/tests/integration/getPool.integration.test.d.ts +0 -2
  45. package/dist/curatedContentRepository/api/tests/integration/getPool.integration.test.d.ts.map +0 -1
  46. package/dist/curatedContentRepository/index.d.ts +0 -2
  47. package/dist/curatedContentRepository/index.d.ts.map +0 -1
  48. package/dist/utils/linkedObject/curatedContentTopicLinkedObject.d.ts +0 -2
  49. package/dist/utils/linkedObject/curatedContentTopicLinkedObject.d.ts.map +0 -1
package/dist/index.cjs.js CHANGED
@@ -385,7 +385,13 @@ const normalize = (source) => Object.keys(source)
385
385
  * @category Cache
386
386
  * @hidden
387
387
  */
388
- const encodeKey = (key) => JSON.stringify(key, (_, val) => (typeof val === 'object' ? normalize(val) : val));
388
+ const encodeKey = (key) => JSON.stringify(key, (_, val) =>
389
+ // `typeof null` is `'object'`, so a nullish segment would reach normalize()
390
+ // and throw on Object.keys(null) — taking down whichever cache read built
391
+ // the key. Amity.Serializable does not admit null in the first place, so a
392
+ // null here is a payload that broke its own contract: encode it as null and
393
+ // let the miss be a miss.
394
+ val !== null && typeof val === 'object' ? normalize(val) : val);
389
395
  /**
390
396
  * Decodes a string back into a {@link Amity.CacheKey}
391
397
 
@@ -2456,10 +2462,11 @@ var MqttError;
2456
2462
  MqttError[MqttError["BAD_USERNAME_OR_PASSWORD"] = 134] = "BAD_USERNAME_OR_PASSWORD";
2457
2463
  MqttError[MqttError["NOT_AUTHORIZED"] = 135] = "NOT_AUTHORIZED";
2458
2464
  })(MqttError || (MqttError = {}));
2459
- // MQTT 5 session expiry, in seconds. 0xFFFFFFFF keeps the session alive
2460
- // indefinitely, matching the previous 3.1.1 `clean: false` behaviour where the
2461
- // broker retained the session (and its subscriptions) across disconnects.
2462
- const SESSION_EXPIRY_INTERVAL = 0xffffffff;
2465
+ // MQTT 5 session expiry, in seconds. Under MQTT 3.1.1 the broker capped
2466
+ // retained sessions at ~30 min; under MQTT 5 the client's value wins, so an
2467
+ // unbounded value ("never") left disconnected sessions piling up on the broker.
2468
+ // 1800s matches the previous 3.1.1 cap.
2469
+ const SESSION_EXPIRY_INTERVAL = 1800;
2463
2470
  function getMqttOptions(params) {
2464
2471
  return Object.assign({ clean: false, clientId: `mqttjs_ + ${Math.random().toString(16).substring(2, 10)}`, protocolId: 'MQTT', protocolVersion: 5, reconnectPeriod: RETRY_BASE_TIMEOUT, resubscribe: true,
2465
2472
  // The broker/LB drops idle sockets at ~60s. mqtt.js v5 sends its first
@@ -2561,8 +2568,16 @@ const createMqttTransport = (endpoint) => {
2561
2568
  }
2562
2569
  return {
2563
2570
  connect,
2564
- async disconnect() {
2571
+ async disconnect(options) {
2565
2572
  if (this.connected) {
2573
+ // On logout we want the broker to release the session immediately
2574
+ // instead of keeping it around for SESSION_EXPIRY_INTERVAL. mqtt.js
2575
+ // only sends a DISCONNECT packet when `force` is false; force=true
2576
+ // just tears the socket down and the broker keeps the session until
2577
+ // it expires on its own.
2578
+ if (options === null || options === void 0 ? void 0 : options.endSession) {
2579
+ return new Promise(resolve => mqttClient === null || mqttClient === void 0 ? void 0 : mqttClient.end(false, { reasonCode: 0, properties: { sessionExpiryInterval: 0 } }, () => resolve()));
2580
+ }
2566
2581
  return new Promise(resolve => mqttClient === null || mqttClient === void 0 ? void 0 : mqttClient.end(true, undefined, () => resolve()));
2567
2582
  }
2568
2583
  },
@@ -5439,7 +5454,7 @@ const logout = async () => {
5439
5454
  const client = getActiveClient();
5440
5455
  client.log('client/api/disconnectClient');
5441
5456
  if (client.mqtt && client.mqtt.connected) {
5442
- client.mqtt.disconnect();
5457
+ await client.mqtt.disconnect({ endSession: true });
5443
5458
  }
5444
5459
  /*
5445
5460
  * for cases when session state is terminated (example on ban) or token expired,
@@ -5690,32 +5705,6 @@ class AnalyticsEventCapturer {
5690
5705
  activityType: "view" /* Amity.AnalyticEventActivityType.View */,
5691
5706
  });
5692
5707
  }
5693
- markCuratedContentWidgetAsViewed(topicId) {
5694
- this.markAs({
5695
- uniqueId: `curatedContentWidget.${topicId}`,
5696
- contentId: topicId,
5697
- contentType: "curated_content_widget" /* Amity.AnalyticEventContentType.CuratedContentWidget */,
5698
- activityType: "view" /* Amity.AnalyticEventActivityType.View */,
5699
- });
5700
- }
5701
- markCuratedContentPostAsViewed(postId, topicId) {
5702
- this.markAs({
5703
- uniqueId: `curatedContentPost.${postId}.view`,
5704
- contentId: postId,
5705
- contentType: "curated_content_post" /* Amity.AnalyticEventContentType.CuratedContentPost */,
5706
- activityType: "view" /* Amity.AnalyticEventActivityType.View */,
5707
- metadata: { topicId },
5708
- });
5709
- }
5710
- markCuratedContentPostAsClicked(postId, topicId) {
5711
- this.markAs({
5712
- uniqueId: `curatedContentPost.${postId}.click`,
5713
- contentId: postId,
5714
- contentType: "curated_content_post" /* Amity.AnalyticEventContentType.CuratedContentPost */,
5715
- activityType: "linkClicked" /* Amity.AnalyticEventActivityType.Click */,
5716
- metadata: { topicId },
5717
- });
5718
- }
5719
5708
  markPostAsMeaningfullyViewed(postId, feedRenderPosition) {
5720
5709
  var _a;
5721
5710
  const cached = (_a = pullFromCache(['feedMetadata', 'get', postId])) === null || _a === void 0 ? void 0 : _a.data;
@@ -5879,24 +5868,6 @@ class AnalyticsEngine {
5879
5868
  this._eventCapturer.markPostAsViewed(postId);
5880
5869
  }
5881
5870
  }
5882
- markCuratedContentWidgetAsViewed(topicId) {
5883
- if (this._client.sessionState === "established" /* Amity.SessionStates.ESTABLISHED */ ||
5884
- this._client.sessionState === "tokenExpired" /* Amity.SessionStates.TOKEN_EXPIRED */) {
5885
- this._eventCapturer.markCuratedContentWidgetAsViewed(topicId);
5886
- }
5887
- }
5888
- markCuratedContentPostAsViewed(postId, topicId) {
5889
- if (this._client.sessionState === "established" /* Amity.SessionStates.ESTABLISHED */ ||
5890
- this._client.sessionState === "tokenExpired" /* Amity.SessionStates.TOKEN_EXPIRED */) {
5891
- this._eventCapturer.markCuratedContentPostAsViewed(postId, topicId);
5892
- }
5893
- }
5894
- markCuratedContentPostAsClicked(postId, topicId) {
5895
- if (this._client.sessionState === "established" /* Amity.SessionStates.ESTABLISHED */ ||
5896
- this._client.sessionState === "tokenExpired" /* Amity.SessionStates.TOKEN_EXPIRED */) {
5897
- this._eventCapturer.markCuratedContentPostAsClicked(postId, topicId);
5898
- }
5899
- }
5900
5871
  markPostAsMeaningfullyViewed(postId, feedRenderPosition) {
5901
5872
  if (this._client.sessionState === "established" /* Amity.SessionStates.ESTABLISHED */ ||
5902
5873
  this._client.sessionState === "tokenExpired" /* Amity.SessionStates.TOKEN_EXPIRED */) {
@@ -7769,19 +7740,21 @@ const renewal = () => {
7769
7740
 
7770
7741
  const validateAccessToken = async ({ token, userId }) => {
7771
7742
  const client = getActiveClient();
7772
- // Validate token using sessions API
7773
- await client.http.get('/api/v3/sessions', {
7774
- headers: {
7775
- Authorization: `Bearer ${token.accessToken}`,
7776
- },
7777
- });
7778
- // Get user details
7779
- const { data: { users }, } = await client.http.get(`/api/v3/users/${userId}`, {
7743
+ // Verify the token and hydrate the caller in a single call.
7744
+ const { data } = await client.http.get('/api/v4/sessions', {
7780
7745
  headers: {
7781
7746
  Authorization: `Bearer ${token.accessToken}`,
7782
7747
  },
7783
7748
  });
7784
- const user = users.find((u) => u.userId === userId);
7749
+ const { users, files, userType } = data;
7750
+ const [user] = users;
7751
+ if (userId && (user === null || user === void 0 ? void 0 : user.userId) && userId !== user.userId) {
7752
+ client.log('client/api/validateAccessToken', {
7753
+ message: 'session userId does not match the token userId; using the server value',
7754
+ tokenUserId: userId,
7755
+ sessionUserId: user.userId,
7756
+ });
7757
+ }
7785
7758
  client.http.defaults.headers.common.Authorization = `Bearer ${token.accessToken}`;
7786
7759
  client.http.defaults.metadata = {
7787
7760
  tokenExpiry: token.expiresAt,
@@ -7795,6 +7768,8 @@ const validateAccessToken = async ({ token, userId }) => {
7795
7768
  isUserDeleted: false,
7796
7769
  };
7797
7770
  client.token = token;
7771
+ ingestInCache(prepareUserPayload({ users, files }));
7772
+ setCurrentUserType(userType);
7798
7773
  return user;
7799
7774
  };
7800
7775
 
@@ -7877,14 +7852,6 @@ const loginWithAccessToken = async (accessToken) => {
7877
7852
  setSessionState("notLoggedIn" /* Amity.SessionStates.NOT_LOGGED_IN */);
7878
7853
  throw new ASCError(`User ${userId} has not been found`, 800000 /* Amity.ClientError.UNKNOWN_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
7879
7854
  }
7880
- if (user.isDeleted) {
7881
- setSessionState("notLoggedIn" /* Amity.SessionStates.NOT_LOGGED_IN */);
7882
- throw new ASCError(`User ${userId} has been deleted`, 800000 /* Amity.ClientError.UNKNOWN_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
7883
- }
7884
- if (user.isGlobalBanned) {
7885
- setSessionState("notLoggedIn" /* Amity.SessionStates.NOT_LOGGED_IN */);
7886
- throw new ASCError(`User ${userId} is globally banned`, 800000 /* Amity.ClientError.UNKNOWN_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
7887
- }
7888
7855
  // Set userId and login method flag
7889
7856
  client.userId = user.userId;
7890
7857
  // Set login method flag to 'accessToken' in platform-specific login session
@@ -8683,21 +8650,13 @@ const resumeSession = async (params, sessionHandler, config) => {
8683
8650
  if (user == null) {
8684
8651
  throw new ASCError(`${params.userId} has not been found`, 800000 /* Amity.ClientError.UNKNOWN_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
8685
8652
  }
8686
- if (user.isDeleted) {
8687
- terminateClient("userDeleted" /* Amity.TokenTerminationReason.USER_DELETED */);
8688
- return false;
8689
- }
8690
- if (user.isGlobalBanned) {
8691
- terminateClient("globalBan" /* Amity.TokenTerminationReason.GLOBAL_BAN */);
8692
- return false;
8693
- }
8694
8653
  client.userId = user.userId;
8695
8654
  client.sessionHandler = sessionHandler;
8696
8655
  /*
8697
8656
  * Cannot push to subscriptions as watcher needs to continue working even if
8698
8657
  * token expires
8699
8658
  */
8700
- unsubWatcher = client.accessTokenExpiryWatcher(sessionHandler);
8659
+ unsubWatcher = client.accessTokenExpiryWatcher();
8701
8660
  setActiveUser(user);
8702
8661
  }
8703
8662
  catch (error) {
@@ -9628,7 +9587,7 @@ const getUserUnread = (callback) => {
9628
9587
  };
9629
9588
  };
9630
9589
 
9631
- var index$t = /*#__PURE__*/Object.freeze({
9590
+ var index$s = /*#__PURE__*/Object.freeze({
9632
9591
  __proto__: null,
9633
9592
  getActiveClient: getActiveClient,
9634
9593
  getActiveUser: getActiveUser,
@@ -10854,7 +10813,7 @@ const getMyFollowInfo = (callback) => {
10854
10813
  };
10855
10814
  /* end_public_function */
10856
10815
 
10857
- var index$s = /*#__PURE__*/Object.freeze({
10816
+ var index$r = /*#__PURE__*/Object.freeze({
10858
10817
  __proto__: null,
10859
10818
  blockUser: blockUser,
10860
10819
  unBlockUser: unBlockUser,
@@ -13056,85 +13015,99 @@ const postLinkedObject = (post) => {
13056
13015
  .filter(Boolean) || []);
13057
13016
  },
13058
13017
  get creator() {
13018
+ // The id is checked for a value, not just for presence: a payload can
13019
+ // carry the field as null, and a null segment in a cache key throws while
13020
+ // being encoded rather than simply missing the cache.
13021
+ if (!post.postedUserId)
13022
+ return undefined;
13059
13023
  const cacheData = pullFromCache(['user', 'get', post.postedUserId]);
13060
13024
  if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
13061
- return;
13025
+ return undefined;
13062
13026
  return userLinkedObject(cacheData.data);
13063
13027
  },
13064
13028
  get targetCommunity() {
13065
13029
  var _a;
13030
+ if (!post.targetId)
13031
+ return undefined;
13066
13032
  const communityCache = (_a = pullFromCache([
13067
13033
  'community',
13068
13034
  'get',
13069
13035
  post.targetId,
13070
13036
  ])) === null || _a === void 0 ? void 0 : _a.data;
13071
13037
  if (!communityCache)
13072
- return;
13038
+ return undefined;
13073
13039
  return communityLinkedObject(communityCache);
13074
13040
  },
13075
13041
  getImageInfo() {
13076
13042
  var _a, _b;
13077
- return isAmityImagePost(post)
13078
- ? fileLinkedObject((_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)
13079
- : undefined;
13043
+ if (!isAmityImagePost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.fileId))
13044
+ return undefined;
13045
+ return fileLinkedObject((_b = pullFromCache(['file', 'get', post.data.fileId])) === null || _b === void 0 ? void 0 : _b.data);
13080
13046
  },
13081
13047
  getVideoInfo() {
13082
13048
  var _a, _b, _c;
13083
- return isAmityVideoPost(post)
13084
- ? fileLinkedObject((_c = pullFromCache(['file', 'get', (_b = (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.videoFileId) === null || _b === void 0 ? void 0 : _b.original])) === null || _c === void 0 ? void 0 : _c.data)
13085
- : undefined;
13049
+ const originalFileId = isAmityVideoPost(post) ? (_b = (_a = post.data) === null || _a === void 0 ? void 0 : _a.videoFileId) === null || _b === void 0 ? void 0 : _b.original : undefined;
13050
+ if (!originalFileId)
13051
+ return undefined;
13052
+ return fileLinkedObject((_c = pullFromCache(['file', 'get', originalFileId])) === null || _c === void 0 ? void 0 : _c.data);
13086
13053
  },
13087
13054
  getVideoThumbnailInfo() {
13088
13055
  var _a, _b;
13089
- return isAmityVideoPost(post)
13090
- ? fileLinkedObject((_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.thumbnailFileId])) === null || _b === void 0 ? void 0 : _b.data)
13091
- : undefined;
13056
+ // `isAmityVideoPost` proves the field is *present* — it tests
13057
+ // `'thumbnailFileId' in post.data` — and presence is not a value. The
13058
+ // server sends the field as null until it has finished transcoding the
13059
+ // video, so a just-published post reaches here with a null id and used to
13060
+ // build the cache key ['file', 'get', null].
13061
+ const thumbnailFileId = isAmityVideoPost(post) ? (_a = post.data) === null || _a === void 0 ? void 0 : _a.thumbnailFileId : undefined;
13062
+ if (!thumbnailFileId)
13063
+ return undefined;
13064
+ return fileLinkedObject((_b = pullFromCache(['file', 'get', thumbnailFileId])) === null || _b === void 0 ? void 0 : _b.data);
13092
13065
  },
13093
13066
  getFileInfo() {
13094
13067
  var _a, _b;
13095
- return isAmityFilePost(post)
13096
- ? (_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
13097
- : undefined;
13068
+ if (!isAmityFilePost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.fileId))
13069
+ return undefined;
13070
+ return (_b = pullFromCache(['file', 'get', post.data.fileId])) === null || _b === void 0 ? void 0 : _b.data;
13098
13071
  },
13099
13072
  getLivestreamInfo() {
13100
13073
  var _a, _b;
13101
- if (!isAmityLivestreamPost(post))
13102
- return;
13074
+ if (!isAmityLivestreamPost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.streamId))
13075
+ return undefined;
13103
13076
  const cache = (_b = pullFromCache([
13104
13077
  'stream',
13105
13078
  'get',
13106
- (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.streamId,
13079
+ post.data.streamId,
13107
13080
  ])) === null || _b === void 0 ? void 0 : _b.data;
13108
13081
  if (!cache)
13109
- return;
13082
+ return undefined;
13110
13083
  return streamLinkedObject(cache);
13111
13084
  },
13112
13085
  getPollInfo() {
13113
13086
  var _a, _b;
13114
- if (!isAmityPollPost(post))
13115
- return;
13116
- const cache = (_b = pullFromCache(['poll', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.pollId])) === null || _b === void 0 ? void 0 : _b.data;
13087
+ if (!isAmityPollPost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.pollId))
13088
+ return undefined;
13089
+ const cache = (_b = pullFromCache(['poll', 'get', post.data.pollId])) === null || _b === void 0 ? void 0 : _b.data;
13117
13090
  if (!cache)
13118
- return;
13091
+ return undefined;
13119
13092
  return pollLinkedObject(cache);
13120
13093
  },
13121
13094
  getClipInfo() {
13122
13095
  var _a, _b;
13123
- return isAmityClipPost(post)
13124
- ? (_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
13125
- : undefined;
13096
+ if (!isAmityClipPost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.fileId))
13097
+ return undefined;
13098
+ return (_b = pullFromCache(['file', 'get', post.data.fileId])) === null || _b === void 0 ? void 0 : _b.data;
13126
13099
  },
13127
13100
  getAudioInfo() {
13128
13101
  var _a, _b;
13129
- return isAmityAudioPost(post)
13130
- ? (_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
13131
- : undefined;
13102
+ if (!isAmityAudioPost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.fileId))
13103
+ return undefined;
13104
+ return (_b = pullFromCache(['file', 'get', post.data.fileId])) === null || _b === void 0 ? void 0 : _b.data;
13132
13105
  },
13133
13106
  getRoomInfo() {
13134
13107
  var _a, _b;
13135
- if (!isAmityRoomPost(post))
13136
- return;
13137
- const room = (_b = pullFromCache(['room', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.roomId])) === null || _b === void 0 ? void 0 : _b.data;
13108
+ if (!isAmityRoomPost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.roomId))
13109
+ return undefined;
13110
+ const room = (_b = pullFromCache(['room', 'get', post.data.roomId])) === null || _b === void 0 ? void 0 : _b.data;
13138
13111
  return room ? roomLinkedObject(room) : undefined;
13139
13112
  },
13140
13113
  getEventInfo() {
@@ -14077,22 +14050,6 @@ const eventLinkedObject = (event) => {
14077
14050
  } });
14078
14051
  };
14079
14052
 
14080
- const curatedContentTopicLinkedObject = (topic) => {
14081
- return shallowClone(topic, {
14082
- analytics: {
14083
- markAsViewed: () => {
14084
- AnalyticsEngine$1.getInstance().markCuratedContentWidgetAsViewed(topic.topicId);
14085
- },
14086
- markPostAsViewed: (postId) => {
14087
- AnalyticsEngine$1.getInstance().markCuratedContentPostAsViewed(postId, topic.topicId);
14088
- },
14089
- markPostClick: (postId) => {
14090
- AnalyticsEngine$1.getInstance().markCuratedContentPostAsClicked(postId, topic.topicId);
14091
- },
14092
- },
14093
- });
14094
- };
14095
-
14096
14053
  const LinkedObject = {
14097
14054
  file: fileLinkedObject,
14098
14055
  ad: adLinkedObject,
@@ -14117,7 +14074,6 @@ const LinkedObject = {
14117
14074
  eventResponse: eventResponseLinkedObject,
14118
14075
  product: productLinkedObject,
14119
14076
  poll: pollLinkedObject,
14120
- curatedContentTopic: curatedContentTopicLinkedObject,
14121
14077
  };
14122
14078
 
14123
14079
  /* begin_public_function
@@ -15440,9 +15396,9 @@ var AmityUserSearchMatchType;
15440
15396
  AmityUserSearchMatchType["PARTIAL"] = "partial";
15441
15397
  })(AmityUserSearchMatchType || (AmityUserSearchMatchType = {}));
15442
15398
 
15443
- var index$r = /*#__PURE__*/Object.freeze({
15399
+ var index$q = /*#__PURE__*/Object.freeze({
15444
15400
  __proto__: null,
15445
- Relationship: index$s,
15401
+ Relationship: index$r,
15446
15402
  getUserByIds: getUserByIds,
15447
15403
  updateUser: updateUser,
15448
15404
  flagUser: flagUser,
@@ -15850,7 +15806,7 @@ const uploadAudio = async (formData, onProgress) => {
15850
15806
  };
15851
15807
  /* end_public_function */
15852
15808
 
15853
- var index$q = /*#__PURE__*/Object.freeze({
15809
+ var index$p = /*#__PURE__*/Object.freeze({
15854
15810
  __proto__: null,
15855
15811
  getFile: getFile,
15856
15812
  uploadFile: uploadFile,
@@ -17823,7 +17779,7 @@ const getReactions$1 = (params, callback, config) => {
17823
17779
  };
17824
17780
  /* end_public_function */
17825
17781
 
17826
- var index$p = /*#__PURE__*/Object.freeze({
17782
+ var index$o = /*#__PURE__*/Object.freeze({
17827
17783
  __proto__: null,
17828
17784
  addReaction: addReaction,
17829
17785
  removeReaction: removeReaction,
@@ -19838,7 +19794,7 @@ const searchMessage = (params, callback) => {
19838
19794
  };
19839
19795
  /* end_public_function */
19840
19796
 
19841
- var index$o = /*#__PURE__*/Object.freeze({
19797
+ var index$n = /*#__PURE__*/Object.freeze({
19842
19798
  __proto__: null,
19843
19799
  createMessage: createMessage,
19844
19800
  updateMessage: updateMessage,
@@ -20374,7 +20330,7 @@ const stopMessageReceiptSync = (subChannelId) => {
20374
20330
  };
20375
20331
  /* end_public_function */
20376
20332
 
20377
- var index$n = /*#__PURE__*/Object.freeze({
20333
+ var index$m = /*#__PURE__*/Object.freeze({
20378
20334
  __proto__: null,
20379
20335
  getSubChannelByIds: getSubChannels$1,
20380
20336
  createSubChannel: createSubChannel,
@@ -22325,7 +22281,7 @@ const searchMembers$1 = (params, callback, config) => {
22325
22281
  };
22326
22282
  /* end_public_function */
22327
22283
 
22328
- var index$m = /*#__PURE__*/Object.freeze({
22284
+ var index$l = /*#__PURE__*/Object.freeze({
22329
22285
  __proto__: null,
22330
22286
  addMembers: addMembers$1,
22331
22287
  removeMembers: removeMembers$1,
@@ -22547,7 +22503,7 @@ const unmuteMembers = async (channelId, userIds) => {
22547
22503
  };
22548
22504
  /* end_public_function */
22549
22505
 
22550
- var index$l = /*#__PURE__*/Object.freeze({
22506
+ var index$k = /*#__PURE__*/Object.freeze({
22551
22507
  __proto__: null,
22552
22508
  addRole: addRole,
22553
22509
  removeRole: removeRole,
@@ -22557,10 +22513,10 @@ var index$l = /*#__PURE__*/Object.freeze({
22557
22513
  unmuteMembers: unmuteMembers
22558
22514
  });
22559
22515
 
22560
- var index$k = /*#__PURE__*/Object.freeze({
22516
+ var index$j = /*#__PURE__*/Object.freeze({
22561
22517
  __proto__: null,
22562
- Membership: index$m,
22563
- Moderation: index$l,
22518
+ Membership: index$l,
22519
+ Moderation: index$k,
22564
22520
  getChannelByIds: getChannelByIds$1,
22565
22521
  createChannel: createChannel,
22566
22522
  updateChannel: updateChannel,
@@ -23989,7 +23945,7 @@ const searchMembers = (params, callback, config) => {
23989
23945
  };
23990
23946
  /* end_public_function */
23991
23947
 
23992
- var index$j = /*#__PURE__*/Object.freeze({
23948
+ var index$i = /*#__PURE__*/Object.freeze({
23993
23949
  __proto__: null,
23994
23950
  addMembers: addMembers,
23995
23951
  removeMembers: removeMembers,
@@ -25240,7 +25196,7 @@ const unbanMembers = async (communityId, userIds) => {
25240
25196
  };
25241
25197
  /* end_public_function */
25242
25198
 
25243
- var index$i = /*#__PURE__*/Object.freeze({
25199
+ var index$h = /*#__PURE__*/Object.freeze({
25244
25200
  __proto__: null,
25245
25201
  addRoles: addRoles,
25246
25202
  removeRoles: removeRoles,
@@ -25248,10 +25204,10 @@ var index$i = /*#__PURE__*/Object.freeze({
25248
25204
  unbanMembers: unbanMembers
25249
25205
  });
25250
25206
 
25251
- var index$h = /*#__PURE__*/Object.freeze({
25207
+ var index$g = /*#__PURE__*/Object.freeze({
25252
25208
  __proto__: null,
25253
- Moderation: index$i,
25254
- Membership: index$j,
25209
+ Moderation: index$h,
25210
+ Membership: index$i,
25255
25211
  getCommunityByIds: getCommunities$1,
25256
25212
  createCommunity: createCommunity,
25257
25213
  updateCommunity: updateCommunity,
@@ -25487,7 +25443,7 @@ const getCategories = (params, callback, config) => {
25487
25443
  };
25488
25444
  /* end_public_function */
25489
25445
 
25490
- var index$g = /*#__PURE__*/Object.freeze({
25446
+ var index$f = /*#__PURE__*/Object.freeze({
25491
25447
  __proto__: null,
25492
25448
  getCategory: getCategory,
25493
25449
  getCategories: getCategories
@@ -26613,7 +26569,7 @@ const getComments = (params, callback, config) => {
26613
26569
  };
26614
26570
  /* end_public_function */
26615
26571
 
26616
- var index$f = /*#__PURE__*/Object.freeze({
26572
+ var index$e = /*#__PURE__*/Object.freeze({
26617
26573
  __proto__: null,
26618
26574
  getCommentByIds: getCommentByIds,
26619
26575
  createComment: createComment,
@@ -27882,7 +27838,7 @@ const getForYouFeed = (callback) => {
27882
27838
  };
27883
27839
  /* end_public_function */
27884
27840
 
27885
- var index$e = /*#__PURE__*/Object.freeze({
27841
+ var index$d = /*#__PURE__*/Object.freeze({
27886
27842
  __proto__: null,
27887
27843
  queryGlobalFeed: queryGlobalFeed,
27888
27844
  getCustomRankingGlobalFeed: getCustomRankingGlobalFeed,
@@ -31027,7 +30983,7 @@ const getRooms = (params, callback, config) => {
31027
30983
  };
31028
30984
  /* end_public_function */
31029
30985
 
31030
- var index$d = /*#__PURE__*/Object.freeze({
30986
+ var index$c = /*#__PURE__*/Object.freeze({
31031
30987
  __proto__: null,
31032
30988
  createRoom: createRoom,
31033
30989
  updateRoom: updateRoom,
@@ -31326,7 +31282,7 @@ const getCommunityLiveRoomPosts = (params, callback, config) => {
31326
31282
  };
31327
31283
  /* end_public_function */
31328
31284
 
31329
- var index$c = /*#__PURE__*/Object.freeze({
31285
+ var index$b = /*#__PURE__*/Object.freeze({
31330
31286
  __proto__: null,
31331
31287
  getPostByIds: getPostByIds,
31332
31288
  createPost: createPost,
@@ -31941,7 +31897,7 @@ const getStreams = (params, callback, config) => {
31941
31897
  };
31942
31898
  };
31943
31899
 
31944
- var index$b = /*#__PURE__*/Object.freeze({
31900
+ var index$a = /*#__PURE__*/Object.freeze({
31945
31901
  __proto__: null,
31946
31902
  createStream: createStream,
31947
31903
  updateStream: updateStream,
@@ -32244,7 +32200,7 @@ const stopHeartbeat = (roomId) => {
32244
32200
  };
32245
32201
  /* end_public_function */
32246
32202
 
32247
- var index$a = /*#__PURE__*/Object.freeze({
32203
+ var index$9 = /*#__PURE__*/Object.freeze({
32248
32204
  __proto__: null,
32249
32205
  getRoomOnlineUsers: getRoomOnlineUsers,
32250
32206
  getRoomUserCount: getRoomUserCount,
@@ -32555,7 +32511,7 @@ const getPoll = (pollId, callback) => {
32555
32511
  };
32556
32512
  /* end_public_function */
32557
32513
 
32558
- var index$9 = /*#__PURE__*/Object.freeze({
32514
+ var index$8 = /*#__PURE__*/Object.freeze({
32559
32515
  __proto__: null,
32560
32516
  createPoll: createPoll,
32561
32517
  closePoll: closePoll,
@@ -32859,7 +32815,7 @@ const getPlayer = async (parameters) => {
32859
32815
  return video;
32860
32816
  };
32861
32817
 
32862
- var index$8 = /*#__PURE__*/Object.freeze({
32818
+ var index$7 = /*#__PURE__*/Object.freeze({
32863
32819
  __proto__: null,
32864
32820
  getPlayer: getPlayer
32865
32821
  });
@@ -34032,7 +33988,7 @@ const getGlobalStoryTargets = (params, callback, config) => {
34032
33988
  };
34033
33989
  };
34034
33990
 
34035
- var index$7 = /*#__PURE__*/Object.freeze({
33991
+ var index$6 = /*#__PURE__*/Object.freeze({
34036
33992
  __proto__: null,
34037
33993
  createImageStory: createImageStory,
34038
33994
  createVideoStory: createVideoStory,
@@ -34069,7 +34025,7 @@ const getNetworkAds = async () => {
34069
34025
  };
34070
34026
  };
34071
34027
 
34072
- var index$6 = /*#__PURE__*/Object.freeze({
34028
+ var index$5 = /*#__PURE__*/Object.freeze({
34073
34029
  __proto__: null,
34074
34030
  getNetworkAds: getNetworkAds
34075
34031
  });
@@ -34460,7 +34416,7 @@ const markTraySeen = async (lastSeenAt) => {
34460
34416
  };
34461
34417
  /* end_public_function */
34462
34418
 
34463
- var index$5 = /*#__PURE__*/Object.freeze({
34419
+ var index$4 = /*#__PURE__*/Object.freeze({
34464
34420
  __proto__: null,
34465
34421
  getNotificationTraySeen: getNotificationTraySeen,
34466
34422
  getNotificationTrayItems: getNotificationTrayItems,
@@ -34762,7 +34718,7 @@ const getInvitations = (params, callback) => {
34762
34718
  };
34763
34719
  };
34764
34720
 
34765
- var index$4 = /*#__PURE__*/Object.freeze({
34721
+ var index$3 = /*#__PURE__*/Object.freeze({
34766
34722
  __proto__: null,
34767
34723
  cancelInvitation: cancelInvitation,
34768
34724
  onLocalInvitationCreated: onLocalInvitationCreated,
@@ -34911,7 +34867,7 @@ const getReactions = (postId, callback) => {
34911
34867
  };
34912
34868
  };
34913
34869
 
34914
- var index$3 = /*#__PURE__*/Object.freeze({
34870
+ var index$2 = /*#__PURE__*/Object.freeze({
34915
34871
  __proto__: null,
34916
34872
  createReaction: createReaction,
34917
34873
  onLiveReactionCreated: onLiveReactionCreated,
@@ -35394,7 +35350,7 @@ const getMyEvents = (params, callback, config) => {
35394
35350
  };
35395
35351
  };
35396
35352
 
35397
- var index$2 = /*#__PURE__*/Object.freeze({
35353
+ var index$1 = /*#__PURE__*/Object.freeze({
35398
35354
  __proto__: null,
35399
35355
  createEvent: createEvent,
35400
35356
  updateEvent: updateEvent,
@@ -35621,36 +35577,12 @@ const searchProducts = (params, callback, config) => {
35621
35577
  };
35622
35578
  /* end_public_function */
35623
35579
 
35624
- var index$1 = /*#__PURE__*/Object.freeze({
35580
+ var index = /*#__PURE__*/Object.freeze({
35625
35581
  __proto__: null,
35626
35582
  getProduct: getProduct,
35627
35583
  searchProducts: searchProducts
35628
35584
  });
35629
35585
 
35630
- const getPool = async (topicId, limit) => {
35631
- const client = getActiveClient();
35632
- if (!topicId)
35633
- throw new ASCError('topicId must not be empty', 800110 /* Amity.ClientError.INVALID_PARAMETERS */, "error" /* Amity.ErrorLevel.ERROR */);
35634
- if (limit !== undefined && (limit < 1 || limit > 100))
35635
- throw new ASCError('limit must be between 1 and 100', 800110 /* Amity.ClientError.INVALID_PARAMETERS */, "error" /* Amity.ErrorLevel.ERROR */);
35636
- const { data } = await client.http.get('/api/v5/curated-content/pool', { params: { topicId, limit } });
35637
- const { topic } = data, payload = __rest(data, ["topic"]);
35638
- const processedPayload = preparePostPayload(payload);
35639
- const cachedAt = client.cache && Date.now();
35640
- if (client.cache) {
35641
- ingestInCache(processedPayload, { cachedAt });
35642
- }
35643
- return {
35644
- topic: LinkedObject.curatedContentTopic(topic),
35645
- posts: processedPayload.posts.map(LinkedObject.post),
35646
- };
35647
- };
35648
-
35649
- var index = /*#__PURE__*/Object.freeze({
35650
- __proto__: null,
35651
- getPool: getPool
35652
- });
35653
-
35654
35586
  /**
35655
35587
  * Helper class for managing product tags per media attachment.
35656
35588
  *
@@ -35699,40 +35631,39 @@ class AmityAttachmentProductTags {
35699
35631
  }
35700
35632
 
35701
35633
  exports.API_REGIONS = API_REGIONS;
35702
- exports.AdRepository = index$6;
35634
+ exports.AdRepository = index$5;
35703
35635
  exports.AmityAttachmentProductTags = AmityAttachmentProductTags;
35704
- exports.CategoryRepository = index$g;
35705
- exports.ChannelRepository = index$k;
35706
- exports.Client = index$t;
35707
- exports.CommentRepository = index$f;
35636
+ exports.CategoryRepository = index$f;
35637
+ exports.ChannelRepository = index$j;
35638
+ exports.Client = index$s;
35639
+ exports.CommentRepository = index$e;
35708
35640
  exports.CommunityPostSettingMaps = CommunityPostSettingMaps;
35709
35641
  exports.CommunityPostSettings = CommunityPostSettings;
35710
- exports.CommunityRepository = index$h;
35642
+ exports.CommunityRepository = index$g;
35711
35643
  exports.ContentFeedType = ContentFeedType;
35712
- exports.CuratedContentRepository = index;
35713
35644
  exports.DefaultCommunityPostSetting = DefaultCommunityPostSetting;
35714
- exports.EventRepository = index$2;
35715
- exports.FeedRepository = index$e;
35716
- exports.FileRepository = index$q;
35645
+ exports.EventRepository = index$1;
35646
+ exports.FeedRepository = index$d;
35647
+ exports.FileRepository = index$p;
35717
35648
  exports.FileType = FileType;
35718
35649
  exports.GET_WATCHER_URLS = GET_WATCHER_URLS;
35719
- exports.InvitationRepository = index$4;
35720
- exports.LiveReactionRepository = index$3;
35721
- exports.LiveStreamPlayer = index$8;
35650
+ exports.InvitationRepository = index$3;
35651
+ exports.LiveReactionRepository = index$2;
35652
+ exports.LiveStreamPlayer = index$7;
35722
35653
  exports.MessageContentType = MessageContentType;
35723
- exports.MessageRepository = index$o;
35724
- exports.PollRepository = index$9;
35654
+ exports.MessageRepository = index$n;
35655
+ exports.PollRepository = index$8;
35725
35656
  exports.PostContentType = PostContentType;
35726
- exports.PostRepository = index$c;
35657
+ exports.PostRepository = index$b;
35727
35658
  exports.PostStructureType = PostStructureType;
35728
- exports.ProductRepository = index$1;
35729
- exports.ReactionRepository = index$p;
35730
- exports.RoomPresenceRepository = index$a;
35731
- exports.RoomRepository = index$d;
35732
- exports.StoryRepository = index$7;
35733
- exports.StreamRepository = index$b;
35734
- exports.SubChannelRepository = index$n;
35735
- exports.UserRepository = index$r;
35659
+ exports.ProductRepository = index;
35660
+ exports.ReactionRepository = index$o;
35661
+ exports.RoomPresenceRepository = index$9;
35662
+ exports.RoomRepository = index$c;
35663
+ exports.StoryRepository = index$6;
35664
+ exports.StreamRepository = index$a;
35665
+ exports.SubChannelRepository = index$m;
35666
+ exports.UserRepository = index$q;
35736
35667
  exports.VERSION = VERSION;
35737
35668
  exports.VideoResolution = VideoResolution;
35738
35669
  exports.VideoSize = VideoSize;
@@ -35794,7 +35725,7 @@ exports.isPaged = isPaged;
35794
35725
  exports.isReportedByMe = isReportedByMe;
35795
35726
  exports.isSkip = isSkip;
35796
35727
  exports.mergeInCache = mergeInCache;
35797
- exports.notificationTray = index$5;
35728
+ exports.notificationTray = index$4;
35798
35729
  exports.onChannelMarkerFetched = onChannelMarkerFetched;
35799
35730
  exports.onFeedMarkerFetched = onFeedMarkerFetched;
35800
35731
  exports.onFeedMarkerUpdated = onFeedMarkerUpdated;