@amityco/ts-sdk 7.1.1-67cf0d9.0 → 7.1.1-6dd179b0.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 (149) hide show
  1. package/dist/@types/core/events.d.ts +5 -2
  2. package/dist/@types/core/events.d.ts.map +1 -1
  3. package/dist/@types/core/model.d.ts +4 -2
  4. package/dist/@types/core/model.d.ts.map +1 -1
  5. package/dist/@types/core/payload.d.ts +18 -0
  6. package/dist/@types/core/payload.d.ts.map +1 -1
  7. package/dist/@types/core/readReceipt.d.ts +1 -12
  8. package/dist/@types/core/readReceipt.d.ts.map +1 -1
  9. package/dist/@types/domains/channel.d.ts +0 -10
  10. package/dist/@types/domains/channel.d.ts.map +1 -1
  11. package/dist/@types/domains/client.d.ts +0 -2
  12. package/dist/@types/domains/client.d.ts.map +1 -1
  13. package/dist/@types/domains/notification.d.ts +81 -0
  14. package/dist/@types/domains/notification.d.ts.map +1 -0
  15. package/dist/@types/index.d.ts +1 -0
  16. package/dist/@types/index.d.ts.map +1 -1
  17. package/dist/channelRepository/events/onChannelDeleted.d.ts.map +1 -1
  18. package/dist/channelRepository/events/onChannelLeft.d.ts.map +1 -1
  19. package/dist/channelRepository/observers/getChannel.d.ts.map +1 -1
  20. package/dist/channelRepository/observers/getChannels/ChannelLiveCollectionController.d.ts.map +1 -1
  21. package/dist/channelRepository/observers/index.d.ts +0 -1
  22. package/dist/channelRepository/observers/index.d.ts.map +1 -1
  23. package/dist/channelRepository/utils/constructChannelDynamicValue.d.ts.map +1 -1
  24. package/dist/channelRepository/utils/prepareChannelPayload.d.ts.map +1 -1
  25. package/dist/client/api/createClient.d.ts +0 -1
  26. package/dist/client/api/createClient.d.ts.map +1 -1
  27. package/dist/client/api/enableUnreadCount.d.ts.map +1 -1
  28. package/dist/client/api/login.d.ts.map +1 -1
  29. package/dist/client/utils/ReadReceiptSync/readReceiptSyncEngine.d.ts +4 -2
  30. package/dist/client/utils/ReadReceiptSync/readReceiptSyncEngine.d.ts.map +1 -1
  31. package/dist/client/utils/endpoints.d.ts +0 -1
  32. package/dist/client/utils/endpoints.d.ts.map +1 -1
  33. package/dist/client/utils/setClientToken.d.ts.map +1 -1
  34. package/dist/core/events.d.ts +3 -3
  35. package/dist/core/events.d.ts.map +1 -1
  36. package/dist/core/model/idResolvers.d.ts.map +1 -1
  37. package/dist/core/model/index.d.ts.map +1 -1
  38. package/dist/index.cjs.js +468 -596
  39. package/dist/index.d.ts +1 -0
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.esm.js +451 -580
  42. package/dist/index.umd.js +4 -4
  43. package/dist/{channelRepository → marker}/events/onChannelUnreadUpdatedLocal.d.ts +2 -2
  44. package/dist/marker/events/onChannelUnreadUpdatedLocal.d.ts.map +1 -0
  45. package/dist/messageRepository/events/onMessageCreated.d.ts.map +1 -1
  46. package/dist/messageRepository/observers/getMessage.d.ts.map +1 -1
  47. package/dist/messageRepository/utils/markReadMessage.d.ts.map +1 -1
  48. package/dist/notificationTray/api/index.d.ts +3 -0
  49. package/dist/notificationTray/api/index.d.ts.map +1 -0
  50. package/dist/notificationTray/api/markItemsSeen.d.ts +16 -0
  51. package/dist/notificationTray/api/markItemsSeen.d.ts.map +1 -0
  52. package/dist/notificationTray/api/markTraySeen.d.ts +19 -0
  53. package/dist/notificationTray/api/markTraySeen.d.ts.map +1 -0
  54. package/dist/notificationTray/events/index.d.ts +2 -0
  55. package/dist/notificationTray/events/index.d.ts.map +1 -0
  56. package/dist/notificationTray/events/onNotificationTraySeenUpdated.d.ts +17 -0
  57. package/dist/notificationTray/events/onNotificationTraySeenUpdated.d.ts.map +1 -0
  58. package/dist/notificationTray/index.d.ts +4 -0
  59. package/dist/notificationTray/index.d.ts.map +1 -0
  60. package/dist/notificationTray/internalApi/getNotificationTraySeen.d.ts +30 -0
  61. package/dist/notificationTray/internalApi/getNotificationTraySeen.d.ts.map +1 -0
  62. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts +13 -0
  63. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts.map +1 -0
  64. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts +9 -0
  65. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts.map +1 -0
  66. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts +9 -0
  67. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts.map +1 -0
  68. package/dist/notificationTray/observers/getNotificationTrayItems.d.ts +12 -0
  69. package/dist/notificationTray/observers/getNotificationTrayItems.d.ts.map +1 -0
  70. package/dist/notificationTray/observers/getNotificationTraySeen.d.ts +21 -0
  71. package/dist/notificationTray/observers/getNotificationTraySeen.d.ts.map +1 -0
  72. package/dist/notificationTray/observers/index.d.ts +3 -0
  73. package/dist/notificationTray/observers/index.d.ts.map +1 -0
  74. package/dist/notificationTray/utils/prepareNotificationTrayItemsPayload.d.ts +2 -0
  75. package/dist/notificationTray/utils/prepareNotificationTrayItemsPayload.d.ts.map +1 -0
  76. package/dist/utils/linkedObject/index.d.ts +1 -0
  77. package/dist/utils/linkedObject/index.d.ts.map +1 -1
  78. package/dist/utils/linkedObject/notificationTrayLinkedObject.d.ts +2 -0
  79. package/dist/utils/linkedObject/notificationTrayLinkedObject.d.ts.map +1 -0
  80. package/package.json +1 -1
  81. package/src/@types/core/events.ts +6 -2
  82. package/src/@types/core/model.ts +6 -4
  83. package/src/@types/core/payload.ts +25 -0
  84. package/src/@types/core/readReceipt.ts +1 -14
  85. package/src/@types/domains/channel.ts +0 -13
  86. package/src/@types/domains/client.ts +0 -3
  87. package/src/@types/domains/notification.ts +90 -0
  88. package/src/@types/index.ts +1 -0
  89. package/src/channelRepository/events/onChannelDeleted.ts +4 -17
  90. package/src/channelRepository/events/onChannelLeft.ts +3 -11
  91. package/src/channelRepository/observers/getChannel.ts +1 -3
  92. package/src/channelRepository/observers/getChannels/ChannelLiveCollectionController.ts +1 -6
  93. package/src/channelRepository/observers/index.ts +0 -1
  94. package/src/channelRepository/utils/constructChannelDynamicValue.ts +2 -12
  95. package/src/channelRepository/utils/prepareChannelPayload.ts +17 -68
  96. package/src/client/api/createClient.ts +1 -7
  97. package/src/client/api/enableUnreadCount.ts +0 -1
  98. package/src/client/api/login.ts +1 -5
  99. package/src/client/utils/ReadReceiptSync/readReceiptSyncEngine.ts +99 -74
  100. package/src/client/utils/endpoints.ts +0 -1
  101. package/src/client/utils/setClientToken.ts +0 -8
  102. package/src/core/model/idResolvers.ts +3 -2
  103. package/src/core/model/index.ts +2 -0
  104. package/src/fileRepository/api/uploadFile.ts +1 -1
  105. package/src/fileRepository/api/uploadImage.ts +1 -1
  106. package/src/fileRepository/api/uploadVideo.ts +1 -1
  107. package/src/index.ts +2 -0
  108. package/src/{channelRepository → marker}/events/onChannelUnreadUpdatedLocal.ts +3 -3
  109. package/src/messageRepository/events/onMessageCreated.ts +1 -45
  110. package/src/messageRepository/observers/getMessage.ts +1 -0
  111. package/src/messageRepository/utils/markReadMessage.ts +3 -10
  112. package/src/notificationTray/api/index.ts +2 -0
  113. package/src/notificationTray/api/markItemsSeen.ts +59 -0
  114. package/src/notificationTray/api/markTraySeen.ts +65 -0
  115. package/src/notificationTray/events/index.ts +1 -0
  116. package/src/notificationTray/events/onNotificationTraySeenUpdated.ts +36 -0
  117. package/src/notificationTray/index.ts +3 -0
  118. package/src/notificationTray/internalApi/getNotificationTraySeen.ts +81 -0
  119. package/src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.ts +96 -0
  120. package/src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.ts +31 -0
  121. package/src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.ts +68 -0
  122. package/src/notificationTray/observers/getNotificationTrayItems.ts +44 -0
  123. package/src/notificationTray/observers/getNotificationTraySeen.ts +43 -0
  124. package/src/notificationTray/observers/index.ts +2 -0
  125. package/src/notificationTray/utils/prepareNotificationTrayItemsPayload.ts +12 -0
  126. package/src/utils/linkedObject/index.ts +2 -0
  127. package/src/utils/linkedObject/notificationTrayLinkedObject.ts +19 -0
  128. package/dist/channelRepository/api/markChannelsAsReadBySegment.d.ts +0 -16
  129. package/dist/channelRepository/api/markChannelsAsReadBySegment.d.ts.map +0 -1
  130. package/dist/channelRepository/events/onChannelUnreadUpdatedLocal.d.ts.map +0 -1
  131. package/dist/channelRepository/internalApi/getTotalChannelsUnread.d.ts +0 -11
  132. package/dist/channelRepository/internalApi/getTotalChannelsUnread.d.ts.map +0 -1
  133. package/dist/channelRepository/observers/getTotalChannelsUnread.d.ts +0 -20
  134. package/dist/channelRepository/observers/getTotalChannelsUnread.d.ts.map +0 -1
  135. package/dist/channelRepository/utils/getLegacyChannelUnread.d.ts +0 -2
  136. package/dist/channelRepository/utils/getLegacyChannelUnread.d.ts.map +0 -1
  137. package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine.d.ts +0 -33
  138. package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine.d.ts.map +0 -1
  139. package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.d.ts +0 -3
  140. package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.d.ts.map +0 -1
  141. package/dist/marker/events/onChannelUnreadInfoUpdatedLocal.d.ts +0 -12
  142. package/dist/marker/events/onChannelUnreadInfoUpdatedLocal.d.ts.map +0 -1
  143. package/src/channelRepository/api/markChannelsAsReadBySegment.ts +0 -29
  144. package/src/channelRepository/internalApi/getTotalChannelsUnread.ts +0 -38
  145. package/src/channelRepository/observers/getTotalChannelsUnread.ts +0 -129
  146. package/src/channelRepository/utils/getLegacyChannelUnread.ts +0 -5
  147. package/src/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine.ts +0 -267
  148. package/src/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.ts +0 -21
  149. package/src/marker/events/onChannelUnreadInfoUpdatedLocal.ts +0 -29
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Internal used only
3
3
  *
