@amityco/ts-sdk 7.1.1-53d7c83.0 → 7.1.1-611ceb49.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.
- package/dist/@types/core/events.d.ts +5 -2
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/model.d.ts +4 -2
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +18 -0
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/core/readReceipt.d.ts +1 -12
- package/dist/@types/core/readReceipt.d.ts.map +1 -1
- package/dist/@types/domains/channel.d.ts +0 -10
- package/dist/@types/domains/channel.d.ts.map +1 -1
- package/dist/@types/domains/client.d.ts +0 -1
- package/dist/@types/domains/client.d.ts.map +1 -1
- package/dist/@types/domains/notification.d.ts +81 -0
- package/dist/@types/domains/notification.d.ts.map +1 -0
- package/dist/channelRepository/events/onChannelDeleted.d.ts.map +1 -1
- package/dist/channelRepository/events/onChannelLeft.d.ts.map +1 -1
- package/dist/channelRepository/observers/getChannel.d.ts.map +1 -1
- package/dist/channelRepository/observers/getChannels/ChannelLiveCollectionController.d.ts.map +1 -1
- package/dist/channelRepository/observers/index.d.ts +0 -1
- package/dist/channelRepository/observers/index.d.ts.map +1 -1
- package/dist/channelRepository/utils/constructChannelDynamicValue.d.ts.map +1 -1
- package/dist/channelRepository/utils/prepareChannelPayload.d.ts.map +1 -1
- package/dist/client/api/createClient.d.ts.map +1 -1
- package/dist/client/api/enableUnreadCount.d.ts.map +1 -1
- package/dist/client/api/login.d.ts.map +1 -1
- package/dist/client/utils/ReadReceiptSync/readReceiptSyncEngine.d.ts +4 -2
- package/dist/client/utils/ReadReceiptSync/readReceiptSyncEngine.d.ts.map +1 -1
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.d.ts.map +1 -1
- package/dist/core/model/idResolvers.d.ts.map +1 -1
- package/dist/core/model/index.d.ts.map +1 -1
- package/dist/index.cjs.js +475 -586
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +451 -563
- package/dist/index.umd.js +4 -4
- package/dist/{channelRepository → marker}/events/onChannelUnreadUpdatedLocal.d.ts +2 -2
- package/dist/marker/events/onChannelUnreadUpdatedLocal.d.ts.map +1 -0
- package/dist/messageRepository/events/onMessageCreated.d.ts.map +1 -1
- package/dist/messageRepository/observers/getMessage.d.ts.map +1 -1
- package/dist/messageRepository/utils/markReadMessage.d.ts.map +1 -1
- package/dist/notificationTrayRepository/api/index.d.ts +3 -0
- package/dist/notificationTrayRepository/api/index.d.ts.map +1 -0
- package/dist/notificationTrayRepository/api/markNotificationItemsSeen.d.ts +16 -0
- package/dist/notificationTrayRepository/api/markNotificationItemsSeen.d.ts.map +1 -0
- package/dist/notificationTrayRepository/api/markNotificationTraySeen.d.ts +19 -0
- package/dist/notificationTrayRepository/api/markNotificationTraySeen.d.ts.map +1 -0
- package/dist/notificationTrayRepository/events/index.d.ts +2 -0
- package/dist/notificationTrayRepository/events/index.d.ts.map +1 -0
- package/dist/notificationTrayRepository/events/onNotificationTraySeenUpdated.d.ts +17 -0
- package/dist/notificationTrayRepository/events/onNotificationTraySeenUpdated.d.ts.map +1 -0
- package/dist/notificationTrayRepository/index.d.ts +4 -0
- package/dist/notificationTrayRepository/index.d.ts.map +1 -0
- package/dist/notificationTrayRepository/internalApi/getNotificationTraySeen.d.ts +30 -0
- package/dist/notificationTrayRepository/internalApi/getNotificationTraySeen.d.ts.map +1 -0
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts +13 -0
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts.map +1 -0
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts +9 -0
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts.map +1 -0
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts +9 -0
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts.map +1 -0
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems.d.ts +12 -0
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems.d.ts.map +1 -0
- package/dist/notificationTrayRepository/observers/getNotificationTraySeen.d.ts +21 -0
- package/dist/notificationTrayRepository/observers/getNotificationTraySeen.d.ts.map +1 -0
- package/dist/notificationTrayRepository/observers/index.d.ts +3 -0
- package/dist/notificationTrayRepository/observers/index.d.ts.map +1 -0
- package/dist/notificationTrayRepository/utils/prepareNotificationTrayItemsPayload.d.ts +2 -0
- package/dist/notificationTrayRepository/utils/prepareNotificationTrayItemsPayload.d.ts.map +1 -0
- package/dist/utils/linkedObject/index.d.ts +1 -0
- package/dist/utils/linkedObject/index.d.ts.map +1 -1
- package/dist/utils/linkedObject/notificationTrayLinkedObject.d.ts +2 -0
- package/dist/utils/linkedObject/notificationTrayLinkedObject.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/@types/core/events.ts +6 -2
- package/src/@types/core/model.ts +6 -4
- package/src/@types/core/payload.ts +25 -0
- package/src/@types/core/readReceipt.ts +1 -14
- package/src/@types/domains/channel.ts +0 -13
- package/src/@types/domains/client.ts +0 -2
- package/src/@types/domains/notification.ts +90 -0
- package/src/channelRepository/events/onChannelDeleted.ts +4 -17
- package/src/channelRepository/events/onChannelLeft.ts +3 -11
- package/src/channelRepository/observers/getChannel.ts +1 -3
- package/src/channelRepository/observers/getChannels/ChannelLiveCollectionController.ts +1 -6
- package/src/channelRepository/observers/index.ts +0 -1
- package/src/channelRepository/utils/constructChannelDynamicValue.ts +2 -12
- package/src/channelRepository/utils/prepareChannelPayload.ts +17 -66
- package/src/client/api/createClient.ts +0 -3
- package/src/client/api/enableUnreadCount.ts +0 -1
- package/src/client/api/login.ts +1 -5
- package/src/client/utils/ReadReceiptSync/readReceiptSyncEngine.ts +99 -74
- package/src/core/model/idResolvers.ts +3 -2
- package/src/core/model/index.ts +2 -0
- package/src/index.ts +2 -0
- package/src/{channelRepository → marker}/events/onChannelUnreadUpdatedLocal.ts +3 -3
- package/src/messageRepository/events/onMessageCreated.ts +1 -45
- package/src/messageRepository/observers/getMessage.ts +1 -0
- package/src/messageRepository/utils/markReadMessage.ts +3 -10
- package/src/notificationTrayRepository/api/index.ts +2 -0
- package/src/notificationTrayRepository/api/markNotificationItemsSeen.ts +59 -0
- package/src/notificationTrayRepository/api/markNotificationTraySeen.ts +65 -0
- package/src/notificationTrayRepository/events/index.ts +1 -0
- package/src/notificationTrayRepository/events/onNotificationTraySeenUpdated.ts +36 -0
- package/src/notificationTrayRepository/index.ts +3 -0
- package/src/notificationTrayRepository/internalApi/getNotificationTraySeen.ts +81 -0
- package/src/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.ts +96 -0
- package/src/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.ts +31 -0
- package/src/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.ts +68 -0
- package/src/notificationTrayRepository/observers/getNotificationTrayItems.ts +44 -0
- package/src/notificationTrayRepository/observers/getNotificationTraySeen.ts +43 -0
- package/src/notificationTrayRepository/observers/index.ts +2 -0
- package/src/notificationTrayRepository/utils/prepareNotificationTrayItemsPayload.ts +12 -0
- package/src/utils/linkedObject/index.ts +2 -0
- package/src/utils/linkedObject/notificationTrayLinkedObject.ts +28 -0
- package/dist/channelRepository/api/markChannelsAsReadBySegment.d.ts +0 -16
- package/dist/channelRepository/api/markChannelsAsReadBySegment.d.ts.map +0 -1
- package/dist/channelRepository/events/onChannelUnreadUpdatedLocal.d.ts.map +0 -1
- package/dist/channelRepository/internalApi/getTotalChannelsUnread.d.ts +0 -11
- package/dist/channelRepository/internalApi/getTotalChannelsUnread.d.ts.map +0 -1
- package/dist/channelRepository/observers/getTotalChannelsUnread.d.ts +0 -20
- package/dist/channelRepository/observers/getTotalChannelsUnread.d.ts.map +0 -1
- package/dist/channelRepository/utils/getLegacyChannelUnread.d.ts +0 -2
- package/dist/channelRepository/utils/getLegacyChannelUnread.d.ts.map +0 -1
- package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine.d.ts +0 -33
- package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine.d.ts.map +0 -1
- package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.d.ts +0 -3
- package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.d.ts.map +0 -1
- package/dist/marker/events/onChannelUnreadInfoUpdatedLocal.d.ts +0 -12
- package/dist/marker/events/onChannelUnreadInfoUpdatedLocal.d.ts.map +0 -1
- package/src/channelRepository/api/markChannelsAsReadBySegment.ts +0 -29
- package/src/channelRepository/internalApi/getTotalChannelsUnread.ts +0 -38
- package/src/channelRepository/observers/getTotalChannelsUnread.ts +0 -129
- package/src/channelRepository/utils/getLegacyChannelUnread.ts +0 -5
- package/src/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine.ts +0 -267
- package/src/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.ts +0 -21
- 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.
|
|
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
|
|
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":"
|
|
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":"
|
|
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":"
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { NotificationTrayRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const updated = await NotificationTrayRepository.markNotificationItemsSeen()
|
|
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 markNotificationItemsSeen: (patch: Amity.QueryNotificationItemSeen) => Promise<void>;
|
|
16
|
+
//# sourceMappingURL=markNotificationItemsSeen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markNotificationItemsSeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/api/markNotificationItemsSeen.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,UAAiB,MAAM,yBAAyB,kBAoCrF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { NotificationTrayRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const updated = await NotificationTrayRepository.markNotificationTraySeen({
|
|
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 markNotificationTraySeen: (lastSeenAt: Amity.timestamp) => Promise<Amity.Cached<Amity.NotificationTraySeenUpdatedPayload>>;
|
|
19
|
+
//# sourceMappingURL=markNotificationTraySeen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markNotificationTraySeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/api/markNotificationTraySeen.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB,eACvB,MAAM,SAAS,KAC1B,QAAQ,MAAM,MAAM,CAAC,MAAM,kCAAkC,CAAC,CAqChE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/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/notificationTrayRepository/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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notificationTrayRepository/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 { NotificationTrayRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const notificationTraySeen = await NotificationTrayRepository.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 { NotificationTrayRepository } from '@amityco/ts-sdk'
|
|
18
|
+
* const notificationTraySeen = await NotificationTrayRepository.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/notificationTrayRepository/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.RawNotificationTrayItem, NotificationTrayItemsPaginationController> {
|
|
4
|
+
private queryStreamController;
|
|
5
|
+
private query;
|
|
6
|
+
constructor(query: Amity.NotificationTrayItemLiveCollection, callback: Amity.LiveCollectionCallback<Amity.RawNotificationTrayItem>);
|
|
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/notificationTrayRepository/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,uBAAuB,EAC7B,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,uBAAuB,CAAC;IAoBvE,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/notificationTrayRepository/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/notificationTrayRepository/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.RawNotificationTrayItem>, config?: Amity.LiveCollectionConfig) => () => void;
|
|
12
|
+
//# sourceMappingURL=getNotificationTrayItems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNotificationTrayItems.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/observers/getNotificationTrayItems.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,WAC3B,MAAM,oBAAoB,CAAC,MAAM,kCAAkC,CAAC,YAClE,MAAM,sBAAsB,CAAC,MAAM,uBAAuB,CAAC,WAC5D,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/notificationTrayRepository/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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/observers/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareNotificationTrayItemsPayload.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/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":"
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"notificationTrayLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/notificationTrayLinkedObject.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,4BAA4B,SACjC,MAAM,4BAA4B,KACvC,MAAM,oBAmBR,CAAC"}
|
package/package.json
CHANGED
|
@@ -237,8 +237,7 @@ declare global {
|
|
|
237
237
|
};
|
|
238
238
|
|
|
239
239
|
'local.subChannelUnread.updated': Amity.SubChannelUnreadInfo;
|
|
240
|
-
'local.
|
|
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;
|
package/src/@types/core/model.ts
CHANGED
|
@@ -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
|
|
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
|
-
lastMentionSegment: number | null;
|
|
151
|
-
isDeleted: boolean;
|
|
152
|
-
};
|
|
153
140
|
}
|
|
154
141
|
}
|
|
@@ -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
|
+
lastOccuredAt: 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
|
+
actionReferenceId?: string;
|
|
37
|
+
parentId?: string;
|
|
38
|
+
data: { communityName: string } | { reactionName: string[] };
|
|
39
|
+
text: string;
|
|
40
|
+
templatedText: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type InternalNotificationTrayItem = RawNotificationTrayItem;
|
|
44
|
+
|
|
45
|
+
type QueryNotificationTrayItem = {
|
|
46
|
+
token?: Amity.Token;
|
|
47
|
+
limit?: Amity.PageLimit['limit'];
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
type NotificationTrayItemLiveCollection = Amity.LiveCollectionParams<
|
|
51
|
+
Omit<QueryNotificationTrayItem, 'limit'>
|
|
52
|
+
>;
|
|
53
|
+
|
|
54
|
+
type NotificationTrayItemLiveCollectionCache = Amity.LiveCollectionCache<
|
|
55
|
+
Amity.InternalNotificationTrayItem['_id'],
|
|
56
|
+
Pick<QueryNotificationTrayItem, 'limit'>
|
|
57
|
+
>;
|
|
58
|
+
|
|
59
|
+
type NotificationTrayItem = Amity.InternalNotificationTrayItem & {
|
|
60
|
+
markRead: () => void;
|
|
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
|
+
}
|
|
@@ -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
|
-
|
|
33
|
-
|
|
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
|
-
}
|
|
40
|
-
|
|
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]));
|
|
@@ -6,7 +6,6 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
|
6
6
|
import { prepareChannelPayload } from '../utils';
|
|
7
7
|
import { deleteChannelUnreadByChannelId } from '../../marker/utils/deleteChannelUnreadByChannelId';
|
|
8
8
|
import { addFlagIsDeletedSubChannelUnreadByChannelId } from '~/marker/utils/addFlagIsDeletedSubChannelUnreadByChannelId';
|
|
9
|
-
import { dropFromCache } from '~/cache/api';
|
|
10
9
|
|
|
11
10
|
type CallbackFn = (
|
|
12
11
|
channel: Amity.StaticInternalChannel,
|
|
@@ -41,17 +40,10 @@ export const onChannelLeft = (
|
|
|
41
40
|
isMessagePreviewUpdated: isLeftByMe,
|
|
42
41
|
});
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
const isLegacyUnreadCount = client.useLegacyUnreadCount;
|
|
46
|
-
|
|
47
|
-
if (isLeftByMe) {
|
|
43
|
+
if (client.isUnreadCountEnabled && client.getMarkerSyncConsistentMode() && isLeftByMe) {
|
|
48
44
|
preparedPayload.channels.forEach(channel => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
deleteChannelUnreadByChannelId(channel.channelId);
|
|
52
|
-
} else if (isLegacyUnreadCount) {
|
|
53
|
-
dropFromCache(['channelUnread', 'get', channel.channelId]);
|
|
54
|
-
}
|
|
45
|
+
addFlagIsDeletedSubChannelUnreadByChannelId(channel.channelId);
|
|
46
|
+
deleteChannelUnreadByChannelId(channel.channelId);
|
|
55
47
|
});
|
|
56
48
|
}
|
|
57
49
|
|