@amityco/ts-sdk 7.1.1-ce25d503.0 → 7.1.1-e23f973a.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/core/events.d.ts +5 -2
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/model.d.ts +4 -2
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +18 -0
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/core/readReceipt.d.ts +1 -12
- package/dist/@types/core/readReceipt.d.ts.map +1 -1
- package/dist/@types/domains/channel.d.ts +0 -10
- package/dist/@types/domains/channel.d.ts.map +1 -1
- package/dist/@types/domains/client.d.ts +0 -1
- package/dist/@types/domains/client.d.ts.map +1 -1
- package/dist/@types/domains/notification.d.ts +82 -0
- package/dist/@types/domains/notification.d.ts.map +1 -0
- package/dist/@types/index.d.ts +1 -0
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/channelRepository/events/onChannelDeleted.d.ts.map +1 -1
- package/dist/channelRepository/events/onChannelLeft.d.ts.map +1 -1
- package/dist/channelRepository/observers/getChannel.d.ts.map +1 -1
- package/dist/channelRepository/observers/getChannels/ChannelLiveCollectionController.d.ts.map +1 -1
- package/dist/channelRepository/observers/index.d.ts +0 -1
- package/dist/channelRepository/observers/index.d.ts.map +1 -1
- package/dist/channelRepository/utils/constructChannelDynamicValue.d.ts.map +1 -1
- package/dist/channelRepository/utils/prepareChannelPayload.d.ts.map +1 -1
- package/dist/client/api/createClient.d.ts.map +1 -1
- package/dist/client/api/enableUnreadCount.d.ts.map +1 -1
- package/dist/client/api/login.d.ts.map +1 -1
- package/dist/client/utils/ReadReceiptSync/readReceiptSyncEngine.d.ts +4 -2
- package/dist/client/utils/ReadReceiptSync/readReceiptSyncEngine.d.ts.map +1 -1
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.d.ts.map +1 -1
- package/dist/core/model/idResolvers.d.ts.map +1 -1
- package/dist/core/model/index.d.ts.map +1 -1
- package/dist/index.cjs.js +462 -567
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +445 -551
- package/dist/index.umd.js +4 -4
- package/dist/{channelRepository → marker}/events/onChannelUnreadUpdatedLocal.d.ts +2 -2
- package/dist/marker/events/onChannelUnreadUpdatedLocal.d.ts.map +1 -0
- package/dist/messageRepository/events/onMessageCreated.d.ts.map +1 -1
- package/dist/messageRepository/observers/getMessage.d.ts.map +1 -1
- package/dist/messageRepository/utils/markReadMessage.d.ts.map +1 -1
- package/dist/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 +6 -2
- package/src/@types/core/model.ts +6 -4
- package/src/@types/core/payload.ts +25 -0
- package/src/@types/core/readReceipt.ts +1 -14
- package/src/@types/domains/channel.ts +0 -13
- package/src/@types/domains/client.ts +0 -2
- package/src/@types/domains/notification.ts +91 -0
- package/src/@types/index.ts +1 -0
- package/src/channelRepository/events/onChannelDeleted.ts +4 -17
- package/src/channelRepository/events/onChannelLeft.ts +3 -11
- package/src/channelRepository/observers/getChannel.ts +1 -3
- package/src/channelRepository/observers/getChannels/ChannelLiveCollectionController.ts +1 -6
- package/src/channelRepository/observers/index.ts +0 -1
- package/src/channelRepository/utils/constructChannelDynamicValue.ts +2 -12
- package/src/channelRepository/utils/prepareChannelPayload.ts +17 -57
- package/src/client/api/createClient.ts +0 -3
- package/src/client/api/enableUnreadCount.ts +0 -1
- package/src/client/api/login.ts +1 -5
- package/src/client/utils/ReadReceiptSync/readReceiptSyncEngine.ts +99 -70
- package/src/core/model/idResolvers.ts +3 -2
- package/src/core/model/index.ts +2 -0
- package/src/index.ts +2 -0
- package/src/{channelRepository → marker}/events/onChannelUnreadUpdatedLocal.ts +3 -3
- package/src/messageRepository/events/onMessageCreated.ts +1 -38
- package/src/messageRepository/observers/getMessage.ts +1 -0
- package/src/messageRepository/utils/markReadMessage.ts +3 -10
- 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 +19 -0
- package/dist/channelRepository/api/markChannelsAsReadBySegment.d.ts +0 -16
- package/dist/channelRepository/api/markChannelsAsReadBySegment.d.ts.map +0 -1
- package/dist/channelRepository/events/onChannelUnreadUpdatedLocal.d.ts.map +0 -1
- package/dist/channelRepository/internalApi/getTotalChannelsUnread.d.ts +0 -11
- package/dist/channelRepository/internalApi/getTotalChannelsUnread.d.ts.map +0 -1
- package/dist/channelRepository/observers/getTotalChannelsUnread.d.ts +0 -20
- package/dist/channelRepository/observers/getTotalChannelsUnread.d.ts.map +0 -1
- package/dist/channelRepository/utils/getLegacyChannelUnread.d.ts +0 -2
- package/dist/channelRepository/utils/getLegacyChannelUnread.d.ts.map +0 -1
- package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine.d.ts +0 -33
- package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine.d.ts.map +0 -1
- package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.d.ts +0 -3
- package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.d.ts.map +0 -1
- package/dist/marker/events/onChannelUnreadInfoUpdatedLocal.d.ts +0 -12
- package/dist/marker/events/onChannelUnreadInfoUpdatedLocal.d.ts.map +0 -1
- package/src/channelRepository/api/markChannelsAsReadBySegment.ts +0 -29
- package/src/channelRepository/internalApi/getTotalChannelsUnread.ts +0 -38
- package/src/channelRepository/observers/getTotalChannelsUnread.ts +0 -129
- package/src/channelRepository/utils/getLegacyChannelUnread.ts +0 -5
- package/src/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine.ts +0 -267
- package/src/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.ts +0 -21
- package/src/marker/events/onChannelUnreadInfoUpdatedLocal.ts +0 -29
package/dist/index.cjs.js
CHANGED
|
@@ -121,6 +121,7 @@ const SECOND$1 = 1000;
|
|
|
121
121
|
const MINUTE = 60 * SECOND$1;
|
|
122
122
|
const HOUR = 60 * MINUTE;
|
|
123
123
|
const DAY = 24 * HOUR;
|
|
124
|
+
const WEEK = 7 * DAY;
|
|
124
125
|
const YEAR = 365 * DAY;
|
|
125
126
|
const ACCESS_TOKEN_WATCHER_INTERVAL = 10 * MINUTE;
|
|
126
127
|
|
|
@@ -516,7 +517,6 @@ const idResolvers = {
|
|
|
516
517
|
messagePreviewSubChannel: ({ subChannelId }) => `${subChannelId}`,
|
|
517
518
|
channelUnreadInfo: ({ channelId }) => channelId,
|
|
518
519
|
subChannelUnreadInfo: ({ subChannelId }) => subChannelId,
|
|
519
|
-
channelUnread: ({ channelId }) => channelId,
|
|
520
520
|
channelMarker: ({ entityId, userId }) => `${entityId}#${userId}`,
|
|
521
521
|
subChannelMarker: ({ entityId, feedId, userId }) => `${entityId}#${feedId}#${userId}`,
|
|
522
522
|
messageMarker: ({ feedId, contentId, creatorId }) => `${feedId}#${contentId}#${creatorId}`,
|
|
@@ -543,6 +543,8 @@ const idResolvers = {
|
|
|
543
543
|
advertiser: ({ advertiserId }) => advertiserId,
|
|
544
544
|
pin: ({ placement, referenceId }) => `${placement}#${referenceId}`,
|
|
545
545
|
pinTarget: ({ targetId }) => targetId,
|
|
546
|
+
notificationTrayItem: ({ _id }) => _id,
|
|
547
|
+
notificationTraySeen: ({ userId }) => userId,
|
|
546
548
|
};
|
|
547
549
|
/**
|
|
548
550
|
* Retrieve the id resolver matching a domain name
|
|
@@ -594,6 +596,7 @@ const PAYLOAD2MODEL = {
|
|
|
594
596
|
advertisers: 'advertiser',
|
|
595
597
|
pinTargets: 'pinTarget',
|
|
596
598
|
pins: 'pin',
|
|
599
|
+
notificationTrayItems: 'notificationTrayItem',
|
|
597
600
|
};
|
|
598
601
|
/** hidden */
|
|
599
602
|
const isOutdated = (prevData, nextData) => {
|
|
@@ -1610,13 +1613,13 @@ class NetworkActivitiesWatcher {
|
|
|
1610
1613
|
this._listener.clear();
|
|
1611
1614
|
}
|
|
1612
1615
|
}
|
|
1613
|
-
let instance$
|
|
1616
|
+
let instance$5;
|
|
1614
1617
|
var NetworkActivitiesWatcher$1 = {
|
|
1615
1618
|
getInstance: () => {
|
|
1616
|
-
if (!instance$
|
|
1617
|
-
instance$
|
|
1619
|
+
if (!instance$5) {
|
|
1620
|
+
instance$5 = new NetworkActivitiesWatcher();
|
|
1618
1621
|
}
|
|
1619
|
-
return instance$
|
|
1622
|
+
return instance$5;
|
|
1620
1623
|
},
|
|
1621
1624
|
};
|
|
1622
1625
|
|
|
@@ -5149,13 +5152,13 @@ class AnalyticsEngine {
|
|
|
5149
5152
|
this._eventCapturer.resetAllBuckets();
|
|
5150
5153
|
}
|
|
5151
5154
|
}
|
|
5152
|
-
let instance$
|
|
5155
|
+
let instance$4;
|
|
5153
5156
|
var AnalyticsEngine$1 = {
|
|
5154
5157
|
getInstance: () => {
|
|
5155
|
-
if (!instance$
|
|
5156
|
-
instance$
|
|
5158
|
+
if (!instance$4) {
|
|
5159
|
+
instance$4 = new AnalyticsEngine();
|
|
5157
5160
|
}
|
|
5158
|
-
return instance$
|
|
5161
|
+
return instance$4;
|
|
5159
5162
|
},
|
|
5160
5163
|
};
|
|
5161
5164
|
|
|
@@ -5581,221 +5584,6 @@ const getMessageReadCount = (message, marker) => {
|
|
|
5581
5584
|
getCachedMarker$2(message)) !== null && _a !== void 0 ? _a : { readCount: 0, deliveredCount: 0 };
|
|
5582
5585
|
}; // and if not found in cache use default value `0`
|
|
5583
5586
|
|
|
5584
|
-
/**
|
|
5585
|
-
*
|
|
5586
|
-
* Mark subChannel as read by readToSegment
|
|
5587
|
-
*
|
|
5588
|
-
* @param subChannelIds the IDs of the {@link Amity.SubChannel} to update
|
|
5589
|
-
* @param readToSegment the segment to mark as read
|
|
5590
|
-
* @returns a success boolean if the {@link Amity.SubChannel} was updated
|
|
5591
|
-
*
|
|
5592
|
-
* @category Channel API
|
|
5593
|
-
* @async
|
|
5594
|
-
*/
|
|
5595
|
-
const markChannelsAsReadBySegment = async (readings) => {
|
|
5596
|
-
const client = getActiveClient();
|
|
5597
|
-
try {
|
|
5598
|
-
await client.http.post('api/v3/channels/seen', { channels: readings });
|
|
5599
|
-
return true;
|
|
5600
|
-
}
|
|
5601
|
-
catch (e) {
|
|
5602
|
-
return false;
|
|
5603
|
-
}
|
|
5604
|
-
};
|
|
5605
|
-
|
|
5606
|
-
class MessageReadReceiptSyncEngine {
|
|
5607
|
-
constructor() {
|
|
5608
|
-
this.isActive = true;
|
|
5609
|
-
this.MAX_RETRY = 3;
|
|
5610
|
-
this.JOB_QUEUE_SIZE = 120;
|
|
5611
|
-
this.jobQueue = [];
|
|
5612
|
-
// Interval for message read receipt sync in seconds
|
|
5613
|
-
this.RECEIPT_SYNC_INTERVAL = 1;
|
|
5614
|
-
this.client = getActiveClient();
|
|
5615
|
-
// Get remaining unsync read receipts from cache
|
|
5616
|
-
this.getUnsyncJobs();
|
|
5617
|
-
}
|
|
5618
|
-
// Call this when client call client.login
|
|
5619
|
-
startSyncReadReceipt() {
|
|
5620
|
-
// Start timer when start receipt sync
|
|
5621
|
-
this.timer = setInterval(() => {
|
|
5622
|
-
this.syncReadReceipts();
|
|
5623
|
-
}, this.RECEIPT_SYNC_INTERVAL * 1000);
|
|
5624
|
-
}
|
|
5625
|
-
// Read receipt observer handling
|
|
5626
|
-
syncReadReceipts() {
|
|
5627
|
-
if (this.jobQueue.length === 0 || this.isActive === false)
|
|
5628
|
-
return;
|
|
5629
|
-
const readReceipts = this.getReadReceipts();
|
|
5630
|
-
if (readReceipts) {
|
|
5631
|
-
this.markReadApi(readReceipts);
|
|
5632
|
-
}
|
|
5633
|
-
}
|
|
5634
|
-
getUnsyncJobs() {
|
|
5635
|
-
var _a;
|
|
5636
|
-
// Get all read receipts that has latestSyncSegment < latestSegment
|
|
5637
|
-
const readReceipts = (_a = queryCache(['readReceipt'])) === null || _a === void 0 ? void 0 : _a.filter(({ data }) => {
|
|
5638
|
-
return data.latestSyncSegment < data.latestSegment;
|
|
5639
|
-
});
|
|
5640
|
-
// Enqueue unsync read receipts to the job queue
|
|
5641
|
-
readReceipts === null || readReceipts === void 0 ? void 0 : readReceipts.forEach(({ data: readReceipt }) => {
|
|
5642
|
-
this.enqueueReadReceipt(readReceipt.channelId, readReceipt.latestSegment);
|
|
5643
|
-
});
|
|
5644
|
-
}
|
|
5645
|
-
getReadReceipts() {
|
|
5646
|
-
// get all read receipts from queue, now the queue is empty
|
|
5647
|
-
const syncJob = this.jobQueue.splice(0, this.jobQueue.length);
|
|
5648
|
-
if (syncJob.length === 0)
|
|
5649
|
-
return;
|
|
5650
|
-
return syncJob.filter(job => {
|
|
5651
|
-
var _a;
|
|
5652
|
-
const readReceipt = (_a = pullFromCache(['readReceipt', job.channelId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
5653
|
-
if (!readReceipt)
|
|
5654
|
-
return false;
|
|
5655
|
-
if (readReceipt.latestSegment > readReceipt.latestSyncSegment)
|
|
5656
|
-
return true;
|
|
5657
|
-
return false;
|
|
5658
|
-
});
|
|
5659
|
-
}
|
|
5660
|
-
async markReadApi(syncJobs) {
|
|
5661
|
-
var _a;
|
|
5662
|
-
// constuct payload
|
|
5663
|
-
// example: [{ channelId: 'channelId', readToSegment: 2 }]
|
|
5664
|
-
const syncJobsPayload = syncJobs.map(job => {
|
|
5665
|
-
return {
|
|
5666
|
-
channelId: job.channelId,
|
|
5667
|
-
readToSegment: job.segment,
|
|
5668
|
-
};
|
|
5669
|
-
});
|
|
5670
|
-
const response = await markChannelsAsReadBySegment(syncJobsPayload);
|
|
5671
|
-
if (response) {
|
|
5672
|
-
for (let i = 0; i < syncJobs.length; i += 1) {
|
|
5673
|
-
// update lastestSyncSegment in read receipt cache
|
|
5674
|
-
const cacheKey = ['readReceipt', syncJobs[i].channelId];
|
|
5675
|
-
const readReceiptCache = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
5676
|
-
pushToCache(cacheKey, Object.assign(Object.assign({}, readReceiptCache), { latestSyncSegment: syncJobs[i].segment }));
|
|
5677
|
-
}
|
|
5678
|
-
}
|
|
5679
|
-
else {
|
|
5680
|
-
for (let i = 0; i < syncJobs.length; i += 1) {
|
|
5681
|
-
// push them back to queue if the syncing is failed and retry count is less than max retry
|
|
5682
|
-
if (syncJobs[i].retryCount >= this.MAX_RETRY)
|
|
5683
|
-
return;
|
|
5684
|
-
const updatedJob = Object.assign(Object.assign({}, syncJobs[i]), { syncState: "create" /* Amity.ReadReceiptSyncState.CREATED */, retryCount: syncJobs[i].retryCount + 1 });
|
|
5685
|
-
this.enqueueJob(updatedJob);
|
|
5686
|
-
}
|
|
5687
|
-
}
|
|
5688
|
-
}
|
|
5689
|
-
startObservingReadReceiptQueue() {
|
|
5690
|
-
if (this.client.useLegacyUnreadCount) {
|
|
5691
|
-
this.isActive = true;
|
|
5692
|
-
this.startSyncReadReceipt();
|
|
5693
|
-
}
|
|
5694
|
-
}
|
|
5695
|
-
stopObservingReadReceiptQueue() {
|
|
5696
|
-
this.isActive = false;
|
|
5697
|
-
this.jobQueue.map(job => {
|
|
5698
|
-
if (job.syncState === "syncing" /* Amity.ReadReceiptSyncState.SYNCING */) {
|
|
5699
|
-
return Object.assign(Object.assign({}, job), { syncState: "create" /* Amity.ReadReceiptSyncState.CREATED */ });
|
|
5700
|
-
}
|
|
5701
|
-
return job;
|
|
5702
|
-
});
|
|
5703
|
-
if (this.timer)
|
|
5704
|
-
clearInterval(this.timer);
|
|
5705
|
-
}
|
|
5706
|
-
// Session Management
|
|
5707
|
-
onSessionEstablished() {
|
|
5708
|
-
this.startObservingReadReceiptQueue();
|
|
5709
|
-
}
|
|
5710
|
-
onSessionDestroyed() {
|
|
5711
|
-
this.stopObservingReadReceiptQueue();
|
|
5712
|
-
this.jobQueue = [];
|
|
5713
|
-
}
|
|
5714
|
-
onTokenExpired() {
|
|
5715
|
-
this.stopObservingReadReceiptQueue();
|
|
5716
|
-
}
|
|
5717
|
-
// Network Connection Management
|
|
5718
|
-
onNetworkOffline() {
|
|
5719
|
-
// Stop observing to the read receipt queue.
|
|
5720
|
-
this.stopObservingReadReceiptQueue();
|
|
5721
|
-
}
|
|
5722
|
-
onNetworkOnline() {
|
|
5723
|
-
// Resume observing to the read receipt queue.
|
|
5724
|
-
this.startObservingReadReceiptQueue();
|
|
5725
|
-
}
|
|
5726
|
-
markRead(channelId, segment) {
|
|
5727
|
-
var _a;
|
|
5728
|
-
// Step 1: Optimistic update of channelUnread.readToSegment to message.segment and update unreadCount value
|
|
5729
|
-
const cacheKey = ['channelUnread', 'get', channelId];
|
|
5730
|
-
const channelUnread = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
5731
|
-
if (channelUnread && segment > channelUnread.readToSegment) {
|
|
5732
|
-
channelUnread.readToSegment = segment;
|
|
5733
|
-
channelUnread.unreadCount = Math.max(channelUnread.lastSegment - segment, 0);
|
|
5734
|
-
pushToCache(cacheKey, channelUnread);
|
|
5735
|
-
fireEvent('local.channelUnread.updated', channelUnread);
|
|
5736
|
-
}
|
|
5737
|
-
// Step 2: Enqueue the read receipt
|
|
5738
|
-
this.enqueueReadReceipt(channelId, segment);
|
|
5739
|
-
}
|
|
5740
|
-
enqueueReadReceipt(channelId, segment) {
|
|
5741
|
-
var _a;
|
|
5742
|
-
const readReceipt = (_a = pullFromCache(['readReceipt', channelId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
5743
|
-
// Create new read receipt if it's not exists and add the job to queue
|
|
5744
|
-
if (!readReceipt) {
|
|
5745
|
-
const readReceiptChannel = {
|
|
5746
|
-
channelId,
|
|
5747
|
-
latestSegment: segment,
|
|
5748
|
-
latestSyncSegment: 0,
|
|
5749
|
-
};
|
|
5750
|
-
pushToCache(['readReceipt', channelId], readReceiptChannel);
|
|
5751
|
-
}
|
|
5752
|
-
else if (readReceipt.latestSegment < segment) {
|
|
5753
|
-
// Update latestSegment in read receipt cache
|
|
5754
|
-
pushToCache(['readReceipt', channelId], Object.assign(Object.assign({}, readReceipt), { latestSegment: segment }));
|
|
5755
|
-
}
|
|
5756
|
-
else if (readReceipt.latestSyncSegment >= segment) {
|
|
5757
|
-
// Skip the job when lastSyncSegment > = segment
|
|
5758
|
-
return;
|
|
5759
|
-
}
|
|
5760
|
-
let syncJob = this.getSyncJob(channelId);
|
|
5761
|
-
if (syncJob === null || syncJob.syncState === "syncing" /* Amity.ReadReceiptSyncState.SYNCING */) {
|
|
5762
|
-
syncJob = {
|
|
5763
|
-
channelId,
|
|
5764
|
-
segment,
|
|
5765
|
-
syncState: "create" /* Amity.ReadReceiptSyncState.CREATED */,
|
|
5766
|
-
retryCount: 0,
|
|
5767
|
-
};
|
|
5768
|
-
this.enqueueJob(syncJob);
|
|
5769
|
-
}
|
|
5770
|
-
else if (syncJob.segment < segment) {
|
|
5771
|
-
syncJob.segment = segment;
|
|
5772
|
-
}
|
|
5773
|
-
}
|
|
5774
|
-
getSyncJob(channelId) {
|
|
5775
|
-
const { jobQueue } = this;
|
|
5776
|
-
const targetJob = jobQueue.find(job => job.channelId === channelId);
|
|
5777
|
-
return targetJob || null;
|
|
5778
|
-
}
|
|
5779
|
-
enqueueJob(syncJob) {
|
|
5780
|
-
if (this.jobQueue.length < this.JOB_QUEUE_SIZE) {
|
|
5781
|
-
this.jobQueue.push(syncJob);
|
|
5782
|
-
}
|
|
5783
|
-
else {
|
|
5784
|
-
// Remove oldest job when queue reach maximum capacity
|
|
5785
|
-
this.jobQueue.shift();
|
|
5786
|
-
this.jobQueue.push(syncJob);
|
|
5787
|
-
}
|
|
5788
|
-
}
|
|
5789
|
-
}
|
|
5790
|
-
let instance$4 = null;
|
|
5791
|
-
var ReadReceiptSyncEngine = {
|
|
5792
|
-
getInstance: () => {
|
|
5793
|
-
if (!instance$4)
|
|
5794
|
-
instance$4 = new MessageReadReceiptSyncEngine();
|
|
5795
|
-
return instance$4;
|
|
5796
|
-
},
|
|
5797
|
-
};
|
|
5798
|
-
|
|
5799
5587
|
/**
|
|
5800
5588
|
*
|
|
5801
5589
|
* Mark subChannel as read by readToSegment
|
|
@@ -5844,7 +5632,7 @@ const reCalculateChannelUnreadInfo = (channelId) => {
|
|
|
5844
5632
|
return channelUnreadInfo;
|
|
5845
5633
|
};
|
|
5846
5634
|
|
|
5847
|
-
class
|
|
5635
|
+
class MessageReadReceiptSyncEngine {
|
|
5848
5636
|
constructor() {
|
|
5849
5637
|
this.isActive = true;
|
|
5850
5638
|
this.MAX_RETRY = 3;
|
|
@@ -5875,7 +5663,7 @@ class LegacyMessageReadReceiptSyncEngine {
|
|
|
5875
5663
|
getUnsyncJobs() {
|
|
5876
5664
|
var _a;
|
|
5877
5665
|
// Get all read receipts that has latestSyncSegment < latestSegment
|
|
5878
|
-
const readReceipts = (_a = queryCache(['
|
|
5666
|
+
const readReceipts = (_a = queryCache(['readReceipt'])) === null || _a === void 0 ? void 0 : _a.filter(({ data }) => {
|
|
5879
5667
|
return data.latestSyncSegment < data.latestSegment;
|
|
5880
5668
|
});
|
|
5881
5669
|
// Enqueue unsync read receipts to the job queue
|
|
@@ -5894,7 +5682,7 @@ class LegacyMessageReadReceiptSyncEngine {
|
|
|
5894
5682
|
return;
|
|
5895
5683
|
// Get readReceipt from cache by subChannelId
|
|
5896
5684
|
const readReceipt = (_a = pullFromCache([
|
|
5897
|
-
'
|
|
5685
|
+
'readReceipt',
|
|
5898
5686
|
syncJob.subChannelId,
|
|
5899
5687
|
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
5900
5688
|
if (!readReceipt)
|
|
@@ -5917,10 +5705,10 @@ class LegacyMessageReadReceiptSyncEngine {
|
|
|
5917
5705
|
if (response) {
|
|
5918
5706
|
this.removeSynedReceipt(syncJob.subChannelId, syncJob.segment);
|
|
5919
5707
|
const readReceiptCache = (_a = pullFromCache([
|
|
5920
|
-
'
|
|
5708
|
+
'readReceipt',
|
|
5921
5709
|
subChannelId,
|
|
5922
5710
|
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
5923
|
-
pushToCache(['
|
|
5711
|
+
pushToCache(['readReceipt', subChannelId], Object.assign(Object.assign({}, readReceiptCache), { latestSyncSegment: segment }));
|
|
5924
5712
|
}
|
|
5925
5713
|
else if (!response) {
|
|
5926
5714
|
if (newSyncJob.retryCount > this.MAX_RETRY) {
|
|
@@ -5987,7 +5775,7 @@ class LegacyMessageReadReceiptSyncEngine {
|
|
|
5987
5775
|
subChannelUnreadInfo.readToSegment = segment;
|
|
5988
5776
|
subChannelUnreadInfo.unreadCount = Math.max(subChannelUnreadInfo.lastSegment - segment, 0);
|
|
5989
5777
|
const channelUnreadInfo = reCalculateChannelUnreadInfo(subChannelUnreadInfo.channelId);
|
|
5990
|
-
fireEvent('local.
|
|
5778
|
+
fireEvent('local.channelUnread.updated', channelUnreadInfo);
|
|
5991
5779
|
pushToCache(cacheKey, subChannelUnreadInfo);
|
|
5992
5780
|
fireEvent('local.subChannelUnread.updated', subChannelUnreadInfo);
|
|
5993
5781
|
}
|
|
@@ -5996,10 +5784,7 @@ class LegacyMessageReadReceiptSyncEngine {
|
|
|
5996
5784
|
}
|
|
5997
5785
|
enqueueReadReceipt(subChannelId, segment) {
|
|
5998
5786
|
var _a;
|
|
5999
|
-
const readReceipt = (_a = pullFromCache([
|
|
6000
|
-
'legacyReadReceipt',
|
|
6001
|
-
subChannelId,
|
|
6002
|
-
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
5787
|
+
const readReceipt = (_a = pullFromCache(['readReceipt', subChannelId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
6003
5788
|
// Create new read receipt if it's not exists and add job to queue
|
|
6004
5789
|
if (!readReceipt) {
|
|
6005
5790
|
const readReceiptSubChannel = {
|
|
@@ -6007,10 +5792,10 @@ class LegacyMessageReadReceiptSyncEngine {
|
|
|
6007
5792
|
latestSegment: segment,
|
|
6008
5793
|
latestSyncSegment: 0,
|
|
6009
5794
|
};
|
|
6010
|
-
pushToCache(['
|
|
5795
|
+
pushToCache(['readReceipt', subChannelId], readReceiptSubChannel);
|
|
6011
5796
|
}
|
|
6012
5797
|
else if (readReceipt.latestSegment < segment) {
|
|
6013
|
-
pushToCache(['
|
|
5798
|
+
pushToCache(['readReceipt', subChannelId], Object.assign(Object.assign({}, readReceipt), { latestSegment: segment }));
|
|
6014
5799
|
}
|
|
6015
5800
|
else if (readReceipt.latestSyncSegment >= segment) {
|
|
6016
5801
|
// Skip the job when lastSyncSegment > = segment
|
|
@@ -6053,24 +5838,18 @@ class LegacyMessageReadReceiptSyncEngine {
|
|
|
6053
5838
|
}
|
|
6054
5839
|
}
|
|
6055
5840
|
let instance$3 = null;
|
|
6056
|
-
var
|
|
5841
|
+
var ReadReceiptSyncEngine = {
|
|
6057
5842
|
getInstance: () => {
|
|
6058
5843
|
if (!instance$3)
|
|
6059
|
-
instance$3 = new
|
|
5844
|
+
instance$3 = new MessageReadReceiptSyncEngine();
|
|
6060
5845
|
return instance$3;
|
|
6061
5846
|
},
|
|
6062
5847
|
};
|
|
6063
5848
|
|
|
6064
5849
|
const markReadMessage = (message) => {
|
|
6065
|
-
const
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
markReadReceiptEngine.markRead(message.channelId, message.channelSegment);
|
|
6069
|
-
}
|
|
6070
|
-
else {
|
|
6071
|
-
const markReadReceiptEngine = LegacyReadReceiptSyncEngine.getInstance();
|
|
6072
|
-
markReadReceiptEngine.markRead(message.subChannelId, message.channelSegment);
|
|
6073
|
-
}
|
|
5850
|
+
const { subChannelId, channelSegment } = message;
|
|
5851
|
+
const markReadReceiptEngine = ReadReceiptSyncEngine.getInstance();
|
|
5852
|
+
markReadReceiptEngine.markRead(subChannelId, channelSegment);
|
|
6074
5853
|
};
|
|
6075
5854
|
|
|
6076
5855
|
const messageLinkedObject = (message) => {
|
|
@@ -6218,6 +5997,14 @@ const pinnedPostLinkedObject = (pinnedPost) => {
|
|
|
6218
5997
|
} });
|
|
6219
5998
|
};
|
|
6220
5999
|
|
|
6000
|
+
const notificationTrayLinkedObject = (noti) => {
|
|
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]))
|
|
6003
|
+
.filter(isNonNullable)
|
|
6004
|
+
.map(({ data }) => data)
|
|
6005
|
+
.map(user => userLinkedObject(user)) });
|
|
6006
|
+
};
|
|
6007
|
+
|
|
6221
6008
|
const LinkedObject = {
|
|
6222
6009
|
ad: adLinkedObject,
|
|
6223
6010
|
comment: commentLinkedObject,
|
|
@@ -6231,6 +6018,7 @@ const LinkedObject = {
|
|
|
6231
6018
|
reactor: reactorLinkedObject,
|
|
6232
6019
|
channel: channelLinkedObject,
|
|
6233
6020
|
pinnedPost: pinnedPostLinkedObject,
|
|
6021
|
+
notificationTray: notificationTrayLinkedObject,
|
|
6234
6022
|
};
|
|
6235
6023
|
|
|
6236
6024
|
const getChannelMessagePreviewWithUser = (channel) => {
|
|
@@ -7058,24 +6846,6 @@ const preUpdateChannelCache = (rawPayload, options = { isMessagePreviewUpdated:
|
|
|
7058
6846
|
channels: rawPayload.channels.map(channel => convertFromRaw(channel, { isMessagePreviewUpdated: options.isMessagePreviewUpdated })),
|
|
7059
6847
|
});
|
|
7060
6848
|
};
|
|
7061
|
-
const updateChannelUnread = ({ currentUserId, channels, channelUsers, }) => {
|
|
7062
|
-
for (let i = 0; i < channels.length; i += 1) {
|
|
7063
|
-
const cacheKey = ['channelUnread', 'get', channels[i].channelId];
|
|
7064
|
-
const { readToSegment, lastMentionedSegment } = channelUsers.find(channelUser => channelUser.channelId === channels[i].channelId && channelUser.userId === currentUserId) || {
|
|
7065
|
-
readToSegment: 0,
|
|
7066
|
-
lastMentionedSegment: 0,
|
|
7067
|
-
};
|
|
7068
|
-
pushToCache(cacheKey, {
|
|
7069
|
-
channelId: channels[i].channelId,
|
|
7070
|
-
lastSegment: channels[i].messageCount,
|
|
7071
|
-
readToSegment,
|
|
7072
|
-
lastMentionedSegment,
|
|
7073
|
-
unreadCount: Math.max(channels[i].messageCount - readToSegment, 0),
|
|
7074
|
-
isMentioned: lastMentionedSegment > readToSegment,
|
|
7075
|
-
isDeleted: channels[i].isDeleted,
|
|
7076
|
-
});
|
|
7077
|
-
}
|
|
7078
|
-
};
|
|
7079
6849
|
const prepareChannelPayload = async (rawPayload, options = { isMessagePreviewUpdated: true }) => {
|
|
7080
6850
|
const client = getActiveClient();
|
|
7081
6851
|
const networkPreviewSetting = await client.getMessagePreviewSetting(false);
|
|
@@ -7085,34 +6855,23 @@ const prepareChannelPayload = async (rawPayload, options = { isMessagePreviewUpd
|
|
|
7085
6855
|
rawPayload.messagePreviews.length > 0) {
|
|
7086
6856
|
updateChannelMessagePreviewCache(rawPayload);
|
|
7087
6857
|
}
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
if (markerIds.length > 0) {
|
|
7101
|
-
// since the get markers method requires a channel cache to function with the reducer.
|
|
7102
|
-
preUpdateChannelCache(rawPayload, {
|
|
7103
|
-
isMessagePreviewUpdated: options.isMessagePreviewUpdated,
|
|
7104
|
-
});
|
|
7105
|
-
try {
|
|
7106
|
-
await getChannelMarkers(markerIds);
|
|
7107
|
-
}
|
|
7108
|
-
catch (e) {
|
|
7109
|
-
// empty block (from the spec, allow marker fetch to fail without having to do anything)
|
|
7110
|
-
}
|
|
6858
|
+
const markerIds = rawPayload.channels
|
|
6859
|
+
// filter channel by type. Only conversation, community and broadcast type are included.
|
|
6860
|
+
.filter(isUnreadCountSupport)
|
|
6861
|
+
.map(({ channelInternalId }) => channelInternalId);
|
|
6862
|
+
if (markerIds.length > 0) {
|
|
6863
|
+
// since the get markers method requires a channel cache to function with the reducer.
|
|
6864
|
+
preUpdateChannelCache(rawPayload, { isMessagePreviewUpdated: options.isMessagePreviewUpdated });
|
|
6865
|
+
try {
|
|
6866
|
+
await getChannelMarkers(markerIds);
|
|
6867
|
+
}
|
|
6868
|
+
catch (e) {
|
|
6869
|
+
// empty block (from the spec, allow marker fetch to fail without having to do anything)
|
|
7111
6870
|
}
|
|
7112
6871
|
}
|
|
7113
|
-
//
|
|
6872
|
+
// attach marker to channel
|
|
7114
6873
|
const channels = rawPayload.channels.map(payload => convertFromRaw(payload, { isMessagePreviewUpdated: options.isMessagePreviewUpdated }));
|
|
7115
|
-
//
|
|
6874
|
+
// user marker to channel users
|
|
7116
6875
|
const channelUsers = rawPayload.channelUsers.map(channelUser => {
|
|
7117
6876
|
return convertRawMembershipToMembership(channelUser);
|
|
7118
6877
|
});
|
|
@@ -7239,28 +6998,15 @@ const getSubChannelsUnreadCount = (channel, marker) => {
|
|
|
7239
6998
|
return (_e = (_c = marker === null || marker === void 0 ? void 0 : marker.unreadCount) !== null && _c !== void 0 ? _c : (_d = getCachedMarker(channel.channelInternalId)) === null || _d === void 0 ? void 0 : _d.unreadCount) !== null && _e !== void 0 ? _e : 0;
|
|
7240
6999
|
};
|
|
7241
7000
|
|
|
7242
|
-
const getLegacyChannelUnread = (channelId) => {
|
|
7243
|
-
var _a;
|
|
7244
|
-
return (_a = pullFromCache(['channelUnread', 'get', channelId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
7245
|
-
};
|
|
7246
|
-
|
|
7247
7001
|
const constructChannelDynamicValue = (channel) => {
|
|
7248
|
-
const client = getActiveClient();
|
|
7249
7002
|
const rest = __rest(channel, ["messageCount"]);
|
|
7250
7003
|
return shallowClone(rest, {
|
|
7251
|
-
get
|
|
7252
|
-
|
|
7253
|
-
return (_b = (_a = getLegacyChannelUnread(rest.channelId)) === null || _a === void 0 ? void 0 : _a.unreadCount) !== null && _b !== void 0 ? _b : 0;
|
|
7004
|
+
get isMentioned() {
|
|
7005
|
+
return getChannelIsMentioned(rest);
|
|
7254
7006
|
},
|
|
7255
7007
|
get subChannelsUnreadCount() {
|
|
7256
7008
|
return getSubChannelsUnreadCount(rest);
|
|
7257
7009
|
},
|
|
7258
|
-
get isMentioned() {
|
|
7259
|
-
var _a, _b;
|
|
7260
|
-
if (client.useLegacyUnreadCount)
|
|
7261
|
-
return (_b = (_a = getLegacyChannelUnread(rest.channelId)) === null || _a === void 0 ? void 0 : _a.isMentioned) !== null && _b !== void 0 ? _b : false;
|
|
7262
|
-
return getChannelIsMentioned(rest);
|
|
7263
|
-
},
|
|
7264
7010
|
});
|
|
7265
7011
|
};
|
|
7266
7012
|
|
|
@@ -7917,21 +7663,12 @@ const onChannelDeleted = (callback) => {
|
|
|
7917
7663
|
const client = getActiveClient();
|
|
7918
7664
|
const filter = async (payload) => {
|
|
7919
7665
|
const data = await prepareChannelPayload(payload);
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
data.channels.forEach(channel => {
|
|
7923
|
-
if (isConsistentMode) {
|
|
7666
|
+
if (client.isUnreadCountEnabled && client.getMarkerSyncConsistentMode()) {
|
|
7667
|
+
data.channels.forEach(channel => {
|
|
7924
7668
|
addFlagIsDeletedSubChannelUnreadByChannelId(channel.channelId);
|
|
7925
7669
|
deleteChannelUnreadByChannelId(channel.channelId);
|
|
7926
|
-
}
|
|
7927
|
-
|
|
7928
|
-
const cacheKey = ['channelUnread', 'get', channel.channelId];
|
|
7929
|
-
const cache = pullFromCache(cacheKey);
|
|
7930
|
-
if (cache) {
|
|
7931
|
-
pushToCache(cacheKey, Object.assign(Object.assign({}, cache), { isDeleted: true }));
|
|
7932
|
-
}
|
|
7933
|
-
}
|
|
7934
|
-
});
|
|
7670
|
+
});
|
|
7671
|
+
}
|
|
7935
7672
|
ingestInCache(data);
|
|
7936
7673
|
callbacks$b.forEach(cb => cb(data.channels[0]));
|
|
7937
7674
|
};
|
|
@@ -8045,25 +7782,6 @@ var readReceiptSyncEngineOnLoginHandler = () => {
|
|
|
8045
7782
|
};
|
|
8046
7783
|
};
|
|
8047
7784
|
|
|
8048
|
-
var legacyReadReceiptSyncEngineOnLoginHandler = () => {
|
|
8049
|
-
const readReceiptSyncEngine = LegacyReadReceiptSyncEngine.getInstance();
|
|
8050
|
-
readReceiptSyncEngine.startSyncReadReceipt();
|
|
8051
|
-
onSessionStateChange(state => {
|
|
8052
|
-
if (state === "established" /* Amity.SessionStates.ESTABLISHED */) {
|
|
8053
|
-
readReceiptSyncEngine.onSessionEstablished();
|
|
8054
|
-
}
|
|
8055
|
-
else if (state === "tokenExpired" /* Amity.SessionStates.TOKEN_EXPIRED */) {
|
|
8056
|
-
readReceiptSyncEngine.onTokenExpired();
|
|
8057
|
-
}
|
|
8058
|
-
else {
|
|
8059
|
-
readReceiptSyncEngine.onSessionDestroyed();
|
|
8060
|
-
}
|
|
8061
|
-
});
|
|
8062
|
-
return () => {
|
|
8063
|
-
readReceiptSyncEngine.onSessionDestroyed();
|
|
8064
|
-
};
|
|
8065
|
-
};
|
|
8066
|
-
|
|
8067
7785
|
const onOnline = (callback) => {
|
|
8068
7786
|
if (typeof window !== 'undefined' && window.addEventListener) {
|
|
8069
7787
|
window.addEventListener('online', callback);
|
|
@@ -8630,17 +8348,10 @@ const onChannelLeft = (callback) => {
|
|
|
8630
8348
|
const preparedPayload = await prepareChannelPayload(payload, {
|
|
8631
8349
|
isMessagePreviewUpdated: isLeftByMe,
|
|
8632
8350
|
});
|
|
8633
|
-
|
|
8634
|
-
const isLegacyUnreadCount = client.useLegacyUnreadCount;
|
|
8635
|
-
if (isLeftByMe) {
|
|
8351
|
+
if (client.isUnreadCountEnabled && client.getMarkerSyncConsistentMode() && isLeftByMe) {
|
|
8636
8352
|
preparedPayload.channels.forEach(channel => {
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
deleteChannelUnreadByChannelId(channel.channelId);
|
|
8640
|
-
}
|
|
8641
|
-
else if (isLegacyUnreadCount) {
|
|
8642
|
-
dropFromCache(['channelUnread', 'get', channel.channelId]);
|
|
8643
|
-
}
|
|
8353
|
+
addFlagIsDeletedSubChannelUnreadByChannelId(channel.channelId);
|
|
8354
|
+
deleteChannelUnreadByChannelId(channel.channelId);
|
|
8644
8355
|
});
|
|
8645
8356
|
}
|
|
8646
8357
|
const { channels, channelUsers } = preparedPayload;
|
|
@@ -8908,31 +8619,6 @@ const onMessageCreatedMqtt = (callback) => {
|
|
|
8908
8619
|
reCalculateChannelUnreadInfo(message.channelId);
|
|
8909
8620
|
});
|
|
8910
8621
|
}
|
|
8911
|
-
if (client.useLegacyUnreadCount) {
|
|
8912
|
-
rawPayload.messages.forEach(message => {
|
|
8913
|
-
var _a, _b;
|
|
8914
|
-
const channelUnread = (_a = pullFromCache([
|
|
8915
|
-
'channelUnread',
|
|
8916
|
-
'get',
|
|
8917
|
-
message.channelId,
|
|
8918
|
-
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
8919
|
-
if (!channelUnread || channelUnread.lastSegment >= message.segment)
|
|
8920
|
-
return;
|
|
8921
|
-
const lastSegment = message.segment;
|
|
8922
|
-
const isMentionedInMessage = (_b = message.mentionedUsers) === null || _b === void 0 ? void 0 : _b.some(mention => {
|
|
8923
|
-
return (mention.type === 'channel' ||
|
|
8924
|
-
(mention.type === 'user' &&
|
|
8925
|
-
client.userId &&
|
|
8926
|
-
mention.userPublicIds.includes(client.userId)));
|
|
8927
|
-
});
|
|
8928
|
-
const lastMentionSegment = isMentionedInMessage
|
|
8929
|
-
? message.segment
|
|
8930
|
-
: channelUnread.lastMentionSegment;
|
|
8931
|
-
const updatedChannelUnread = Object.assign(Object.assign({}, channelUnread), { lastSegment, unreadCount: Math.max(lastSegment - channelUnread.readToSegment, 0), lastMentionSegment, isMentioned: !(channelUnread.readToSegment >= lastMentionSegment) });
|
|
8932
|
-
pushToCache(['channelUnread', 'get', message.channelId], updatedChannelUnread);
|
|
8933
|
-
fireEvent('local.channelUnread.updated', updatedChannelUnread);
|
|
8934
|
-
});
|
|
8935
|
-
}
|
|
8936
8622
|
// Update in cache
|
|
8937
8623
|
ingestInCache(payload);
|
|
8938
8624
|
payload.messages.forEach(message => {
|
|
@@ -9108,7 +8794,6 @@ const enableUnreadCount = () => {
|
|
|
9108
8794
|
if (client.isUnreadCountEnabled)
|
|
9109
8795
|
return false;
|
|
9110
8796
|
client.isUnreadCountEnabled = true;
|
|
9111
|
-
client.useLegacyUnreadCount = false;
|
|
9112
8797
|
client.emitter.emit('unreadCountEnabled', true);
|
|
9113
8798
|
return true;
|
|
9114
8799
|
};
|
|
@@ -9424,12 +9109,7 @@ const login = async (params, sessionHandler, config) => {
|
|
|
9424
9109
|
// NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
|
|
9425
9110
|
// the channel because currently backend can't handle this, so every time a user is banned from
|
|
9426
9111
|
// a channel or the channel is deleted the channel's unread count will not be reset to zero
|
|
9427
|
-
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler());
|
|
9428
|
-
if (client.useLegacyUnreadCount) {
|
|
9429
|
-
subscriptions.push(readReceiptSyncEngineOnLoginHandler());
|
|
9430
|
-
}
|
|
9431
|
-
else
|
|
9432
|
-
subscriptions.push(legacyReadReceiptSyncEngineOnLoginHandler());
|
|
9112
|
+
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), readReceiptSyncEngineOnLoginHandler(), objectResolverEngineOnLoginHandler());
|
|
9433
9113
|
const markerSyncUnsubscriber = await startMarkerSync();
|
|
9434
9114
|
subscriptions.push(markerSyncUnsubscriber);
|
|
9435
9115
|
}
|
|
@@ -9610,8 +9290,6 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
|
|
|
9610
9290
|
const sessionState = "notLoggedIn" /* Amity.SessionStates.NOT_LOGGED_IN */;
|
|
9611
9291
|
const sessionHandler = undefined;
|
|
9612
9292
|
const isUnreadCountEnabled = false;
|
|
9613
|
-
// Legacy unread count is true by default
|
|
9614
|
-
const useLegacyUnreadCount = true;
|
|
9615
9293
|
const client = {
|
|
9616
9294
|
version: `${VERSION}`,
|
|
9617
9295
|
apiKey,
|
|
@@ -9641,7 +9319,6 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
|
|
|
9641
9319
|
getMessagePreviewSetting,
|
|
9642
9320
|
use: () => setActiveClient(client),
|
|
9643
9321
|
isUnreadCountEnabled,
|
|
9644
|
-
useLegacyUnreadCount,
|
|
9645
9322
|
getMarkerSyncConsistentMode,
|
|
9646
9323
|
/**
|
|
9647
9324
|
* Prefix for the deviceId key in the local storage or async storage.
|
|
@@ -10112,7 +9789,7 @@ const getUserUnread = (callback) => {
|
|
|
10112
9789
|
};
|
|
10113
9790
|
};
|
|
10114
9791
|
|
|
10115
|
-
var index$
|
|
9792
|
+
var index$m = /*#__PURE__*/Object.freeze({
|
|
10116
9793
|
__proto__: null,
|
|
10117
9794
|
getActiveClient: getActiveClient,
|
|
10118
9795
|
getActiveUser: getActiveUser,
|
|
@@ -11319,7 +10996,7 @@ const getMyFollowInfo = (callback) => {
|
|
|
11319
10996
|
};
|
|
11320
10997
|
/* end_public_function */
|
|
11321
10998
|
|
|
11322
|
-
var index$
|
|
10999
|
+
var index$l = /*#__PURE__*/Object.freeze({
|
|
11323
11000
|
__proto__: null,
|
|
11324
11001
|
blockUser: blockUser,
|
|
11325
11002
|
unBlockUser: unBlockUser,
|
|
@@ -12334,9 +12011,9 @@ var AmityUserSearchMatchType;
|
|
|
12334
12011
|
AmityUserSearchMatchType["PARTIAL"] = "partial";
|
|
12335
12012
|
})(AmityUserSearchMatchType || (AmityUserSearchMatchType = {}));
|
|
12336
12013
|
|
|
12337
|
-
var index$
|
|
12014
|
+
var index$k = /*#__PURE__*/Object.freeze({
|
|
12338
12015
|
__proto__: null,
|
|
12339
|
-
Relationship: index$
|
|
12016
|
+
Relationship: index$l,
|
|
12340
12017
|
getUserByIds: getUserByIds,
|
|
12341
12018
|
updateUser: updateUser,
|
|
12342
12019
|
flagUser: flagUser,
|
|
@@ -12600,7 +12277,7 @@ const uploadImage = async (formData, onProgress) => {
|
|
|
12600
12277
|
};
|
|
12601
12278
|
/* end_public_function */
|
|
12602
12279
|
|
|
12603
|
-
var index$
|
|
12280
|
+
var index$j = /*#__PURE__*/Object.freeze({
|
|
12604
12281
|
__proto__: null,
|
|
12605
12282
|
getFile: getFile,
|
|
12606
12283
|
uploadFile: uploadFile,
|
|
@@ -14412,7 +14089,7 @@ const getReactions = (params, callback, config) => {
|
|
|
14412
14089
|
};
|
|
14413
14090
|
/* end_public_function */
|
|
14414
14091
|
|
|
14415
|
-
var index$
|
|
14092
|
+
var index$i = /*#__PURE__*/Object.freeze({
|
|
14416
14093
|
__proto__: null,
|
|
14417
14094
|
addReaction: addReaction,
|
|
14418
14095
|
removeReaction: removeReaction,
|
|
@@ -16228,7 +15905,7 @@ const getMessages = (params, callback, config) => {
|
|
|
16228
15905
|
};
|
|
16229
15906
|
/* end_public_function */
|
|
16230
15907
|
|
|
16231
|
-
var index$
|
|
15908
|
+
var index$h = /*#__PURE__*/Object.freeze({
|
|
16232
15909
|
__proto__: null,
|
|
16233
15910
|
createMessage: createMessage,
|
|
16234
15911
|
updateMessage: updateMessage,
|
|
@@ -16754,7 +16431,7 @@ const stopMessageReceiptSync = (subChannelId) => {
|
|
|
16754
16431
|
};
|
|
16755
16432
|
/* end_public_function */
|
|
16756
16433
|
|
|
16757
|
-
var index$
|
|
16434
|
+
var index$g = /*#__PURE__*/Object.freeze({
|
|
16758
16435
|
__proto__: null,
|
|
16759
16436
|
getSubChannelByIds: getSubChannels$1,
|
|
16760
16437
|
createSubChannel: createSubChannel,
|
|
@@ -16775,37 +16452,19 @@ var index$f = /*#__PURE__*/Object.freeze({
|
|
|
16775
16452
|
/**
|
|
16776
16453
|
* Internal used only
|
|
16777
16454
|
*
|
|
16778
|
-
* Fired when an {@link Amity.
|
|
16779
|
-
*
|
|
16780
|
-
* @param callback The function to call when the event was fired
|
|
16781
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
16782
|
-
*
|
|
16783
|
-
* @category ChannelMarker Events
|
|
16784
|
-
*/
|
|
16785
|
-
const onChannelUnreadInfoUpdatedLocal = (callback) => {
|
|
16786
|
-
const client = getActiveClient();
|
|
16787
|
-
const filter = (payload) => {
|
|
16788
|
-
callback(payload);
|
|
16789
|
-
};
|
|
16790
|
-
return createEventSubscriber(client, 'channelMarker/onChannelUnreadInfoUpdatedLocal', 'local.channelUnreadInfo.updated', filter);
|
|
16791
|
-
};
|
|
16792
|
-
|
|
16793
|
-
/**
|
|
16794
|
-
* Internal used only
|
|
16795
|
-
*
|
|
16796
|
-
* Fired when an {@link Amity.ChannelUnread} has been updated.
|
|
16455
|
+
* Fired when an {@link Amity.userMessageFeedMarkers} has been resolved by Object Rsesolver
|
|
16797
16456
|
*
|
|
16798
16457
|
* @param callback The function to call when the event was fired
|
|
16799
16458
|
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
16800
16459
|
*
|
|
16801
|
-
* @category
|
|
16460
|
+
* @category MessageMarker Events
|
|
16802
16461
|
*/
|
|
16803
16462
|
const onChannelUnreadUpdatedLocal = (callback) => {
|
|
16804
16463
|
const client = getActiveClient();
|
|
16805
16464
|
const filter = (payload) => {
|
|
16806
16465
|
callback(payload);
|
|
16807
16466
|
};
|
|
16808
|
-
return createEventSubscriber(client, '
|
|
16467
|
+
return createEventSubscriber(client, 'channelMarker/onChannelUnreadUpdatedLocal', 'local.channelUnread.updated', filter);
|
|
16809
16468
|
};
|
|
16810
16469
|
|
|
16811
16470
|
/* begin_public_function
|
|
@@ -17007,7 +16666,6 @@ const getChannel = (channelId, callback) => {
|
|
|
17007
16666
|
return onSubChannelUpdated(updateMessagePreview);
|
|
17008
16667
|
}, 'channelId', 'channel'),
|
|
17009
16668
|
convertEventPayload(onSubChannelCreated, 'channelId', 'channel'),
|
|
17010
|
-
convertEventPayload(onChannelUnreadInfoUpdatedLocal, 'channelId', 'channel'),
|
|
17011
16669
|
convertEventPayload(onChannelUnreadUpdatedLocal, 'channelId', 'channel'),
|
|
17012
16670
|
], {
|
|
17013
16671
|
forceDispatch: true,
|
|
@@ -17521,10 +17179,6 @@ class ChannelLiveCollectionController extends LiveCollectionController {
|
|
|
17521
17179
|
},
|
|
17522
17180
|
action: "OnResolveUnread" /* Amity.ChannelActionType.OnResolveUnread */,
|
|
17523
17181
|
},
|
|
17524
|
-
{
|
|
17525
|
-
fn: convertEventPayload(onChannelUnreadInfoUpdatedLocal, 'channelId', 'channel'),
|
|
17526
|
-
action: "onUpdate" /* Amity.ChannelActionType.OnUpdate */,
|
|
17527
|
-
},
|
|
17528
17182
|
{
|
|
17529
17183
|
fn: convertEventPayload(onChannelUnreadUpdatedLocal, 'channelId', 'channel'),
|
|
17530
17184
|
action: "onUpdate" /* Amity.ChannelActionType.OnUpdate */,
|
|
@@ -17590,120 +17244,6 @@ const getChannels = (params, callback, config) => {
|
|
|
17590
17244
|
};
|
|
17591
17245
|
/* end_public_function */
|
|
17592
17246
|
|
|
17593
|
-
/**
|
|
17594
|
-
*
|
|
17595
|
-
* Calculate user unread from {@link Amity.ChannelUnread} objects
|
|
17596
|
-
*
|
|
17597
|
-
* @returns the {@link Amity.UserUnread} objects
|
|
17598
|
-
*
|
|
17599
|
-
* @category Channel API
|
|
17600
|
-
* @async
|
|
17601
|
-
*/
|
|
17602
|
-
const getTotalChannelsUnread$1 = () => {
|
|
17603
|
-
var _a;
|
|
17604
|
-
const client = getActiveClient();
|
|
17605
|
-
client.log('channel/getTotalChannelsUnread.locally');
|
|
17606
|
-
const cachedChannelsUnread = ((_a = queryCache(['channelUnread', 'get'])) === null || _a === void 0 ? void 0 : _a.filter(({ data }) => {
|
|
17607
|
-
return !data.isDeleted;
|
|
17608
|
-
})) || [];
|
|
17609
|
-
const totalChannelsUnread = (cachedChannelsUnread === null || cachedChannelsUnread === void 0 ? void 0 : cachedChannelsUnread.reduce((acc, { data }) => {
|
|
17610
|
-
acc.unreadCount += data.unreadCount;
|
|
17611
|
-
acc.isMentioned = acc.isMentioned || data.isMentioned;
|
|
17612
|
-
return acc;
|
|
17613
|
-
}, { unreadCount: 0, isMentioned: false })) || { unreadCount: 0, isMentioned: false };
|
|
17614
|
-
const cachedAt = client.cache && Date.now();
|
|
17615
|
-
return {
|
|
17616
|
-
data: totalChannelsUnread,
|
|
17617
|
-
cachedAt,
|
|
17618
|
-
};
|
|
17619
|
-
};
|
|
17620
|
-
|
|
17621
|
-
/* begin_public_function
|
|
17622
|
-
id: totalChannelsUnread.get
|
|
17623
|
-
*/
|
|
17624
|
-
/**
|
|
17625
|
-
* ```js
|
|
17626
|
-
* import { ChannelRepository } from '@amityco/ts-sdk';
|
|
17627
|
-
*
|
|
17628
|
-
* let totalChannelsUnread;
|
|
17629
|
-
*
|
|
17630
|
-
* const unsubscribe = ChannelRepository.getTotalChannelsUnread(response => {
|
|
17631
|
-
* unread = response.data;
|
|
17632
|
-
* });
|
|
17633
|
-
* ```
|
|
17634
|
-
*
|
|
17635
|
-
* Observe all mutation on a given {@link Amity.UserUnread}
|
|
17636
|
-
*
|
|
17637
|
-
* @returns An {@link Amity.UserUnread} function to run when willing to stop observing the message
|
|
17638
|
-
*
|
|
17639
|
-
* @category User Unread Live Object
|
|
17640
|
-
*
|
|
17641
|
-
*/
|
|
17642
|
-
const getTotalChannelsUnread = (callback) => {
|
|
17643
|
-
const { _id: userId } = getActiveUser();
|
|
17644
|
-
if (!userId)
|
|
17645
|
-
throw new ASCError('The _id has not been defined in ActiveUser', 800000 /* Amity.ClientError.UNKNOWN_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
17646
|
-
const { log, cache } = getActiveClient();
|
|
17647
|
-
if (!cache) {
|
|
17648
|
-
console.log('For using Live Object feature you need to enable Cache!');
|
|
17649
|
-
}
|
|
17650
|
-
const timestamp = Date.now();
|
|
17651
|
-
log(`liveTotalChannelsUnread(tmpid: ${timestamp}) > listen`);
|
|
17652
|
-
const disposers = [];
|
|
17653
|
-
let isUnsyncedModel = false; // for messages
|
|
17654
|
-
let model;
|
|
17655
|
-
const dispatcher = (data) => {
|
|
17656
|
-
const { data: userUnread } = data;
|
|
17657
|
-
const callbackModel = userUnread
|
|
17658
|
-
? {
|
|
17659
|
-
unreadCount: userUnread.unreadCount,
|
|
17660
|
-
isMentioned: userUnread.isMentioned,
|
|
17661
|
-
}
|
|
17662
|
-
: undefined;
|
|
17663
|
-
model = callbackModel ? convertGetterPropsToStatic(callbackModel) : callbackModel;
|
|
17664
|
-
callback({
|
|
17665
|
-
data: callbackModel
|
|
17666
|
-
? Object.assign(Object.assign({}, callbackModel), { isMentioned: callbackModel.isMentioned }) : callbackModel,
|
|
17667
|
-
loading: data.loading,
|
|
17668
|
-
error: data.error,
|
|
17669
|
-
});
|
|
17670
|
-
};
|
|
17671
|
-
const realtimeRouter = (userUnread) => {
|
|
17672
|
-
if (isEqual(model, userUnread))
|
|
17673
|
-
return;
|
|
17674
|
-
dispatcher({
|
|
17675
|
-
loading: false,
|
|
17676
|
-
data: userUnread,
|
|
17677
|
-
});
|
|
17678
|
-
};
|
|
17679
|
-
const onFetch = () => {
|
|
17680
|
-
const query = createQuery(async () => getTotalChannelsUnread$1());
|
|
17681
|
-
runQuery(query, ({ error, data, loading, origin, cachedAt }) => {
|
|
17682
|
-
if (cachedAt === UNSYNCED_OBJECT_CACHED_AT_VALUE) {
|
|
17683
|
-
dispatcher({
|
|
17684
|
-
data,
|
|
17685
|
-
origin,
|
|
17686
|
-
loading: false,
|
|
17687
|
-
error: new ASCApiError(UNSYNCED_OBJECT_CACHED_AT_MESSAGE, 800800 /* Amity.ClientError.DISALOOW_UNSYNCED_OBJECT */, "error" /* Amity.ErrorLevel.ERROR */),
|
|
17688
|
-
});
|
|
17689
|
-
isUnsyncedModel = true;
|
|
17690
|
-
disposers.forEach(fn => fn());
|
|
17691
|
-
}
|
|
17692
|
-
else if (!isUnsyncedModel) {
|
|
17693
|
-
dispatcher({ loading, data, origin, error });
|
|
17694
|
-
}
|
|
17695
|
-
if (error) {
|
|
17696
|
-
disposers.forEach(fn => fn());
|
|
17697
|
-
}
|
|
17698
|
-
});
|
|
17699
|
-
};
|
|
17700
|
-
disposers.push(onChannelUnreadUpdatedLocal(realtimeRouter));
|
|
17701
|
-
onFetch();
|
|
17702
|
-
return () => {
|
|
17703
|
-
disposers.forEach(fn => fn());
|
|
17704
|
-
};
|
|
17705
|
-
};
|
|
17706
|
-
|
|
17707
17247
|
/* begin_public_function
|
|
17708
17248
|
id: channel.member.add
|
|
17709
17249
|
*/
|
|
@@ -18068,7 +17608,7 @@ const searchMembers$1 = (params, callback, config) => {
|
|
|
18068
17608
|
};
|
|
18069
17609
|
/* end_public_function */
|
|
18070
17610
|
|
|
18071
|
-
var index$
|
|
17611
|
+
var index$f = /*#__PURE__*/Object.freeze({
|
|
18072
17612
|
__proto__: null,
|
|
18073
17613
|
addMembers: addMembers$1,
|
|
18074
17614
|
removeMembers: removeMembers$1,
|
|
@@ -18271,7 +17811,7 @@ const unmuteMembers = async (channelId, userIds) => {
|
|
|
18271
17811
|
};
|
|
18272
17812
|
/* end_public_function */
|
|
18273
17813
|
|
|
18274
|
-
var index$
|
|
17814
|
+
var index$e = /*#__PURE__*/Object.freeze({
|
|
18275
17815
|
__proto__: null,
|
|
18276
17816
|
addRole: addRole,
|
|
18277
17817
|
removeRole: removeRole,
|
|
@@ -18281,10 +17821,10 @@ var index$d = /*#__PURE__*/Object.freeze({
|
|
|
18281
17821
|
unmuteMembers: unmuteMembers
|
|
18282
17822
|
});
|
|
18283
17823
|
|
|
18284
|
-
var index$
|
|
17824
|
+
var index$d = /*#__PURE__*/Object.freeze({
|
|
18285
17825
|
__proto__: null,
|
|
18286
|
-
Membership: index$
|
|
18287
|
-
Moderation: index$
|
|
17826
|
+
Membership: index$f,
|
|
17827
|
+
Moderation: index$e,
|
|
18288
17828
|
getChannelByIds: getChannelByIds$1,
|
|
18289
17829
|
createChannel: createChannel,
|
|
18290
17830
|
updateChannel: updateChannel,
|
|
@@ -18307,7 +17847,6 @@ var index$c = /*#__PURE__*/Object.freeze({
|
|
|
18307
17847
|
onChannelMemberRoleRemoved: onChannelMemberRoleRemoved,
|
|
18308
17848
|
getChannel: getChannel,
|
|
18309
17849
|
getChannels: getChannels,
|
|
18310
|
-
getTotalChannelsUnread: getTotalChannelsUnread,
|
|
18311
17850
|
MARKER_INCLUDED_CHANNEL_TYPE: MARKER_INCLUDED_CHANNEL_TYPE,
|
|
18312
17851
|
isUnreadCountSupport: isUnreadCountSupport,
|
|
18313
17852
|
convertFromRaw: convertFromRaw,
|
|
@@ -19664,7 +19203,7 @@ const searchMembers = (params, callback, config) => {
|
|
|
19664
19203
|
};
|
|
19665
19204
|
/* end_public_function */
|
|
19666
19205
|
|
|
19667
|
-
var index$
|
|
19206
|
+
var index$c = /*#__PURE__*/Object.freeze({
|
|
19668
19207
|
__proto__: null,
|
|
19669
19208
|
addMembers: addMembers,
|
|
19670
19209
|
removeMembers: removeMembers,
|
|
@@ -20689,7 +20228,7 @@ const unbanMembers = async (communityId, userIds) => {
|
|
|
20689
20228
|
};
|
|
20690
20229
|
/* end_public_function */
|
|
20691
20230
|
|
|
20692
|
-
var index$
|
|
20231
|
+
var index$b = /*#__PURE__*/Object.freeze({
|
|
20693
20232
|
__proto__: null,
|
|
20694
20233
|
addRoles: addRoles,
|
|
20695
20234
|
removeRoles: removeRoles,
|
|
@@ -20697,10 +20236,10 @@ var index$a = /*#__PURE__*/Object.freeze({
|
|
|
20697
20236
|
unbanMembers: unbanMembers
|
|
20698
20237
|
});
|
|
20699
20238
|
|
|
20700
|
-
var index$
|
|
20239
|
+
var index$a = /*#__PURE__*/Object.freeze({
|
|
20701
20240
|
__proto__: null,
|
|
20702
|
-
Moderation: index$
|
|
20703
|
-
Membership: index$
|
|
20241
|
+
Moderation: index$b,
|
|
20242
|
+
Membership: index$c,
|
|
20704
20243
|
getCommunityByIds: getCommunities$1,
|
|
20705
20244
|
createCommunity: createCommunity,
|
|
20706
20245
|
updateCommunity: updateCommunity,
|
|
@@ -20933,7 +20472,7 @@ const getCategories = (params, callback, config) => {
|
|
|
20933
20472
|
};
|
|
20934
20473
|
/* end_public_function */
|
|
20935
20474
|
|
|
20936
|
-
var index$
|
|
20475
|
+
var index$9 = /*#__PURE__*/Object.freeze({
|
|
20937
20476
|
__proto__: null,
|
|
20938
20477
|
getCategory: getCategory,
|
|
20939
20478
|
getCategories: getCategories
|
|
@@ -21101,7 +20640,7 @@ getCustomRankingGlobalFeed.locally = (query) => {
|
|
|
21101
20640
|
: undefined;
|
|
21102
20641
|
};
|
|
21103
20642
|
|
|
21104
|
-
var index$
|
|
20643
|
+
var index$8 = /*#__PURE__*/Object.freeze({
|
|
21105
20644
|
__proto__: null,
|
|
21106
20645
|
queryGlobalFeed: queryGlobalFeed,
|
|
21107
20646
|
getCustomRankingGlobalFeed: getCustomRankingGlobalFeed
|
|
@@ -22416,7 +21955,7 @@ const getComments = (params, callback, config) => {
|
|
|
22416
21955
|
};
|
|
22417
21956
|
/* end_public_function */
|
|
22418
21957
|
|
|
22419
|
-
var index$
|
|
21958
|
+
var index$7 = /*#__PURE__*/Object.freeze({
|
|
22420
21959
|
__proto__: null,
|
|
22421
21960
|
getCommentByIds: getCommentByIds,
|
|
22422
21961
|
createComment: createComment,
|
|
@@ -23423,7 +22962,7 @@ const semanticSearchPosts = (params, callback, config) => {
|
|
|
23423
22962
|
};
|
|
23424
22963
|
};
|
|
23425
22964
|
|
|
23426
|
-
var index$
|
|
22965
|
+
var index$6 = /*#__PURE__*/Object.freeze({
|
|
23427
22966
|
__proto__: null,
|
|
23428
22967
|
getPostByIds: getPostByIds,
|
|
23429
22968
|
createPost: createPost,
|
|
@@ -23957,7 +23496,7 @@ const getStreams = (params, callback, config) => {
|
|
|
23957
23496
|
};
|
|
23958
23497
|
};
|
|
23959
23498
|
|
|
23960
|
-
var index$
|
|
23499
|
+
var index$5 = /*#__PURE__*/Object.freeze({
|
|
23961
23500
|
__proto__: null,
|
|
23962
23501
|
createStream: createStream,
|
|
23963
23502
|
updateStream: updateStream,
|
|
@@ -24244,7 +23783,7 @@ const getPoll = (pollId, callback) => {
|
|
|
24244
23783
|
};
|
|
24245
23784
|
/* end_public_function */
|
|
24246
23785
|
|
|
24247
|
-
var index$
|
|
23786
|
+
var index$4 = /*#__PURE__*/Object.freeze({
|
|
24248
23787
|
__proto__: null,
|
|
24249
23788
|
createPoll: createPoll,
|
|
24250
23789
|
closePoll: closePoll,
|
|
@@ -24615,7 +24154,7 @@ const getPlayer = async (parameters) => {
|
|
|
24615
24154
|
return video;
|
|
24616
24155
|
};
|
|
24617
24156
|
|
|
24618
|
-
var index$
|
|
24157
|
+
var index$3 = /*#__PURE__*/Object.freeze({
|
|
24619
24158
|
__proto__: null,
|
|
24620
24159
|
getPlayer: getPlayer
|
|
24621
24160
|
});
|
|
@@ -25788,7 +25327,7 @@ const getGlobalStoryTargets = (params, callback, config) => {
|
|
|
25788
25327
|
};
|
|
25789
25328
|
};
|
|
25790
25329
|
|
|
25791
|
-
var index$
|
|
25330
|
+
var index$2 = /*#__PURE__*/Object.freeze({
|
|
25792
25331
|
__proto__: null,
|
|
25793
25332
|
createImageStory: createImageStory,
|
|
25794
25333
|
createVideoStory: createVideoStory,
|
|
@@ -25825,7 +25364,7 @@ const getNetworkAds = async () => {
|
|
|
25825
25364
|
};
|
|
25826
25365
|
};
|
|
25827
25366
|
|
|
25828
|
-
var index = /*#__PURE__*/Object.freeze({
|
|
25367
|
+
var index$1 = /*#__PURE__*/Object.freeze({
|
|
25829
25368
|
__proto__: null,
|
|
25830
25369
|
getNetworkAds: getNetworkAds
|
|
25831
25370
|
});
|
|
@@ -25852,31 +25391,386 @@ const createUserToken = async (apiKey, apiRegion, params) => {
|
|
|
25852
25391
|
return { accessToken: data.accessToken };
|
|
25853
25392
|
};
|
|
25854
25393
|
|
|
25394
|
+
/* begin_public_function
|
|
25395
|
+
id: notificationTray.getNotificationTraySeen
|
|
25396
|
+
*/
|
|
25397
|
+
/**
|
|
25398
|
+
* ```js
|
|
25399
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
25400
|
+
* const notificationTraySeen = await notificationTray.getNotificationTraySeen()
|
|
25401
|
+
* ```
|
|
25402
|
+
*
|
|
25403
|
+
*
|
|
25404
|
+
* @returns A page of {@link Amity.NotificationTraySeen} objects
|
|
25405
|
+
*
|
|
25406
|
+
* @category NotificationTray API
|
|
25407
|
+
* @async
|
|
25408
|
+
* */
|
|
25409
|
+
const getNotificationTraySeen$1 = async () => {
|
|
25410
|
+
const client = getActiveClient();
|
|
25411
|
+
client.log('notificationTray/getNotificationTraySeen', {});
|
|
25412
|
+
const { data: payload } = await client.http.get(`api/v1/notification-tray/tray/seen`);
|
|
25413
|
+
const cachedAt = client.cache && Date.now();
|
|
25414
|
+
if (client.cache) {
|
|
25415
|
+
const cacheKey = ['notificationTraySeen', 'get', client.userId];
|
|
25416
|
+
pushToCache(cacheKey, {
|
|
25417
|
+
userId: client.userId,
|
|
25418
|
+
lastTraySeenAt: payload.lastTraySeenAt,
|
|
25419
|
+
lastTrayOccuredAt: payload.lastTrayOccuredAt,
|
|
25420
|
+
});
|
|
25421
|
+
}
|
|
25422
|
+
return {
|
|
25423
|
+
data: {
|
|
25424
|
+
userId: client.userId,
|
|
25425
|
+
lastTraySeenAt: payload.lastTraySeenAt,
|
|
25426
|
+
lastTrayOccuredAt: payload.lastTrayOccuredAt,
|
|
25427
|
+
isSeen: payload.lastTraySeenAt > payload.lastTrayOccuredAt,
|
|
25428
|
+
},
|
|
25429
|
+
cachedAt,
|
|
25430
|
+
};
|
|
25431
|
+
};
|
|
25432
|
+
/* end_public_function */
|
|
25433
|
+
/**
|
|
25434
|
+
* ```js
|
|
25435
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
25436
|
+
* const notificationTraySeen = await notificationTray.getNotificationTraySeen.locally()
|
|
25437
|
+
* ```
|
|
25438
|
+
*
|
|
25439
|
+
* Queries a paginable list of {@link Amity.NotificationTraySeen} objects from cache
|
|
25440
|
+
*
|
|
25441
|
+
* @returns A page of {@link Amity.NotificationTraySeen} objects
|
|
25442
|
+
*
|
|
25443
|
+
* @category NotificationTray API
|
|
25444
|
+
* @async
|
|
25445
|
+
* */
|
|
25446
|
+
getNotificationTraySeen$1.locally = () => {
|
|
25447
|
+
var _a;
|
|
25448
|
+
const client = getActiveClient();
|
|
25449
|
+
client.log('notificationTray/getNotificationTraySeen.locally', {});
|
|
25450
|
+
if (!client.cache)
|
|
25451
|
+
return;
|
|
25452
|
+
const queryKey = ['notificationTraySeen', 'get'];
|
|
25453
|
+
const { data, cachedAt } = (_a = pullFromCache(queryKey)) !== null && _a !== void 0 ? _a : {};
|
|
25454
|
+
if (!(data === null || data === void 0 ? void 0 : data.notificationTraySeen))
|
|
25455
|
+
return;
|
|
25456
|
+
return { data: data.notificationTraySeen, cachedAt };
|
|
25457
|
+
};
|
|
25458
|
+
|
|
25459
|
+
/**
|
|
25460
|
+
* ```js
|
|
25461
|
+
* import { onNotificationTraySeenUpdated } from '@amityco/ts-sdk'
|
|
25462
|
+
* const dispose = onNotificationTraySeenUpdated(data => {
|
|
25463
|
+
* // ...
|
|
25464
|
+
* })
|
|
25465
|
+
* ```
|
|
25466
|
+
*
|
|
25467
|
+
* Fired when an {@link Amity.NotificationTraySeen} has been updated
|
|
25468
|
+
*
|
|
25469
|
+
* @param callback The function to call when the event was fired
|
|
25470
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
25471
|
+
*
|
|
25472
|
+
* @category NotificationTraySeen Events
|
|
25473
|
+
*/
|
|
25474
|
+
const onNotificationTraySeenUpdated = (callback) => {
|
|
25475
|
+
const client = getActiveClient();
|
|
25476
|
+
const disposers = [
|
|
25477
|
+
createEventSubscriber(client, 'onNotificationTraySeenUpdated', 'local.notificationTraySeen.updated', payload => callback(payload)),
|
|
25478
|
+
];
|
|
25479
|
+
return () => {
|
|
25480
|
+
disposers.forEach(fn => fn());
|
|
25481
|
+
};
|
|
25482
|
+
};
|
|
25483
|
+
|
|
25484
|
+
/* begin_public_function
|
|
25485
|
+
id: notificationTraySeen.get
|
|
25486
|
+
*/
|
|
25487
|
+
/**
|
|
25488
|
+
* ```js
|
|
25489
|
+
* import { getNotificationTraySeen } from '@amityco/ts-sdk';
|
|
25490
|
+
*
|
|
25491
|
+
* let notificationTraySeen;
|
|
25492
|
+
*
|
|
25493
|
+
* const unsubscribe = getNotificationTraySeen(userId, response => {
|
|
25494
|
+
* notificationTraySeen = response.data;
|
|
25495
|
+
* });
|
|
25496
|
+
* ```
|
|
25497
|
+
*
|
|
25498
|
+
* Observe all mutation on a given {@link Amity.NotificationTraySeen}
|
|
25499
|
+
*
|
|
25500
|
+
* @param userId the ID of the user to observe
|
|
25501
|
+
* @param callback the function to call when new data are available
|
|
25502
|
+
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the message
|
|
25503
|
+
*
|
|
25504
|
+
* @category NotificationTraySeen Live Object
|
|
25505
|
+
*/
|
|
25506
|
+
const getNotificationTraySeen = (callback) => {
|
|
25507
|
+
const responder = (snapshot) => {
|
|
25508
|
+
const { data } = snapshot;
|
|
25509
|
+
callback(Object.assign(Object.assign({}, snapshot), { data }));
|
|
25510
|
+
};
|
|
25511
|
+
const { userId } = getActiveUser();
|
|
25512
|
+
return liveObject(userId, responder, 'userId', getNotificationTraySeen$1, [
|
|
25513
|
+
onNotificationTraySeenUpdated,
|
|
25514
|
+
]);
|
|
25515
|
+
};
|
|
25516
|
+
/* end_public_function */
|
|
25517
|
+
|
|
25518
|
+
/**
|
|
25519
|
+
* TODO: handle cache receive cache option, and cache policy
|
|
25520
|
+
* TODO: check if querybyIds is supported
|
|
25521
|
+
*/
|
|
25522
|
+
class NotificationTrayItemsPaginationController extends PaginationController {
|
|
25523
|
+
async getRequest(queryParams, token) {
|
|
25524
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
|
|
25525
|
+
const options = token ? { token } : { limit };
|
|
25526
|
+
const { data: queryResponse } = await this.http.get(`/api/v1/notification-tray`, {
|
|
25527
|
+
params: Object.assign(Object.assign({}, params), { options }),
|
|
25528
|
+
});
|
|
25529
|
+
return queryResponse;
|
|
25530
|
+
}
|
|
25531
|
+
}
|
|
25532
|
+
|
|
25533
|
+
class NotificationTrayItemsQuerystreamController extends QueryStreamController {
|
|
25534
|
+
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
25535
|
+
super(query, cacheKey);
|
|
25536
|
+
this.notifyChange = notifyChange;
|
|
25537
|
+
this.preparePayload = preparePayload;
|
|
25538
|
+
}
|
|
25539
|
+
async saveToMainDB(response) {
|
|
25540
|
+
const processedPayload = await this.preparePayload(response);
|
|
25541
|
+
const client = getActiveClient();
|
|
25542
|
+
const cachedAt = client.cache && Date.now();
|
|
25543
|
+
if (client.cache) {
|
|
25544
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
25545
|
+
}
|
|
25546
|
+
}
|
|
25547
|
+
appendToQueryStream(response, direction, refresh = false) {
|
|
25548
|
+
var _a, _b;
|
|
25549
|
+
if (refresh) {
|
|
25550
|
+
pushToCache(this.cacheKey, {
|
|
25551
|
+
data: response.notificationTrayItems.map(getResolver('notificationTrayItem')),
|
|
25552
|
+
});
|
|
25553
|
+
}
|
|
25554
|
+
else {
|
|
25555
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
25556
|
+
const notifications = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
25557
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [
|
|
25558
|
+
...new Set([
|
|
25559
|
+
...notifications,
|
|
25560
|
+
...response.notificationTrayItems.map(getResolver('notificationTrayItem')),
|
|
25561
|
+
]),
|
|
25562
|
+
] }));
|
|
25563
|
+
}
|
|
25564
|
+
}
|
|
25565
|
+
}
|
|
25566
|
+
|
|
25567
|
+
const prepareNotificationTrayItemsPayload = (rawPayload) => {
|
|
25568
|
+
const users = rawPayload.users.map(convertRawUserToInternalUser);
|
|
25569
|
+
return Object.assign(Object.assign({}, rawPayload), { users });
|
|
25570
|
+
};
|
|
25571
|
+
|
|
25572
|
+
class NotificationTrayItemsLiveCollectionController extends LiveCollectionController {
|
|
25573
|
+
constructor(query, callback) {
|
|
25574
|
+
const queryStreamId = hash__default["default"](query);
|
|
25575
|
+
const cacheKey = ['notificationTrayItem', 'collection', queryStreamId];
|
|
25576
|
+
const paginationController = new NotificationTrayItemsPaginationController(query);
|
|
25577
|
+
super(paginationController, queryStreamId, cacheKey, callback);
|
|
25578
|
+
this.query = query;
|
|
25579
|
+
this.queryStreamController = new NotificationTrayItemsQuerystreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareNotificationTrayItemsPayload);
|
|
25580
|
+
this.callback = callback.bind(this);
|
|
25581
|
+
this.loadPage({ initial: true });
|
|
25582
|
+
}
|
|
25583
|
+
setup() {
|
|
25584
|
+
var _a;
|
|
25585
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
25586
|
+
if (!collection) {
|
|
25587
|
+
pushToCache(this.cacheKey, {
|
|
25588
|
+
data: [],
|
|
25589
|
+
params: {},
|
|
25590
|
+
});
|
|
25591
|
+
}
|
|
25592
|
+
}
|
|
25593
|
+
async persistModel(queryPayload) {
|
|
25594
|
+
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
25595
|
+
}
|
|
25596
|
+
persistQueryStream({ response, direction, refresh, }) {
|
|
25597
|
+
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
25598
|
+
}
|
|
25599
|
+
// eslint-disable-next-line class-methods-use-this
|
|
25600
|
+
startSubscription() {
|
|
25601
|
+
return [];
|
|
25602
|
+
}
|
|
25603
|
+
notifyChange({ origin, loading, error }) {
|
|
25604
|
+
var _a, _b;
|
|
25605
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
25606
|
+
if (!collection)
|
|
25607
|
+
return;
|
|
25608
|
+
const data = ((_b = collection.data
|
|
25609
|
+
.map(id => pullFromCache(['notificationTrayItem', 'get', id]))
|
|
25610
|
+
.filter(isNonNullable)
|
|
25611
|
+
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.notificationTray);
|
|
25612
|
+
if (!this.shouldNotify(data) && origin === 'event')
|
|
25613
|
+
return;
|
|
25614
|
+
this.callback({
|
|
25615
|
+
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
25616
|
+
data,
|
|
25617
|
+
hasNextPage: !!this.paginationController.getNextToken(),
|
|
25618
|
+
loading,
|
|
25619
|
+
error,
|
|
25620
|
+
});
|
|
25621
|
+
}
|
|
25622
|
+
}
|
|
25623
|
+
|
|
25624
|
+
/**
|
|
25625
|
+
* Get notification tray items for a notification tray page
|
|
25626
|
+
*
|
|
25627
|
+
* @param params the limit query parameters
|
|
25628
|
+
* @param callback the callback to be called when the notification tray items are updated
|
|
25629
|
+
* @returns items in the notification tray
|
|
25630
|
+
*
|
|
25631
|
+
* @category Notification tray items Live Collection
|
|
25632
|
+
*
|
|
25633
|
+
*/
|
|
25634
|
+
const getNotificationTrayItems = (params, callback, config) => {
|
|
25635
|
+
const { log, cache } = getActiveClient();
|
|
25636
|
+
if (!cache) {
|
|
25637
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
25638
|
+
}
|
|
25639
|
+
const timestamp = Date.now();
|
|
25640
|
+
log(`getNotificationTrayItems(tmpid: ${timestamp}) > listen`);
|
|
25641
|
+
const notiTrayItemsLiveCollection = new NotificationTrayItemsLiveCollectionController(params, callback);
|
|
25642
|
+
const disposers = notiTrayItemsLiveCollection.startSubscription();
|
|
25643
|
+
const cacheKey = notiTrayItemsLiveCollection.getCacheKey();
|
|
25644
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
25645
|
+
return () => {
|
|
25646
|
+
log(`getNotificationTrayItems(tmpid: ${timestamp}) > dispose`);
|
|
25647
|
+
disposers.forEach(fn => fn());
|
|
25648
|
+
};
|
|
25649
|
+
};
|
|
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
|
+
|
|
25696
|
+
/* begin_public_function
|
|
25697
|
+
id: notificationTray.markSeen
|
|
25698
|
+
*/
|
|
25699
|
+
/**
|
|
25700
|
+
* ```js
|
|
25701
|
+
* import { notificationTray } from '@amityco/ts-sdk'
|
|
25702
|
+
* const updated = await notificationTray.markTraySeen({
|
|
25703
|
+
* lastSeenAt: Amity.timestamp,
|
|
25704
|
+
* })
|
|
25705
|
+
* ```
|
|
25706
|
+
*
|
|
25707
|
+
* Updates an {@link Amity.NotificationTraySeen}
|
|
25708
|
+
*
|
|
25709
|
+
* @param userId The ID of the {@link Amity.NotificationTraySeen} to edit
|
|
25710
|
+
* @param lastSeenAt The patch data to apply
|
|
25711
|
+
* @returns the updated {@link Amity.NotificationTraySeen} object
|
|
25712
|
+
*
|
|
25713
|
+
* @category Post API
|
|
25714
|
+
* @async
|
|
25715
|
+
*/
|
|
25716
|
+
const markTraySeen = async (lastSeenAt) => {
|
|
25717
|
+
var _a;
|
|
25718
|
+
const client = getActiveClient();
|
|
25719
|
+
client.log('notificationTray/markTraySeen', {});
|
|
25720
|
+
const { data: payload } = await client.http.put(`api/v1/notification-tray/tray/seen`, {
|
|
25721
|
+
lastSeenAt,
|
|
25722
|
+
});
|
|
25723
|
+
const cacheData = (_a = pullFromCache([
|
|
25724
|
+
'notificationTraySeen',
|
|
25725
|
+
'get',
|
|
25726
|
+
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
25727
|
+
const data = Object.assign({ userId: client.userId }, payload);
|
|
25728
|
+
const updateCacheData = Object.assign(Object.assign({}, cacheData), data);
|
|
25729
|
+
const cachedAt = client.cache && Date.now();
|
|
25730
|
+
if (client.cache)
|
|
25731
|
+
pushToCache(['notificationTraySeen', 'get', client.userId], updateCacheData, { cachedAt });
|
|
25732
|
+
fireEvent('local.notificationTraySeen.updated', data);
|
|
25733
|
+
return {
|
|
25734
|
+
data: payload,
|
|
25735
|
+
cachedAt,
|
|
25736
|
+
};
|
|
25737
|
+
};
|
|
25738
|
+
/* end_public_function */
|
|
25739
|
+
|
|
25740
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
25741
|
+
__proto__: null,
|
|
25742
|
+
getNotificationTraySeen: getNotificationTraySeen,
|
|
25743
|
+
getNotificationTrayItems: getNotificationTrayItems,
|
|
25744
|
+
markItemsSeen: markItemsSeen,
|
|
25745
|
+
markTraySeen: markTraySeen,
|
|
25746
|
+
onNotificationTraySeenUpdated: onNotificationTraySeenUpdated
|
|
25747
|
+
});
|
|
25748
|
+
|
|
25855
25749
|
exports.API_REGIONS = API_REGIONS;
|
|
25856
|
-
exports.AdRepository = index;
|
|
25857
|
-
exports.CategoryRepository = index$
|
|
25858
|
-
exports.ChannelRepository = index$
|
|
25859
|
-
exports.Client = index$
|
|
25860
|
-
exports.CommentRepository = index$
|
|
25750
|
+
exports.AdRepository = index$1;
|
|
25751
|
+
exports.CategoryRepository = index$9;
|
|
25752
|
+
exports.ChannelRepository = index$d;
|
|
25753
|
+
exports.Client = index$m;
|
|
25754
|
+
exports.CommentRepository = index$7;
|
|
25861
25755
|
exports.CommunityPostSettingMaps = CommunityPostSettingMaps;
|
|
25862
25756
|
exports.CommunityPostSettings = CommunityPostSettings;
|
|
25863
|
-
exports.CommunityRepository = index$
|
|
25757
|
+
exports.CommunityRepository = index$a;
|
|
25864
25758
|
exports.ContentFeedType = ContentFeedType;
|
|
25865
25759
|
exports.DefaultCommunityPostSetting = DefaultCommunityPostSetting;
|
|
25866
|
-
exports.FeedRepository = index$
|
|
25867
|
-
exports.FileRepository = index$
|
|
25760
|
+
exports.FeedRepository = index$8;
|
|
25761
|
+
exports.FileRepository = index$j;
|
|
25868
25762
|
exports.FileType = FileType;
|
|
25869
|
-
exports.LiveStreamPlayer = index$
|
|
25763
|
+
exports.LiveStreamPlayer = index$3;
|
|
25870
25764
|
exports.MessageContentType = MessageContentType;
|
|
25871
|
-
exports.MessageRepository = index$
|
|
25872
|
-
exports.PollRepository = index$
|
|
25765
|
+
exports.MessageRepository = index$h;
|
|
25766
|
+
exports.PollRepository = index$4;
|
|
25873
25767
|
exports.PostContentType = PostContentType;
|
|
25874
|
-
exports.PostRepository = index$
|
|
25875
|
-
exports.ReactionRepository = index$
|
|
25876
|
-
exports.StoryRepository = index$
|
|
25877
|
-
exports.StreamRepository = index$
|
|
25878
|
-
exports.SubChannelRepository = index$
|
|
25879
|
-
exports.UserRepository = index$
|
|
25768
|
+
exports.PostRepository = index$6;
|
|
25769
|
+
exports.ReactionRepository = index$i;
|
|
25770
|
+
exports.StoryRepository = index$2;
|
|
25771
|
+
exports.StreamRepository = index$5;
|
|
25772
|
+
exports.SubChannelRepository = index$g;
|
|
25773
|
+
exports.UserRepository = index$k;
|
|
25880
25774
|
exports.VERSION = VERSION;
|
|
25881
25775
|
exports.VideoResolution = VideoResolution;
|
|
25882
25776
|
exports.VideoSize = VideoSize;
|
|
@@ -25929,6 +25823,7 @@ exports.isPaged = isPaged;
|
|
|
25929
25823
|
exports.isReportedByMe = isReportedByMe;
|
|
25930
25824
|
exports.isSkip = isSkip;
|
|
25931
25825
|
exports.mergeInCache = mergeInCache;
|
|
25826
|
+
exports.notificationTray = index;
|
|
25932
25827
|
exports.onChannelMarkerFetched = onChannelMarkerFetched;
|
|
25933
25828
|
exports.onFeedMarkerFetched = onFeedMarkerFetched;
|
|
25934
25829
|
exports.onFeedMarkerUpdated = onFeedMarkerUpdated;
|