4
- * Fired when an {@link Amity.ChannelUnread} has been updated.
4
+ * Fired when an {@link Amity.userMessageFeedMarkers} has been resolved by Object Rsesolver
5
5
  *
6
6
  * @param callback The function to call when the event was fired
7
7
  * @returns an {@link Amity.Unsubscriber} function to stop listening
8
8
  *
9
- * @category Channel Events
9
+ * @category MessageMarker Events
10
10
  */
11
11
  export declare const onChannelUnreadUpdatedLocal: (callback: Amity.Listener<Amity.Events['local.channelUnread.updated']>) => Amity.Unsubscriber;
12
12
  //# sourceMappingURL=onChannelUnreadUpdatedLocal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onChannelUnreadUpdatedLocal.d.ts","sourceRoot":"","sources":["../../../src/marker/events/onChannelUnreadUpdatedLocal.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,aAC5B,MAAM,QAAQ,CAAC,MAAM,MAAM,CAAC,6BAA6B,CAAC,CAAC,KACpE,MAAM,YAaR,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"onMessageCreated.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/events/onMessageCreated.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,aACrB,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,KAC9C,MAAM,YA0ER,CAAC;AAEF,eAAO,MAAM,qBAAqB,aACtB,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,KAC9C,MAAM,YAoBR,CAAC"}
