@amityco/ts-sdk 7.1.1-e23f973a.0 → 7.2.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 (152) hide show
  1. package/.env +26 -26
  2. package/dist/@types/core/events.d.ts +2 -5
  3. package/dist/@types/core/events.d.ts.map +1 -1
  4. package/dist/@types/core/model.d.ts +2 -4
  5. package/dist/@types/core/model.d.ts.map +1 -1
  6. package/dist/@types/core/payload.d.ts +0 -18
  7. package/dist/@types/core/payload.d.ts.map +1 -1
  8. package/dist/@types/core/readReceipt.d.ts +12 -1
  9. package/dist/@types/core/readReceipt.d.ts.map +1 -1
  10. package/dist/@types/domains/channel.d.ts +10 -0
  11. package/dist/@types/domains/channel.d.ts.map +1 -1
  12. package/dist/@types/domains/client.d.ts +2 -0
  13. package/dist/@types/domains/client.d.ts.map +1 -1
  14. package/dist/@types/index.d.ts +0 -1
  15. package/dist/@types/index.d.ts.map +1 -1
  16. package/dist/channelRepository/api/markChannelsAsReadBySegment.d.ts +16 -0
  17. package/dist/channelRepository/api/markChannelsAsReadBySegment.d.ts.map +1 -0
  18. package/dist/channelRepository/events/onChannelDeleted.d.ts.map +1 -1
  19. package/dist/channelRepository/events/onChannelLeft.d.ts.map +1 -1
  20. package/dist/{marker → channelRepository}/events/onChannelUnreadUpdatedLocal.d.ts +2 -2
  21. package/dist/channelRepository/events/onChannelUnreadUpdatedLocal.d.ts.map +1 -0
  22. package/dist/channelRepository/internalApi/getTotalChannelsUnread.d.ts +11 -0
  23. package/dist/channelRepository/internalApi/getTotalChannelsUnread.d.ts.map +1 -0
  24. package/dist/channelRepository/observers/getChannel.d.ts.map +1 -1
  25. package/dist/channelRepository/observers/getChannels/ChannelLiveCollectionController.d.ts.map +1 -1
  26. package/dist/channelRepository/observers/getTotalChannelsUnread.d.ts +20 -0
  27. package/dist/channelRepository/observers/getTotalChannelsUnread.d.ts.map +1 -0
  28. package/dist/channelRepository/observers/index.d.ts +1 -0
  29. package/dist/channelRepository/observers/index.d.ts.map +1 -1
  30. package/dist/channelRepository/utils/constructChannelDynamicValue.d.ts.map +1 -1
  31. package/dist/channelRepository/utils/getLegacyChannelUnread.d.ts +2 -0
  32. package/dist/channelRepository/utils/getLegacyChannelUnread.d.ts.map +1 -0
  33. package/dist/channelRepository/utils/prepareChannelPayload.d.ts.map +1 -1
  34. package/dist/client/api/createClient.d.ts +1 -0
  35. package/dist/client/api/createClient.d.ts.map +1 -1
  36. package/dist/client/api/enableUnreadCount.d.ts.map +1 -1
  37. package/dist/client/api/login.d.ts.map +1 -1
  38. package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine.d.ts +33 -0
  39. package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine.d.ts.map +1 -0
  40. package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.d.ts +3 -0
  41. package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.d.ts.map +1 -0
  42. package/dist/client/utils/ReadReceiptSync/readReceiptSyncEngine.d.ts +2 -4
  43. package/dist/client/utils/ReadReceiptSync/readReceiptSyncEngine.d.ts.map +1 -1
  44. package/dist/client/utils/endpoints.d.ts +1 -0
  45. package/dist/client/utils/endpoints.d.ts.map +1 -1
  46. package/dist/client/utils/setClientToken.d.ts.map +1 -1
  47. package/dist/commentRepository/events/utils.d.ts.map +1 -1
  48. package/dist/core/events.d.ts +3 -3
  49. package/dist/core/events.d.ts.map +1 -1
  50. package/dist/core/model/idResolvers.d.ts.map +1 -1
  51. package/dist/core/model/index.d.ts.map +1 -1
  52. package/dist/index.cjs.js +657 -474
  53. package/dist/index.d.ts +0 -1
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.esm.js +639 -455
  56. package/dist/index.umd.js +4 -4
  57. package/dist/marker/events/onChannelUnreadInfoUpdatedLocal.d.ts +12 -0
  58. package/dist/marker/events/onChannelUnreadInfoUpdatedLocal.d.ts.map +1 -0
  59. package/dist/messageRepository/events/onMessageCreated.d.ts.map +1 -1
  60. package/dist/messageRepository/observers/getMessage.d.ts.map +1 -1
  61. package/dist/messageRepository/utils/markReadMessage.d.ts.map +1 -1
  62. package/dist/utils/linkedObject/index.d.ts +0 -1
  63. package/dist/utils/linkedObject/index.d.ts.map +1 -1
  64. package/package.json +1 -1
  65. package/src/@types/core/events.ts +2 -6
  66. package/src/@types/core/model.ts +4 -6
  67. package/src/@types/core/payload.ts +0 -25
  68. package/src/@types/core/readReceipt.ts +14 -1
  69. package/src/@types/domains/channel.ts +13 -0
  70. package/src/@types/domains/client.ts +3 -0
  71. package/src/@types/index.ts +0 -1
  72. package/src/channelRepository/api/markChannelsAsReadBySegment.ts +29 -0
  73. package/src/channelRepository/events/onChannelDeleted.ts +17 -4
  74. package/src/channelRepository/events/onChannelLeft.ts +11 -3
  75. package/src/{marker → channelRepository}/events/onChannelUnreadUpdatedLocal.ts +3 -3
  76. package/src/channelRepository/internalApi/getTotalChannelsUnread.ts +38 -0
  77. package/src/channelRepository/observers/getChannel.ts +3 -1
  78. package/src/channelRepository/observers/getChannels/ChannelLiveCollectionController.ts +6 -1
  79. package/src/channelRepository/observers/getTotalChannelsUnread.ts +129 -0
  80. package/src/channelRepository/observers/index.ts +1 -0
  81. package/src/channelRepository/utils/constructChannelDynamicValue.ts +12 -2
  82. package/src/channelRepository/utils/getLegacyChannelUnread.ts +5 -0
  83. package/src/channelRepository/utils/prepareChannelPayload.ts +68 -17
  84. package/src/client/api/createClient.ts +7 -1
  85. package/src/client/api/enableUnreadCount.ts +1 -0
  86. package/src/client/api/login.ts +5 -1
  87. package/src/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine.ts +267 -0
  88. package/src/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.ts +21 -0
  89. package/src/client/utils/ReadReceiptSync/readReceiptSyncEngine.ts +74 -99
  90. package/src/client/utils/endpoints.ts +1 -0
  91. package/src/client/utils/setClientToken.ts +8 -0
  92. package/src/commentRepository/events/utils.ts +73 -0
  93. package/src/core/model/idResolvers.ts +2 -3
  94. package/src/core/model/index.ts +0 -2
  95. package/src/fileRepository/api/uploadFile.ts +1 -1
  96. package/src/fileRepository/api/uploadImage.ts +1 -1
  97. package/src/fileRepository/api/uploadVideo.ts +1 -1
  98. package/src/index.ts +0 -2
  99. package/src/marker/events/onChannelUnreadInfoUpdatedLocal.ts +29 -0
  100. package/src/messageRepository/events/onMessageCreated.ts +45 -1
  101. package/src/messageRepository/observers/getMessage.ts +0 -1
  102. package/src/messageRepository/utils/markReadMessage.ts +10 -3
  103. package/src/utils/linkedObject/index.ts +0 -2
  104. package/dist/@types/domains/notification.d.ts +0 -82
  105. package/dist/@types/domains/notification.d.ts.map +0 -1
  106. package/dist/marker/events/onChannelUnreadUpdatedLocal.d.ts.map +0 -1
  107. package/dist/notificationTray/api/index.d.ts +0 -3
  108. package/dist/notificationTray/api/index.d.ts.map +0 -1
  109. package/dist/notificationTray/api/markItemsSeen.d.ts +0 -16
  110. package/dist/notificationTray/api/markItemsSeen.d.ts.map +0 -1
  111. package/dist/notificationTray/api/markTraySeen.d.ts +0 -19
  112. package/dist/notificationTray/api/markTraySeen.d.ts.map +0 -1
  113. package/dist/notificationTray/events/index.d.ts +0 -2
  114. package/dist/notificationTray/events/index.d.ts.map +0 -1
  115. package/dist/notificationTray/events/onNotificationTraySeenUpdated.d.ts +0 -17
  116. package/dist/notificationTray/events/onNotificationTraySeenUpdated.d.ts.map +0 -1
  117. package/dist/notificationTray/index.d.ts +0 -4
  118. package/dist/notificationTray/index.d.ts.map +0 -1
  119. package/dist/notificationTray/internalApi/getNotificationTraySeen.d.ts +0 -30
  120. package/dist/notificationTray/internalApi/getNotificationTraySeen.d.ts.map +0 -1
  121. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts +0 -13
  122. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts.map +0 -1
  123. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts +0 -9
  124. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts.map +0 -1
  125. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts +0 -9
  126. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts.map +0 -1
  127. package/dist/notificationTray/observers/getNotificationTrayItems.d.ts +0 -12
  128. package/dist/notificationTray/observers/getNotificationTrayItems.d.ts.map +0 -1
  129. package/dist/notificationTray/observers/getNotificationTraySeen.d.ts +0 -21
  130. package/dist/notificationTray/observers/getNotificationTraySeen.d.ts.map +0 -1
  131. package/dist/notificationTray/observers/index.d.ts +0 -3
  132. package/dist/notificationTray/observers/index.d.ts.map +0 -1
  133. package/dist/notificationTray/utils/prepareNotificationTrayItemsPayload.d.ts +0 -2
  134. package/dist/notificationTray/utils/prepareNotificationTrayItemsPayload.d.ts.map +0 -1
  135. package/dist/utils/linkedObject/notificationTrayLinkedObject.d.ts +0 -2
  136. package/dist/utils/linkedObject/notificationTrayLinkedObject.d.ts.map +0 -1
  137. package/src/@types/domains/notification.ts +0 -91
  138. package/src/notificationTray/api/index.ts +0 -2
  139. package/src/notificationTray/api/markItemsSeen.ts +0 -59
  140. package/src/notificationTray/api/markTraySeen.ts +0 -65
  141. package/src/notificationTray/events/index.ts +0 -1
  142. package/src/notificationTray/events/onNotificationTraySeenUpdated.ts +0 -36
  143. package/src/notificationTray/index.ts +0 -3
  144. package/src/notificationTray/internalApi/getNotificationTraySeen.ts +0 -81
  145. package/src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.ts +0 -96
  146. package/src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.ts +0 -31
  147. package/src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.ts +0 -68
  148. package/src/notificationTray/observers/getNotificationTrayItems.ts +0 -44
  149. package/src/notificationTray/observers/getNotificationTraySeen.ts +0 -43
  150. package/src/notificationTray/observers/index.ts +0 -2
  151. package/src/notificationTray/utils/prepareNotificationTrayItemsPayload.ts +0 -12
  152. package/src/utils/linkedObject/notificationTrayLinkedObject.ts +0 -19
