@amityco/ts-sdk 7.1.1-1325f22d.0 → 7.1.1-15835b61.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/domains/notification.d.ts +1 -8
- package/dist/@types/domains/notification.d.ts.map +1 -1
- package/dist/index.cjs.js +18 -23
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +18 -23
- package/dist/index.umd.js +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.map +1 -0
- package/dist/notificationTrayRepository/events/onNotificationTraySeenUpdated.d.ts.map +1 -0
- package/dist/notificationTrayRepository/index.d.ts.map +1 -0
- package/dist/{notificationTray → notificationTrayRepository}/internalApi/getNotificationTraySeen.d.ts +5 -5
- package/dist/notificationTrayRepository/internalApi/getNotificationTraySeen.d.ts.map +1 -0
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts.map +1 -0
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts.map +1 -0
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts.map +1 -0
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems.d.ts.map +1 -0
- package/dist/notificationTrayRepository/observers/getNotificationTraySeen.d.ts.map +1 -0
- package/dist/notificationTrayRepository/observers/index.d.ts.map +1 -0
- package/dist/notificationTrayRepository/utils/prepareNotificationTrayItemsPayload.d.ts.map +1 -0
- package/dist/utils/linkedObject/notificationTrayLinkedObject.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/domains/notification.ts +2 -9
- package/src/index.ts +1 -1
- package/src/notificationTrayRepository/api/index.ts +2 -0
- package/src/{notificationTray/api/markItemsSeen.ts → notificationTrayRepository/api/markNotificationItemsSeen.ts} +4 -4
- package/src/{notificationTray/api/markTraySeen.ts → notificationTrayRepository/api/markNotificationTraySeen.ts} +4 -4
- package/src/{notificationTray → notificationTrayRepository}/internalApi/getNotificationTraySeen.ts +5 -6
- package/src/{notificationTray → notificationTrayRepository}/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.ts +3 -5
- package/src/utils/linkedObject/notificationTrayLinkedObject.ts +2 -12
- package/dist/notificationTray/api/index.d.ts +0 -3
- package/dist/notificationTray/api/index.d.ts.map +0 -1
- package/dist/notificationTray/api/markItemsSeen.d.ts +0 -16
- package/dist/notificationTray/api/markItemsSeen.d.ts.map +0 -1
- package/dist/notificationTray/api/markTraySeen.d.ts +0 -19
- package/dist/notificationTray/api/markTraySeen.d.ts.map +0 -1
- package/dist/notificationTray/events/index.d.ts.map +0 -1
- package/dist/notificationTray/events/onNotificationTraySeenUpdated.d.ts.map +0 -1
- package/dist/notificationTray/index.d.ts.map +0 -1
- package/dist/notificationTray/internalApi/getNotificationTraySeen.d.ts.map +0 -1
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts.map +0 -1
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts.map +0 -1
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts.map +0 -1
- package/dist/notificationTray/observers/getNotificationTrayItems.d.ts.map +0 -1
- package/dist/notificationTray/observers/getNotificationTraySeen.d.ts.map +0 -1
- package/dist/notificationTray/observers/index.d.ts.map +0 -1
- package/dist/notificationTray/utils/prepareNotificationTrayItemsPayload.d.ts.map +0 -1
- package/src/notificationTray/api/index.ts +0 -2
- /package/dist/{notificationTray → notificationTrayRepository}/events/index.d.ts +0 -0
- /package/dist/{notificationTray → notificationTrayRepository}/events/onNotificationTraySeenUpdated.d.ts +0 -0
- /package/dist/{notificationTray → notificationTrayRepository}/index.d.ts +0 -0
- /package/dist/{notificationTray → notificationTrayRepository}/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts +0 -0
- /package/dist/{notificationTray → notificationTrayRepository}/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts +0 -0
- /package/dist/{notificationTray → notificationTrayRepository}/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts +0 -0
- /package/dist/{notificationTray → notificationTrayRepository}/observers/getNotificationTrayItems.d.ts +0 -0
- /package/dist/{notificationTray → notificationTrayRepository}/observers/getNotificationTraySeen.d.ts +0 -0
- /package/dist/{notificationTray → notificationTrayRepository}/observers/index.d.ts +0 -0
- /package/dist/{notificationTray → notificationTrayRepository}/utils/prepareNotificationTrayItemsPayload.d.ts +0 -0
- /package/src/{notificationTray → notificationTrayRepository}/events/index.ts +0 -0
- /package/src/{notificationTray → notificationTrayRepository}/events/onNotificationTraySeenUpdated.ts +0 -0
- /package/src/{notificationTray → notificationTrayRepository}/index.ts +0 -0
- /package/src/{notificationTray → notificationTrayRepository}/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.ts +0 -0
- /package/src/{notificationTray → notificationTrayRepository}/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.ts +0 -0
- /package/src/{notificationTray → notificationTrayRepository}/observers/getNotificationTrayItems.ts +0 -0
- /package/src/{notificationTray → notificationTrayRepository}/observers/getNotificationTraySeen.ts +0 -0
- /package/src/{notificationTray → notificationTrayRepository}/observers/index.ts +0 -0
- /package/src/{notificationTray → notificationTrayRepository}/utils/prepareNotificationTrayItemsPayload.ts +0 -0
|
@@ -19,7 +19,7 @@ declare global {
|
|
|
19
19
|
_id: string;
|
|
20
20
|
lastSeenAt: Amity.timestamp;
|
|
21
21
|
lastOccuredAt: Amity.timestamp;
|
|
22
|
-
|
|
22
|
+
actorIds: {
|
|
23
23
|
_id: string;
|
|
24
24
|
lastActedAt: Amity.timestamp;
|
|
25
25
|
}[];
|
|
@@ -49,9 +49,6 @@ declare global {
|
|
|
49
49
|
type NotificationTrayItemLiveCollectionCache = Amity.LiveCollectionCache<Amity.InternalNotificationTrayItem['_id'], Pick<QueryNotificationTrayItem, 'limit'>>;
|
|
50
50
|
type NotificationTrayItem = Amity.InternalNotificationTrayItem & {
|
|
51
51
|
markRead: () => void;
|
|
52
|
-
isSeen: boolean;
|
|
53
|
-
isRecent: boolean;
|
|
54
|
-
users: Amity.User[];
|
|
55
52
|
};
|
|
56
53
|
type RawNotificationTraySeen = {
|
|
57
54
|
lastTraySeenAt: Amity.timestamp;
|
|
@@ -63,10 +60,6 @@ declare global {
|
|
|
63
60
|
type InternalNotificationTraySeen = RawNotificationTraySeen & {
|
|
64
61
|
userId: string;
|
|
65
62
|
};
|
|
66
|
-
type NotificationTraySeen = RawNotificationTraySeen & {
|
|
67
|
-
userId: string;
|
|
68
|
-
isSeen: boolean;
|
|
69
|
-
};
|
|
70
63
|
type RawNotificationItemSeen = {
|
|
71
64
|
lastSeenAt: Amity.timestamp;
|
|
72
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,WAAW,oBAAoB;YAC7B,YAAY,oBAAoB;YAChC,eAAe,uBAAuB;YACtC,UAAU,kBAAkB;YAC5B,aAAa,qBAAqB;SACnC;QAED,WAAW,UAAU;YACnB,IAAI,SAAS;YACb,IAAI,SAAS;YACb,OAAO,YAAY;YACnB,QAAQ,aAAa;YACrB,OAAO,YAAY;YACnB,KAAK,UAAU;SAChB;QAED,KAAK,uBAA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OND$1;
|
|
122
122
|
const HOUR = 60 * MINUTE;
|
|
123
123
|
const DAY = 24 * HOUR;
|
|
124
|
-
const WEEK = 7 * DAY;
|
|
125
124
|
const YEAR = 365 * DAY;
|
|
126
125
|
const ACCESS_TOKEN_WATCHER_INTERVAL = 10 * MINUTE;
|
|
127
126
|
|
|
@@ -6002,8 +6001,8 @@ const pinnedPostLinkedObject = (pinnedPost) => {
|
|
|
6002
6001
|
*/
|
|
6003
6002
|
/**
|
|
6004
6003
|
* ```js
|
|
6005
|
-
* import {
|
|
6006
|
-
* const updated = await
|
|
6004
|
+
* import { NotificationTrayRepository } from '@amityco/ts-sdk'
|
|
6005
|
+
* const updated = await NotificationTrayRepository.markNotificationItemsSeen()
|
|
6007
6006
|
* ```
|
|
6008
6007
|
*
|
|
6009
6008
|
* Updates an {@link Amity.NotificationItemSeen}
|
|
@@ -6014,9 +6013,9 @@ const pinnedPostLinkedObject = (pinnedPost) => {
|
|
|
6014
6013
|
* @category NotificationItemSeen API
|
|
6015
6014
|
* @async
|
|
6016
6015
|
*/
|
|
6017
|
-
const
|
|
6016
|
+
const markNotificationItemsSeen = async (patch) => {
|
|
6018
6017
|
const client = getActiveClient();
|
|
6019
|
-
client.log('notificationTray/
|
|
6018
|
+
client.log('notificationTray/markNotificationItemsSeen', {});
|
|
6020
6019
|
const { data: payload } = await client.http.put(`api/v1/notification-tray/items/seen`, {
|
|
6021
6020
|
patch,
|
|
6022
6021
|
});
|
|
@@ -6043,10 +6042,7 @@ const markItemsSeen = async (patch) => {
|
|
|
6043
6042
|
/* end_public_function */
|
|
6044
6043
|
|
|
6045
6044
|
const notificationTrayLinkedObject = (noti) => {
|
|
6046
|
-
return Object.assign(Object.assign({}, noti), {
|
|
6047
|
-
.map(userId => { var _a; return (_a = pullFromCache(['user', 'get', userId])) === null || _a === void 0 ? void 0 : _a.data; })
|
|
6048
|
-
.filter(isNonNullable)
|
|
6049
|
-
.map(user => userLinkedObject(user)), markRead: () => markItemsSeen({
|
|
6045
|
+
return Object.assign(Object.assign({}, noti), { markRead: () => markNotificationItemsSeen({
|
|
6050
6046
|
trayItems: [
|
|
6051
6047
|
{
|
|
6052
6048
|
id: noti._id,
|
|
@@ -25447,8 +25443,8 @@ const createUserToken = async (apiKey, apiRegion, params) => {
|
|
|
25447
25443
|
*/
|
|
25448
25444
|
/**
|
|
25449
25445
|
* ```js
|
|
25450
|
-
* import {
|
|
25451
|
-
* const notificationTraySeen = await
|
|
25446
|
+
* import { NotificationTrayRepository } from '@amityco/ts-sdk'
|
|
25447
|
+
* const notificationTraySeen = await NotificationTrayRepository.getNotificationTraySeen()
|
|
25452
25448
|
* ```
|
|
25453
25449
|
*
|
|
25454
25450
|
*
|
|
@@ -25475,7 +25471,6 @@ const getNotificationTraySeen$1 = async () => {
|
|
|
25475
25471
|
userId: client.userId,
|
|
25476
25472
|
lastTraySeenAt: payload.lastTraySeenAt,
|
|
25477
25473
|
lastTrayOccuredAt: payload.lastTrayOccuredAt,
|
|
25478
|
-
isSeen: payload.lastTraySeenAt > payload.lastTrayOccuredAt,
|
|
25479
25474
|
},
|
|
25480
25475
|
cachedAt,
|
|
25481
25476
|
};
|
|
@@ -25483,8 +25478,8 @@ const getNotificationTraySeen$1 = async () => {
|
|
|
25483
25478
|
/* end_public_function */
|
|
25484
25479
|
/**
|
|
25485
25480
|
* ```js
|
|
25486
|
-
* import {
|
|
25487
|
-
* const notificationTraySeen = await
|
|
25481
|
+
* import { NotificationTrayRepository } from '@amityco/ts-sdk'
|
|
25482
|
+
* const notificationTraySeen = await NotificationTrayRepository.getNotificationTraySeen.locally()
|
|
25488
25483
|
* ```
|
|
25489
25484
|
*
|
|
25490
25485
|
* Queries a paginable list of {@link Amity.NotificationTraySeen} objects from cache
|
|
@@ -25656,10 +25651,10 @@ class NotificationTrayItemsLiveCollectionController extends LiveCollectionContro
|
|
|
25656
25651
|
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
25657
25652
|
if (!collection)
|
|
25658
25653
|
return;
|
|
25659
|
-
const data = (
|
|
25654
|
+
const data = (_b = collection.data
|
|
25660
25655
|
.map(id => pullFromCache(['notificationTrayItem', 'get', id]))
|
|
25661
25656
|
.filter(isNonNullable)
|
|
25662
|
-
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : []
|
|
25657
|
+
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : [];
|
|
25663
25658
|
if (!this.shouldNotify(data) && origin === 'event')
|
|
25664
25659
|
return;
|
|
25665
25660
|
this.callback({
|
|
@@ -25704,8 +25699,8 @@ const getNotificationTrayItems = (params, callback, config) => {
|
|
|
25704
25699
|
*/
|
|
25705
25700
|
/**
|
|
25706
25701
|
* ```js
|
|
25707
|
-
* import {
|
|
25708
|
-
* const updated = await
|
|
25702
|
+
* import { NotificationTrayRepository } from '@amityco/ts-sdk'
|
|
25703
|
+
* const updated = await NotificationTrayRepository.markNotificationTraySeen({
|
|
25709
25704
|
* lastSeenAt: Amity.timestamp,
|
|
25710
25705
|
* })
|
|
25711
25706
|
* ```
|
|
@@ -25719,10 +25714,10 @@ const getNotificationTrayItems = (params, callback, config) => {
|
|
|
25719
25714
|
* @category Post API
|
|
25720
25715
|
* @async
|
|
25721
25716
|
*/
|
|
25722
|
-
const
|
|
25717
|
+
const markNotificationTraySeen = async (lastSeenAt) => {
|
|
25723
25718
|
var _a;
|
|
25724
25719
|
const client = getActiveClient();
|
|
25725
|
-
client.log('notificationTray/
|
|
25720
|
+
client.log('notificationTray/markNotificationTraySeen', {});
|
|
25726
25721
|
const { data: payload } = await client.http.put(`api/v1/notification-tray/tray/seen`, {
|
|
25727
25722
|
lastSeenAt,
|
|
25728
25723
|
});
|
|
@@ -25747,8 +25742,8 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
25747
25742
|
__proto__: null,
|
|
25748
25743
|
getNotificationTraySeen: getNotificationTraySeen,
|
|
25749
25744
|
getNotificationTrayItems: getNotificationTrayItems,
|
|
25750
|
-
|
|
25751
|
-
|
|
25745
|
+
markNotificationItemsSeen: markNotificationItemsSeen,
|
|
25746
|
+
markNotificationTraySeen: markNotificationTraySeen,
|
|
25752
25747
|
onNotificationTraySeenUpdated: onNotificationTraySeenUpdated
|
|
25753
25748
|
});
|
|
25754
25749
|
|
|
@@ -25769,6 +25764,7 @@ exports.FileType = FileType;
|
|
|
25769
25764
|
exports.LiveStreamPlayer = index$3;
|
|
25770
25765
|
exports.MessageContentType = MessageContentType;
|
|
25771
25766
|
exports.MessageRepository = index$h;
|
|
25767
|
+
exports.NotificationTrayRepository = index;
|
|
25772
25768
|
exports.PollRepository = index$4;
|
|
25773
25769
|
exports.PostContentType = PostContentType;
|
|
25774
25770
|
exports.PostRepository = index$6;
|
|
@@ -25829,7 +25825,6 @@ exports.isPaged = isPaged;
|
|
|
25829
25825
|
exports.isReportedByMe = isReportedByMe;
|
|
25830
25826
|
exports.isSkip = isSkip;
|
|
25831
25827
|
exports.mergeInCache = mergeInCache;
|
|
25832
|
-
exports.notificationTray = index;
|
|
25833
25828
|
exports.onChannelMarkerFetched = onChannelMarkerFetched;
|
|
25834
25829
|
exports.onFeedMarkerFetched = onFeedMarkerFetched;
|
|
25835
25830
|
exports.onFeedMarkerUpdated = onFeedMarkerUpdated;
|
package/dist/index.d.ts
CHANGED
|
@@ -25,5 +25,5 @@ export * as LiveStreamPlayer from './liveStreamPlayer';
|
|
|
25
25
|
export * as StoryRepository from './storyRepository';
|
|
26
26
|
export * as AdRepository from './adRepository';
|
|
27
27
|
export * from './external/api';
|
|
28
|
-
export * as
|
|
28
|
+
export * as NotificationTrayRepository from './notificationTrayRepository';
|
|
29
29
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AAEzB,cAAc,WAAW,CAAC;AAG1B,cAAc,cAAc,CAA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KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AAEnD,cAAc,YAAY,CAAC;AAG3B,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAE3D,cAAc,cAAc,CAAC;AAG7B,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,oBAAoB,MAAM,wBAAwB,CAAC;AAE/D,cAAc,iBAAiB,CAAC;AAGhC,OAAO,KAAK,mBAAmB,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC;AAGrD,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAG/C,cAAc,gBAAgB,CAAC;AAE/B,OAAO,KAAK,0BAA0B,MAAM,8BAA8B,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -106,7 +106,6 @@ const SECOND$1 = 1000;
|
|
|
106
106
|
const MINUTE = 60 * SECOND$1;
|
|
107
107
|
const HOUR = 60 * MINUTE;
|
|
108
108
|
const DAY = 24 * HOUR;
|
|
109
|
-
const WEEK = 7 * DAY;
|
|
110
109
|
const YEAR = 365 * DAY;
|
|
111
110
|
const ACCESS_TOKEN_WATCHER_INTERVAL = 10 * MINUTE;
|
|
112
111
|
|
|
@@ -22094,8 +22093,8 @@ const pinnedPostLinkedObject = (pinnedPost) => {
|
|
|
22094
22093
|
*/
|
|
22095
22094
|
/**
|
|
22096
22095
|
* ```js
|
|
22097
|
-
* import {
|
|
22098
|
-
* const updated = await
|
|
22096
|
+
* import { NotificationTrayRepository } from '@amityco/ts-sdk'
|
|
22097
|
+
* const updated = await NotificationTrayRepository.markNotificationItemsSeen()
|
|
22099
22098
|
* ```
|
|
22100
22099
|
*
|
|
22101
22100
|
* Updates an {@link Amity.NotificationItemSeen}
|
|
@@ -22106,9 +22105,9 @@ const pinnedPostLinkedObject = (pinnedPost) => {
|
|
|
22106
22105
|
* @category NotificationItemSeen API
|
|
22107
22106
|
* @async
|
|
22108
22107
|
*/
|
|
22109
|
-
const
|
|
22108
|
+
const markNotificationItemsSeen = async (patch) => {
|
|
22110
22109
|
const client = getActiveClient();
|
|
22111
|
-
client.log('notificationTray/
|
|
22110
|
+
client.log('notificationTray/markNotificationItemsSeen', {});
|
|
22112
22111
|
const { data: payload } = await client.http.put(`api/v1/notification-tray/items/seen`, {
|
|
22113
22112
|
patch,
|
|
22114
22113
|
});
|
|
@@ -22135,10 +22134,7 @@ const markItemsSeen = async (patch) => {
|
|
|
22135
22134
|
/* end_public_function */
|
|
22136
22135
|
|
|
22137
22136
|
const notificationTrayLinkedObject = (noti) => {
|
|
22138
|
-
return Object.assign(Object.assign({}, noti), {
|
|
22139
|
-
.map(userId => { var _a; return (_a = pullFromCache(['user', 'get', userId])) === null || _a === void 0 ? void 0 : _a.data; })
|
|
22140
|
-
.filter(isNonNullable)
|
|
22141
|
-
.map(user => userLinkedObject(user)), markRead: () => markItemsSeen({
|
|
22137
|
+
return Object.assign(Object.assign({}, noti), { markRead: () => markNotificationItemsSeen({
|
|
22142
22138
|
trayItems: [
|
|
22143
22139
|
{
|
|
22144
22140
|
id: noti._id,
|
|
@@ -41539,8 +41535,8 @@ const createUserToken = async (apiKey, apiRegion, params) => {
|
|
|
41539
41535
|
*/
|
|
41540
41536
|
/**
|
|
41541
41537
|
* ```js
|
|
41542
|
-
* import {
|
|
41543
|
-
* const notificationTraySeen = await
|
|
41538
|
+
* import { NotificationTrayRepository } from '@amityco/ts-sdk'
|
|
41539
|
+
* const notificationTraySeen = await NotificationTrayRepository.getNotificationTraySeen()
|
|
41544
41540
|
* ```
|
|
41545
41541
|
*
|
|
41546
41542
|
*
|
|
@@ -41567,7 +41563,6 @@ const getNotificationTraySeen$1 = async () => {
|
|
|
41567
41563
|
userId: client.userId,
|
|
41568
41564
|
lastTraySeenAt: payload.lastTraySeenAt,
|
|
41569
41565
|
lastTrayOccuredAt: payload.lastTrayOccuredAt,
|
|
41570
|
-
isSeen: payload.lastTraySeenAt > payload.lastTrayOccuredAt,
|
|
41571
41566
|
},
|
|
41572
41567
|
cachedAt,
|
|
41573
41568
|
};
|
|
@@ -41575,8 +41570,8 @@ const getNotificationTraySeen$1 = async () => {
|
|
|
41575
41570
|
/* end_public_function */
|
|
41576
41571
|
/**
|
|
41577
41572
|
* ```js
|
|
41578
|
-
* import {
|
|
41579
|
-
* const notificationTraySeen = await
|
|
41573
|
+
* import { NotificationTrayRepository } from '@amityco/ts-sdk'
|
|
41574
|
+
* const notificationTraySeen = await NotificationTrayRepository.getNotificationTraySeen.locally()
|
|
41580
41575
|
* ```
|
|
41581
41576
|
*
|
|
41582
41577
|
* Queries a paginable list of {@link Amity.NotificationTraySeen} objects from cache
|
|
@@ -41748,10 +41743,10 @@ class NotificationTrayItemsLiveCollectionController extends LiveCollectionContro
|
|
|
41748
41743
|
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
41749
41744
|
if (!collection)
|
|
41750
41745
|
return;
|
|
41751
|
-
const data = (
|
|
41746
|
+
const data = (_b = collection.data
|
|
41752
41747
|
.map(id => pullFromCache(['notificationTrayItem', 'get', id]))
|
|
41753
41748
|
.filter(isNonNullable)
|
|
41754
|
-
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : []
|
|
41749
|
+
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : [];
|
|
41755
41750
|
if (!this.shouldNotify(data) && origin === 'event')
|
|
41756
41751
|
return;
|
|
41757
41752
|
this.callback({
|
|
@@ -41796,8 +41791,8 @@ const getNotificationTrayItems = (params, callback, config) => {
|
|
|
41796
41791
|
*/
|
|
41797
41792
|
/**
|
|
41798
41793
|
* ```js
|
|
41799
|
-
* import {
|
|
41800
|
-
* const updated = await
|
|
41794
|
+
* import { NotificationTrayRepository } from '@amityco/ts-sdk'
|
|
41795
|
+
* const updated = await NotificationTrayRepository.markNotificationTraySeen({
|
|
41801
41796
|
* lastSeenAt: Amity.timestamp,
|
|
41802
41797
|
* })
|
|
41803
41798
|
* ```
|
|
@@ -41811,10 +41806,10 @@ const getNotificationTrayItems = (params, callback, config) => {
|
|
|
41811
41806
|
* @category Post API
|
|
41812
41807
|
* @async
|
|
41813
41808
|
*/
|
|
41814
|
-
const
|
|
41809
|
+
const markNotificationTraySeen = async (lastSeenAt) => {
|
|
41815
41810
|
var _a;
|
|
41816
41811
|
const client = getActiveClient();
|
|
41817
|
-
client.log('notificationTray/
|
|
41812
|
+
client.log('notificationTray/markNotificationTraySeen', {});
|
|
41818
41813
|
const { data: payload } = await client.http.put(`api/v1/notification-tray/tray/seen`, {
|
|
41819
41814
|
lastSeenAt,
|
|
41820
41815
|
});
|
|
@@ -41839,9 +41834,9 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
41839
41834
|
__proto__: null,
|
|
41840
41835
|
getNotificationTraySeen: getNotificationTraySeen,
|
|
41841
41836
|
getNotificationTrayItems: getNotificationTrayItems,
|
|
41842
|
-
|
|
41843
|
-
|
|
41837
|
+
markNotificationItemsSeen: markNotificationItemsSeen,
|
|
41838
|
+
markNotificationTraySeen: markNotificationTraySeen,
|
|
41844
41839
|
onNotificationTraySeenUpdated: onNotificationTraySeenUpdated
|
|
41845
41840
|
});
|
|
41846
41841
|
|
|
41847
|
-
export { API_REGIONS, index$1 as AdRepository, index$9 as CategoryRepository, index$d as ChannelRepository, index$m as Client, index$7 as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$a as CommunityRepository, ContentFeedType, DefaultCommunityPostSetting, index$8 as FeedRepository, FileAccessTypeEnum, index$j as FileRepository, FileType, index$3 as LiveStreamPlayer, MessageContentType, index$h as MessageRepository, index$4 as PollRepository, PostContentType, index$6 as PostRepository, index$i as ReactionRepository, index$2 as StoryRepository, index$5 as StreamRepository, index$g as SubChannelRepository, SubscriptionLevels, index$k as UserRepository, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache,
|
|
41842
|
+
export { API_REGIONS, index$1 as AdRepository, index$9 as CategoryRepository, index$d as ChannelRepository, index$m as Client, index$7 as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$a as CommunityRepository, ContentFeedType, DefaultCommunityPostSetting, index$8 as FeedRepository, FileAccessTypeEnum, index$j as FileRepository, FileType, index$3 as LiveStreamPlayer, MessageContentType, index$h as MessageRepository, index as NotificationTrayRepository, index$4 as PollRepository, PostContentType, index$6 as PostRepository, index$i as ReactionRepository, index$2 as StoryRepository, index$5 as StreamRepository, index$g as SubChannelRepository, SubscriptionLevels, index$k as UserRepository, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, wipeCache };
|