@amityco/ts-sdk 7.1.1-61f30ce0.0 → 7.1.1-6dd179b0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/domains/notification.d.ts +4 -4
- package/dist/@types/domains/notification.d.ts.map +1 -1
- package/dist/@types/index.d.ts +1 -0
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/index.cjs.js +60 -66
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +60 -66
- package/dist/index.umd.js +1 -1
- package/dist/notificationTray/api/index.d.ts +3 -0
- package/dist/notificationTray/api/index.d.ts.map +1 -0
- package/dist/notificationTray/api/markItemsSeen.d.ts +16 -0
- package/dist/notificationTray/api/markItemsSeen.d.ts.map +1 -0
- package/dist/notificationTray/api/markTraySeen.d.ts +19 -0
- package/dist/notificationTray/api/markTraySeen.d.ts.map +1 -0
- package/dist/notificationTray/events/index.d.ts.map +1 -0
- package/dist/notificationTray/events/onNotificationTraySeenUpdated.d.ts.map +1 -0
- package/dist/notificationTray/index.d.ts.map +1 -0
- package/dist/{notificationTrayRepository → notificationTray}/internalApi/getNotificationTraySeen.d.ts +4 -4
- package/dist/notificationTray/internalApi/getNotificationTraySeen.d.ts.map +1 -0
- package/dist/{notificationTrayRepository → notificationTray}/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts +2 -2
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts.map +1 -0
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts.map +1 -0
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts.map +1 -0
- package/dist/{notificationTrayRepository → notificationTray}/observers/getNotificationTrayItems.d.ts +1 -1
- package/dist/notificationTray/observers/getNotificationTrayItems.d.ts.map +1 -0
- package/dist/notificationTray/observers/getNotificationTraySeen.d.ts.map +1 -0
- package/dist/notificationTray/observers/index.d.ts.map +1 -0
- package/dist/notificationTray/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 +4 -4
- package/src/@types/index.ts +1 -0
- package/src/index.ts +1 -1
- package/src/notificationTray/api/index.ts +2 -0
- package/src/{notificationTrayRepository/api/markNotificationItemsSeen.ts → notificationTray/api/markItemsSeen.ts} +4 -4
- package/src/{notificationTrayRepository/api/markNotificationTraySeen.ts → notificationTray/api/markTraySeen.ts} +4 -4
- package/src/{notificationTrayRepository → notificationTray}/internalApi/getNotificationTraySeen.ts +4 -4
- package/src/{notificationTrayRepository → notificationTray}/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.ts +3 -3
- package/src/{notificationTrayRepository → notificationTray}/observers/getNotificationTrayItems.ts +1 -1
- package/src/utils/linkedObject/notificationTrayLinkedObject.ts +6 -15
- package/dist/notificationTrayRepository/api/index.d.ts +0 -3
- package/dist/notificationTrayRepository/api/index.d.ts.map +0 -1
- package/dist/notificationTrayRepository/api/markNotificationItemsSeen.d.ts +0 -16
- package/dist/notificationTrayRepository/api/markNotificationItemsSeen.d.ts.map +0 -1
- package/dist/notificationTrayRepository/api/markNotificationTraySeen.d.ts +0 -19
- package/dist/notificationTrayRepository/api/markNotificationTraySeen.d.ts.map +0 -1
- package/dist/notificationTrayRepository/events/index.d.ts.map +0 -1
- package/dist/notificationTrayRepository/events/onNotificationTraySeenUpdated.d.ts.map +0 -1
- package/dist/notificationTrayRepository/index.d.ts.map +0 -1
- package/dist/notificationTrayRepository/internalApi/getNotificationTraySeen.d.ts.map +0 -1
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts.map +0 -1
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts.map +0 -1
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts.map +0 -1
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems.d.ts.map +0 -1
- package/dist/notificationTrayRepository/observers/getNotificationTraySeen.d.ts.map +0 -1
- package/dist/notificationTrayRepository/observers/index.d.ts.map +0 -1
- package/dist/notificationTrayRepository/utils/prepareNotificationTrayItemsPayload.d.ts.map +0 -1
- package/src/notificationTrayRepository/api/index.ts +0 -2
- /package/dist/{notificationTrayRepository → notificationTray}/events/index.d.ts +0 -0
- /package/dist/{notificationTrayRepository → notificationTray}/events/onNotificationTraySeenUpdated.d.ts +0 -0
- /package/dist/{notificationTrayRepository → notificationTray}/index.d.ts +0 -0
- /package/dist/{notificationTrayRepository → notificationTray}/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts +0 -0
- /package/dist/{notificationTrayRepository → notificationTray}/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts +0 -0
- /package/dist/{notificationTrayRepository → notificationTray}/observers/getNotificationTraySeen.d.ts +0 -0
- /package/dist/{notificationTrayRepository → notificationTray}/observers/index.d.ts +0 -0
- /package/dist/{notificationTrayRepository → notificationTray}/utils/prepareNotificationTrayItemsPayload.d.ts +0 -0
- /package/src/{notificationTrayRepository → notificationTray}/events/index.ts +0 -0
- /package/src/{notificationTrayRepository → notificationTray}/events/onNotificationTraySeenUpdated.ts +0 -0
- /package/src/{notificationTrayRepository → notificationTray}/index.ts +0 -0
- /package/src/{notificationTrayRepository → notificationTray}/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.ts +0 -0
- /package/src/{notificationTrayRepository → notificationTray}/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.ts +0 -0
- /package/src/{notificationTrayRepository → notificationTray}/observers/getNotificationTraySeen.ts +0 -0
- /package/src/{notificationTrayRepository → notificationTray}/observers/index.ts +0 -0
- /package/src/{notificationTrayRepository → notificationTray}/utils/prepareNotificationTrayItemsPayload.ts +0 -0
|
@@ -18,18 +18,18 @@ declare global {
|
|
|
18
18
|
type RawNotificationTrayItem = {
|
|
19
19
|
_id: string;
|
|
20
20
|
lastSeenAt: Amity.timestamp;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
lastOccurredAt: Amity.timestamp;
|
|
22
|
+
actors: {
|
|
23
23
|
_id: string;
|
|
24
24
|
lastActedAt: Amity.timestamp;
|
|
25
25
|
}[];
|
|
26
26
|
actorsCount: number;
|
|
27
|
-
action: TrayAction;
|
|
28
27
|
trayItemCategory?: TrayItemCategoryType;
|
|
29
28
|
targetId: string;
|
|
30
29
|
targetType: string;
|
|
31
30
|
referenceId?: string;
|
|
32
31
|
referenceType?: string;
|
|
32
|
+
actionType: TrayAction;
|
|
33
33
|
actionReferenceId?: string;
|
|
34
34
|
parentId?: string;
|
|
35
35
|
data: {
|
|
@@ -39,6 +39,7 @@ declare global {
|
|
|
39
39
|
};
|
|
40
40
|
text: string;
|
|
41
41
|
templatedText: string;
|
|
42
|
+
daySegment?: Amity.timestamp;
|
|
42
43
|
};
|
|
43
44
|
type InternalNotificationTrayItem = RawNotificationTrayItem;
|
|
44
45
|
type QueryNotificationTrayItem = {
|
|
@@ -48,7 +49,6 @@ declare global {
|
|
|
48
49
|
type NotificationTrayItemLiveCollection = Amity.LiveCollectionParams<Omit<QueryNotificationTrayItem, 'limit'>>;
|
|
49
50
|
type NotificationTrayItemLiveCollectionCache = Amity.LiveCollectionCache<Amity.InternalNotificationTrayItem['_id'], Pick<QueryNotificationTrayItem, 'limit'>>;
|
|
50
51
|
type NotificationTrayItem = Amity.InternalNotificationTrayItem & {
|
|
51
|
-
markRead: () => void;
|
|
52
52
|
isSeen: boolean;
|
|
53
53
|
isRecent: boolean;
|
|
54
54
|
users: Amity.User[];
|
|
@@ -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,uBAAuB,GAAG;YAC7B,GAAG,EAAE,MAAM,CAAC;YACZ,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;YAC5B,
|
|
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,uBAAuB,GAAG;YAC7B,GAAG,EAAE,MAAM,CAAC;YACZ,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;YAC5B,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC;YAChC,MAAM,EAAE;gBACN,GAAG,EAAE,MAAM,CAAC;gBACZ,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC;aAC9B,EAAE,CAAC;YACJ,WAAW,EAAE,MAAM,CAAC;YACpB,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;YACxC,QAAQ,EAAE,MAAM,CAAC;YACjB,UAAU,EAAE,MAAM,CAAC;YACnB,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,aAAa,CAAC,EAAE,MA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,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/@types/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,CAAC;AAClB,OAAO,eAAe,CAAC;AACvB,OAAO,oBAAoB,CAAC;AAC5B,OAAO,gBAAgB,CAAC;AACxB,OAAO,eAAe,CAAC;AACvB,OAAO,eAAe,CAAC;AACvB,OAAO,cAAc,CAAC;AACtB,OAAO,cAAc,CAAC;AACtB,OAAO,aAAa,CAAC;AAGrB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,gBAAgB,CAAC;AACxB,OAAO,kBAAkB,CAAC;AAE1B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,oBAAoB,CAAC;AAE5B,OAAO,iBAAiB,CAAC;AACzB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,sBAAsB,CAAC;AAE9B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,mBAAmB,CAAC;AAE3B,OAAO,kBAAkB,CAAC;AAE1B,OAAO,mBAAmB,CAAC;AAE3B,OAAO,gBAAgB,CAAC;AACxB,OAAO,iBAAiB,CAAC;AAEzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -5997,63 +5997,12 @@ const pinnedPostLinkedObject = (pinnedPost) => {
|
|
|
5997
5997
|
} });
|
|
5998
5998
|
};
|
|
5999
5999
|
|
|
6000
|
-
/* begin_public_function
|
|
6001
|
-
id: notificationTrayItem.markSeen
|
|
6002
|
-
*/
|
|
6003
|
-
/**
|
|
6004
|
-
* ```js
|
|
6005
|
-
* import { NotificationTrayRepository } from '@amityco/ts-sdk'
|
|
6006
|
-
* const updated = await NotificationTrayRepository.markNotificationItemsSeen()
|
|
6007
|
-
* ```
|
|
6008
|
-
*
|
|
6009
|
-
* Updates an {@link Amity.NotificationItemSeen}
|
|
6010
|
-
*
|
|
6011
|
-
* @param trayItems[] that include id and lastTraySeenAt, The ID of the {@link Amity.NotificationItemSeen} to edit
|
|
6012
|
-
* @returns the updated {@link Amity.NotificationItemSeen} object
|
|
6013
|
-
*
|
|
6014
|
-
* @category NotificationItemSeen API
|
|
6015
|
-
* @async
|
|
6016
|
-
*/
|
|
6017
|
-
const markNotificationItemsSeen = async (patch) => {
|
|
6018
|
-
const client = getActiveClient();
|
|
6019
|
-
client.log('notificationTray/markNotificationItemsSeen', {});
|
|
6020
|
-
const { data: payload } = await client.http.put(`api/v1/notification-tray/items/seen`, {
|
|
6021
|
-
patch,
|
|
6022
|
-
});
|
|
6023
|
-
const updatedData = patch.trayItems
|
|
6024
|
-
.map(patchItem => {
|
|
6025
|
-
var _a;
|
|
6026
|
-
const cacheData = (_a = pullFromCache([
|
|
6027
|
-
'notificationTraySeen',
|
|
6028
|
-
'get',
|
|
6029
|
-
patchItem.id,
|
|
6030
|
-
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
6031
|
-
if (!cacheData)
|
|
6032
|
-
return;
|
|
6033
|
-
const data = Object.assign(Object.assign({}, cacheData), payload);
|
|
6034
|
-
if (client.cache) {
|
|
6035
|
-
const cachedAt = Date.now();
|
|
6036
|
-
pushToCache(['notificationTrayItem', 'get'], data, { cachedAt });
|
|
6037
|
-
}
|
|
6038
|
-
return data;
|
|
6039
|
-
})
|
|
6040
|
-
.filter(Boolean);
|
|
6041
|
-
fireEvent('local.notificationTrayItem.updated', { notificationTrayItems: updatedData });
|
|
6042
|
-
};
|
|
6043
|
-
/* end_public_function */
|
|
6044
|
-
|
|
6045
6000
|
const notificationTrayLinkedObject = (noti) => {
|
|
6046
|
-
return Object.assign(Object.assign({}, noti), { isSeen: noti.lastSeenAt > noti.
|
|
6047
|
-
.map(
|
|
6001
|
+
return Object.assign(Object.assign({}, noti), { isSeen: noti.lastSeenAt > noti.lastOccurredAt, isRecent: new Date(noti.lastOccurredAt).getTime() >= Date.now() - WEEK, users: noti.actors
|
|
6002
|
+
.map(({ _id }) => pullFromCache(['user', 'get', _id]))
|
|
6048
6003
|
.filter(isNonNullable)
|
|
6049
|
-
.map(
|
|
6050
|
-
|
|
6051
|
-
{
|
|
6052
|
-
id: noti._id,
|
|
6053
|
-
lastSeenAt: noti.lastSeenAt,
|
|
6054
|
-
},
|
|
6055
|
-
],
|
|
6056
|
-
}) });
|
|
6004
|
+
.map(({ data }) => data)
|
|
6005
|
+
.map(user => userLinkedObject(user)) });
|
|
6057
6006
|
};
|
|
6058
6007
|
|
|
6059
6008
|
const LinkedObject = {
|
|
@@ -25447,8 +25396,8 @@ const createUserToken = async (apiKey, apiRegion, params) => {
|
|
|
25447
25396
|
*/
|
|
25448
25397
|
/**
|
|
25449
25398
|
* ```js
|
|
25450
|
-
* import {
|
|
25451
|
-
* const notificationTraySeen = await
|
|
25399
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
25400
|
+
* const notificationTraySeen = await notificationTray.getNotificationTraySeen()
|
|
25452
25401
|
* ```
|
|
25453
25402
|
*
|
|
25454
25403
|
*
|
|
@@ -25483,8 +25432,8 @@ const getNotificationTraySeen$1 = async () => {
|
|
|
25483
25432
|
/* end_public_function */
|
|
25484
25433
|
/**
|
|
25485
25434
|
* ```js
|
|
25486
|
-
* import {
|
|
25487
|
-
* const notificationTraySeen = await
|
|
25435
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
25436
|
+
* const notificationTraySeen = await notificationTray.getNotificationTraySeen.locally()
|
|
25488
25437
|
* ```
|
|
25489
25438
|
*
|
|
25490
25439
|
* Queries a paginable list of {@link Amity.NotificationTraySeen} objects from cache
|
|
@@ -25699,13 +25648,58 @@ const getNotificationTrayItems = (params, callback, config) => {
|
|
|
25699
25648
|
};
|
|
25700
25649
|
};
|
|
25701
25650
|
|
|
25651
|
+
/* begin_public_function
|
|
25652
|
+
id: notificationTrayItem.markSeen
|
|
25653
|
+
*/
|
|
25654
|
+
/**
|
|
25655
|
+
* ```js
|
|
25656
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
25657
|
+
* const updated = await notificationTray.markItemsSeen()
|
|
25658
|
+
* ```
|
|
25659
|
+
*
|
|
25660
|
+
* Updates an {@link Amity.NotificationItemSeen}
|
|
25661
|
+
*
|
|
25662
|
+
* @param trayItems[] that include id and lastTraySeenAt, The ID of the {@link Amity.NotificationItemSeen} to edit
|
|
25663
|
+
* @returns the updated {@link Amity.NotificationItemSeen} object
|
|
25664
|
+
*
|
|
25665
|
+
* @category NotificationItemSeen API
|
|
25666
|
+
* @async
|
|
25667
|
+
*/
|
|
25668
|
+
const markItemsSeen = async (patch) => {
|
|
25669
|
+
const client = getActiveClient();
|
|
25670
|
+
client.log('notificationTray/markItemsSeen', {});
|
|
25671
|
+
const { data: payload } = await client.http.put(`api/v1/notification-tray/items/seen`, {
|
|
25672
|
+
patch,
|
|
25673
|
+
});
|
|
25674
|
+
const updatedData = patch.trayItems
|
|
25675
|
+
.map(patchItem => {
|
|
25676
|
+
var _a;
|
|
25677
|
+
const cacheData = (_a = pullFromCache([
|
|
25678
|
+
'notificationTraySeen',
|
|
25679
|
+
'get',
|
|
25680
|
+
patchItem.id,
|
|
25681
|
+
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
25682
|
+
if (!cacheData)
|
|
25683
|
+
return;
|
|
25684
|
+
const data = Object.assign(Object.assign({}, cacheData), payload);
|
|
25685
|
+
if (client.cache) {
|
|
25686
|
+
const cachedAt = Date.now();
|
|
25687
|
+
pushToCache(['notificationTrayItem', 'get'], data, { cachedAt });
|
|
25688
|
+
}
|
|
25689
|
+
return data;
|
|
25690
|
+
})
|
|
25691
|
+
.filter(Boolean);
|
|
25692
|
+
fireEvent('local.notificationTrayItem.updated', { notificationTrayItems: updatedData });
|
|
25693
|
+
};
|
|
25694
|
+
/* end_public_function */
|
|
25695
|
+
|
|
25702
25696
|
/* begin_public_function
|
|
25703
25697
|
id: notificationTray.markSeen
|
|
25704
25698
|
*/
|
|
25705
25699
|
/**
|
|
25706
25700
|
* ```js
|
|
25707
|
-
* import {
|
|
25708
|
-
* const updated = await
|
|
25701
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
25702
|
+
* const updated = await notificationTray.markTraySeen({
|
|
25709
25703
|
* lastSeenAt: Amity.timestamp,
|
|
25710
25704
|
* })
|
|
25711
25705
|
* ```
|
|
@@ -25719,10 +25713,10 @@ const getNotificationTrayItems = (params, callback, config) => {
|
|
|
25719
25713
|
* @category Post API
|
|
25720
25714
|
* @async
|
|
25721
25715
|
*/
|
|
25722
|
-
const
|
|
25716
|
+
const markTraySeen = async (lastSeenAt) => {
|
|
25723
25717
|
var _a;
|
|
25724
25718
|
const client = getActiveClient();
|
|
25725
|
-
client.log('notificationTray/
|
|
25719
|
+
client.log('notificationTray/markTraySeen', {});
|
|
25726
25720
|
const { data: payload } = await client.http.put(`api/v1/notification-tray/tray/seen`, {
|
|
25727
25721
|
lastSeenAt,
|
|
25728
25722
|
});
|
|
@@ -25747,8 +25741,8 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
25747
25741
|
__proto__: null,
|
|
25748
25742
|
getNotificationTraySeen: getNotificationTraySeen,
|
|
25749
25743
|
getNotificationTrayItems: getNotificationTrayItems,
|
|
25750
|
-
|
|
25751
|
-
|
|
25744
|
+
markItemsSeen: markItemsSeen,
|
|
25745
|
+
markTraySeen: markTraySeen,
|
|
25752
25746
|
onNotificationTraySeenUpdated: onNotificationTraySeenUpdated
|
|
25753
25747
|
});
|
|
25754
25748
|
|
|
@@ -25769,7 +25763,6 @@ exports.FileType = FileType;
|
|
|
25769
25763
|
exports.LiveStreamPlayer = index$3;
|
|
25770
25764
|
exports.MessageContentType = MessageContentType;
|
|
25771
25765
|
exports.MessageRepository = index$h;
|
|
25772
|
-
exports.NotificationTrayRepository = index;
|
|
25773
25766
|
exports.PollRepository = index$4;
|
|
25774
25767
|
exports.PostContentType = PostContentType;
|
|
25775
25768
|
exports.PostRepository = index$6;
|
|
@@ -25830,6 +25823,7 @@ exports.isPaged = isPaged;
|
|
|
25830
25823
|
exports.isReportedByMe = isReportedByMe;
|
|
25831
25824
|
exports.isSkip = isSkip;
|
|
25832
25825
|
exports.mergeInCache = mergeInCache;
|
|
25826
|
+
exports.notificationTray = index;
|
|
25833
25827
|
exports.onChannelMarkerFetched = onChannelMarkerFetched;
|
|
25834
25828
|
exports.onFeedMarkerFetched = onFeedMarkerFetched;
|
|
25835
25829
|
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 notificationTray from './notificationTray';
|
|
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,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAE5B,OAAO,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;A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AAC;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,gBAAgB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -22089,63 +22089,12 @@ const pinnedPostLinkedObject = (pinnedPost) => {
|
|
|
22089
22089
|
} });
|
|
22090
22090
|
};
|
|
22091
22091
|
|
|
22092
|
-
/* begin_public_function
|
|
22093
|
-
id: notificationTrayItem.markSeen
|
|
22094
|
-
*/
|
|
22095
|
-
/**
|
|
22096
|
-
* ```js
|
|
22097
|
-
* import { NotificationTrayRepository } from '@amityco/ts-sdk'
|
|
22098
|
-
* const updated = await NotificationTrayRepository.markNotificationItemsSeen()
|
|
22099
|
-
* ```
|
|
22100
|
-
*
|
|
22101
|
-
* Updates an {@link Amity.NotificationItemSeen}
|
|
22102
|
-
*
|
|
22103
|
-
* @param trayItems[] that include id and lastTraySeenAt, The ID of the {@link Amity.NotificationItemSeen} to edit
|
|
22104
|
-
* @returns the updated {@link Amity.NotificationItemSeen} object
|
|
22105
|
-
*
|
|
22106
|
-
* @category NotificationItemSeen API
|
|
22107
|
-
* @async
|
|
22108
|
-
*/
|
|
22109
|
-
const markNotificationItemsSeen = async (patch) => {
|
|
22110
|
-
const client = getActiveClient();
|
|
22111
|
-
client.log('notificationTray/markNotificationItemsSeen', {});
|
|
22112
|
-
const { data: payload } = await client.http.put(`api/v1/notification-tray/items/seen`, {
|
|
22113
|
-
patch,
|
|
22114
|
-
});
|
|
22115
|
-
const updatedData = patch.trayItems
|
|
22116
|
-
.map(patchItem => {
|
|
22117
|
-
var _a;
|
|
22118
|
-
const cacheData = (_a = pullFromCache([
|
|
22119
|
-
'notificationTraySeen',
|
|
22120
|
-
'get',
|
|
22121
|
-
patchItem.id,
|
|
22122
|
-
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
22123
|
-
if (!cacheData)
|
|
22124
|
-
return;
|
|
22125
|
-
const data = Object.assign(Object.assign({}, cacheData), payload);
|
|
22126
|
-
if (client.cache) {
|
|
22127
|
-
const cachedAt = Date.now();
|
|
22128
|
-
pushToCache(['notificationTrayItem', 'get'], data, { cachedAt });
|
|
22129
|
-
}
|
|
22130
|
-
return data;
|
|
22131
|
-
})
|
|
22132
|
-
.filter(Boolean);
|
|
22133
|
-
fireEvent('local.notificationTrayItem.updated', { notificationTrayItems: updatedData });
|
|
22134
|
-
};
|
|
22135
|
-
/* end_public_function */
|
|
22136
|
-
|
|
22137
22092
|
const notificationTrayLinkedObject = (noti) => {
|
|
22138
|
-
return Object.assign(Object.assign({}, noti), { isSeen: noti.lastSeenAt > noti.
|
|
22139
|
-
.map(
|
|
22093
|
+
return Object.assign(Object.assign({}, noti), { isSeen: noti.lastSeenAt > noti.lastOccurredAt, isRecent: new Date(noti.lastOccurredAt).getTime() >= Date.now() - WEEK, users: noti.actors
|
|
22094
|
+
.map(({ _id }) => pullFromCache(['user', 'get', _id]))
|
|
22140
22095
|
.filter(isNonNullable)
|
|
22141
|
-
.map(
|
|
22142
|
-
|
|
22143
|
-
{
|
|
22144
|
-
id: noti._id,
|
|
22145
|
-
lastSeenAt: noti.lastSeenAt,
|
|
22146
|
-
},
|
|
22147
|
-
],
|
|
22148
|
-
}) });
|
|
22096
|
+
.map(({ data }) => data)
|
|
22097
|
+
.map(user => userLinkedObject(user)) });
|
|
22149
22098
|
};
|
|
22150
22099
|
|
|
22151
22100
|
const LinkedObject = {
|
|
@@ -41539,8 +41488,8 @@ const createUserToken = async (apiKey, apiRegion, params) => {
|
|
|
41539
41488
|
*/
|
|
41540
41489
|
/**
|
|
41541
41490
|
* ```js
|
|
41542
|
-
* import {
|
|
41543
|
-
* const notificationTraySeen = await
|
|
41491
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
41492
|
+
* const notificationTraySeen = await notificationTray.getNotificationTraySeen()
|
|
41544
41493
|
* ```
|
|
41545
41494
|
*
|
|
41546
41495
|
*
|
|
@@ -41575,8 +41524,8 @@ const getNotificationTraySeen$1 = async () => {
|
|
|
41575
41524
|
/* end_public_function */
|
|
41576
41525
|
/**
|
|
41577
41526
|
* ```js
|
|
41578
|
-
* import {
|
|
41579
|
-
* const notificationTraySeen = await
|
|
41527
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
41528
|
+
* const notificationTraySeen = await notificationTray.getNotificationTraySeen.locally()
|
|
41580
41529
|
* ```
|
|
41581
41530
|
*
|
|
41582
41531
|
* Queries a paginable list of {@link Amity.NotificationTraySeen} objects from cache
|
|
@@ -41791,13 +41740,58 @@ const getNotificationTrayItems = (params, callback, config) => {
|
|
|
41791
41740
|
};
|
|
41792
41741
|
};
|
|
41793
41742
|
|
|
41743
|
+
/* begin_public_function
|
|
41744
|
+
id: notificationTrayItem.markSeen
|
|
41745
|
+
*/
|
|
41746
|
+
/**
|
|
41747
|
+
* ```js
|
|
41748
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
41749
|
+
* const updated = await notificationTray.markItemsSeen()
|
|
41750
|
+
* ```
|
|
41751
|
+
*
|
|
41752
|
+
* Updates an {@link Amity.NotificationItemSeen}
|
|
41753
|
+
*
|
|
41754
|
+
* @param trayItems[] that include id and lastTraySeenAt, The ID of the {@link Amity.NotificationItemSeen} to edit
|
|
41755
|
+
* @returns the updated {@link Amity.NotificationItemSeen} object
|
|
41756
|
+
*
|
|
41757
|
+
* @category NotificationItemSeen API
|
|
41758
|
+
* @async
|
|
41759
|
+
*/
|
|
41760
|
+
const markItemsSeen = async (patch) => {
|
|
41761
|
+
const client = getActiveClient();
|
|
41762
|
+
client.log('notificationTray/markItemsSeen', {});
|
|
41763
|
+
const { data: payload } = await client.http.put(`api/v1/notification-tray/items/seen`, {
|
|
41764
|
+
patch,
|
|
41765
|
+
});
|
|
41766
|
+
const updatedData = patch.trayItems
|
|
41767
|
+
.map(patchItem => {
|
|
41768
|
+
var _a;
|
|
41769
|
+
const cacheData = (_a = pullFromCache([
|
|
41770
|
+
'notificationTraySeen',
|
|
41771
|
+
'get',
|
|
41772
|
+
patchItem.id,
|
|
41773
|
+
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
41774
|
+
if (!cacheData)
|
|
41775
|
+
return;
|
|
41776
|
+
const data = Object.assign(Object.assign({}, cacheData), payload);
|
|
41777
|
+
if (client.cache) {
|
|
41778
|
+
const cachedAt = Date.now();
|
|
41779
|
+
pushToCache(['notificationTrayItem', 'get'], data, { cachedAt });
|
|
41780
|
+
}
|
|
41781
|
+
return data;
|
|
41782
|
+
})
|
|
41783
|
+
.filter(Boolean);
|
|
41784
|
+
fireEvent('local.notificationTrayItem.updated', { notificationTrayItems: updatedData });
|
|
41785
|
+
};
|
|
41786
|
+
/* end_public_function */
|
|
41787
|
+
|
|
41794
41788
|
/* begin_public_function
|
|
41795
41789
|
id: notificationTray.markSeen
|
|
41796
41790
|
*/
|
|
41797
41791
|
/**
|
|
41798
41792
|
* ```js
|
|
41799
|
-
* import {
|
|
41800
|
-
* const updated = await
|
|
41793
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
41794
|
+
* const updated = await notificationTray.markTraySeen({
|
|
41801
41795
|
* lastSeenAt: Amity.timestamp,
|
|
41802
41796
|
* })
|
|
41803
41797
|
* ```
|
|
@@ -41811,10 +41805,10 @@ const getNotificationTrayItems = (params, callback, config) => {
|
|
|
41811
41805
|
* @category Post API
|
|
41812
41806
|
* @async
|
|
41813
41807
|
*/
|
|
41814
|
-
const
|
|
41808
|
+
const markTraySeen = async (lastSeenAt) => {
|
|
41815
41809
|
var _a;
|
|
41816
41810
|
const client = getActiveClient();
|
|
41817
|
-
client.log('notificationTray/
|
|
41811
|
+
client.log('notificationTray/markTraySeen', {});
|
|
41818
41812
|
const { data: payload } = await client.http.put(`api/v1/notification-tray/tray/seen`, {
|
|
41819
41813
|
lastSeenAt,
|
|
41820
41814
|
});
|
|
@@ -41839,9 +41833,9 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
41839
41833
|
__proto__: null,
|
|
41840
41834
|
getNotificationTraySeen: getNotificationTraySeen,
|
|
41841
41835
|
getNotificationTrayItems: getNotificationTrayItems,
|
|
41842
|
-
|
|
41843
|
-
|
|
41836
|
+
markItemsSeen: markItemsSeen,
|
|
41837
|
+
markTraySeen: markTraySeen,
|
|
41844
41838
|
onNotificationTraySeenUpdated: onNotificationTraySeenUpdated
|
|
41845
41839
|
});
|
|
41846
41840
|
|
|
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
|
|
41841
|
+
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, index as notificationTray, 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 };
|