1
+ {"version":3,"file":"onMessageCreated.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/events/onMessageCreated.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,aACrB,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,KAC9C,MAAM,YA+BR,CAAC;AAEF,eAAO,MAAM,qBAAqB,aACtB,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,KAC9C,MAAM,YAoBR,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getMessage.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/observers/getMessage.ts"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,UAAU,cACV,MAAM,OAAO,CAAC,WAAW,CAAC,YAC3B,MAAM,kBAAkB,CAAC,MAAM,OAAO,CAAC,KAChD,MAAM,YAmBR,CAAC"}
1
+ {"version":3,"file":"getMessage.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/observers/getMessage.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,UAAU,cACV,MAAM,OAAO,CAAC,WAAW,CAAC,YAC3B,MAAM,kBAAkB,CAAC,MAAM,OAAO,CAAC,KAChD,MAAM,YAmBR,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"markReadMessage.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/utils/markReadMessage.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,YAAa,MAAM,eAAe,SAU7D,CAAC"}
1
+ {"version":3,"file":"markReadMessage.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/utils/markReadMessage.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,YAAa,MAAM,eAAe,SAK7D,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './markItemsSeen';
2
+ export * from './markTraySeen';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * ```js
3
+ * import { notificationTray } from '@amityco/ts-sdk'
4
+ * const updated = await notificationTray.markItemsSeen()
5
+ * ```
6
+ *
7
+ * Updates an {@link Amity.NotificationItemSeen}
8
+ *
9
+ * @param trayItems[] that include id and lastTraySeenAt, The ID of the {@link Amity.NotificationItemSeen} to edit
10
+ * @returns the updated {@link Amity.NotificationItemSeen} object
11
+ *
12
+ * @category NotificationItemSeen API
13
+ * @async
14
+ */
15
+ export declare const markItemsSeen: (patch: Amity.QueryNotificationItemSeen) => Promise<void>;
16
+ //# sourceMappingURL=markItemsSeen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markItemsSeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/api/markItemsSeen.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,UAAiB,MAAM,yBAAyB,kBAoCzE,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * ```js
3
+ * import { notificationTray } from '@amityco/ts-sdk'
4
+ * const updated = await notificationTray.markTraySeen({
5
+ * lastSeenAt: Amity.timestamp,
6
+ * })
7
+ * ```
8
+ *
9
+ * Updates an {@link Amity.NotificationTraySeen}
10
+ *
11
+ * @param userId The ID of the {@link Amity.NotificationTraySeen} to edit
12
+ * @param lastSeenAt The patch data to apply
13
+ * @returns the updated {@link Amity.NotificationTraySeen} object
14
+ *
15
+ * @category Post API
16
+ * @async
17
+ */
18
+ export declare const markTraySeen: (lastSeenAt: Amity.timestamp) => Promise<Amity.Cached<Amity.NotificationTraySeenUpdatedPayload>>;
19
+ //# sourceMappingURL=markTraySeen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markTraySeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/api/markTraySeen.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,YAAY,eACX,MAAM,SAAS,KAC1B,QAAQ,MAAM,MAAM,CAAC,MAAM,kCAAkC,CAAC,CAqChE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './onNotificationTraySeenUpdated';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * ```js
3
+ * import { onNotificationTraySeenUpdated } from '@amityco/ts-sdk'
4
+ * const dispose = onNotificationTraySeenUpdated(data => {
5
+ * // ...
6
+ * })
7
+ * ```
8
+ *
9
+ * Fired when an {@link Amity.NotificationTraySeen} has been updated
10
+ *
11
+ * @param callback The function to call when the event was fired
12
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
13
+ *
14
+ * @category NotificationTraySeen Events
15
+ */
16
+ export declare const onNotificationTraySeenUpdated: (callback: Amity.Listener<Amity.InternalNotificationTraySeen>) => Amity.Unsubscriber;
17
+ //# sourceMappingURL=onNotificationTraySeenUpdated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onNotificationTraySeenUpdated.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/events/onNotificationTraySeenUpdated.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,6BAA6B,aAC9B,MAAM,QAAQ,CAAC,MAAM,4BAA4B,CAAC,KAC3D,MAAM,YAeR,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './observers';
2
+ export * from './api';
3
+ export * from './events';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notificationTray/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * ```js
3
+ * import { notificationTray } from '@amityco/ts-sdk'
4
+ * const notificationTraySeen = await notificationTray.getNotificationTraySeen()
5
+ * ```
6
+ *
7
+ *
8
+ * @returns A page of {@link Amity.NotificationTraySeen} objects
9
+ *
10
+ * @category NotificationTray API
11
+ * @async
12
+ * */
13
+ export declare const getNotificationTraySeen: {
14
+ (): Promise<Amity.Cached<Amity.NotificationTraySeen>>;
15
+ /**
16
+ * ```js
17
+ * import { notificationTray } from '@amityco/ts-sdk'
18
+ * const notificationTraySeen = await notificationTray.getNotificationTraySeen.locally()
19
+ * ```
20
+ *
21
+ * Queries a paginable list of {@link Amity.NotificationTraySeen} objects from cache
22
+ *
23
+ * @returns A page of {@link Amity.NotificationTraySeen} objects
24
+ *
25
+ * @category NotificationTray API
26
+ * @async
27
+ * */
28
+ locally(): Amity.Cached<Amity.NotificationTraySeenPayload> | undefined;
29
+ };
30
+ //# sourceMappingURL=getNotificationTraySeen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNotificationTraySeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/internalApi/getNotificationTraySeen.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;KAWK;AACL,eAAO,MAAM,uBAAuB;QAAa,QAC/C,MAAM,MAAM,CAAC,MAAM,oBAAoB,CAAC,CACzC;IA+BD;;;;;;;;;;;;SAYK;eAED,MAAM,MAAM,CAAC,MAAM,2BAA2B,CAAC,GAC/C,SAAS;CAlBZ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { NotificationTrayItemsPaginationController } from './NotificationTrayItemsPaginationController';
2
+ import { LiveCollectionController } from '~/core/liveCollection/LiveCollectionController';
3
+ export declare class NotificationTrayItemsLiveCollectionController extends LiveCollectionController<'notificationTrayItem', Amity.NotificationTrayItemLiveCollection, Amity.NotificationTrayItem, NotificationTrayItemsPaginationController> {
4
+ private queryStreamController;
5
+ private query;
6
+ constructor(query: Amity.NotificationTrayItemLiveCollection, callback: Amity.LiveCollectionCallback<Amity.NotificationTrayItem>);
7
+ protected setup(): void;
8
+ protected persistModel(queryPayload: Amity.NotificationTrayPayload & Amity.Pagination): Promise<void>;
9
+ protected persistQueryStream({ response, direction, refresh, }: Amity.LiveCollectionPersistQueryStreamParams<'notificationTrayItem'>): void;
10
+ startSubscription(): Amity.Unsubscriber[];
11
+ notifyChange({ origin, loading, error }: Amity.LiveCollectionNotifyParams): void;
12
+ }
13
+ //# sourceMappingURL=NotificationTrayItemsLiveCollectionController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationTrayItemsLiveCollectionController.d.ts","sourceRoot":"","sources":["../../../../src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yCAAyC,EAAE,MAAM,6CAA6C,CAAC;AAExG,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAK1F,qBAAa,6CAA8C,SAAQ,wBAAwB,CACzF,sBAAsB,EACtB,KAAK,CAAC,kCAAkC,EACxC,KAAK,CAAC,oBAAoB,EAC1B,yCAAyC,CAC1C;IACC,OAAO,CAAC,qBAAqB,CAA6C;IAE1E,OAAO,CAAC,KAAK,CAA2C;gBAGtD,KAAK,EAAE,KAAK,CAAC,kCAAkC,EAC/C,QAAQ,EAAE,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,oBAAoB,CAAC;IAoBpE,SAAS,CAAC,KAAK;cAYC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,uBAAuB,GAAG,KAAK,CAAC,UAAU;IAI3F,SAAS,CAAC,kBAAkB,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,KAAK,CAAC,sCAAsC,CAAC,sBAAsB,CAAC;IAKvE,iBAAiB;IAIjB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,0BAA0B;CAyB1E"}
@@ -0,0 +1,9 @@
1
+ import { PaginationController } from '~/core/liveCollection/PaginationController';
2
+ /**
3
+ * TODO: handle cache receive cache option, and cache policy
4
+ * TODO: check if querybyIds is supported
5
+ */
6
+ export declare class NotificationTrayItemsPaginationController extends PaginationController<'notificationTrayItem', Amity.NotificationTrayItemLiveCollection> {
7
+ getRequest(queryParams: Amity.NotificationTrayItemLiveCollection, token: string | undefined): Promise<Amity.NotificationTrayPayload & Amity.Pagination>;
8
+ }
9
+ //# sourceMappingURL=NotificationTrayItemsPaginationController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationTrayItemsPaginationController.d.ts","sourceRoot":"","sources":["../../../../src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAGlF;;;GAGG;AACH,qBAAa,yCAA0C,SAAQ,oBAAoB,CACjF,sBAAsB,EACtB,KAAK,CAAC,kCAAkC,CACzC;IACO,UAAU,CACd,WAAW,EAAE,KAAK,CAAC,kCAAkC,EACrD,KAAK,EAAE,MAAM,GAAG,SAAS;CAiB5B"}
@@ -0,0 +1,9 @@
1
+ import { QueryStreamController } from '~/core/liveCollection/QueryStreamController';
2
+ export declare class NotificationTrayItemsQuerystreamController extends QueryStreamController<Amity.NotificationTrayPayload, Amity.NotificationTrayItemLiveCollection> {
3
+ private notifyChange;
4
+ private preparePayload;
5
+ constructor(query: Amity.NotificationTrayItemLiveCollection, cacheKey: string[], notifyChange: (params: Amity.LiveCollectionNotifyParams) => void, preparePayload: (response: Amity.NotificationTrayPayload) => Amity.ProcessedNotificationTrayPayload);
6
+ saveToMainDB(response: Amity.NotificationTrayPayload): Promise<void>;
7
+ appendToQueryStream(response: Amity.NotificationTrayPayload & Partial<Amity.Pagination>, direction: Amity.LiveCollectionPageDirection, refresh?: boolean): void;
8
+ }
9
+ //# sourceMappingURL=NotificationTrayItemsQuerystreamController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationTrayItemsQuerystreamController.d.ts","sourceRoot":"","sources":["../../../../src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAMpF,qBAAa,0CAA2C,SAAQ,qBAAqB,CACnF,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,kCAAkC,CACzC;IACC,OAAO,CAAC,YAAY,CAAqD;IAEzE,OAAO,CAAC,cAAc,CAEsB;gBAG1C,KAAK,EAAE,KAAK,CAAC,kCAAkC,EAC/C,QAAQ,EAAE,MAAM,EAAE,EAClB,YAAY,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,0BAA0B,KAAK,IAAI,EAChE,cAAc,EAAE,CACd,QAAQ,EAAE,KAAK,CAAC,uBAAuB,KACpC,KAAK,CAAC,gCAAgC;IAOvC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,uBAAuB;IAW1D,mBAAmB,CACjB,QAAQ,EAAE,KAAK,CAAC,uBAAuB,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,EACnE,SAAS,EAAE,KAAK,CAAC,2BAA2B,EAC5C,OAAO,UAAQ;CAwBlB"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Get notification tray items for a notification tray page
3
+ *
4
+ * @param params the limit query parameters
5
+ * @param callback the callback to be called when the notification tray items are updated
6
+ * @returns items in the notification tray
7
+ *
8
+ * @category Notification tray items Live Collection
9
+ *
10
+ */
11
+ export declare const getNotificationTrayItems: (params: Amity.LiveCollectionParams<Amity.NotificationTrayItemLiveCollection>, callback: Amity.LiveCollectionCallback<Amity.NotificationTrayItem>, config?: Amity.LiveCollectionConfig) => () => void;
12
+ //# sourceMappingURL=getNotificationTrayItems.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNotificationTrayItems.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/observers/getNotificationTrayItems.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,WAC3B,MAAM,oBAAoB,CAAC,MAAM,kCAAkC,CAAC,YAClE,MAAM,sBAAsB,CAAC,MAAM,oBAAoB,CAAC,WACzD,MAAM,oBAAoB,eAyBpC,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * ```js
3
+ * import { getNotificationTraySeen } from '@amityco/ts-sdk';
4
+ *
5
+ * let notificationTraySeen;
6
+ *
7
+ * const unsubscribe = getNotificationTraySeen(userId, response => {
8
+ * notificationTraySeen = response.data;
9
+ * });
10
+ * ```
11
+ *
12
+ * Observe all mutation on a given {@link Amity.NotificationTraySeen}
13
+ *
14
+ * @param userId the ID of the user to observe
15
+ * @param callback the function to call when new data are available
16
+ * @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the message
17
+ *
18
+ * @category NotificationTraySeen Live Object
19
+ */
20
+ export declare const getNotificationTraySeen: (callback: Amity.LiveObjectCallback<Amity.NotificationTraySeenPayload>) => Amity.Unsubscriber;
21
+ //# sourceMappingURL=getNotificationTraySeen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNotificationTraySeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/observers/getNotificationTraySeen.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,uBAAuB,aACxB,MAAM,kBAAkB,CAAC,MAAM,2BAA2B,CAAC,KACpE,MAAM,YAYR,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './getNotificationTraySeen';
2
+ export * from './getNotificationTrayItems';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/observers/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const prepareNotificationTrayItemsPayload: (rawPayload: Amity.NotificationTrayPayload) => Amity.ProcessedNotificationTrayPayload;
2
+ //# sourceMappingURL=prepareNotificationTrayItemsPayload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareNotificationTrayItemsPayload.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/utils/prepareNotificationTrayItemsPayload.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mCAAmC,eAClC,MAAM,uBAAuB,KACxC,MAAM,gCAOR,CAAC"}
@@ -11,5 +11,6 @@ export declare const LinkedObject: {
11
11
  reactor: (reactor: Amity.InternalReactor) => Amity.Reactor;
12
12
  channel: (channel: Amity.InternalChannel<any>) => Amity.Channel<any>;
13
13
  pinnedPost: (pinnedPost: Amity.RawPin) => Amity.PinnedPost;
14
+ notificationTray: (noti: Amity.RawNotificationTrayItem) => Amity.NotificationTrayItem;
14
15
  };
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAaxB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/index.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;CAcxB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const notificationTrayLinkedObject: (noti: Amity.InternalNotificationTrayItem) => Amity.NotificationTrayItem;
2
+ //# sourceMappingURL=notificationTrayLinkedObject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notificationTrayLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/notificationTrayLinkedObject.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,4BAA4B,SACjC,MAAM,4BAA4B,KACvC,MAAM,oBAWR,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ts-sdk",
3
- "version": "7.1.1-67cf0d9.0",
3
+ "version": "7.1.1-6dd179b0.0",
4
4
  "license": "CC-BY-ND-4.0",
5
5
  "author": "amity.co <developers@amity.co> (https://amity.co)",
6
6
  "description": "Amity Social Cloud Typescript SDK",
@@ -237,8 +237,7 @@ declare global {
237
237
  };
238
238
 
239
239
  'local.subChannelUnread.updated': Amity.SubChannelUnreadInfo;
240
- 'local.channelUnreadInfo.updated': Amity.ChannelUnreadInfo;
241
- 'local.channelUnread.updated': Amity.ChannelUnread;
240
+ 'local.channelUnread.updated': Amity.ChannelUnreadInfo;
242
241
 
243
242
  'local.story.created': Amity.StoryPayload;
244
243
  'local.story.updated': Amity.StoryPayload;
@@ -256,6 +255,11 @@ declare global {
256
255
  'local.story.error': Amity.StoryPayload;
257
256
  'local.story.reload': { referenceIds: Amity.Story['referenceId'][] };
258
257
 
258
+ 'local.notificationTraySeen.updated': Amity.InternalNotificationTraySeen;
259
+ 'local.notificationTrayItem.updated': {
260
+ notificationTrayItems: Amity.InternalNotificationTrayItem[];
261
+ };
262
+
259
263
  sessionStateChange: Amity.SessionStates;
260
264
  // used by accessTokenExpiryWatcher
261
265
  tokenExpired: Amity.SessionStates.TOKEN_EXPIRED;
@@ -25,8 +25,6 @@ declare global {
25
25
  channelUnreadInfo: Amity.ChannelUnreadInfo;
26
26
  subChannelUnreadInfo: Amity.SubChannelUnreadInfo;
27
27
 
28
- channelUnread: Amity.ChannelUnread;
29
-
30
28
  channelMarker: Amity.ChannelMarker;
31
29
  subChannelMarker: Amity.SubChannelMarker;
32
30
  messageMarker: Amity.MessageMarker;
@@ -57,6 +55,9 @@ declare global {
57
55
 
58
56
  pinTarget: Amity.InternalPinTarget;
59
57
  pin: Amity.InternalPin;
58
+
59
+ notificationTrayItem: Amity.InternalNotificationTrayItem;
60
+ notificationTraySeen: Amity.InternalNotificationTraySeen;
60
61
  };
61
62
 
62
63
  type Model = ValueOf<Models>;
@@ -86,8 +87,6 @@ declare global {
86
87
  channelUnreadInfo: Pick<Amity.ChannelUnreadInfo, 'channelId'>;
87
88
  subChannelUnreadInfo: Pick<Amity.SubChannelUnreadInfo, 'subChannelId'>;
88
89
 
89
- channelUnread: Pick<Amity.ChannelUnread, 'channelId'>;
90
-
91
90
  channelMarker: Pick<Amity.ChannelMarker, 'entityId' | 'userId'>;
92
91
  subChannelMarker: Pick<Amity.SubChannelMarker, 'feedId' | 'entityId' | 'userId'>;
93
92
  messageMarker: Pick<Amity.MessageMarker, 'feedId' | 'contentId' | 'creatorId'>;
@@ -118,6 +117,9 @@ declare global {
118
117
 
119
118
  pinTarget: Pick<Amity.InternalPinTarget, 'targetId'>;
120
119
  pin: Pick<Amity.InternalPin, 'placement' | 'referenceId'>;
120
+
121
+ notificationTrayItem: Amity.InternalNotificationTrayItem;
122
+ notificationTraySeen: Amity.InternalNotificationTraySeen;
121
123
  };
122
124
  }
123
125
  }
@@ -26,6 +26,7 @@ declare global {
26
26
  blockUser: Amity.BlockedUserPayload;
27
27
  semanticSearchPost: Amity.SemanticSearchPostPayload;
28
28
  semanticSearchCommunity: Amity.SemanticSearchCommunityPayload;
29
+ notificationTrayItem: Amity.NotificationTrayPayload;
29
30
  };
30
31
 
31
32
  type UserPayload = {
@@ -378,6 +379,30 @@ declare global {
378
379
  reactions: Amity.InternalReactor[];
379
380
  } & Amity.StoryPayload;
380
381
 
382
+ type NotificationTrayPayload = {
383
+ notificationTrayItems: Amity.RawNotificationTrayItem[];
384
+ users: Amity.RawUser[];
385
+ files?: Amity.File[];
386
+ };
387
+
388
+ type ProcessedNotificationTrayPayload = Omit<
389
+ NotificationTrayPayload,
390
+ 'notificationTrayItems' | 'users'
391
+ > & {
392
+ notificationTrayItems: Amity.InternalNotificationTrayItem[];
393
+ users: Amity.InternalUser[];
394
+ files?: Amity.File[];
395
+ };
396
+
397
+ type NotificationTraySeenPayload = {
398
+ lastTraySeenAt: Amity.timestamp;
399
+ lastTrayOccuredAt: Amity.timestamp;
400
+ };
401
+
402
+ type NotificationTraySeenUpdatedPayload = {
403
+ lastTraySeenAt: Amity.timestamp;
404
+ };
405
+
381
406
  /**
382
407
  * Items that extend from `Amity.PostPayload`
383
408
  * - communities: `Amity.RawCommunity` -> `Amity.Community` (Added Marker Service related props)
@@ -8,25 +8,12 @@ declare global {
8
8
  }
9
9
 
10
10
  type ReadReceipt = {
11
- channelId: Amity.Channel['channelId'];
12
- latestSegment: number;
13
- latestSyncSegment: number;
14
- };
15
-
16
- type ReadReceiptSyncJob = {
17
- channelId: Amity.Channel['channelId'];
18
- segment: number;
19
- syncState: ReadReceiptSyncState;
20
- retryCount: number;
21
- };
22
-
23
- type LegacyReadReceipt = {
24
11
  subChannelId: Amity.SubChannel['subChannelId'];
25
12
  latestSegment: number;
26
13
  latestSyncSegment: number;
27
14
  };
28
15
 
29
- type LegacyReadReceiptSyncJob = {
16
+ type ReadReceiptSyncJob = {
30
17
  subChannelId: Amity.SubChannel['subChannelId'];
31
18
  segment: number;
32
19
  syncState: ReadReceiptSyncState;
@@ -84,8 +84,6 @@ declare global {
84
84
  > & {
85
85
  isMentioned: boolean;
86
86
  subChannelsUnreadCount: number;
87
- // legacy unread count does not use the maker service
88
- unreadCount: number;
89
87
  };
90
88
 
91
89
  /* public type */
@@ -139,16 +137,5 @@ declare global {
139
137
  Amity.Membership<'channel'>['userId'],
140
138
  Pick<QueryChannelMembers, 'page'>
141
139
  >;
142
-
143
- // Use for channel's unread count value stored in the local cache
144
- type ChannelUnread = {
145
- channelId: Amity.Channel['channelId'];
146
- unreadCount: number;
147
- isMentioned: boolean;
148
- readToSegment: number | null;
149
- lastSegment: number;
150
- lastMentionedSegment: number | null;
151
- isDeleted: boolean;
152
- };
153
140
  }
154
141
  }
@@ -36,7 +36,6 @@ declare global {
36
36
 
37
37
  log: Logger;
38
38
  http: AxiosInstance;
39
- upload: AxiosInstance;
40
39
  mqtt?: Amity.MqttClient;
41
40
  ws?: SocketIOClient.Socket;
42
41
  emitter: Emitter<Amity.Events>;
@@ -57,8 +56,6 @@ declare global {
57
56
 
58
57
  isUnreadCountEnabled: boolean;
59
58
 
60
- useLegacyUnreadCount: boolean;
61
-
62
59
  use: () => void;
63
60
 
64
61
  accessTokenExpiryWatcher: (sessionHandler: Amity.SessionHandler) => Amity.Unsubscriber;
@@ -0,0 +1,90 @@
1
+ export {};
2
+
3
+ declare global {
4
+ namespace Amity {
5
+ const enum TrayItemCategoryType {
6
+ POST_MENTION = 'mention_in_post',
7
+ COMMENT_MENTION = 'mention_in_comment',
8
+ POST_REACT = 'react_to_post',
9
+ COMMENT_REACT = 'react_to_comment',
10
+ }
11
+
12
+ const enum TrayAction {
13
+ POST = 'post',
14
+ POLL = 'poll',
15
+ COMMENT = 'comment',
16
+ REACTION = 'reaction',
17
+ MENTION = 'mention',
18
+ REPLY = 'reply',
19
+ }
20
+
21
+ type RawNotificationTrayItem = {
22
+ _id: string;
23
+ lastSeenAt: Amity.timestamp;
24
+ lastOccurredAt: Amity.timestamp;
25
+ actors: {
26
+ _id: string;
27
+ lastActedAt: Amity.timestamp;
28
+ }[];
29
+ actorsCount: number;
30
+ trayItemCategory?: TrayItemCategoryType;
31
+ targetId: string;
32
+ targetType: string;
33
+ referenceId?: string;
34
+ referenceType?: string;
35
+ actionType: TrayAction;
36
+ actionReferenceId?: string;
37
+ parentId?: string;
38
+ data: { communityName: string } | { reactionName: string[] };
39
+ text: string;
40
+ templatedText: string;
41
+ daySegment?: Amity.timestamp;
42
+ };
43
+
44
+ type InternalNotificationTrayItem = RawNotificationTrayItem;
45
+
46
+ type QueryNotificationTrayItem = {
47
+ token?: Amity.Token;
48
+ limit?: Amity.PageLimit['limit'];
49
+ };
50
+
51
+ type NotificationTrayItemLiveCollection = Amity.LiveCollectionParams<
52
+ Omit<QueryNotificationTrayItem, 'limit'>
53
+ >;
54
+
55
+ type NotificationTrayItemLiveCollectionCache = Amity.LiveCollectionCache<
56
+ Amity.InternalNotificationTrayItem['_id'],
57
+ Pick<QueryNotificationTrayItem, 'limit'>
58
+ >;
59
+
60
+ type NotificationTrayItem = Amity.InternalNotificationTrayItem & {
61
+ isSeen: boolean;
62
+ isRecent: boolean;
63
+ users: Amity.User[];
64
+ };
65
+
66
+ type RawNotificationTraySeen = {
67
+ lastTraySeenAt: Amity.timestamp;
68
+ lastTrayOccuredAt: Amity.timestamp;
69
+ };
70
+
71
+ type RawNotificationTraySeenUpdated = {
72
+ lastTraySeenAt: Amity.timestamp;
73
+ };
74
+
75
+ type InternalNotificationTraySeen = RawNotificationTraySeen & { userId: string };
76
+
77
+ type NotificationTraySeen = RawNotificationTraySeen & { userId: string; isSeen: boolean };
78
+
79
+ type RawNotificationItemSeen = {
80
+ lastSeenAt: Amity.timestamp;
81
+ };
82
+
83
+ type QueryNotificationItemSeen = {
84
+ trayItems: {
85
+ id: string;
86
+ lastSeenAt: Amity.timestamp;
87
+ }[];
88
+ };
89
+ }
90
+ }
@@ -37,3 +37,4 @@ export * from './domains/message';
37
37
  export * from './domains/post';
38
38
  export * from './domains/story';
39
39
  export * from './domains/ad';
40
+ export * from './domains/notification';
@@ -6,7 +6,6 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
6
6
  import { prepareChannelPayload } from '../utils/prepareChannelPayload';
7
7
  import { addFlagIsDeletedSubChannelUnreadByChannelId } from '~/marker/utils/addFlagIsDeletedSubChannelUnreadByChannelId';
8
8
  import { deleteChannelUnreadByChannelId } from '../../marker/utils/deleteChannelUnreadByChannelId';
9
- import { dropFromCache, pullFromCache, pushToCache } from '~/cache/api';
10
9
 
11
10
  type CallbackFn = (channel: Amity.StaticInternalChannel) => void;
12
11
  const callbacks: CallbackFn[] = [];
@@ -29,24 +28,12 @@ export const onChannelDeleted = (callback: Amity.Listener<Amity.StaticInternalCh
29
28
  const filter = async (payload: Amity.ChannelPayload) => {
30
29
  const data = await prepareChannelPayload(payload);
31
30
 
32
- const isConsistentMode = client.getMarkerSyncConsistentMode() && client.isUnreadCountEnabled;
33
- const isLegacyUnreadCount = client.useLegacyUnreadCount;
34
-
35
- data.channels.forEach(channel => {
36
- if (isConsistentMode) {
31
+ if (client.isUnreadCountEnabled && client.getMarkerSyncConsistentMode()) {
32
+ data.channels.forEach(channel => {
37
33
  addFlagIsDeletedSubChannelUnreadByChannelId(channel.channelId);
38
34
  deleteChannelUnreadByChannelId(channel.channelId);
39
- } else if (isLegacyUnreadCount) {
40
- const cacheKey = ['channelUnread', 'get', channel.channelId];
41
- const cache = pullFromCache<Amity.ChannelUnread>(cacheKey);
42
- if (cache) {
43
- pushToCache(cacheKey, {
44
- ...cache,
45
- isDeleted: true,
46
- });
47
- }
48
- }
49
- });
35
+ });
36
+ }
50
37
 
51
38
  ingestInCache(data);
52
39
  callbacks.forEach(cb => cb(data.channels[0]));