@@ -1 +0,0 @@
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,3 +0,0 @@
1
- export * from './markItemsSeen';
2
- export * from './markTraySeen';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
@@ -1,16 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,19 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- export * from './onNotificationTraySeenUpdated';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
@@ -1,17 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,4 +0,0 @@
1
- export * from './observers';
2
- export * from './api';
3
- export * from './events';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,30 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,13 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,9 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,9 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,12 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,21 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,3 +0,0 @@
1
- export * from './getNotificationTraySeen';
2
- export * from './getNotificationTrayItems';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/observers/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const prepareNotificationTrayItemsPayload: (rawPayload: Amity.NotificationTrayPayload) => Amity.ProcessedNotificationTrayPayload;
2
- //# sourceMappingURL=prepareNotificationTrayItemsPayload.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- export declare const notificationTrayLinkedObject: (noti: Amity.InternalNotificationTrayItem) => Amity.NotificationTrayItem;
2
- //# sourceMappingURL=notificationTrayLinkedObject.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,91 +0,0 @@
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
- action: TrayAction;
31
- trayItemCategory?: TrayItemCategoryType;
32
- targetId: string;
33
- targetType: string;
34
- referenceId?: string;
35
- referenceType?: string;
36
- actionType: string;
37
- actionReferenceId?: string;
38
- parentId?: string;
39
- data: { communityName: string } | { reactionName: string[] };
40
- text: string;
41
- templatedText: string;
42
- daySegment?: Amity.timestamp;
43
- };
44
-
45
- type InternalNotificationTrayItem = RawNotificationTrayItem;
46
-
47
- type QueryNotificationTrayItem = {
48
- token?: Amity.Token;
49
- limit?: Amity.PageLimit['limit'];
50
- };
51
-
52
- type NotificationTrayItemLiveCollection = Amity.LiveCollectionParams<
53
- Omit<QueryNotificationTrayItem, 'limit'>
54
- >;
55
-
56
- type NotificationTrayItemLiveCollectionCache = Amity.LiveCollectionCache<
57
- Amity.InternalNotificationTrayItem['_id'],
58
- Pick<QueryNotificationTrayItem, 'limit'>
59
- >;
60
-
61
- type NotificationTrayItem = Amity.InternalNotificationTrayItem & {
62
- isSeen: boolean;
63
- isRecent: boolean;
64
- users: Amity.User[];
65
- };
66
-
67
- type RawNotificationTraySeen = {
68
- lastTraySeenAt: Amity.timestamp;
69
- lastTrayOccuredAt: Amity.timestamp;
70
- };
71
-
72
- type RawNotificationTraySeenUpdated = {
73
- lastTraySeenAt: Amity.timestamp;
74
- };
75
-
76
- type InternalNotificationTraySeen = RawNotificationTraySeen & { userId: string };
77
-
78
- type NotificationTraySeen = RawNotificationTraySeen & { userId: string; isSeen: boolean };
79
-
80
- type RawNotificationItemSeen = {
81
- lastSeenAt: Amity.timestamp;
82
- };
83
-
84
- type QueryNotificationItemSeen = {
85
- trayItems: {
86
- id: string;
87
- lastSeenAt: Amity.timestamp;
88
- }[];
89
- };
90
- }
91
- }
@@ -1,2 +0,0 @@
1
- export * from './markItemsSeen';
2
- export * from './markTraySeen';
@@ -1,59 +0,0 @@
1
- import { getActiveClient } from '~/client/api/activeClient';
2
- import { fireEvent } from '~/core/events';
3
- import { pullFromCache, pushToCache } from '~/cache/api';
4
-
5
- /* begin_public_function
6
- id: notificationTrayItem.markSeen
7
- */
8
- /**
9
- * ```js
10
- * import { notificationTray } from '@amityco/ts-sdk'
11
- * const updated = await notificationTray.markItemsSeen()
12
- * ```
13
- *
14
- * Updates an {@link Amity.NotificationItemSeen}
15
- *
16
- * @param trayItems[] that include id and lastTraySeenAt, The ID of the {@link Amity.NotificationItemSeen} to edit
17
- * @returns the updated {@link Amity.NotificationItemSeen} object
18
- *
19
- * @category NotificationItemSeen API
20
- * @async
21
- */
22
- export const markItemsSeen = async (patch: Amity.QueryNotificationItemSeen) => {
23
- const client = getActiveClient();
24
- client.log('notificationTray/markItemsSeen', {});
25
-
26
- const { data: payload } = await client.http.put<Amity.RawNotificationTraySeenUpdated>(
27
- `api/v1/notification-tray/items/seen`,
28
- {
29
- patch,
30
- },
31
- );
32
-
33
- const updatedData = patch.trayItems
34
- .map(patchItem => {
35
- const cacheData = pullFromCache<Amity.InternalNotificationTrayItem>([
36
- 'notificationTraySeen',
37
- 'get',
38
- patchItem.id,
39
- ])?.data;
40
-
41
- if (!cacheData) return;
42
-
43
- const data = {
44
- ...cacheData,
45
- ...payload,
46
- };
47
-
48
- if (client.cache) {
49
- const cachedAt = Date.now();
50
- pushToCache(['notificationTrayItem', 'get'], data, { cachedAt });
51
- }
52
-
53
- return data;
54
- })
55
- .filter(Boolean) as Amity.InternalNotificationTrayItem[];
56
-
57
- fireEvent('local.notificationTrayItem.updated', { notificationTrayItems: updatedData });
58
- };
59
- /* end_public_function */
@@ -1,65 +0,0 @@
1
- import { getActiveClient } from '~/client/api';
2
- import { fireEvent } from '~/core/events';
3
- import { pullFromCache, pushToCache } from '~/cache/api';
4
-
5
- /* begin_public_function
6
- id: notificationTray.markSeen
7
- */
8
- /**
9
- * ```js
10
- * import { notificationTray } from '@amityco/ts-sdk'
11
- * const updated = await notificationTray.markTraySeen({
12
- * lastSeenAt: Amity.timestamp,
13
- * })
14
- * ```
15
- *
16
- * Updates an {@link Amity.NotificationTraySeen}
17
- *
18
- * @param userId The ID of the {@link Amity.NotificationTraySeen} to edit
19
- * @param lastSeenAt The patch data to apply
20
- * @returns the updated {@link Amity.NotificationTraySeen} object
21
- *
22
- * @category Post API
23
- * @async
24
- */
25
- export const markTraySeen = async (
26
- lastSeenAt: Amity.timestamp,
27
- ): Promise<Amity.Cached<Amity.NotificationTraySeenUpdatedPayload>> => {
28
- const client = getActiveClient();
29
- client.log('notificationTray/markTraySeen', {});
30
-
31
- const { data: payload } = await client.http.put<Amity.NotificationTraySeenUpdatedPayload>(
32
- `api/v1/notification-tray/tray/seen`,
33
- {
34
- lastSeenAt,
35
- },
36
- );
37
-
38
- const cacheData = pullFromCache<Amity.InternalNotificationTraySeen>([
39
- 'notificationTraySeen',
40
- 'get',
41
- ])?.data;
42
-
43
- const data = {
44
- userId: client.userId!,
45
- ...payload,
46
- } as Amity.InternalNotificationTraySeen;
47
-
48
- const updateCacheData = {
49
- ...cacheData,
50
- ...data,
51
- };
52
-
53
- const cachedAt = client.cache && Date.now();
54
-
55
- if (client.cache)
56
- pushToCache(['notificationTraySeen', 'get', client.userId!], updateCacheData, { cachedAt });
57
-
58
- fireEvent('local.notificationTraySeen.updated', data);
59
-
60
- return {
61
- data: payload,
62
- cachedAt,
63
- };
64
- };
65
- /* end_public_function */
@@ -1 +0,0 @@
1
- export * from './onNotificationTraySeenUpdated';
@@ -1,36 +0,0 @@
1
- import { getActiveClient } from '~/client/api/activeClient';
2
- import { createEventSubscriber } from '~/core/events';
3
-
4
- /**
5
- * ```js
6
- * import { onNotificationTraySeenUpdated } from '@amityco/ts-sdk'
7
- * const dispose = onNotificationTraySeenUpdated(data => {
8
- * // ...
9
- * })
10
- * ```
11
- *
12
- * Fired when an {@link Amity.NotificationTraySeen} has been updated
13
- *
14
- * @param callback The function to call when the event was fired
15
- * @returns an {@link Amity.Unsubscriber} function to stop listening
16
- *
17
- * @category NotificationTraySeen Events
18
- */
19
- export const onNotificationTraySeenUpdated = (
20
- callback: Amity.Listener<Amity.InternalNotificationTraySeen>,
21
- ): Amity.Unsubscriber => {
22
- const client = getActiveClient();
23
-
24
- const disposers = [
25
- createEventSubscriber(
26
- client,
27
- 'onNotificationTraySeenUpdated',
28
- 'local.notificationTraySeen.updated',
29
- payload => callback(payload),
30
- ),
31
- ];
32
-
33
- return () => {
34
- disposers.forEach(fn => fn());
35
- };
36
- };
@@ -1,3 +0,0 @@
1
- export * from './observers';
2
- export * from './api';
3
- export * from './events';
@@ -1,81 +0,0 @@
1
- import { getActiveClient } from '~/client/api/activeClient';
2
- import { pullFromCache, pushToCache } from '~/cache/api';
3
-
4
- /* begin_public_function
5
- id: notificationTray.getNotificationTraySeen
6
- */
7
- /**
8
- * ```js
9
- * import { notificationTray } from '@amityco/ts-sdk'
10
- * const notificationTraySeen = await notificationTray.getNotificationTraySeen()
11
- * ```
12
- *
13
- *
14
- * @returns A page of {@link Amity.NotificationTraySeen} objects
15
- *
16
- * @category NotificationTray API
17
- * @async
18
- * */
19
- export const getNotificationTraySeen = async (): Promise<
20
- Amity.Cached<Amity.NotificationTraySeen>
21
- > => {
22
- const client = getActiveClient();
23
- client.log('notificationTray/getNotificationTraySeen', {});
24
-
25
- const { data: payload } = await client.http.get<Amity.NotificationTraySeenPayload>(
26
- `api/v1/notification-tray/tray/seen`,
27
- );
28
-
29
- const cachedAt = client.cache && Date.now();
30
-
31
- if (client.cache) {
32
- const cacheKey = ['notificationTraySeen', 'get', client.userId];
33
- pushToCache(cacheKey, {
34
- userId: client.userId,
35
- lastTraySeenAt: payload.lastTraySeenAt,
36
- lastTrayOccuredAt: payload.lastTrayOccuredAt,
37
- });
38
- }
39
-
40
- return {
41
- data: {
42
- userId: client.userId!,
43
- lastTraySeenAt: payload.lastTraySeenAt,
44
- lastTrayOccuredAt: payload.lastTrayOccuredAt,
45
- isSeen: payload.lastTraySeenAt > payload.lastTrayOccuredAt,
46
- },
47
- cachedAt,
48
- };
49
- };
50
- /* end_public_function */
51
-
52
- /**
53
- * ```js
54
- * import { notificationTray } from '@amityco/ts-sdk'
55
- * const notificationTraySeen = await notificationTray.getNotificationTraySeen.locally()
56
- * ```
57
- *
58
- * Queries a paginable list of {@link Amity.NotificationTraySeen} objects from cache
59
- *
60
- * @returns A page of {@link Amity.NotificationTraySeen} objects
61
- *
62
- * @category NotificationTray API
63
- * @async
64
- * */
65
- getNotificationTraySeen.locally = ():
66
- | Amity.Cached<Amity.NotificationTraySeenPayload>
67
- | undefined => {
68
- const client = getActiveClient();
69
- client.log('notificationTray/getNotificationTraySeen.locally', {});
70
-
71
- if (!client.cache) return;
72
-
73
- const queryKey = ['notificationTraySeen', 'get'];
74
-
75
- const { data, cachedAt } =
76
- pullFromCache<{ notificationTraySeen: Amity.NotificationTraySeenPayload }>(queryKey) ?? {};
77
-
78
- if (!data?.notificationTraySeen) return;
79
-
80
- return { data: data.notificationTraySeen, cachedAt };
81
- };