@amityco/ts-sdk 7.1.0 → 7.1.1-1325f22d.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/.env +26 -26
- package/dist/@types/core/events.d.ts +4 -0
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/model.d.ts +4 -0
- 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/domains/notification.d.ts +81 -0
- package/dist/@types/domains/notification.d.ts.map +1 -0
- 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 +420 -45
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +403 -29
- package/dist/index.umd.js +4 -4
- 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 +2 -0
- package/dist/notificationTray/events/index.d.ts.map +1 -0
- package/dist/notificationTray/events/onNotificationTraySeenUpdated.d.ts +17 -0
- package/dist/notificationTray/events/onNotificationTraySeenUpdated.d.ts.map +1 -0
- package/dist/notificationTray/index.d.ts +4 -0
- package/dist/notificationTray/index.d.ts.map +1 -0
- package/dist/notificationTray/internalApi/getNotificationTraySeen.d.ts +30 -0
- package/dist/notificationTray/internalApi/getNotificationTraySeen.d.ts.map +1 -0
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts +13 -0
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts.map +1 -0
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts +9 -0
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts.map +1 -0
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts +9 -0
- package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts.map +1 -0
- package/dist/notificationTray/observers/getNotificationTrayItems.d.ts +12 -0
- package/dist/notificationTray/observers/getNotificationTrayItems.d.ts.map +1 -0
- package/dist/notificationTray/observers/getNotificationTraySeen.d.ts +21 -0
- package/dist/notificationTray/observers/getNotificationTraySeen.d.ts.map +1 -0
- package/dist/notificationTray/observers/index.d.ts +3 -0
- package/dist/notificationTray/observers/index.d.ts.map +1 -0
- package/dist/notificationTray/utils/prepareNotificationTrayItemsPayload.d.ts +2 -0
- package/dist/notificationTray/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 +5 -0
- package/src/@types/core/model.ts +6 -0
- package/src/@types/core/payload.ts +25 -0
- package/src/@types/domains/notification.ts +90 -0
- package/src/core/model/idResolvers.ts +3 -0
- package/src/core/model/index.ts +2 -0
- package/src/index.ts +2 -0
- package/src/notificationTray/api/index.ts +2 -0
- package/src/notificationTray/api/markItemsSeen.ts +59 -0
- package/src/notificationTray/api/markTraySeen.ts +65 -0
- package/src/notificationTray/events/index.ts +1 -0
- package/src/notificationTray/events/onNotificationTraySeenUpdated.ts +36 -0
- package/src/notificationTray/index.ts +3 -0
- package/src/notificationTray/internalApi/getNotificationTraySeen.ts +81 -0
- package/src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.ts +96 -0
- package/src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.ts +31 -0
- package/src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.ts +68 -0
- package/src/notificationTray/observers/getNotificationTrayItems.ts +44 -0
- package/src/notificationTray/observers/getNotificationTraySeen.ts +43 -0
- package/src/notificationTray/observers/index.ts +2 -0
- package/src/notificationTray/utils/prepareNotificationTrayItemsPayload.ts +12 -0
- package/src/utils/linkedObject/index.ts +2 -0
- package/src/utils/linkedObject/notificationTrayLinkedObject.ts +28 -0
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;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"}
|
|
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;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,gBAAgB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -106,6 +106,7 @@ 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;
|
|
109
110
|
const YEAR = 365 * DAY;
|
|
110
111
|
const ACCESS_TOKEN_WATCHER_INTERVAL = 10 * MINUTE;
|
|
111
112
|
|
|
@@ -527,6 +528,8 @@ const idResolvers = {
|
|
|
527
528
|
advertiser: ({ advertiserId }) => advertiserId,
|
|
528
529
|
pin: ({ placement, referenceId }) => `${placement}#${referenceId}`,
|
|
529
530
|
pinTarget: ({ targetId }) => targetId,
|
|
531
|
+
notificationTrayItem: ({ _id }) => _id,
|
|
532
|
+
notificationTraySeen: ({ userId }) => userId,
|
|
530
533
|
};
|
|
531
534
|
/**
|
|
532
535
|
* Retrieve the id resolver matching a domain name
|
|
@@ -578,6 +581,7 @@ const PAYLOAD2MODEL = {
|
|
|
578
581
|
advertisers: 'advertiser',
|
|
579
582
|
pinTargets: 'pinTarget',
|
|
580
583
|
pins: 'pin',
|
|
584
|
+
notificationTrayItems: 'notificationTrayItem',
|
|
581
585
|
};
|
|
582
586
|
/** hidden */
|
|
583
587
|
const isOutdated = (prevData, nextData) => {
|
|
@@ -22085,6 +22089,65 @@ const pinnedPostLinkedObject = (pinnedPost) => {
|
|
|
22085
22089
|
} });
|
|
22086
22090
|
};
|
|
22087
22091
|
|
|
22092
|
+
/* begin_public_function
|
|
22093
|
+
id: notificationTrayItem.markSeen
|
|
22094
|
+
*/
|
|
22095
|
+
/**
|
|
22096
|
+
* ```js
|
|
22097
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
22098
|
+
* const updated = await notificationTray.markItemsSeen()
|
|
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 markItemsSeen = async (patch) => {
|
|
22110
|
+
const client = getActiveClient();
|
|
22111
|
+
client.log('notificationTray/markItemsSeen', {});
|
|
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
|
+
const notificationTrayLinkedObject = (noti) => {
|
|
22138
|
+
return Object.assign(Object.assign({}, noti), { isSeen: noti.lastSeenAt > noti.lastOccuredAt, isRecent: new Date(noti.lastOccuredAt).getTime() >= Date.now() - WEEK, users: noti.actors
|
|
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({
|
|
22142
|
+
trayItems: [
|
|
22143
|
+
{
|
|
22144
|
+
id: noti._id,
|
|
22145
|
+
lastSeenAt: noti.lastSeenAt,
|
|
22146
|
+
},
|
|
22147
|
+
],
|
|
22148
|
+
}) });
|
|
22149
|
+
};
|
|
22150
|
+
|
|
22088
22151
|
const LinkedObject = {
|
|
22089
22152
|
ad: adLinkedObject,
|
|
22090
22153
|
comment: commentLinkedObject,
|
|
@@ -22098,6 +22161,7 @@ const LinkedObject = {
|
|
|
22098
22161
|
reactor: reactorLinkedObject,
|
|
22099
22162
|
channel: channelLinkedObject,
|
|
22100
22163
|
pinnedPost: pinnedPostLinkedObject,
|
|
22164
|
+
notificationTray: notificationTrayLinkedObject,
|
|
22101
22165
|
};
|
|
22102
22166
|
|
|
22103
22167
|
const getChannelMessagePreviewWithUser = (channel) => {
|
|
@@ -25868,7 +25932,7 @@ const getUserUnread = (callback) => {
|
|
|
25868
25932
|
};
|
|
25869
25933
|
};
|
|
25870
25934
|
|
|
25871
|
-
var index$
|
|
25935
|
+
var index$m = /*#__PURE__*/Object.freeze({
|
|
25872
25936
|
__proto__: null,
|
|
25873
25937
|
getActiveClient: getActiveClient,
|
|
25874
25938
|
getActiveUser: getActiveUser,
|
|
@@ -27075,7 +27139,7 @@ const getMyFollowInfo = (callback) => {
|
|
|
27075
27139
|
};
|
|
27076
27140
|
/* end_public_function */
|
|
27077
27141
|
|
|
27078
|
-
var index$
|
|
27142
|
+
var index$l = /*#__PURE__*/Object.freeze({
|
|
27079
27143
|
__proto__: null,
|
|
27080
27144
|
blockUser: blockUser,
|
|
27081
27145
|
unBlockUser: unBlockUser,
|
|
@@ -28090,9 +28154,9 @@ var AmityUserSearchMatchType;
|
|
|
28090
28154
|
AmityUserSearchMatchType["PARTIAL"] = "partial";
|
|
28091
28155
|
})(AmityUserSearchMatchType || (AmityUserSearchMatchType = {}));
|
|
28092
28156
|
|
|
28093
|
-
var index$
|
|
28157
|
+
var index$k = /*#__PURE__*/Object.freeze({
|
|
28094
28158
|
__proto__: null,
|
|
28095
|
-
Relationship: index$
|
|
28159
|
+
Relationship: index$l,
|
|
28096
28160
|
getUserByIds: getUserByIds,
|
|
28097
28161
|
updateUser: updateUser,
|
|
28098
28162
|
flagUser: flagUser,
|
|
@@ -28356,7 +28420,7 @@ const uploadImage = async (formData, onProgress) => {
|
|
|
28356
28420
|
};
|
|
28357
28421
|
/* end_public_function */
|
|
28358
28422
|
|
|
28359
|
-
var index$
|
|
28423
|
+
var index$j = /*#__PURE__*/Object.freeze({
|
|
28360
28424
|
__proto__: null,
|
|
28361
28425
|
getFile: getFile,
|
|
28362
28426
|
uploadFile: uploadFile,
|
|
@@ -30168,7 +30232,7 @@ const getReactions = (params, callback, config) => {
|
|
|
30168
30232
|
};
|
|
30169
30233
|
/* end_public_function */
|
|
30170
30234
|
|
|
30171
|
-
var index$
|
|
30235
|
+
var index$i = /*#__PURE__*/Object.freeze({
|
|
30172
30236
|
__proto__: null,
|
|
30173
30237
|
addReaction: addReaction,
|
|
30174
30238
|
removeReaction: removeReaction,
|
|
@@ -31984,7 +32048,7 @@ const getMessages = (params, callback, config) => {
|
|
|
31984
32048
|
};
|
|
31985
32049
|
/* end_public_function */
|
|
31986
32050
|
|
|
31987
|
-
var index$
|
|
32051
|
+
var index$h = /*#__PURE__*/Object.freeze({
|
|
31988
32052
|
__proto__: null,
|
|
31989
32053
|
createMessage: createMessage,
|
|
31990
32054
|
updateMessage: updateMessage,
|
|
@@ -32510,7 +32574,7 @@ const stopMessageReceiptSync = (subChannelId) => {
|
|
|
32510
32574
|
};
|
|
32511
32575
|
/* end_public_function */
|
|
32512
32576
|
|
|
32513
|
-
var index$
|
|
32577
|
+
var index$g = /*#__PURE__*/Object.freeze({
|
|
32514
32578
|
__proto__: null,
|
|
32515
32579
|
getSubChannelByIds: getSubChannels$1,
|
|
32516
32580
|
createSubChannel: createSubChannel,
|
|
@@ -33687,7 +33751,7 @@ const searchMembers$1 = (params, callback, config) => {
|
|
|
33687
33751
|
};
|
|
33688
33752
|
/* end_public_function */
|
|
33689
33753
|
|
|
33690
|
-
var index$
|
|
33754
|
+
var index$f = /*#__PURE__*/Object.freeze({
|
|
33691
33755
|
__proto__: null,
|
|
33692
33756
|
addMembers: addMembers$1,
|
|
33693
33757
|
removeMembers: removeMembers$1,
|
|
@@ -33890,7 +33954,7 @@ const unmuteMembers = async (channelId, userIds) => {
|
|
|
33890
33954
|
};
|
|
33891
33955
|
/* end_public_function */
|
|
33892
33956
|
|
|
33893
|
-
var index$
|
|
33957
|
+
var index$e = /*#__PURE__*/Object.freeze({
|
|
33894
33958
|
__proto__: null,
|
|
33895
33959
|
addRole: addRole,
|
|
33896
33960
|
removeRole: removeRole,
|
|
@@ -33900,10 +33964,10 @@ var index$d = /*#__PURE__*/Object.freeze({
|
|
|
33900
33964
|
unmuteMembers: unmuteMembers
|
|
33901
33965
|
});
|
|
33902
33966
|
|
|
33903
|
-
var index$
|
|
33967
|
+
var index$d = /*#__PURE__*/Object.freeze({
|
|
33904
33968
|
__proto__: null,
|
|
33905
|
-
Membership: index$
|
|
33906
|
-
Moderation: index$
|
|
33969
|
+
Membership: index$f,
|
|
33970
|
+
Moderation: index$e,
|
|
33907
33971
|
getChannelByIds: getChannelByIds$1,
|
|
33908
33972
|
createChannel: createChannel,
|
|
33909
33973
|
updateChannel: updateChannel,
|
|
@@ -35282,7 +35346,7 @@ const searchMembers = (params, callback, config) => {
|
|
|
35282
35346
|
};
|
|
35283
35347
|
/* end_public_function */
|
|
35284
35348
|
|
|
35285
|
-
var index$
|
|
35349
|
+
var index$c = /*#__PURE__*/Object.freeze({
|
|
35286
35350
|
__proto__: null,
|
|
35287
35351
|
addMembers: addMembers,
|
|
35288
35352
|
removeMembers: removeMembers,
|
|
@@ -36307,7 +36371,7 @@ const unbanMembers = async (communityId, userIds) => {
|
|
|
36307
36371
|
};
|
|
36308
36372
|
/* end_public_function */
|
|
36309
36373
|
|
|
36310
|
-
var index$
|
|
36374
|
+
var index$b = /*#__PURE__*/Object.freeze({
|
|
36311
36375
|
__proto__: null,
|
|
36312
36376
|
addRoles: addRoles,
|
|
36313
36377
|
removeRoles: removeRoles,
|
|
@@ -36315,10 +36379,10 @@ var index$a = /*#__PURE__*/Object.freeze({
|
|
|
36315
36379
|
unbanMembers: unbanMembers
|
|
36316
36380
|
});
|
|
36317
36381
|
|
|
36318
|
-
var index$
|
|
36382
|
+
var index$a = /*#__PURE__*/Object.freeze({
|
|
36319
36383
|
__proto__: null,
|
|
36320
|
-
Moderation: index$
|
|
36321
|
-
Membership: index$
|
|
36384
|
+
Moderation: index$b,
|
|
36385
|
+
Membership: index$c,
|
|
36322
36386
|
getCommunityByIds: getCommunities$1,
|
|
36323
36387
|
createCommunity: createCommunity,
|
|
36324
36388
|
updateCommunity: updateCommunity,
|
|
@@ -36551,7 +36615,7 @@ const getCategories = (params, callback, config) => {
|
|
|
36551
36615
|
};
|
|
36552
36616
|
/* end_public_function */
|
|
36553
36617
|
|
|
36554
|
-
var index$
|
|
36618
|
+
var index$9 = /*#__PURE__*/Object.freeze({
|
|
36555
36619
|
__proto__: null,
|
|
36556
36620
|
getCategory: getCategory,
|
|
36557
36621
|
getCategories: getCategories
|
|
@@ -36719,7 +36783,7 @@ getCustomRankingGlobalFeed.locally = (query) => {
|
|
|
36719
36783
|
: undefined;
|
|
36720
36784
|
};
|
|
36721
36785
|
|
|
36722
|
-
var index$
|
|
36786
|
+
var index$8 = /*#__PURE__*/Object.freeze({
|
|
36723
36787
|
__proto__: null,
|
|
36724
36788
|
queryGlobalFeed: queryGlobalFeed,
|
|
36725
36789
|
getCustomRankingGlobalFeed: getCustomRankingGlobalFeed
|
|
@@ -38034,7 +38098,7 @@ const getComments = (params, callback, config) => {
|
|
|
38034
38098
|
};
|
|
38035
38099
|
/* end_public_function */
|
|
38036
38100
|
|
|
38037
|
-
var index$
|
|
38101
|
+
var index$7 = /*#__PURE__*/Object.freeze({
|
|
38038
38102
|
__proto__: null,
|
|
38039
38103
|
getCommentByIds: getCommentByIds,
|
|
38040
38104
|
createComment: createComment,
|
|
@@ -39041,7 +39105,7 @@ const semanticSearchPosts = (params, callback, config) => {
|
|
|
39041
39105
|
};
|
|
39042
39106
|
};
|
|
39043
39107
|
|
|
39044
|
-
var index$
|
|
39108
|
+
var index$6 = /*#__PURE__*/Object.freeze({
|
|
39045
39109
|
__proto__: null,
|
|
39046
39110
|
getPostByIds: getPostByIds,
|
|
39047
39111
|
createPost: createPost,
|
|
@@ -39575,7 +39639,7 @@ const getStreams = (params, callback, config) => {
|
|
|
39575
39639
|
};
|
|
39576
39640
|
};
|
|
39577
39641
|
|
|
39578
|
-
var index$
|
|
39642
|
+
var index$5 = /*#__PURE__*/Object.freeze({
|
|
39579
39643
|
__proto__: null,
|
|
39580
39644
|
createStream: createStream,
|
|
39581
39645
|
updateStream: updateStream,
|
|
@@ -39862,7 +39926,7 @@ const getPoll = (pollId, callback) => {
|
|
|
39862
39926
|
};
|
|
39863
39927
|
/* end_public_function */
|
|
39864
39928
|
|
|
39865
|
-
var index$
|
|
39929
|
+
var index$4 = /*#__PURE__*/Object.freeze({
|
|
39866
39930
|
__proto__: null,
|
|
39867
39931
|
createPoll: createPoll,
|
|
39868
39932
|
closePoll: closePoll,
|
|
@@ -39873,7 +39937,7 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
39873
39937
|
getPoll: getPoll
|
|
39874
39938
|
});
|
|
39875
39939
|
|
|
39876
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
39940
|
+
const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDAARz+hmBgi8pJ\nQb8LeY41gtHhk+ACMwRfhsn7GqpqRQNG2qU0755mzZuVDUqjQMGSo8THJB7O+OJs\nflbZRkFXlFoFOVNw1UpNOgwEQZ6wB9oRwzepTJAfF1sVhm/o/ixvXh1zDFNDy6yZ\npXyiiJHUVxqyjllZhxnwdvjoVtDs6hW6awG09bB9nh/TTejlUKXoAgzqVwu/1QMu\nUVViET495elEe19aUarEy+oL2iKeXCEvqda/pWNBdbieFyJvvZ08HN8dPuT88wq2\njZLEAth1vrwQ2IAa4ktaLcBQdLJgIkrbDvAiVZ8lQAjS/bq5vXQikTGvoPlC5bbn\nvuOM/3eLAgMBAAECggEAVZ+peHAghq2QVj71nX5lxsNCKaCyYwixSJBpfouTt7Rz\nE6PpzMOXFi1W1o+I22jDakuSM2SOQKqI/u0QefB0r0O/KVk5NrZHXk0mkrdYtxOp\nUgaGyf8UvmjB+8VqHrNKyZdk9qtmbnNj01kTTcAtmE4H39zPR7eR/8Rul94vaZbs\nwCnKJS3mLT3JxyGug6lxanveKkjG+CKC1nJQYWaxCJxaFSzbwXQPvDhB+TvrIbee\npd5v4EAyEJohpr+T9oDGGJkb/KARBZCtwLyB976PKJwwBA8MRVL1i5QwawuMiMq5\nUtnOnbGKtCeFzaLbNU0Qi8bqyims84EQxC6DOu1fkQKBgQDdvsoBsEhsOXV7hlIJ\naEd0eSJZVkdqimxH8uGoMM2FeNaOrcB6yBXqTSP0R3OIyf8eaY6yjRvP30ZNXcll\n/gD3O1Mu6YmWQdt1W2WA6pKOsUuPXasf0pdOF7IiFZKlSabz5YHXFqwVuqm8loaj\nsXel3YWqPVdHiankE7tz+3ssnQKBgQDdqi4TNdD1MdEpihx19jr0QjUiXW3939FK\nqp30HESPEGDGQzXdmJgif9HhZb+cJSuWaHEbjgBrYahvgCF+y6LbEpOD+D/dmT+s\nDEAQaR84sah6dokwPjV8fjBSrcVFjCS+doxv0d3p/9OUEeyUhFrY03nxtIEYkLIE\n/Zvn37b4RwKBgQCLENVFe9XfsaVhQ5r9dV2iyTlmh7qgMZG5CbTFs12hQGhm8McO\n+Z7s41YSJCFr/yq1WwP4LJDtrBw99vyQr1zRsG35tNLp3gGRNzGQSQyC2uQFVHw2\np+7mNewsfhUK/gbrXNsyFnDz6635rPlhfbII3sWuP2wWXFqkxE9CbMwR7QKBgQC6\nawDMzxmo2/iYArrkyevSuEuPVxvFwpF1RgAI6C0QVCnPE38dmdN4UB7mfHekje4W\nVEercMURidPp0cxZolCYBQtilUjAyL0vqC3In1/Ogjq6oy3FEMxSop1pKxMY5j+Q\nnoqFD+6deLUrddeNH7J3X4LSr4dSbX4JjG+tlgt+yQKBgQCuwTL4hA6KqeInQ0Ta\n9VQX5Qr8hFlqJz1gpymi/k63tW/Ob8yedbg3WWNWyShwRMFYyY9S81ITFWM95uL6\nvF3x9rmRjwElJw9PMwVu6dmf/CO0Z1wzXSp2VVD12gbrUD/0/d7MUoJ9LgC8X8f/\nn0txLHYGHbx+nf95+JUg6lV3hg==\n-----END PRIVATE KEY-----";
|
|
39877
39941
|
/*
|
|
39878
39942
|
* The crypto algorithm used for importing key and signing string
|
|
39879
39943
|
*/
|
|
@@ -40233,7 +40297,7 @@ const getPlayer = async (parameters) => {
|
|
|
40233
40297
|
return video;
|
|
40234
40298
|
};
|
|
40235
40299
|
|
|
40236
|
-
var index$
|
|
40300
|
+
var index$3 = /*#__PURE__*/Object.freeze({
|
|
40237
40301
|
__proto__: null,
|
|
40238
40302
|
getPlayer: getPlayer
|
|
40239
40303
|
});
|
|
@@ -41406,7 +41470,7 @@ const getGlobalStoryTargets = (params, callback, config) => {
|
|
|
41406
41470
|
};
|
|
41407
41471
|
};
|
|
41408
41472
|
|
|
41409
|
-
var index$
|
|
41473
|
+
var index$2 = /*#__PURE__*/Object.freeze({
|
|
41410
41474
|
__proto__: null,
|
|
41411
41475
|
createImageStory: createImageStory,
|
|
41412
41476
|
createVideoStory: createVideoStory,
|
|
@@ -41443,7 +41507,7 @@ const getNetworkAds = async () => {
|
|
|
41443
41507
|
};
|
|
41444
41508
|
};
|
|
41445
41509
|
|
|
41446
|
-
var index = /*#__PURE__*/Object.freeze({
|
|
41510
|
+
var index$1 = /*#__PURE__*/Object.freeze({
|
|
41447
41511
|
__proto__: null,
|
|
41448
41512
|
getNetworkAds: getNetworkAds
|
|
41449
41513
|
});
|
|
@@ -41470,4 +41534,314 @@ const createUserToken = async (apiKey, apiRegion, params) => {
|
|
|
41470
41534
|
return { accessToken: data.accessToken };
|
|
41471
41535
|
};
|
|
41472
41536
|
|
|
41473
|
-
|
|
41537
|
+
/* begin_public_function
|
|
41538
|
+
id: notificationTray.getNotificationTraySeen
|
|
41539
|
+
*/
|
|
41540
|
+
/**
|
|
41541
|
+
* ```js
|
|
41542
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
41543
|
+
* const notificationTraySeen = await notificationTray.getNotificationTraySeen()
|
|
41544
|
+
* ```
|
|
41545
|
+
*
|
|
41546
|
+
*
|
|
41547
|
+
* @returns A page of {@link Amity.NotificationTraySeen} objects
|
|
41548
|
+
*
|
|
41549
|
+
* @category NotificationTray API
|
|
41550
|
+
* @async
|
|
41551
|
+
* */
|
|
41552
|
+
const getNotificationTraySeen$1 = async () => {
|
|
41553
|
+
const client = getActiveClient();
|
|
41554
|
+
client.log('notificationTray/getNotificationTraySeen', {});
|
|
41555
|
+
const { data: payload } = await client.http.get(`api/v1/notification-tray/tray/seen`);
|
|
41556
|
+
const cachedAt = client.cache && Date.now();
|
|
41557
|
+
if (client.cache) {
|
|
41558
|
+
const cacheKey = ['notificationTraySeen', 'get', client.userId];
|
|
41559
|
+
pushToCache(cacheKey, {
|
|
41560
|
+
userId: client.userId,
|
|
41561
|
+
lastTraySeenAt: payload.lastTraySeenAt,
|
|
41562
|
+
lastTrayOccuredAt: payload.lastTrayOccuredAt,
|
|
41563
|
+
});
|
|
41564
|
+
}
|
|
41565
|
+
return {
|
|
41566
|
+
data: {
|
|
41567
|
+
userId: client.userId,
|
|
41568
|
+
lastTraySeenAt: payload.lastTraySeenAt,
|
|
41569
|
+
lastTrayOccuredAt: payload.lastTrayOccuredAt,
|
|
41570
|
+
isSeen: payload.lastTraySeenAt > payload.lastTrayOccuredAt,
|
|
41571
|
+
},
|
|
41572
|
+
cachedAt,
|
|
41573
|
+
};
|
|
41574
|
+
};
|
|
41575
|
+
/* end_public_function */
|
|
41576
|
+
/**
|
|
41577
|
+
* ```js
|
|
41578
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
41579
|
+
* const notificationTraySeen = await notificationTray.getNotificationTraySeen.locally()
|
|
41580
|
+
* ```
|
|
41581
|
+
*
|
|
41582
|
+
* Queries a paginable list of {@link Amity.NotificationTraySeen} objects from cache
|
|
41583
|
+
*
|
|
41584
|
+
* @returns A page of {@link Amity.NotificationTraySeen} objects
|
|
41585
|
+
*
|
|
41586
|
+
* @category NotificationTray API
|
|
41587
|
+
* @async
|
|
41588
|
+
* */
|
|
41589
|
+
getNotificationTraySeen$1.locally = () => {
|
|
41590
|
+
var _a;
|
|
41591
|
+
const client = getActiveClient();
|
|
41592
|
+
client.log('notificationTray/getNotificationTraySeen.locally', {});
|
|
41593
|
+
if (!client.cache)
|
|
41594
|
+
return;
|
|
41595
|
+
const queryKey = ['notificationTraySeen', 'get'];
|
|
41596
|
+
const { data, cachedAt } = (_a = pullFromCache(queryKey)) !== null && _a !== void 0 ? _a : {};
|
|
41597
|
+
if (!(data === null || data === void 0 ? void 0 : data.notificationTraySeen))
|
|
41598
|
+
return;
|
|
41599
|
+
return { data: data.notificationTraySeen, cachedAt };
|
|
41600
|
+
};
|
|
41601
|
+
|
|
41602
|
+
/**
|
|
41603
|
+
* ```js
|
|
41604
|
+
* import { onNotificationTraySeenUpdated } from '@amityco/ts-sdk'
|
|
41605
|
+
* const dispose = onNotificationTraySeenUpdated(data => {
|
|
41606
|
+
* // ...
|
|
41607
|
+
* })
|
|
41608
|
+
* ```
|
|
41609
|
+
*
|
|
41610
|
+
* Fired when an {@link Amity.NotificationTraySeen} has been updated
|
|
41611
|
+
*
|
|
41612
|
+
* @param callback The function to call when the event was fired
|
|
41613
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
41614
|
+
*
|
|
41615
|
+
* @category NotificationTraySeen Events
|
|
41616
|
+
*/
|
|
41617
|
+
const onNotificationTraySeenUpdated = (callback) => {
|
|
41618
|
+
const client = getActiveClient();
|
|
41619
|
+
const disposers = [
|
|
41620
|
+
createEventSubscriber(client, 'onNotificationTraySeenUpdated', 'local.notificationTraySeen.updated', payload => callback(payload)),
|
|
41621
|
+
];
|
|
41622
|
+
return () => {
|
|
41623
|
+
disposers.forEach(fn => fn());
|
|
41624
|
+
};
|
|
41625
|
+
};
|
|
41626
|
+
|
|
41627
|
+
/* begin_public_function
|
|
41628
|
+
id: notificationTraySeen.get
|
|
41629
|
+
*/
|
|
41630
|
+
/**
|
|
41631
|
+
* ```js
|
|
41632
|
+
* import { getNotificationTraySeen } from '@amityco/ts-sdk';
|
|
41633
|
+
*
|
|
41634
|
+
* let notificationTraySeen;
|
|
41635
|
+
*
|
|
41636
|
+
* const unsubscribe = getNotificationTraySeen(userId, response => {
|
|
41637
|
+
* notificationTraySeen = response.data;
|
|
41638
|
+
* });
|
|
41639
|
+
* ```
|
|
41640
|
+
*
|
|
41641
|
+
* Observe all mutation on a given {@link Amity.NotificationTraySeen}
|
|
41642
|
+
*
|
|
41643
|
+
* @param userId the ID of the user to observe
|
|
41644
|
+
* @param callback the function to call when new data are available
|
|
41645
|
+
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the message
|
|
41646
|
+
*
|
|
41647
|
+
* @category NotificationTraySeen Live Object
|
|
41648
|
+
*/
|
|
41649
|
+
const getNotificationTraySeen = (callback) => {
|
|
41650
|
+
const responder = (snapshot) => {
|
|
41651
|
+
const { data } = snapshot;
|
|
41652
|
+
callback(Object.assign(Object.assign({}, snapshot), { data }));
|
|
41653
|
+
};
|
|
41654
|
+
const { userId } = getActiveUser();
|
|
41655
|
+
return liveObject(userId, responder, 'userId', getNotificationTraySeen$1, [
|
|
41656
|
+
onNotificationTraySeenUpdated,
|
|
41657
|
+
]);
|
|
41658
|
+
};
|
|
41659
|
+
/* end_public_function */
|
|
41660
|
+
|
|
41661
|
+
/**
|
|
41662
|
+
* TODO: handle cache receive cache option, and cache policy
|
|
41663
|
+
* TODO: check if querybyIds is supported
|
|
41664
|
+
*/
|
|
41665
|
+
class NotificationTrayItemsPaginationController extends PaginationController {
|
|
41666
|
+
async getRequest(queryParams, token) {
|
|
41667
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
|
|
41668
|
+
const options = token ? { token } : { limit };
|
|
41669
|
+
const { data: queryResponse } = await this.http.get(`/api/v1/notification-tray`, {
|
|
41670
|
+
params: Object.assign(Object.assign({}, params), { options }),
|
|
41671
|
+
});
|
|
41672
|
+
return queryResponse;
|
|
41673
|
+
}
|
|
41674
|
+
}
|
|
41675
|
+
|
|
41676
|
+
class NotificationTrayItemsQuerystreamController extends QueryStreamController {
|
|
41677
|
+
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
41678
|
+
super(query, cacheKey);
|
|
41679
|
+
this.notifyChange = notifyChange;
|
|
41680
|
+
this.preparePayload = preparePayload;
|
|
41681
|
+
}
|
|
41682
|
+
async saveToMainDB(response) {
|
|
41683
|
+
const processedPayload = await this.preparePayload(response);
|
|
41684
|
+
const client = getActiveClient();
|
|
41685
|
+
const cachedAt = client.cache && Date.now();
|
|
41686
|
+
if (client.cache) {
|
|
41687
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
41688
|
+
}
|
|
41689
|
+
}
|
|
41690
|
+
appendToQueryStream(response, direction, refresh = false) {
|
|
41691
|
+
var _a, _b;
|
|
41692
|
+
if (refresh) {
|
|
41693
|
+
pushToCache(this.cacheKey, {
|
|
41694
|
+
data: response.notificationTrayItems.map(getResolver('notificationTrayItem')),
|
|
41695
|
+
});
|
|
41696
|
+
}
|
|
41697
|
+
else {
|
|
41698
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
41699
|
+
const notifications = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
41700
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [
|
|
41701
|
+
...new Set([
|
|
41702
|
+
...notifications,
|
|
41703
|
+
...response.notificationTrayItems.map(getResolver('notificationTrayItem')),
|
|
41704
|
+
]),
|
|
41705
|
+
] }));
|
|
41706
|
+
}
|
|
41707
|
+
}
|
|
41708
|
+
}
|
|
41709
|
+
|
|
41710
|
+
const prepareNotificationTrayItemsPayload = (rawPayload) => {
|
|
41711
|
+
const users = rawPayload.users.map(convertRawUserToInternalUser);
|
|
41712
|
+
return Object.assign(Object.assign({}, rawPayload), { users });
|
|
41713
|
+
};
|
|
41714
|
+
|
|
41715
|
+
class NotificationTrayItemsLiveCollectionController extends LiveCollectionController {
|
|
41716
|
+
constructor(query, callback) {
|
|
41717
|
+
const queryStreamId = hash(query);
|
|
41718
|
+
const cacheKey = ['notificationTrayItem', 'collection', queryStreamId];
|
|
41719
|
+
const paginationController = new NotificationTrayItemsPaginationController(query);
|
|
41720
|
+
super(paginationController, queryStreamId, cacheKey, callback);
|
|
41721
|
+
this.query = query;
|
|
41722
|
+
this.queryStreamController = new NotificationTrayItemsQuerystreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareNotificationTrayItemsPayload);
|
|
41723
|
+
this.callback = callback.bind(this);
|
|
41724
|
+
this.loadPage({ initial: true });
|
|
41725
|
+
}
|
|
41726
|
+
setup() {
|
|
41727
|
+
var _a;
|
|
41728
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
41729
|
+
if (!collection) {
|
|
41730
|
+
pushToCache(this.cacheKey, {
|
|
41731
|
+
data: [],
|
|
41732
|
+
params: {},
|
|
41733
|
+
});
|
|
41734
|
+
}
|
|
41735
|
+
}
|
|
41736
|
+
async persistModel(queryPayload) {
|
|
41737
|
+
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
41738
|
+
}
|
|
41739
|
+
persistQueryStream({ response, direction, refresh, }) {
|
|
41740
|
+
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
41741
|
+
}
|
|
41742
|
+
// eslint-disable-next-line class-methods-use-this
|
|
41743
|
+
startSubscription() {
|
|
41744
|
+
return [];
|
|
41745
|
+
}
|
|
41746
|
+
notifyChange({ origin, loading, error }) {
|
|
41747
|
+
var _a, _b;
|
|
41748
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
41749
|
+
if (!collection)
|
|
41750
|
+
return;
|
|
41751
|
+
const data = ((_b = collection.data
|
|
41752
|
+
.map(id => pullFromCache(['notificationTrayItem', 'get', id]))
|
|
41753
|
+
.filter(isNonNullable)
|
|
41754
|
+
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.notificationTray);
|
|
41755
|
+
if (!this.shouldNotify(data) && origin === 'event')
|
|
41756
|
+
return;
|
|
41757
|
+
this.callback({
|
|
41758
|
+
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
41759
|
+
data,
|
|
41760
|
+
hasNextPage: !!this.paginationController.getNextToken(),
|
|
41761
|
+
loading,
|
|
41762
|
+
error,
|
|
41763
|
+
});
|
|
41764
|
+
}
|
|
41765
|
+
}
|
|
41766
|
+
|
|
41767
|
+
/**
|
|
41768
|
+
* Get notification tray items for a notification tray page
|
|
41769
|
+
*
|
|
41770
|
+
* @param params the limit query parameters
|
|
41771
|
+
* @param callback the callback to be called when the notification tray items are updated
|
|
41772
|
+
* @returns items in the notification tray
|
|
41773
|
+
*
|
|
41774
|
+
* @category Notification tray items Live Collection
|
|
41775
|
+
*
|
|
41776
|
+
*/
|
|
41777
|
+
const getNotificationTrayItems = (params, callback, config) => {
|
|
41778
|
+
const { log, cache } = getActiveClient();
|
|
41779
|
+
if (!cache) {
|
|
41780
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
41781
|
+
}
|
|
41782
|
+
const timestamp = Date.now();
|
|
41783
|
+
log(`getNotificationTrayItems(tmpid: ${timestamp}) > listen`);
|
|
41784
|
+
const notiTrayItemsLiveCollection = new NotificationTrayItemsLiveCollectionController(params, callback);
|
|
41785
|
+
const disposers = notiTrayItemsLiveCollection.startSubscription();
|
|
41786
|
+
const cacheKey = notiTrayItemsLiveCollection.getCacheKey();
|
|
41787
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
41788
|
+
return () => {
|
|
41789
|
+
log(`getNotificationTrayItems(tmpid: ${timestamp}) > dispose`);
|
|
41790
|
+
disposers.forEach(fn => fn());
|
|
41791
|
+
};
|
|
41792
|
+
};
|
|
41793
|
+
|
|
41794
|
+
/* begin_public_function
|
|
41795
|
+
id: notificationTray.markSeen
|
|
41796
|
+
*/
|
|
41797
|
+
/**
|
|
41798
|
+
* ```js
|
|
41799
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
41800
|
+
* const updated = await notificationTray.markTraySeen({
|
|
41801
|
+
* lastSeenAt: Amity.timestamp,
|
|
41802
|
+
* })
|
|
41803
|
+
* ```
|
|
41804
|
+
*
|
|
41805
|
+
* Updates an {@link Amity.NotificationTraySeen}
|
|
41806
|
+
*
|
|
41807
|
+
* @param userId The ID of the {@link Amity.NotificationTraySeen} to edit
|
|
41808
|
+
* @param lastSeenAt The patch data to apply
|
|
41809
|
+
* @returns the updated {@link Amity.NotificationTraySeen} object
|
|
41810
|
+
*
|
|
41811
|
+
* @category Post API
|
|
41812
|
+
* @async
|
|
41813
|
+
*/
|
|
41814
|
+
const markTraySeen = async (lastSeenAt) => {
|
|
41815
|
+
var _a;
|
|
41816
|
+
const client = getActiveClient();
|
|
41817
|
+
client.log('notificationTray/markTraySeen', {});
|
|
41818
|
+
const { data: payload } = await client.http.put(`api/v1/notification-tray/tray/seen`, {
|
|
41819
|
+
lastSeenAt,
|
|
41820
|
+
});
|
|
41821
|
+
const cacheData = (_a = pullFromCache([
|
|
41822
|
+
'notificationTraySeen',
|
|
41823
|
+
'get',
|
|
41824
|
+
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
41825
|
+
const data = Object.assign({ userId: client.userId }, payload);
|
|
41826
|
+
const updateCacheData = Object.assign(Object.assign({}, cacheData), data);
|
|
41827
|
+
const cachedAt = client.cache && Date.now();
|
|
41828
|
+
if (client.cache)
|
|
41829
|
+
pushToCache(['notificationTraySeen', 'get', client.userId], updateCacheData, { cachedAt });
|
|
41830
|
+
fireEvent('local.notificationTraySeen.updated', data);
|
|
41831
|
+
return {
|
|
41832
|
+
data: payload,
|
|
41833
|
+
cachedAt,
|
|
41834
|
+
};
|
|
41835
|
+
};
|
|
41836
|
+
/* end_public_function */
|
|
41837
|
+
|
|
41838
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
41839
|
+
__proto__: null,
|
|
41840
|
+
getNotificationTraySeen: getNotificationTraySeen,
|
|
41841
|
+
getNotificationTrayItems: getNotificationTrayItems,
|
|
41842
|
+
markItemsSeen: markItemsSeen,
|
|
41843
|
+
markTraySeen: markTraySeen,
|
|
41844
|
+
onNotificationTraySeenUpdated: onNotificationTraySeenUpdated
|
|
41845
|
+
});
|
|
41846
|
+
|
|
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, 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 };
|