@amityco/ts-sdk-react-native 6.32.7-289cad7.0 → 6.33.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 +16 -2
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +3 -0
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/pinnedPost.d.ts +1 -0
- package/dist/@types/domains/pinnedPost.d.ts.map +1 -1
- package/dist/@types/domains/reaction.d.ts +8 -2
- package/dist/@types/domains/reaction.d.ts.map +1 -1
- package/dist/@types/domains/user.d.ts +2 -0
- package/dist/@types/domains/user.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/utils.d.ts.map +1 -1
- package/dist/communityRepository/utils/communityWithMembership.d.ts.map +1 -1
- package/dist/feedRepository/api/queryGlobalFeed.d.ts.map +1 -1
- package/dist/index.cjs.js +908 -570
- package/dist/index.esm.js +766 -428
- package/dist/index.umd.js +3 -3
- package/dist/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostLiveCollectionController.d.ts +13 -0
- package/dist/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostLiveCollectionController.d.ts.map +1 -0
- package/dist/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostPaginationController.d.ts +13 -0
- package/dist/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostPaginationController.d.ts.map +1 -0
- package/dist/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostQueryStreamController.d.ts +15 -0
- package/dist/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostQueryStreamController.d.ts.map +1 -0
- package/dist/postRepository/observers/getGlobalPinnedPosts.d.ts +10 -0
- package/dist/postRepository/observers/getGlobalPinnedPosts.d.ts.map +1 -0
- package/dist/postRepository/observers/index.d.ts +1 -0
- package/dist/postRepository/observers/index.d.ts.map +1 -1
- package/dist/reactionRepository/api/addReaction.d.ts.map +1 -1
- package/dist/reactionRepository/api/removeReaction.d.ts.map +1 -1
- package/dist/reactionRepository/events/onReactorAddedLocal.d.ts +19 -0
- package/dist/reactionRepository/events/onReactorAddedLocal.d.ts.map +1 -0
- package/dist/reactionRepository/events/onReactorRemovedLocal.d.ts +19 -0
- package/dist/reactionRepository/events/onReactorRemovedLocal.d.ts.map +1 -0
- package/dist/reactionRepository/observers/getReactions/ReactionLiveCollectionController.d.ts +13 -0
- package/dist/reactionRepository/observers/getReactions/ReactionLiveCollectionController.d.ts.map +1 -0
- package/dist/reactionRepository/observers/getReactions/ReactionPaginationController.d.ts +5 -0
- package/dist/reactionRepository/observers/getReactions/ReactionPaginationController.d.ts.map +1 -0
- package/dist/reactionRepository/observers/getReactions/ReactionQueryStreamController.d.ts +14 -0
- package/dist/reactionRepository/observers/getReactions/ReactionQueryStreamController.d.ts.map +1 -0
- package/dist/reactionRepository/observers/{getReactions.d.ts → getReactions/getReactions.d.ts} +1 -1
- package/dist/reactionRepository/observers/getReactions/getReactions.d.ts.map +1 -0
- package/dist/reactionRepository/observers/getReactions/index.d.ts +2 -0
- package/dist/reactionRepository/observers/getReactions/index.d.ts.map +1 -0
- package/dist/reactionRepository/observers/index.d.ts +1 -1
- package/dist/reactionRepository/observers/index.d.ts.map +1 -1
- package/dist/storyRepository/observers/getGlobalStoryTargets/GlobalStoryLiveCollectionController.d.ts.map +1 -1
- package/dist/storyRepository/observers/getGlobalStoryTargets/GlobalStoryQueryStreamController.d.ts +1 -1
- package/dist/storyRepository/observers/getGlobalStoryTargets/GlobalStoryQueryStreamController.d.ts.map +1 -1
- package/dist/userRepository/observers/getBlockedUsers/BlockedUserLiveCollectionController.d.ts.map +1 -1
- package/dist/userRepository/observers/getBlockedUsers/BlockedUserQueryStreamController.d.ts +3 -2
- package/dist/userRepository/observers/getBlockedUsers/BlockedUserQueryStreamController.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/core/events.ts +18 -6
- package/src/@types/core/payload.ts +4 -0
- package/src/@types/domains/pin.ts +1 -1
- package/src/@types/domains/pinnedPost.ts +2 -0
- package/src/@types/domains/reaction.ts +9 -3
- package/src/@types/domains/user.ts +2 -0
- package/src/communityRepository/communityMembership/events/utils.ts +4 -2
- package/src/communityRepository/utils/communityWithMembership.ts +15 -8
- package/src/feedRepository/api/queryGlobalFeed.ts +4 -1
- package/src/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostLiveCollectionController.ts +96 -0
- package/src/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostPaginationController.ts +19 -0
- package/src/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostQueryStreamController.ts +88 -0
- package/src/postRepository/observers/getGlobalPinnedPosts.ts +42 -0
- package/src/postRepository/observers/index.ts +1 -0
- package/src/reactionRepository/api/addReaction.ts +23 -1
- package/src/reactionRepository/api/removeReaction.ts +25 -2
- package/src/reactionRepository/events/onReactorAddedLocal.ts +95 -0
- package/src/reactionRepository/events/onReactorRemovedLocal.ts +94 -0
- package/src/reactionRepository/observers/getReactions/ReactionLiveCollectionController.ts +111 -0
- package/src/reactionRepository/observers/getReactions/ReactionPaginationController.ts +30 -0
- package/src/reactionRepository/observers/getReactions/ReactionQueryStreamController.ts +92 -0
- package/src/reactionRepository/observers/getReactions/getReactions.ts +57 -0
- package/src/reactionRepository/observers/getReactions/index.ts +1 -0
- package/src/reactionRepository/observers/index.ts +1 -1
- package/src/storyRepository/events/onStoryReactionAdded.ts +3 -3
- package/src/storyRepository/events/onStoryReactionRemoved.ts +3 -3
- package/src/storyRepository/observers/getGlobalStoryTargets/GlobalStoryLiveCollectionController.ts +5 -0
- package/src/storyRepository/observers/getGlobalStoryTargets/GlobalStoryQueryStreamController.ts +5 -2
- package/src/userRepository/observers/getBlockedUsers/BlockedUserLiveCollectionController.ts +12 -1
- package/src/userRepository/observers/getBlockedUsers/BlockedUserQueryStreamController.ts +13 -5
- package/src/userRepository/relationship/follow/observers/getFollowers/FollowerLiveCollectionController.ts +1 -1
- package/src/userRepository/relationship/follow/observers/getFollowings/FollowingLiveCollectionController.ts +1 -1
- package/dist/reactionRepository/observers/getReactions.d.ts.map +0 -1
- package/src/reactionRepository/observers/getReactions.ts +0 -146
package/dist/index.esm.js
CHANGED
|
@@ -89,8 +89,8 @@ const PostContentType = Object.freeze({
|
|
|
89
89
|
|
|
90
90
|
function getVersion() {
|
|
91
91
|
try {
|
|
92
|
-
// the string ''v6.
|
|
93
|
-
return 'v6.
|
|
92
|
+
// the string ''v6.33.0-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
93
|
+
return 'v6.33.0-esm';
|
|
94
94
|
}
|
|
95
95
|
catch (error) {
|
|
96
96
|
return '__dev__';
|
|
@@ -26321,6 +26321,18 @@ class QueryStreamController {
|
|
|
26321
26321
|
}
|
|
26322
26322
|
}
|
|
26323
26323
|
|
|
26324
|
+
var EnumFollowActions;
|
|
26325
|
+
(function (EnumFollowActions) {
|
|
26326
|
+
EnumFollowActions["OnRequested"] = "onRequested";
|
|
26327
|
+
EnumFollowActions["OnAccepted"] = "onAccepted";
|
|
26328
|
+
EnumFollowActions["OnDeclined"] = "onDeclined";
|
|
26329
|
+
EnumFollowActions["OnCanceled"] = "onCanceled";
|
|
26330
|
+
EnumFollowActions["OnFollowed"] = "onFollowed";
|
|
26331
|
+
EnumFollowActions["OnUnfollowed"] = "onUnfollowed";
|
|
26332
|
+
EnumFollowActions["OnDeleted"] = "onDeleted";
|
|
26333
|
+
EnumFollowActions["OnUserDeleted"] = "onUserDeleted";
|
|
26334
|
+
})(EnumFollowActions || (EnumFollowActions = {}));
|
|
26335
|
+
|
|
26324
26336
|
class BlockedUserQueryStreamController extends QueryStreamController {
|
|
26325
26337
|
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
26326
26338
|
super(query, cacheKey);
|
|
@@ -26349,10 +26361,13 @@ class BlockedUserQueryStreamController extends QueryStreamController {
|
|
|
26349
26361
|
}
|
|
26350
26362
|
}
|
|
26351
26363
|
reactor(action) {
|
|
26352
|
-
return (
|
|
26364
|
+
return (targetUser) => {
|
|
26353
26365
|
var _a;
|
|
26354
|
-
|
|
26355
|
-
|
|
26366
|
+
if (action === EnumFollowActions.OnFollowed) {
|
|
26367
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
26368
|
+
const updatedCollection = collection === null || collection === void 0 ? void 0 : collection.data.filter(id => id !== targetUser.userId);
|
|
26369
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: updatedCollection }));
|
|
26370
|
+
}
|
|
26356
26371
|
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
26357
26372
|
};
|
|
26358
26373
|
}
|
|
@@ -26549,6 +26564,292 @@ var EnumUserActions;
|
|
|
26549
26564
|
EnumUserActions["OnUserFlagCleared"] = "onUserFlagCleared";
|
|
26550
26565
|
})(EnumUserActions || (EnumUserActions = {}));
|
|
26551
26566
|
|
|
26567
|
+
const createFollowEventSubscriber = (event, callback) => {
|
|
26568
|
+
const client = getActiveClient();
|
|
26569
|
+
const filter = (data) => {
|
|
26570
|
+
const payload = prepareFollowersPayload(data);
|
|
26571
|
+
if (!client.cache) {
|
|
26572
|
+
callback(payload.follows[0]);
|
|
26573
|
+
}
|
|
26574
|
+
else {
|
|
26575
|
+
ingestInCache(payload);
|
|
26576
|
+
callback(payload.follows[0]);
|
|
26577
|
+
}
|
|
26578
|
+
};
|
|
26579
|
+
return createEventSubscriber(client, event, event, filter);
|
|
26580
|
+
};
|
|
26581
|
+
const createLocalFollowEventSubscriber = (event, callback) => {
|
|
26582
|
+
const client = getActiveClient();
|
|
26583
|
+
const filter = (data) => {
|
|
26584
|
+
const payload = prepareFollowStatusPayload(data);
|
|
26585
|
+
if (!client.cache) {
|
|
26586
|
+
callback(payload.follows[0]);
|
|
26587
|
+
}
|
|
26588
|
+
else {
|
|
26589
|
+
ingestInCache(payload);
|
|
26590
|
+
callback(payload.follows[0]);
|
|
26591
|
+
}
|
|
26592
|
+
};
|
|
26593
|
+
return createEventSubscriber(client, event, event, filter);
|
|
26594
|
+
};
|
|
26595
|
+
|
|
26596
|
+
/**
|
|
26597
|
+
* ```js
|
|
26598
|
+
* import { onUserFollowed } from '@amityco/ts-sdk-react-native'
|
|
26599
|
+
* const dispose = onUserFollowed(status => {
|
|
26600
|
+
* // ...
|
|
26601
|
+
* })
|
|
26602
|
+
* ```
|
|
26603
|
+
*
|
|
26604
|
+
* Fired when a user follows another users and confirmation is not required
|
|
26605
|
+
*
|
|
26606
|
+
* @param callback The function to call when the event was fired
|
|
26607
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
26608
|
+
*
|
|
26609
|
+
* @category Follow Events
|
|
26610
|
+
*/
|
|
26611
|
+
const onUserFollowed = (callback) => createFollowEventSubscriber('follow.created', callback);
|
|
26612
|
+
|
|
26613
|
+
/**
|
|
26614
|
+
* ```js
|
|
26615
|
+
* import { onUserUnfollowed } from '@amityco/ts-sdk-react-native'
|
|
26616
|
+
* const dispose = onUserFollowed(status => {
|
|
26617
|
+
* // ...
|
|
26618
|
+
* })
|
|
26619
|
+
* ```
|
|
26620
|
+
*
|
|
26621
|
+
* Fired when a user unfollows
|
|
26622
|
+
*
|
|
26623
|
+
* @param callback The function to call when the event was fired
|
|
26624
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
26625
|
+
*
|
|
26626
|
+
* @category Follow Events
|
|
26627
|
+
*/
|
|
26628
|
+
const onUserUnfollowed = (callback) => createFollowEventSubscriber('follow.unfollowed', callback);
|
|
26629
|
+
|
|
26630
|
+
/**
|
|
26631
|
+
* ```js
|
|
26632
|
+
* import { onFollowerDeleted } from '@amityco/ts-sdk-react-native'
|
|
26633
|
+
* const dispose = onFollowerDeleted(status => {
|
|
26634
|
+
* // ...
|
|
26635
|
+
* })
|
|
26636
|
+
* ```
|
|
26637
|
+
*
|
|
26638
|
+
* Fired when a follower has been deleted
|
|
26639
|
+
*
|
|
26640
|
+
* @param callback The function to call when the event was fired
|
|
26641
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
26642
|
+
*
|
|
26643
|
+
* @category Follow Events
|
|
26644
|
+
*/
|
|
26645
|
+
const onFollowerDeleted = (callback) => createFollowEventSubscriber('follow.followerDeleted', callback);
|
|
26646
|
+
|
|
26647
|
+
/**
|
|
26648
|
+
* ```js
|
|
26649
|
+
* import { onFollowerRequested } from '@amityco/ts-sdk-react-native'
|
|
26650
|
+
* const dispose = onFollowerRequested(status => {
|
|
26651
|
+
* // ...
|
|
26652
|
+
* })
|
|
26653
|
+
* ```
|
|
26654
|
+
*
|
|
26655
|
+
* Fired when a user follows another users and confirmation is required
|
|
26656
|
+
*
|
|
26657
|
+
* @param callback The function to call when the event was fired
|
|
26658
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
26659
|
+
*
|
|
26660
|
+
* @category Follow Events
|
|
26661
|
+
*/
|
|
26662
|
+
const onFollowerRequested = (callback) => createFollowEventSubscriber('follow.requested', callback);
|
|
26663
|
+
|
|
26664
|
+
/**
|
|
26665
|
+
* ```js
|
|
26666
|
+
* import { onFollowRequestCanceled } from '@amityco/ts-sdk-react-native'
|
|
26667
|
+
* const dispose = onFollowRequestCanceled(status => {
|
|
26668
|
+
* // ...
|
|
26669
|
+
* })
|
|
26670
|
+
* ```
|
|
26671
|
+
*
|
|
26672
|
+
* Fired when a follow request has been canceled
|
|
26673
|
+
*
|
|
26674
|
+
* @param callback The function to call when the event was fired
|
|
26675
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
26676
|
+
*
|
|
26677
|
+
* @category Follow Events
|
|
26678
|
+
*/
|
|
26679
|
+
const onFollowRequestCanceled = (callback) => createFollowEventSubscriber('follow.requestCanceled', callback);
|
|
26680
|
+
|
|
26681
|
+
/**
|
|
26682
|
+
* ```js
|
|
26683
|
+
* import { onFollowRequestAccepted } from '@amityco/ts-sdk-react-native'
|
|
26684
|
+
* const dispose = onFollowRequestAccepted(status => {
|
|
26685
|
+
* // ...
|
|
26686
|
+
* })
|
|
26687
|
+
* ```
|
|
26688
|
+
*
|
|
26689
|
+
* Fired when a follow request has been accepted
|
|
26690
|
+
*
|
|
26691
|
+
* @param callback The function to call when the event was fired
|
|
26692
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
26693
|
+
*
|
|
26694
|
+
* @category Follow Events
|
|
26695
|
+
*/
|
|
26696
|
+
const onFollowRequestAccepted = (callback) => createFollowEventSubscriber('follow.accepted', callback);
|
|
26697
|
+
|
|
26698
|
+
/**
|
|
26699
|
+
* ```js
|
|
26700
|
+
* import { onFollowRequestDeclined } from '@amityco/ts-sdk-react-native'
|
|
26701
|
+
* const dispose = onFollowRequestDeclined(status => {
|
|
26702
|
+
* // ...
|
|
26703
|
+
* })
|
|
26704
|
+
* ```
|
|
26705
|
+
*
|
|
26706
|
+
* Fired when a follow request has been declined
|
|
26707
|
+
*
|
|
26708
|
+
* @param callback The function to call when the event was fired
|
|
26709
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
26710
|
+
*
|
|
26711
|
+
* @category Follow Events
|
|
26712
|
+
*/
|
|
26713
|
+
const onFollowRequestDeclined = (callback) => createFollowEventSubscriber('follow.requestDeclined', callback);
|
|
26714
|
+
|
|
26715
|
+
/**
|
|
26716
|
+
* ```js
|
|
26717
|
+
* import { getFollowInfo } from '@amityco/ts-sdk-react-native'
|
|
26718
|
+
* const { data: followInfo } = await getFollowInfo('foobar')
|
|
26719
|
+
* ```
|
|
26720
|
+
*
|
|
26721
|
+
* Fetches the number of followers, followings, pending requests and the follow status for current user
|
|
26722
|
+
*
|
|
26723
|
+
* @param userId the ID of the {@link Amity.InternalUser}
|
|
26724
|
+
* @returns the associated {@link Amity.FollowInfo} object
|
|
26725
|
+
*
|
|
26726
|
+
* @category Follow API
|
|
26727
|
+
* @async
|
|
26728
|
+
*/
|
|
26729
|
+
const getFollowInfo$1 = async (userId) => {
|
|
26730
|
+
var _a, _b;
|
|
26731
|
+
const client = getActiveClient();
|
|
26732
|
+
client.log('follow/getFollowInfo', userId);
|
|
26733
|
+
const { data } = await client.http.get(client.userId === userId ? `/api/v4/me/followInfo` : `/api/v5/users/${userId}/followInfo`);
|
|
26734
|
+
const cachedAt = client.cache && Date.now();
|
|
26735
|
+
const followInfo = 'follows' in data
|
|
26736
|
+
? Object.assign(Object.assign({}, data.followCounts[0]), { status: (_b = (_a = data.follows) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.status }) : data.followCounts[0];
|
|
26737
|
+
if (client.cache) {
|
|
26738
|
+
pushToCache(['followInfo', 'get', userId], followInfo, {
|
|
26739
|
+
cachedAt,
|
|
26740
|
+
});
|
|
26741
|
+
}
|
|
26742
|
+
return {
|
|
26743
|
+
data: followInfo,
|
|
26744
|
+
cachedAt,
|
|
26745
|
+
};
|
|
26746
|
+
};
|
|
26747
|
+
/**
|
|
26748
|
+
* ```js
|
|
26749
|
+
* import { getFollowInfo } from '@amityco/ts-sdk-react-native'
|
|
26750
|
+
* const { data: followInfo } = getFollowInfo.locally('foobar')
|
|
26751
|
+
* ```
|
|
26752
|
+
*
|
|
26753
|
+
* Fetches the number of followers, followings, pending requests and the follow status for current user from cache
|
|
26754
|
+
*
|
|
26755
|
+
* @param userId the ID of the {@link Amity.InternalUser}
|
|
26756
|
+
* @returns the associated {@link Amity.FollowInfo} object
|
|
26757
|
+
*
|
|
26758
|
+
* @category Follow API
|
|
26759
|
+
*/
|
|
26760
|
+
getFollowInfo$1.locally = (userId) => {
|
|
26761
|
+
const client = getActiveClient();
|
|
26762
|
+
client.log('follow/getFollowInfo.locally', userId);
|
|
26763
|
+
if (!client.cache) {
|
|
26764
|
+
return;
|
|
26765
|
+
}
|
|
26766
|
+
const cached = pullFromCache(['followInfo', 'get', userId]);
|
|
26767
|
+
if (!cached) {
|
|
26768
|
+
return;
|
|
26769
|
+
}
|
|
26770
|
+
return {
|
|
26771
|
+
data: cached.data,
|
|
26772
|
+
cachedAt: cached.cachedAt,
|
|
26773
|
+
};
|
|
26774
|
+
};
|
|
26775
|
+
|
|
26776
|
+
/**
|
|
26777
|
+
* ```js
|
|
26778
|
+
* import { onFollowInfoUpdated } from '@amityco/ts-sdk-react-native'
|
|
26779
|
+
* const dispose = onFollowInfoUpdated(followInfo => {
|
|
26780
|
+
* // ...
|
|
26781
|
+
* })
|
|
26782
|
+
* ```
|
|
26783
|
+
*
|
|
26784
|
+
* Fired when a {@link Amity.FollowInfo} has been updated
|
|
26785
|
+
*
|
|
26786
|
+
* @param callback The function to call when the event was fired
|
|
26787
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
26788
|
+
*
|
|
26789
|
+
* @category Follow Events
|
|
26790
|
+
*/
|
|
26791
|
+
const onFollowInfoUpdated = (callback) => {
|
|
26792
|
+
const handler = async (payload) => {
|
|
26793
|
+
const [{ data: followInfoFrom }, { data: followInfoTo }] = await Promise.all([
|
|
26794
|
+
getFollowInfo$1(payload.from),
|
|
26795
|
+
getFollowInfo$1(payload.to),
|
|
26796
|
+
]);
|
|
26797
|
+
callback(followInfoFrom);
|
|
26798
|
+
callback(followInfoTo);
|
|
26799
|
+
};
|
|
26800
|
+
const disposers = [
|
|
26801
|
+
createFollowEventSubscriber('follow.created', handler),
|
|
26802
|
+
createFollowEventSubscriber('follow.requested', handler),
|
|
26803
|
+
createFollowEventSubscriber('follow.accepted', handler),
|
|
26804
|
+
createFollowEventSubscriber('follow.unfollowed', handler),
|
|
26805
|
+
createFollowEventSubscriber('follow.requestCanceled', handler),
|
|
26806
|
+
createFollowEventSubscriber('follow.requestDeclined', handler),
|
|
26807
|
+
createFollowEventSubscriber('follow.followerDeleted', handler),
|
|
26808
|
+
createLocalFollowEventSubscriber('local.follow.created', handler),
|
|
26809
|
+
createLocalFollowEventSubscriber('local.follow.requested', handler),
|
|
26810
|
+
createLocalFollowEventSubscriber('local.follow.accepted', handler),
|
|
26811
|
+
createLocalFollowEventSubscriber('local.follow.unfollowed', handler),
|
|
26812
|
+
createLocalFollowEventSubscriber('local.follow.requestDeclined', handler),
|
|
26813
|
+
];
|
|
26814
|
+
return () => {
|
|
26815
|
+
disposers.forEach(fn => fn());
|
|
26816
|
+
};
|
|
26817
|
+
};
|
|
26818
|
+
|
|
26819
|
+
const onLocalUserFollowed = (callback) => createLocalFollowEventSubscriber('local.follow.created', callback);
|
|
26820
|
+
|
|
26821
|
+
const onLocalUserUnfollowed = (callback) => createLocalFollowEventSubscriber('local.follow.unfollowed', callback);
|
|
26822
|
+
|
|
26823
|
+
const onLocalFollowerRequested = (callback) => createLocalFollowEventSubscriber('local.follow.requested', callback);
|
|
26824
|
+
|
|
26825
|
+
const onLocalFollowRequestAccepted = (callback) => createLocalFollowEventSubscriber('local.follow.accepted', callback);
|
|
26826
|
+
|
|
26827
|
+
const onLocalFollowRequestDeclined = (callback) => createLocalFollowEventSubscriber('local.follow.requestDeclined', callback);
|
|
26828
|
+
|
|
26829
|
+
const convertEventPayload = (eventHandler, sourceModelProp, destinationDomain) => (callback) => eventHandler(sourceModel => {
|
|
26830
|
+
var _a, _b;
|
|
26831
|
+
if (!sourceModel) {
|
|
26832
|
+
return sourceModel;
|
|
26833
|
+
}
|
|
26834
|
+
const client = getActiveClient();
|
|
26835
|
+
const { objectSyncMap } = client;
|
|
26836
|
+
/*
|
|
26837
|
+
* NOTE: For objects created locally (optimistic creation), the SDK stores them with their local ID as the cache key, which is used throughout the entire SDK session (in-memory) for syncing updates.
|
|
26838
|
+
* If the payload or response only contains the remote ID of the same object, the SDK will look up the corresponding local ID to retrieve the object.
|
|
26839
|
+
*/
|
|
26840
|
+
const resolvedId = isLocalId(sourceModel[sourceModelProp])
|
|
26841
|
+
? sourceModel[sourceModelProp]
|
|
26842
|
+
: (_a = objectSyncMap.get(sourceModel[sourceModelProp])) !== null && _a !== void 0 ? _a : sourceModel[sourceModelProp];
|
|
26843
|
+
const model = (_b = pullFromCache([
|
|
26844
|
+
destinationDomain,
|
|
26845
|
+
'get',
|
|
26846
|
+
`${resolvedId}`,
|
|
26847
|
+
])) === null || _b === void 0 ? void 0 : _b.data;
|
|
26848
|
+
if (!model)
|
|
26849
|
+
return;
|
|
26850
|
+
return callback(model);
|
|
26851
|
+
});
|
|
26852
|
+
|
|
26552
26853
|
class BlockedUserLiveCollectionController extends LiveCollectionController {
|
|
26553
26854
|
constructor(query, callback) {
|
|
26554
26855
|
const queryStreamId = hash(query);
|
|
@@ -26582,6 +26883,15 @@ class BlockedUserLiveCollectionController extends LiveCollectionController {
|
|
|
26582
26883
|
fn: onUserDeleted$2,
|
|
26583
26884
|
action: EnumUserActions.OnUserDeleted,
|
|
26584
26885
|
},
|
|
26886
|
+
// In the case of unblocking a user, we need to subscribe to the follow events
|
|
26887
|
+
{
|
|
26888
|
+
fn: convertEventPayload(onLocalUserFollowed, 'to', 'user'),
|
|
26889
|
+
action: EnumFollowActions.OnFollowed,
|
|
26890
|
+
},
|
|
26891
|
+
{
|
|
26892
|
+
fn: convertEventPayload(onUserFollowed, 'to', 'user'),
|
|
26893
|
+
action: EnumFollowActions.OnFollowed,
|
|
26894
|
+
},
|
|
26585
26895
|
]);
|
|
26586
26896
|
}
|
|
26587
26897
|
notifyChange({ origin, loading, error }) {
|
|
@@ -26842,268 +27152,6 @@ const declineMyFollower = async (userId) => {
|
|
|
26842
27152
|
};
|
|
26843
27153
|
/* end_public_function */
|
|
26844
27154
|
|
|
26845
|
-
const createFollowEventSubscriber = (event, callback) => {
|
|
26846
|
-
const client = getActiveClient();
|
|
26847
|
-
const filter = (data) => {
|
|
26848
|
-
const payload = prepareFollowersPayload(data);
|
|
26849
|
-
if (!client.cache) {
|
|
26850
|
-
callback(payload.follows[0]);
|
|
26851
|
-
}
|
|
26852
|
-
else {
|
|
26853
|
-
ingestInCache(payload);
|
|
26854
|
-
callback(payload.follows[0]);
|
|
26855
|
-
}
|
|
26856
|
-
};
|
|
26857
|
-
return createEventSubscriber(client, event, event, filter);
|
|
26858
|
-
};
|
|
26859
|
-
const createLocalFollowEventSubscriber = (event, callback) => {
|
|
26860
|
-
const client = getActiveClient();
|
|
26861
|
-
const filter = (data) => {
|
|
26862
|
-
const payload = prepareFollowStatusPayload(data);
|
|
26863
|
-
if (!client.cache) {
|
|
26864
|
-
callback(payload.follows[0]);
|
|
26865
|
-
}
|
|
26866
|
-
else {
|
|
26867
|
-
ingestInCache(payload);
|
|
26868
|
-
callback(payload.follows[0]);
|
|
26869
|
-
}
|
|
26870
|
-
};
|
|
26871
|
-
return createEventSubscriber(client, event, event, filter);
|
|
26872
|
-
};
|
|
26873
|
-
|
|
26874
|
-
/**
|
|
26875
|
-
* ```js
|
|
26876
|
-
* import { onUserFollowed } from '@amityco/ts-sdk-react-native'
|
|
26877
|
-
* const dispose = onUserFollowed(status => {
|
|
26878
|
-
* // ...
|
|
26879
|
-
* })
|
|
26880
|
-
* ```
|
|
26881
|
-
*
|
|
26882
|
-
* Fired when a user follows another users and confirmation is not required
|
|
26883
|
-
*
|
|
26884
|
-
* @param callback The function to call when the event was fired
|
|
26885
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
26886
|
-
*
|
|
26887
|
-
* @category Follow Events
|
|
26888
|
-
*/
|
|
26889
|
-
const onUserFollowed = (callback) => createFollowEventSubscriber('follow.created', callback);
|
|
26890
|
-
|
|
26891
|
-
/**
|
|
26892
|
-
* ```js
|
|
26893
|
-
* import { onUserUnfollowed } from '@amityco/ts-sdk-react-native'
|
|
26894
|
-
* const dispose = onUserFollowed(status => {
|
|
26895
|
-
* // ...
|
|
26896
|
-
* })
|
|
26897
|
-
* ```
|
|
26898
|
-
*
|
|
26899
|
-
* Fired when a user unfollows
|
|
26900
|
-
*
|
|
26901
|
-
* @param callback The function to call when the event was fired
|
|
26902
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
26903
|
-
*
|
|
26904
|
-
* @category Follow Events
|
|
26905
|
-
*/
|
|
26906
|
-
const onUserUnfollowed = (callback) => createFollowEventSubscriber('follow.unfollowed', callback);
|
|
26907
|
-
|
|
26908
|
-
/**
|
|
26909
|
-
* ```js
|
|
26910
|
-
* import { onFollowerDeleted } from '@amityco/ts-sdk-react-native'
|
|
26911
|
-
* const dispose = onFollowerDeleted(status => {
|
|
26912
|
-
* // ...
|
|
26913
|
-
* })
|
|
26914
|
-
* ```
|
|
26915
|
-
*
|
|
26916
|
-
* Fired when a follower has been deleted
|
|
26917
|
-
*
|
|
26918
|
-
* @param callback The function to call when the event was fired
|
|
26919
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
26920
|
-
*
|
|
26921
|
-
* @category Follow Events
|
|
26922
|
-
*/
|
|
26923
|
-
const onFollowerDeleted = (callback) => createFollowEventSubscriber('follow.followerDeleted', callback);
|
|
26924
|
-
|
|
26925
|
-
/**
|
|
26926
|
-
* ```js
|
|
26927
|
-
* import { onFollowerRequested } from '@amityco/ts-sdk-react-native'
|
|
26928
|
-
* const dispose = onFollowerRequested(status => {
|
|
26929
|
-
* // ...
|
|
26930
|
-
* })
|
|
26931
|
-
* ```
|
|
26932
|
-
*
|
|
26933
|
-
* Fired when a user follows another users and confirmation is required
|
|
26934
|
-
*
|
|
26935
|
-
* @param callback The function to call when the event was fired
|
|
26936
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
26937
|
-
*
|
|
26938
|
-
* @category Follow Events
|
|
26939
|
-
*/
|
|
26940
|
-
const onFollowerRequested = (callback) => createFollowEventSubscriber('follow.requested', callback);
|
|
26941
|
-
|
|
26942
|
-
/**
|
|
26943
|
-
* ```js
|
|
26944
|
-
* import { onFollowRequestCanceled } from '@amityco/ts-sdk-react-native'
|
|
26945
|
-
* const dispose = onFollowRequestCanceled(status => {
|
|
26946
|
-
* // ...
|
|
26947
|
-
* })
|
|
26948
|
-
* ```
|
|
26949
|
-
*
|
|
26950
|
-
* Fired when a follow request has been canceled
|
|
26951
|
-
*
|
|
26952
|
-
* @param callback The function to call when the event was fired
|
|
26953
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
26954
|
-
*
|
|
26955
|
-
* @category Follow Events
|
|
26956
|
-
*/
|
|
26957
|
-
const onFollowRequestCanceled = (callback) => createFollowEventSubscriber('follow.requestCanceled', callback);
|
|
26958
|
-
|
|
26959
|
-
/**
|
|
26960
|
-
* ```js
|
|
26961
|
-
* import { onFollowRequestAccepted } from '@amityco/ts-sdk-react-native'
|
|
26962
|
-
* const dispose = onFollowRequestAccepted(status => {
|
|
26963
|
-
* // ...
|
|
26964
|
-
* })
|
|
26965
|
-
* ```
|
|
26966
|
-
*
|
|
26967
|
-
* Fired when a follow request has been accepted
|
|
26968
|
-
*
|
|
26969
|
-
* @param callback The function to call when the event was fired
|
|
26970
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
26971
|
-
*
|
|
26972
|
-
* @category Follow Events
|
|
26973
|
-
*/
|
|
26974
|
-
const onFollowRequestAccepted = (callback) => createFollowEventSubscriber('follow.accepted', callback);
|
|
26975
|
-
|
|
26976
|
-
/**
|
|
26977
|
-
* ```js
|
|
26978
|
-
* import { onFollowRequestDeclined } from '@amityco/ts-sdk-react-native'
|
|
26979
|
-
* const dispose = onFollowRequestDeclined(status => {
|
|
26980
|
-
* // ...
|
|
26981
|
-
* })
|
|
26982
|
-
* ```
|
|
26983
|
-
*
|
|
26984
|
-
* Fired when a follow request has been declined
|
|
26985
|
-
*
|
|
26986
|
-
* @param callback The function to call when the event was fired
|
|
26987
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
26988
|
-
*
|
|
26989
|
-
* @category Follow Events
|
|
26990
|
-
*/
|
|
26991
|
-
const onFollowRequestDeclined = (callback) => createFollowEventSubscriber('follow.requestDeclined', callback);
|
|
26992
|
-
|
|
26993
|
-
/**
|
|
26994
|
-
* ```js
|
|
26995
|
-
* import { getFollowInfo } from '@amityco/ts-sdk-react-native'
|
|
26996
|
-
* const { data: followInfo } = await getFollowInfo('foobar')
|
|
26997
|
-
* ```
|
|
26998
|
-
*
|
|
26999
|
-
* Fetches the number of followers, followings, pending requests and the follow status for current user
|
|
27000
|
-
*
|
|
27001
|
-
* @param userId the ID of the {@link Amity.InternalUser}
|
|
27002
|
-
* @returns the associated {@link Amity.FollowInfo} object
|
|
27003
|
-
*
|
|
27004
|
-
* @category Follow API
|
|
27005
|
-
* @async
|
|
27006
|
-
*/
|
|
27007
|
-
const getFollowInfo$1 = async (userId) => {
|
|
27008
|
-
var _a, _b;
|
|
27009
|
-
const client = getActiveClient();
|
|
27010
|
-
client.log('follow/getFollowInfo', userId);
|
|
27011
|
-
const { data } = await client.http.get(client.userId === userId ? `/api/v4/me/followInfo` : `/api/v5/users/${userId}/followInfo`);
|
|
27012
|
-
const cachedAt = client.cache && Date.now();
|
|
27013
|
-
const followInfo = 'follows' in data
|
|
27014
|
-
? Object.assign(Object.assign({}, data.followCounts[0]), { status: (_b = (_a = data.follows) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.status }) : data.followCounts[0];
|
|
27015
|
-
if (client.cache) {
|
|
27016
|
-
pushToCache(['followInfo', 'get', userId], followInfo, {
|
|
27017
|
-
cachedAt,
|
|
27018
|
-
});
|
|
27019
|
-
}
|
|
27020
|
-
return {
|
|
27021
|
-
data: followInfo,
|
|
27022
|
-
cachedAt,
|
|
27023
|
-
};
|
|
27024
|
-
};
|
|
27025
|
-
/**
|
|
27026
|
-
* ```js
|
|
27027
|
-
* import { getFollowInfo } from '@amityco/ts-sdk-react-native'
|
|
27028
|
-
* const { data: followInfo } = getFollowInfo.locally('foobar')
|
|
27029
|
-
* ```
|
|
27030
|
-
*
|
|
27031
|
-
* Fetches the number of followers, followings, pending requests and the follow status for current user from cache
|
|
27032
|
-
*
|
|
27033
|
-
* @param userId the ID of the {@link Amity.InternalUser}
|
|
27034
|
-
* @returns the associated {@link Amity.FollowInfo} object
|
|
27035
|
-
*
|
|
27036
|
-
* @category Follow API
|
|
27037
|
-
*/
|
|
27038
|
-
getFollowInfo$1.locally = (userId) => {
|
|
27039
|
-
const client = getActiveClient();
|
|
27040
|
-
client.log('follow/getFollowInfo.locally', userId);
|
|
27041
|
-
if (!client.cache) {
|
|
27042
|
-
return;
|
|
27043
|
-
}
|
|
27044
|
-
const cached = pullFromCache(['followInfo', 'get', userId]);
|
|
27045
|
-
if (!cached) {
|
|
27046
|
-
return;
|
|
27047
|
-
}
|
|
27048
|
-
return {
|
|
27049
|
-
data: cached.data,
|
|
27050
|
-
cachedAt: cached.cachedAt,
|
|
27051
|
-
};
|
|
27052
|
-
};
|
|
27053
|
-
|
|
27054
|
-
/**
|
|
27055
|
-
* ```js
|
|
27056
|
-
* import { onFollowInfoUpdated } from '@amityco/ts-sdk-react-native'
|
|
27057
|
-
* const dispose = onFollowInfoUpdated(followInfo => {
|
|
27058
|
-
* // ...
|
|
27059
|
-
* })
|
|
27060
|
-
* ```
|
|
27061
|
-
*
|
|
27062
|
-
* Fired when a {@link Amity.FollowInfo} has been updated
|
|
27063
|
-
*
|
|
27064
|
-
* @param callback The function to call when the event was fired
|
|
27065
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
27066
|
-
*
|
|
27067
|
-
* @category Follow Events
|
|
27068
|
-
*/
|
|
27069
|
-
const onFollowInfoUpdated = (callback) => {
|
|
27070
|
-
const handler = async (payload) => {
|
|
27071
|
-
const [{ data: followInfoFrom }, { data: followInfoTo }] = await Promise.all([
|
|
27072
|
-
getFollowInfo$1(payload.from),
|
|
27073
|
-
getFollowInfo$1(payload.to),
|
|
27074
|
-
]);
|
|
27075
|
-
callback(followInfoFrom);
|
|
27076
|
-
callback(followInfoTo);
|
|
27077
|
-
};
|
|
27078
|
-
const disposers = [
|
|
27079
|
-
createFollowEventSubscriber('follow.created', handler),
|
|
27080
|
-
createFollowEventSubscriber('follow.requested', handler),
|
|
27081
|
-
createFollowEventSubscriber('follow.accepted', handler),
|
|
27082
|
-
createFollowEventSubscriber('follow.unfollowed', handler),
|
|
27083
|
-
createFollowEventSubscriber('follow.requestCanceled', handler),
|
|
27084
|
-
createFollowEventSubscriber('follow.requestDeclined', handler),
|
|
27085
|
-
createFollowEventSubscriber('follow.followerDeleted', handler),
|
|
27086
|
-
createLocalFollowEventSubscriber('local.follow.created', handler),
|
|
27087
|
-
createLocalFollowEventSubscriber('local.follow.requested', handler),
|
|
27088
|
-
createLocalFollowEventSubscriber('local.follow.accepted', handler),
|
|
27089
|
-
createLocalFollowEventSubscriber('local.follow.unfollowed', handler),
|
|
27090
|
-
createLocalFollowEventSubscriber('local.follow.requestDeclined', handler),
|
|
27091
|
-
];
|
|
27092
|
-
return () => {
|
|
27093
|
-
disposers.forEach(fn => fn());
|
|
27094
|
-
};
|
|
27095
|
-
};
|
|
27096
|
-
|
|
27097
|
-
const onLocalUserFollowed = (callback) => createLocalFollowEventSubscriber('local.follow.created', callback);
|
|
27098
|
-
|
|
27099
|
-
const onLocalUserUnfollowed = (callback) => createLocalFollowEventSubscriber('local.follow.unfollowed', callback);
|
|
27100
|
-
|
|
27101
|
-
const onLocalFollowerRequested = (callback) => createLocalFollowEventSubscriber('local.follow.requested', callback);
|
|
27102
|
-
|
|
27103
|
-
const onLocalFollowRequestAccepted = (callback) => createLocalFollowEventSubscriber('local.follow.accepted', callback);
|
|
27104
|
-
|
|
27105
|
-
const onLocalFollowRequestDeclined = (callback) => createLocalFollowEventSubscriber('local.follow.requestDeclined', callback);
|
|
27106
|
-
|
|
27107
27155
|
/**
|
|
27108
27156
|
* ```js
|
|
27109
27157
|
* import { observeFollowInfo } from '@amityco/ts-sdk-react-native'
|
|
@@ -27232,18 +27280,6 @@ class FollowerPaginationController extends PaginationController {
|
|
|
27232
27280
|
}
|
|
27233
27281
|
}
|
|
27234
27282
|
|
|
27235
|
-
var EnumFollowActions;
|
|
27236
|
-
(function (EnumFollowActions) {
|
|
27237
|
-
EnumFollowActions["OnRequested"] = "onRequested";
|
|
27238
|
-
EnumFollowActions["OnAccepted"] = "onAccepted";
|
|
27239
|
-
EnumFollowActions["OnDeclined"] = "onDeclined";
|
|
27240
|
-
EnumFollowActions["OnCanceled"] = "onCanceled";
|
|
27241
|
-
EnumFollowActions["OnFollowed"] = "onFollowed";
|
|
27242
|
-
EnumFollowActions["OnUnfollowed"] = "onUnfollowed";
|
|
27243
|
-
EnumFollowActions["OnDeleted"] = "onDeleted";
|
|
27244
|
-
EnumFollowActions["OnUserDeleted"] = "onUserDeleted";
|
|
27245
|
-
})(EnumFollowActions || (EnumFollowActions = {}));
|
|
27246
|
-
|
|
27247
27283
|
class FollowerQueryStreamController extends QueryStreamController {
|
|
27248
27284
|
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
27249
27285
|
super(query, cacheKey);
|
|
@@ -27321,7 +27357,7 @@ const onFollowerUserDeleted = ({ userId }) => (callback) => {
|
|
|
27321
27357
|
|
|
27322
27358
|
class FollowerLiveCollectionController extends LiveCollectionController {
|
|
27323
27359
|
constructor(query, callback) {
|
|
27324
|
-
const queryStreamId = hash(query);
|
|
27360
|
+
const queryStreamId = hash(Object.assign(Object.assign({}, query), { type: 'follower' }));
|
|
27325
27361
|
const cacheKey = ['follow', 'collection', queryStreamId];
|
|
27326
27362
|
const paginationController = new FollowerPaginationController(query);
|
|
27327
27363
|
super(paginationController, queryStreamId, cacheKey, callback);
|
|
@@ -27526,7 +27562,7 @@ const onFollowingUserDeleted = ({ userId }) => (callback) => {
|
|
|
27526
27562
|
|
|
27527
27563
|
class FollowingLiveCollectionController extends LiveCollectionController {
|
|
27528
27564
|
constructor(query, callback) {
|
|
27529
|
-
const queryStreamId = hash(query);
|
|
27565
|
+
const queryStreamId = hash(Object.assign(Object.assign({}, query), { type: 'following' }));
|
|
27530
27566
|
const cacheKey = ['follow', 'collection', queryStreamId];
|
|
27531
27567
|
const paginationController = new FollowingPaginationController(query);
|
|
27532
27568
|
super(paginationController, queryStreamId, cacheKey, callback);
|
|
@@ -29432,16 +29468,19 @@ function isCurrentUserPartOfCommunity(c, m) {
|
|
|
29432
29468
|
}
|
|
29433
29469
|
/*
|
|
29434
29470
|
* For mqtt events server will not send user specific data as it's broadcasted
|
|
29435
|
-
* to multiple users
|
|
29436
|
-
*
|
|
29471
|
+
* to multiple users and it also does not include communityUser
|
|
29472
|
+
*
|
|
29473
|
+
* Client SDK needs to check for the existing isJoined field in cache data before calculating.
|
|
29474
|
+
* Althought this can be calculated, it's not scalable.
|
|
29437
29475
|
*/
|
|
29438
29476
|
function updateMembershipStatus(communities, communityUsers) {
|
|
29439
29477
|
return communities.map(c => {
|
|
29440
|
-
|
|
29441
|
-
|
|
29442
|
-
return Object.assign(Object.assign({},
|
|
29478
|
+
const cachedCommunity = pullFromCache(['community', 'get', c.communityId]);
|
|
29479
|
+
if ((cachedCommunity === null || cachedCommunity === void 0 ? void 0 : cachedCommunity.data) && (cachedCommunity === null || cachedCommunity === void 0 ? void 0 : cachedCommunity.data.hasOwnProperty('isJoined'))) {
|
|
29480
|
+
return Object.assign(Object.assign({}, cachedCommunity.data), c);
|
|
29443
29481
|
}
|
|
29444
|
-
|
|
29482
|
+
const isJoined = communityUsers.some(m => isCurrentUserPartOfCommunity(c, m) && isMember(m.communityMembership));
|
|
29483
|
+
return Object.assign(Object.assign({}, c), { isJoined });
|
|
29445
29484
|
});
|
|
29446
29485
|
}
|
|
29447
29486
|
|
|
@@ -29542,7 +29581,7 @@ const addReaction = async (referenceType, referenceId, reactionName) => {
|
|
|
29542
29581
|
referenceType,
|
|
29543
29582
|
reactionName,
|
|
29544
29583
|
});
|
|
29545
|
-
await client.http.post('/api/v2/reactions', {
|
|
29584
|
+
const { data } = await client.http.post('/api/v2/reactions', {
|
|
29546
29585
|
referenceId,
|
|
29547
29586
|
referenceType,
|
|
29548
29587
|
reactionName,
|
|
@@ -29560,12 +29599,33 @@ const addReaction = async (referenceType, referenceId, reactionName) => {
|
|
|
29560
29599
|
if (referenceType === 'comment') {
|
|
29561
29600
|
fireEvent('local.comment.addReaction', {
|
|
29562
29601
|
comment: updatedModel,
|
|
29602
|
+
reactor: {
|
|
29603
|
+
userId: client.userId,
|
|
29604
|
+
reactionName,
|
|
29605
|
+
reactionId: data.addedId,
|
|
29606
|
+
},
|
|
29563
29607
|
});
|
|
29564
29608
|
return true;
|
|
29565
29609
|
}
|
|
29566
29610
|
if (referenceType === 'post') {
|
|
29567
29611
|
fireEvent('local.post.addReaction', {
|
|
29568
29612
|
post: updatedModel,
|
|
29613
|
+
reactor: {
|
|
29614
|
+
userId: client.userId,
|
|
29615
|
+
reactionName,
|
|
29616
|
+
reactionId: data.addedId,
|
|
29617
|
+
},
|
|
29618
|
+
});
|
|
29619
|
+
return true;
|
|
29620
|
+
}
|
|
29621
|
+
if (referenceType === 'story') {
|
|
29622
|
+
fireEvent('local.story.reactionAdded', {
|
|
29623
|
+
story: updatedModel,
|
|
29624
|
+
reactor: {
|
|
29625
|
+
userId: client.userId,
|
|
29626
|
+
reactionName,
|
|
29627
|
+
reactionId: data.addedId,
|
|
29628
|
+
},
|
|
29569
29629
|
});
|
|
29570
29630
|
return true;
|
|
29571
29631
|
}
|
|
@@ -29640,7 +29700,7 @@ const removeReaction = async (referenceType, referenceId, reactionName) => {
|
|
|
29640
29700
|
referenceType,
|
|
29641
29701
|
reactionName,
|
|
29642
29702
|
});
|
|
29643
|
-
await client.http.delete(`/api/v2/reactions`, {
|
|
29703
|
+
const { data } = await client.http.delete(`/api/v2/reactions`, {
|
|
29644
29704
|
data: {
|
|
29645
29705
|
referenceId,
|
|
29646
29706
|
referenceType,
|
|
@@ -29660,12 +29720,33 @@ const removeReaction = async (referenceType, referenceId, reactionName) => {
|
|
|
29660
29720
|
if (referenceType === 'comment') {
|
|
29661
29721
|
fireEvent('local.comment.removeReaction', {
|
|
29662
29722
|
comment: updatedModel,
|
|
29723
|
+
reactor: {
|
|
29724
|
+
reactionId: data.removedId,
|
|
29725
|
+
reactionName,
|
|
29726
|
+
userId: client.userId,
|
|
29727
|
+
},
|
|
29663
29728
|
});
|
|
29664
29729
|
return true;
|
|
29665
29730
|
}
|
|
29666
29731
|
if (referenceType === 'post') {
|
|
29667
29732
|
fireEvent('local.post.removeReaction', {
|
|
29668
29733
|
post: updatedModel,
|
|
29734
|
+
reactor: {
|
|
29735
|
+
reactionId: data.removedId,
|
|
29736
|
+
reactionName,
|
|
29737
|
+
userId: client.userId,
|
|
29738
|
+
},
|
|
29739
|
+
});
|
|
29740
|
+
return true;
|
|
29741
|
+
}
|
|
29742
|
+
if (referenceType === 'story') {
|
|
29743
|
+
fireEvent('local.story.reactionAdded', {
|
|
29744
|
+
story: updatedModel,
|
|
29745
|
+
reactor: {
|
|
29746
|
+
userId: client.userId,
|
|
29747
|
+
reactionName,
|
|
29748
|
+
reactionId: data.removedId,
|
|
29749
|
+
},
|
|
29669
29750
|
});
|
|
29670
29751
|
return true;
|
|
29671
29752
|
}
|
|
@@ -29689,7 +29770,7 @@ const removeReaction = async (referenceType, referenceId, reactionName) => {
|
|
|
29689
29770
|
* @category Reaction API
|
|
29690
29771
|
* */
|
|
29691
29772
|
removeReaction.optimistically = (referenceType, referenceId, reactionName) => {
|
|
29692
|
-
var _a, _b, _c, _d
|
|
29773
|
+
var _a, _b, _c, _d;
|
|
29693
29774
|
const client = getActiveClient();
|
|
29694
29775
|
client.log('reaction/removeReaction.optimistically', {
|
|
29695
29776
|
referenceId,
|
|
@@ -29710,7 +29791,7 @@ removeReaction.optimistically = (referenceType, referenceId, reactionName) => {
|
|
|
29710
29791
|
cachedAt: UNSYNCED_OBJECT_CACHED_AT_VALUE,
|
|
29711
29792
|
});
|
|
29712
29793
|
dispatchReactable(referenceType, reaction);
|
|
29713
|
-
return
|
|
29794
|
+
return !((_d = reaction === null || reaction === void 0 ? void 0 : reaction.myReactions) === null || _d === void 0 ? void 0 : _d.includes(reactionName));
|
|
29714
29795
|
};
|
|
29715
29796
|
|
|
29716
29797
|
const getMatchPostSetting = (value) => {
|
|
@@ -30532,73 +30613,262 @@ const onReactorRemoved = (referenceType, referenceId, callback) => {
|
|
|
30532
30613
|
|
|
30533
30614
|
const REFERENCE_API_V5 = 5;
|
|
30534
30615
|
|
|
30616
|
+
class ReactionPaginationController extends PaginationController {
|
|
30617
|
+
async getRequest(queryParams, token) {
|
|
30618
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
|
|
30619
|
+
const options = token ? { token } : { limit };
|
|
30620
|
+
const client = getActiveClient();
|
|
30621
|
+
client.log('reaction/queryReactions', queryParams);
|
|
30622
|
+
const path = '/api/v3/reactions';
|
|
30623
|
+
const { data: queryResponse } = await this.http.get(path, {
|
|
30624
|
+
params: Object.assign(Object.assign({}, params), { referenceVersion: REFERENCE_API_V5, // Need to put this param to make it can query reaction for message in sub-channel
|
|
30625
|
+
options }),
|
|
30626
|
+
});
|
|
30627
|
+
return queryResponse;
|
|
30628
|
+
}
|
|
30629
|
+
}
|
|
30630
|
+
|
|
30631
|
+
class ReactionQueryStreamController extends QueryStreamController {
|
|
30632
|
+
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
30633
|
+
super(query, cacheKey);
|
|
30634
|
+
this.notifyChange = notifyChange;
|
|
30635
|
+
this.preparePayload = preparePayload;
|
|
30636
|
+
}
|
|
30637
|
+
async saveToMainDB(response) {
|
|
30638
|
+
var _a;
|
|
30639
|
+
const processedPayload = await this.preparePayload(response);
|
|
30640
|
+
const client = getActiveClient();
|
|
30641
|
+
const cachedAt = client.cache && Date.now();
|
|
30642
|
+
if (client.cache) {
|
|
30643
|
+
const { reactions } = processedPayload, restPayload = __rest(processedPayload, ["reactions"]);
|
|
30644
|
+
ingestInCache(Object.assign(Object.assign({}, restPayload), { reactions, reactors: (_a = reactions[0]) === null || _a === void 0 ? void 0 : _a.reactors }), { cachedAt });
|
|
30645
|
+
}
|
|
30646
|
+
}
|
|
30647
|
+
appendToQueryStream(response, direction, refresh = false) {
|
|
30648
|
+
var _a, _b, _c, _d;
|
|
30649
|
+
const reactors = (_b = (_a = response.reactions[0]) === null || _a === void 0 ? void 0 : _a.reactors) !== null && _b !== void 0 ? _b : [];
|
|
30650
|
+
if (refresh) {
|
|
30651
|
+
pushToCache(this.cacheKey, {
|
|
30652
|
+
data: reactors.map(getResolver('reactor')),
|
|
30653
|
+
});
|
|
30654
|
+
}
|
|
30655
|
+
else {
|
|
30656
|
+
const collection = (_c = pullFromCache(this.cacheKey)) === null || _c === void 0 ? void 0 : _c.data;
|
|
30657
|
+
const reactions = (_d = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _d !== void 0 ? _d : [];
|
|
30658
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...reactions, ...reactors.map(getResolver('reactor'))])] }));
|
|
30659
|
+
}
|
|
30660
|
+
}
|
|
30661
|
+
reactor(action) {
|
|
30662
|
+
return (reaction) => {
|
|
30663
|
+
var _a;
|
|
30664
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30665
|
+
if (!collection)
|
|
30666
|
+
return;
|
|
30667
|
+
if (action === "onAdded" /* Amity.ReactionActionTypeEnum.OnAdded */) {
|
|
30668
|
+
collection.data = [...new Set([reaction.reactionId, ...collection.data])];
|
|
30669
|
+
}
|
|
30670
|
+
else if (action === "onRemoved" /* Amity.ReactionActionTypeEnum.OnRemoved */) {
|
|
30671
|
+
collection.data = collection.data.filter(p => p !== reaction.reactionId);
|
|
30672
|
+
}
|
|
30673
|
+
pushToCache(this.cacheKey, collection);
|
|
30674
|
+
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
30675
|
+
};
|
|
30676
|
+
}
|
|
30677
|
+
subscribeRTE(createSubscriber) {
|
|
30678
|
+
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
30679
|
+
}
|
|
30680
|
+
}
|
|
30681
|
+
|
|
30535
30682
|
/**
|
|
30536
30683
|
* ```js
|
|
30537
|
-
* import {
|
|
30538
|
-
* const
|
|
30539
|
-
*
|
|
30540
|
-
* referenceType: 'post',
|
|
30684
|
+
* import { onReactorRemovedLocal } from '@amityco/ts-sdk'
|
|
30685
|
+
* const dispose = onReactorRemoved('post', postId, reactor => {
|
|
30686
|
+
* // ...
|
|
30541
30687
|
* })
|
|
30542
30688
|
* ```
|
|
30543
30689
|
*
|
|
30544
|
-
*
|
|
30690
|
+
* Fired when an {@link Amity.InternalReactor} has been removed
|
|
30545
30691
|
*
|
|
30546
|
-
* @param
|
|
30547
|
-
* @
|
|
30692
|
+
* @param {@link Amity.ReactableType} referenceType
|
|
30693
|
+
* @param {string} referenceId
|
|
30694
|
+
* @param callback The function to call when the event was fired
|
|
30695
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
30548
30696
|
*
|
|
30549
|
-
* @
|
|
30550
|
-
* @async
|
|
30697
|
+
* @category Events
|
|
30551
30698
|
* */
|
|
30552
|
-
const
|
|
30699
|
+
const onReactorRemovedLocal = (referenceType, referenceId, callback) => {
|
|
30553
30700
|
const client = getActiveClient();
|
|
30554
|
-
|
|
30555
|
-
|
|
30556
|
-
|
|
30557
|
-
|
|
30558
|
-
|
|
30559
|
-
|
|
30560
|
-
|
|
30561
|
-
|
|
30562
|
-
|
|
30563
|
-
|
|
30564
|
-
|
|
30565
|
-
|
|
30566
|
-
|
|
30567
|
-
|
|
30568
|
-
|
|
30569
|
-
|
|
30701
|
+
const callbackWrapper = (referenceType_, referenceId_, reaction) => {
|
|
30702
|
+
if (referenceType_ === referenceType && referenceId_ === referenceId) {
|
|
30703
|
+
callback(reaction);
|
|
30704
|
+
}
|
|
30705
|
+
};
|
|
30706
|
+
if (referenceType === 'message') {
|
|
30707
|
+
const filter = async (rawPayload) => {
|
|
30708
|
+
const payload = await prepareMessagePayload(rawPayload);
|
|
30709
|
+
if (!payload.reactions[0])
|
|
30710
|
+
return;
|
|
30711
|
+
ingestInCache(payload);
|
|
30712
|
+
callbackWrapper('message', payload.messages[0].messageId, payload.reactions[0]);
|
|
30713
|
+
};
|
|
30714
|
+
return createEventSubscriber(client, 'reaction/onReactorRemoved', 'message.reactionRemoved', filter);
|
|
30715
|
+
}
|
|
30716
|
+
if (referenceType === 'post') {
|
|
30717
|
+
const filter = (payload) => {
|
|
30718
|
+
callbackWrapper('post', payload.post.postId, payload.reactor);
|
|
30719
|
+
};
|
|
30720
|
+
return createEventSubscriber(client, 'local.post.removeReaction', 'local.post.removeReaction', filter);
|
|
30721
|
+
}
|
|
30722
|
+
if (referenceType === 'story') {
|
|
30723
|
+
const filter = (payload) => {
|
|
30724
|
+
const { reactions } = payload, rest = __rest(payload, ["reactions"]);
|
|
30725
|
+
ingestInCache(rest);
|
|
30726
|
+
ingestInCache({ reactors: reactions });
|
|
30727
|
+
if (payload.stories.length === 0 || payload.reactions.length === 0)
|
|
30728
|
+
return;
|
|
30729
|
+
callbackWrapper('story', payload.stories[0].storyId, payload.reactions[0]);
|
|
30730
|
+
};
|
|
30731
|
+
return createEventSubscriber(client, 'story.reactionRemoved', 'story.reactionRemoved', filter);
|
|
30732
|
+
}
|
|
30733
|
+
const filter = (payload) => {
|
|
30734
|
+
callbackWrapper('comment', payload.comment.commentId, payload.reactor);
|
|
30735
|
+
};
|
|
30736
|
+
return createEventSubscriber(client, 'local.comment.removeReaction', 'local.comment.removeReaction', filter);
|
|
30570
30737
|
};
|
|
30571
30738
|
|
|
30572
30739
|
/**
|
|
30573
30740
|
* ```js
|
|
30574
|
-
* import {
|
|
30575
|
-
* const
|
|
30576
|
-
*
|
|
30577
|
-
* referenceType: 'post',
|
|
30741
|
+
* import { onReactorAddedLocal } from '@amityco/ts-sdk'
|
|
30742
|
+
* const dispose = onReactorAdded('post', postId, reactor => {
|
|
30743
|
+
* // ...
|
|
30578
30744
|
* })
|
|
30579
30745
|
* ```
|
|
30580
30746
|
*
|
|
30581
|
-
*
|
|
30747
|
+
* Fired when an {@link Amity.InternalReactor} has been added
|
|
30582
30748
|
*
|
|
30583
|
-
* @param
|
|
30584
|
-
* @
|
|
30749
|
+
* @param {@link Amity.ReactableType} referenceType
|
|
30750
|
+
* @param {string} referenceId
|
|
30751
|
+
* @param callback The function to call when the event was fired
|
|
30752
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
30585
30753
|
*
|
|
30586
|
-
* @
|
|
30587
|
-
* @async
|
|
30754
|
+
* @category Events
|
|
30588
30755
|
* */
|
|
30589
|
-
const
|
|
30756
|
+
const onReactorAddedLocal = (referenceType, referenceId, callback) => {
|
|
30590
30757
|
const client = getActiveClient();
|
|
30591
|
-
|
|
30592
|
-
|
|
30593
|
-
|
|
30758
|
+
const callbackWrapper = (referenceType_, referenceId_, reaction) => {
|
|
30759
|
+
if (referenceType_ === referenceType && referenceId_ === referenceId) {
|
|
30760
|
+
callback(reaction);
|
|
30761
|
+
}
|
|
30762
|
+
};
|
|
30763
|
+
if (referenceType === 'message') {
|
|
30764
|
+
const filter = async (rawPayload) => {
|
|
30765
|
+
const payload = await prepareMessagePayload(rawPayload);
|
|
30766
|
+
if (!payload.reactions[0])
|
|
30767
|
+
return;
|
|
30768
|
+
ingestInCache(payload);
|
|
30769
|
+
ingestInCache({ reactors: payload.reactions });
|
|
30770
|
+
callbackWrapper('message', payload.messages[0].messageId, payload.reactions[0]);
|
|
30771
|
+
};
|
|
30772
|
+
return createEventSubscriber(client, 'reaction/onReactorAdded', 'message.reactionAdded', filter);
|
|
30773
|
+
}
|
|
30774
|
+
if (referenceType === 'post') {
|
|
30775
|
+
const filter = (payload) => {
|
|
30776
|
+
callbackWrapper('post', payload.post.postId, payload.reactor);
|
|
30777
|
+
};
|
|
30778
|
+
return createEventSubscriber(client, 'local.post.addReaction', 'local.post.addReaction', filter);
|
|
30779
|
+
}
|
|
30780
|
+
if (referenceType === 'story') {
|
|
30781
|
+
const filter = (payload) => {
|
|
30782
|
+
const { reactions } = payload, rest = __rest(payload, ["reactions"]);
|
|
30783
|
+
ingestInCache(rest);
|
|
30784
|
+
ingestInCache({ reactors: reactions });
|
|
30785
|
+
if (payload.stories.length === 0 || payload.reactions.length === 0)
|
|
30786
|
+
return;
|
|
30787
|
+
callbackWrapper('story', payload.stories[0].storyId, payload.reactions[0]);
|
|
30788
|
+
};
|
|
30789
|
+
return createEventSubscriber(client, 'story.reactionAdded', 'story.reactionAdded', filter);
|
|
30790
|
+
}
|
|
30791
|
+
const filter = (payload) => {
|
|
30792
|
+
callbackWrapper('comment', payload.comment.commentId, payload.reactor);
|
|
30793
|
+
};
|
|
30794
|
+
return createEventSubscriber(client, 'local.comment.addReaction', 'local.comment.addReaction', filter);
|
|
30594
30795
|
};
|
|
30595
30796
|
|
|
30797
|
+
class ReactionLiveCollectionController extends LiveCollectionController {
|
|
30798
|
+
constructor(query, callback) {
|
|
30799
|
+
const queryStreamId = hash(query);
|
|
30800
|
+
const cacheKey = ['reaction', 'collection', queryStreamId];
|
|
30801
|
+
const paginationController = new ReactionPaginationController(query);
|
|
30802
|
+
super(paginationController, queryStreamId, cacheKey, callback);
|
|
30803
|
+
this.query = query;
|
|
30804
|
+
this.queryStreamController = new ReactionQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), payload => payload);
|
|
30805
|
+
this.callback = callback.bind(this);
|
|
30806
|
+
this.loadPage({ initial: true });
|
|
30807
|
+
}
|
|
30808
|
+
setup() {
|
|
30809
|
+
var _a;
|
|
30810
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30811
|
+
if (!collection) {
|
|
30812
|
+
pushToCache(this.cacheKey, {
|
|
30813
|
+
data: [],
|
|
30814
|
+
params: {},
|
|
30815
|
+
});
|
|
30816
|
+
}
|
|
30817
|
+
}
|
|
30818
|
+
async persistModel(queryPayload) {
|
|
30819
|
+
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
30820
|
+
}
|
|
30821
|
+
persistQueryStream({ response, direction, refresh, }) {
|
|
30822
|
+
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
30823
|
+
}
|
|
30824
|
+
startSubscription() {
|
|
30825
|
+
return this.queryStreamController.subscribeRTE([
|
|
30826
|
+
{
|
|
30827
|
+
fn: callback => onReactorAdded(this.query.referenceType, this.query.referenceId, callback),
|
|
30828
|
+
action: "onAdded" /* Amity.ReactionActionTypeEnum.OnAdded */,
|
|
30829
|
+
},
|
|
30830
|
+
{
|
|
30831
|
+
fn: callback => onReactorRemoved(this.query.referenceType, this.query.referenceId, callback),
|
|
30832
|
+
action: "onRemoved" /* Amity.ReactionActionTypeEnum.OnRemoved */,
|
|
30833
|
+
},
|
|
30834
|
+
{
|
|
30835
|
+
fn: callback => onReactorRemovedLocal(this.query.referenceType, this.query.referenceId, callback),
|
|
30836
|
+
action: "onRemoved" /* Amity.ReactionActionTypeEnum.OnRemoved */,
|
|
30837
|
+
},
|
|
30838
|
+
{
|
|
30839
|
+
fn: callback => onReactorAddedLocal(this.query.referenceType, this.query.referenceId, callback),
|
|
30840
|
+
action: "onRemoved" /* Amity.ReactionActionTypeEnum.OnRemoved */,
|
|
30841
|
+
},
|
|
30842
|
+
]);
|
|
30843
|
+
}
|
|
30844
|
+
notifyChange({ origin, loading, error }) {
|
|
30845
|
+
var _a, _b;
|
|
30846
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30847
|
+
if (!collection)
|
|
30848
|
+
return;
|
|
30849
|
+
const data = (_b = collection.data
|
|
30850
|
+
.map(reactorId => pullFromCache(['reactor', 'get', reactorId]))
|
|
30851
|
+
.filter(Boolean)
|
|
30852
|
+
.map(({ data }) => LinkedObject.reactor(data))) !== null && _b !== void 0 ? _b : [];
|
|
30853
|
+
if (!this.shouldNotify(data) && origin === 'event')
|
|
30854
|
+
return;
|
|
30855
|
+
this.callback({
|
|
30856
|
+
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
30857
|
+
data,
|
|
30858
|
+
hasNextPage: !!this.paginationController.getNextToken(),
|
|
30859
|
+
loading,
|
|
30860
|
+
error,
|
|
30861
|
+
});
|
|
30862
|
+
}
|
|
30863
|
+
}
|
|
30864
|
+
|
|
30865
|
+
/* eslint-disable no-use-before-define */
|
|
30596
30866
|
/* begin_public_function
|
|
30597
30867
|
id: reaction.query
|
|
30598
30868
|
*/
|
|
30599
30869
|
/**
|
|
30600
30870
|
* ```js
|
|
30601
|
-
* import { getReactions } from '@amityco/ts-sdk
|
|
30871
|
+
* import { getReactions } from '@amityco/ts-sdk'
|
|
30602
30872
|
*
|
|
30603
30873
|
* let reactions = []
|
|
30604
30874
|
* const unsub = liveReactions({
|
|
@@ -30622,69 +30892,15 @@ const getReactions = (params, callback, config) => {
|
|
|
30622
30892
|
console.log('For using Live Collection feature you need to enable Cache!');
|
|
30623
30893
|
}
|
|
30624
30894
|
const timestamp = Date.now();
|
|
30625
|
-
log(`
|
|
30626
|
-
const
|
|
30627
|
-
const
|
|
30628
|
-
const
|
|
30629
|
-
|
|
30630
|
-
|
|
30631
|
-
|
|
30632
|
-
'collection',
|
|
30633
|
-
{ referenceId: params.referenceId, referenceType: params.referenceType },
|
|
30634
|
-
];
|
|
30635
|
-
const responder = (data) => {
|
|
30636
|
-
var _a, _b;
|
|
30637
|
-
const reactions = (_a = data.data
|
|
30638
|
-
.map(reactorId => pullFromCache(['reactor', 'get', reactorId]))
|
|
30639
|
-
.filter(Boolean)
|
|
30640
|
-
.map(({ data }) => LinkedObject.reactor(data))) !== null && _a !== void 0 ? _a : [];
|
|
30641
|
-
callback({
|
|
30642
|
-
onNextPage: onFetch,
|
|
30643
|
-
data: reactions,
|
|
30644
|
-
hasNextPage: !!((_b = data.params) === null || _b === void 0 ? void 0 : _b.page),
|
|
30645
|
-
loading: data.loading,
|
|
30646
|
-
error: data.error,
|
|
30647
|
-
});
|
|
30648
|
-
};
|
|
30649
|
-
const realtimeRouter = (action) => (reaction) => {
|
|
30650
|
-
var _a;
|
|
30651
|
-
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30652
|
-
if (!collection)
|
|
30653
|
-
return;
|
|
30654
|
-
if (action === 'onAdded') {
|
|
30655
|
-
collection.data = [...new Set([reaction.reactionId, ...collection.data])];
|
|
30656
|
-
}
|
|
30657
|
-
else if (action === 'onRemoved') {
|
|
30658
|
-
collection.data = collection.data.filter(p => p !== reaction.reactionId);
|
|
30659
|
-
}
|
|
30660
|
-
pushToCache(cacheKey, collection);
|
|
30661
|
-
responder(collection);
|
|
30662
|
-
};
|
|
30663
|
-
const onFetch = (initial = false) => {
|
|
30664
|
-
var _a, _b, _c, _d;
|
|
30665
|
-
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30666
|
-
const reactions = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30667
|
-
if (!initial && reactions.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
30668
|
-
return;
|
|
30669
|
-
const query = createQuery(queryReactor, Object.assign(Object.assign({}, queryParams), { page: (_d = (!initial ? collection === null || collection === void 0 ? void 0 : collection.params.page : undefined)) !== null && _d !== void 0 ? _d : { limit } }));
|
|
30670
|
-
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
30671
|
-
const data = {
|
|
30672
|
-
loading,
|
|
30673
|
-
error,
|
|
30674
|
-
params: { page },
|
|
30675
|
-
data: reactions,
|
|
30676
|
-
};
|
|
30677
|
-
if (result) {
|
|
30678
|
-
data.data = [...new Set([...reactions, ...result.map(getResolver('reactor'))])];
|
|
30679
|
-
}
|
|
30680
|
-
pushToCache(cacheKey, data);
|
|
30681
|
-
responder(data);
|
|
30682
|
-
}, queryOptions(policy));
|
|
30683
|
-
};
|
|
30684
|
-
disposers.push(onReactorAdded(queryParams.referenceType, queryParams.referenceId, realtimeRouter('onAdded')), onReactorRemoved(queryParams.referenceType, queryParams.referenceId, realtimeRouter('onRemoved')));
|
|
30685
|
-
onFetch(true);
|
|
30895
|
+
log(`getReactions(tmpid: ${timestamp}) > listen`);
|
|
30896
|
+
const reactionLiveCollection = new ReactionLiveCollectionController(params, callback);
|
|
30897
|
+
const disposers = reactionLiveCollection.startSubscription();
|
|
30898
|
+
const cacheKey = reactionLiveCollection.getCacheKey();
|
|
30899
|
+
disposers.push(() => {
|
|
30900
|
+
dropFromCache(cacheKey);
|
|
30901
|
+
});
|
|
30686
30902
|
return () => {
|
|
30687
|
-
log(`
|
|
30903
|
+
log(`getReactions(tmpid: ${timestamp}) > dispose`);
|
|
30688
30904
|
disposers.forEach(fn => fn());
|
|
30689
30905
|
};
|
|
30690
30906
|
};
|
|
@@ -31190,30 +31406,6 @@ const unmuteChannel = async (channelId) => {
|
|
|
31190
31406
|
};
|
|
31191
31407
|
/* end_public_function */
|
|
31192
31408
|
|
|
31193
|
-
const convertEventPayload = (eventHandler, sourceModelProp, destinationDomain) => (callback) => eventHandler(sourceModel => {
|
|
31194
|
-
var _a, _b;
|
|
31195
|
-
if (!sourceModel) {
|
|
31196
|
-
return sourceModel;
|
|
31197
|
-
}
|
|
31198
|
-
const client = getActiveClient();
|
|
31199
|
-
const { objectSyncMap } = client;
|
|
31200
|
-
/*
|
|
31201
|
-
* NOTE: For objects created locally (optimistic creation), the SDK stores them with their local ID as the cache key, which is used throughout the entire SDK session (in-memory) for syncing updates.
|
|
31202
|
-
* If the payload or response only contains the remote ID of the same object, the SDK will look up the corresponding local ID to retrieve the object.
|
|
31203
|
-
*/
|
|
31204
|
-
const resolvedId = isLocalId(sourceModel[sourceModelProp])
|
|
31205
|
-
? sourceModel[sourceModelProp]
|
|
31206
|
-
: (_a = objectSyncMap.get(sourceModel[sourceModelProp])) !== null && _a !== void 0 ? _a : sourceModel[sourceModelProp];
|
|
31207
|
-
const model = (_b = pullFromCache([
|
|
31208
|
-
destinationDomain,
|
|
31209
|
-
'get',
|
|
31210
|
-
`${resolvedId}`,
|
|
31211
|
-
])) === null || _b === void 0 ? void 0 : _b.data;
|
|
31212
|
-
if (!model)
|
|
31213
|
-
return;
|
|
31214
|
-
return callback(model);
|
|
31215
|
-
});
|
|
31216
|
-
|
|
31217
31409
|
/**
|
|
31218
31410
|
* ```js
|
|
31219
31411
|
* import { observeChannel } from '@amityco/ts-sdk-react-native'
|
|
@@ -35363,7 +35555,8 @@ const createCommunityMemberEventSubscriber = (event, callback) => {
|
|
|
35363
35555
|
callback(preparedPayload.communities[0], getEventRelatedMember(event, preparedPayload));
|
|
35364
35556
|
}
|
|
35365
35557
|
else {
|
|
35366
|
-
|
|
35558
|
+
// NOTE: The event payload should be merge with existing cache data
|
|
35559
|
+
ingestInCache(preparedPayload, undefined, false);
|
|
35367
35560
|
const community = pullFromCache([
|
|
35368
35561
|
'community',
|
|
35369
35562
|
'get',
|
|
@@ -35400,7 +35593,8 @@ const createLocalCommunityMemberEventSubscriber = (event, callback) => {
|
|
|
35400
35593
|
callback(preparedPayload.communities[0], getEventRelatedMember(event, preparedPayload));
|
|
35401
35594
|
}
|
|
35402
35595
|
else {
|
|
35403
|
-
|
|
35596
|
+
// NOTE: The event payload should be merge with existing cache data
|
|
35597
|
+
ingestInCache(preparedPayload, undefined, false);
|
|
35404
35598
|
const community = pullFromCache([
|
|
35405
35599
|
'community',
|
|
35406
35600
|
'get',
|
|
@@ -37490,9 +37684,10 @@ const queryGlobalFeed = async (query) => {
|
|
|
37490
37684
|
const { paging } = queryPayload, payload = __rest(queryPayload, ["paging"]);
|
|
37491
37685
|
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
37492
37686
|
const { posts } = data;
|
|
37687
|
+
const { communities: processedCommunity } = prepareCommunityPayload(data);
|
|
37493
37688
|
const cachedAt = client.cache && Date.now();
|
|
37494
37689
|
if (client.cache) {
|
|
37495
|
-
ingestInCache(data);
|
|
37690
|
+
ingestInCache(Object.assign(Object.assign({}, data), { communitis: processedCommunity }));
|
|
37496
37691
|
const cacheKey = [
|
|
37497
37692
|
'globalFeed',
|
|
37498
37693
|
'query',
|
|
@@ -39807,6 +40002,145 @@ const getPinnedPosts = (params, callback, config) => {
|
|
|
39807
40002
|
};
|
|
39808
40003
|
};
|
|
39809
40004
|
|
|
40005
|
+
class GlobalPinnedPostPaginationController extends PaginationController {
|
|
40006
|
+
async getRequest(queryParams, token) {
|
|
40007
|
+
__rest(queryParams, ["limit"]);
|
|
40008
|
+
const path = '/api/v1/pinned-posts/global';
|
|
40009
|
+
const { data: queryResponse } = await this.http.get(path);
|
|
40010
|
+
return queryResponse;
|
|
40011
|
+
}
|
|
40012
|
+
}
|
|
40013
|
+
|
|
40014
|
+
class GlobalPinnedPostQueryStreamController extends QueryStreamController {
|
|
40015
|
+
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
40016
|
+
super(query, cacheKey);
|
|
40017
|
+
this.notifyChange = notifyChange;
|
|
40018
|
+
this.preparePayload = preparePayload;
|
|
40019
|
+
}
|
|
40020
|
+
// eslint-disable-next-line class-methods-use-this
|
|
40021
|
+
async saveToMainDB(response) {
|
|
40022
|
+
const client = getActiveClient();
|
|
40023
|
+
const cachedAt = client.cache && Date.now();
|
|
40024
|
+
if (client.cache) {
|
|
40025
|
+
ingestInCache(response, { cachedAt });
|
|
40026
|
+
}
|
|
40027
|
+
}
|
|
40028
|
+
appendToQueryStream(response, direction, refresh = false) {
|
|
40029
|
+
var _a, _b;
|
|
40030
|
+
if (refresh) {
|
|
40031
|
+
pushToCache(this.cacheKey, {
|
|
40032
|
+
data: response.pins.map(getResolver('pin')),
|
|
40033
|
+
});
|
|
40034
|
+
}
|
|
40035
|
+
else {
|
|
40036
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
40037
|
+
const pinnedPosts = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
40038
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...pinnedPosts, ...response.pins.map(getResolver('pin'))])] }));
|
|
40039
|
+
this.notifyChange({
|
|
40040
|
+
origin: "server" /* Amity.LiveDataOrigin.SERVER */,
|
|
40041
|
+
loading: false,
|
|
40042
|
+
});
|
|
40043
|
+
}
|
|
40044
|
+
}
|
|
40045
|
+
reactor(action) {
|
|
40046
|
+
return (post) => {
|
|
40047
|
+
var _a;
|
|
40048
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
40049
|
+
if (!collection)
|
|
40050
|
+
return;
|
|
40051
|
+
if (action === EnumPostActions.OnPostDeleted) {
|
|
40052
|
+
collection.data = collection.data.filter(referenceId => referenceId !== `global#${post.postId}`);
|
|
40053
|
+
}
|
|
40054
|
+
pushToCache(this.cacheKey, collection);
|
|
40055
|
+
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
40056
|
+
};
|
|
40057
|
+
}
|
|
40058
|
+
subscribeRTE(createSubscriber) {
|
|
40059
|
+
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
40060
|
+
}
|
|
40061
|
+
}
|
|
40062
|
+
|
|
40063
|
+
class GlobalPinnedPostLiveCollectionController extends LiveCollectionController {
|
|
40064
|
+
constructor(query, callback) {
|
|
40065
|
+
const queryStreamId = hash(query);
|
|
40066
|
+
const cacheKey = ['pinnedPosts', 'collection', queryStreamId];
|
|
40067
|
+
const paginationController = new GlobalPinnedPostPaginationController(query);
|
|
40068
|
+
super(paginationController, queryStreamId, cacheKey, callback);
|
|
40069
|
+
this.query = query;
|
|
40070
|
+
this.queryStreamController = new GlobalPinnedPostQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), response => response);
|
|
40071
|
+
this.callback = callback.bind(this);
|
|
40072
|
+
this.loadPage({ initial: true });
|
|
40073
|
+
}
|
|
40074
|
+
setup() {
|
|
40075
|
+
var _a;
|
|
40076
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
40077
|
+
if (!collection) {
|
|
40078
|
+
pushToCache(this.cacheKey, {
|
|
40079
|
+
data: [],
|
|
40080
|
+
params: {},
|
|
40081
|
+
});
|
|
40082
|
+
}
|
|
40083
|
+
}
|
|
40084
|
+
async persistModel(queryPayload) {
|
|
40085
|
+
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
40086
|
+
}
|
|
40087
|
+
persistQueryStream({ response, direction, refresh, }) {
|
|
40088
|
+
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
40089
|
+
}
|
|
40090
|
+
// eslint-disable-next-line class-methods-use-this
|
|
40091
|
+
startSubscription() {
|
|
40092
|
+
return this.queryStreamController.subscribeRTE([
|
|
40093
|
+
{ fn: onLocalPostDeleted, action: EnumPostActions.OnPostDeleted },
|
|
40094
|
+
{
|
|
40095
|
+
fn: onPostDeleted,
|
|
40096
|
+
action: EnumPostActions.OnPostDeleted,
|
|
40097
|
+
},
|
|
40098
|
+
]);
|
|
40099
|
+
}
|
|
40100
|
+
notifyChange({ origin, loading, error }) {
|
|
40101
|
+
var _a, _b;
|
|
40102
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
40103
|
+
if (!collection)
|
|
40104
|
+
return;
|
|
40105
|
+
const data = ((_b = collection.data
|
|
40106
|
+
.map(id => pullFromCache(['pin', 'get', id]))
|
|
40107
|
+
.filter(isNonNullable)
|
|
40108
|
+
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.pinnedPost);
|
|
40109
|
+
if (!this.shouldNotify(data) && origin === 'event')
|
|
40110
|
+
return;
|
|
40111
|
+
this.callback({
|
|
40112
|
+
data,
|
|
40113
|
+
loading,
|
|
40114
|
+
error,
|
|
40115
|
+
});
|
|
40116
|
+
}
|
|
40117
|
+
}
|
|
40118
|
+
|
|
40119
|
+
/**
|
|
40120
|
+
* Get global pinned posts
|
|
40121
|
+
*
|
|
40122
|
+
* @returns the global pinned post(s)
|
|
40123
|
+
*
|
|
40124
|
+
* @category Pined Posts Live Collection
|
|
40125
|
+
*
|
|
40126
|
+
*/
|
|
40127
|
+
const getGlobalPinnedPosts = (params, callback, config) => {
|
|
40128
|
+
const { log, cache } = getActiveClient();
|
|
40129
|
+
if (!cache) {
|
|
40130
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
40131
|
+
}
|
|
40132
|
+
const timestamp = Date.now();
|
|
40133
|
+
log(`getGlobalPinnedPosts(tmpid: ${timestamp}) > listen`);
|
|
40134
|
+
const globalPinnedPostLiveCollection = new GlobalPinnedPostLiveCollectionController(params, callback);
|
|
40135
|
+
const disposers = globalPinnedPostLiveCollection.startSubscription();
|
|
40136
|
+
const cacheKey = globalPinnedPostLiveCollection.getCacheKey();
|
|
40137
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
40138
|
+
return () => {
|
|
40139
|
+
log(`getGlobalPinnedPosts(tmpid: ${timestamp}) > dispose`);
|
|
40140
|
+
disposers.forEach(fn => fn());
|
|
40141
|
+
};
|
|
40142
|
+
};
|
|
40143
|
+
|
|
39810
40144
|
class SemanticSearchPostPaginationController extends PaginationController {
|
|
39811
40145
|
async getRequest(queryParams, token) {
|
|
39812
40146
|
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
|
|
@@ -40068,6 +40402,7 @@ var index$5 = /*#__PURE__*/Object.freeze({
|
|
|
40068
40402
|
getPost: getPost$1,
|
|
40069
40403
|
getPosts: getPosts,
|
|
40070
40404
|
getPinnedPosts: getPinnedPosts,
|
|
40405
|
+
getGlobalPinnedPosts: getGlobalPinnedPosts,
|
|
40071
40406
|
semanticSearchPosts: semanticSearchPosts
|
|
40072
40407
|
});
|
|
40073
40408
|
|
|
@@ -40957,7 +41292,7 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
40957
41292
|
getPoll: getPoll
|
|
40958
41293
|
});
|
|
40959
41294
|
|
|
40960
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
41295
|
+
const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHo80SecH7FuF2\nhFYnb+l26/VN8UMLXAQFLnxciNTEwkGVFMpdezlH8rU2HtUJL4RETogbAOLVY0XM\njs6sPn8G1nALmh9qeDpUtVqFOVtBHxEZ910TLOtQiunjqJKO5nWdqZ71EC3OFluR\niGQkO84BiIFbv37ub7xl3S8XarbtKoLcyVpkDHi+1wx1pgCAn6gtBUgckPL5NR8j\nLseabl3HAXQfhTCKo4tmOFM2Dxwl1IUMmIJrJg/aIU/U0tj/1Eoo7mG0JcNWX19l\nW3EecCbi0ncCJOrkUdwlBrcjaMayaX/ubEwyUeTGiLdyc4L3GRLHjyK8xgVNXRMH\nbZWJ2a5NAgMBAAECggEASxuE+35zTFO/XydKgmvIGcWL9FbgMlXb7Vcf0nBoG945\nbiz0NVc2paraIhJXc608xbYF3qLmtAE1MVBI0ORyRdBHNxY024l/6H6SH60Ed+uI\nM4ysp5ourY6Vj+DLwpdRiI9YDjqYAQDIUmhNxJP7XPhOMoZI6st+xZQBM34ic/bv\nAMSJm9OZphSp3+qXVkFZztr2mxD2EZSJJLYxi8BCdgM2qhazalbcJ6zDKHCZWVWm\n8RRxDGldyMb/237JxETzP40tAlzOZDmBAbUgEnurDJ93RVDIE3rbZUshwgeQd18a\nem096mWgvB1AIKYgsTAR3pw+V19YWAjq/glP6fz8wQKBgQD/oQq+ukKF0PRgBeM5\ngeTjSwsdGppQLmf5ndujvoiz/TpdjDEPu6R8kigQr1rG2t4K/yfdZoI8RdmJD1al\n3Q7N9hofooSy4rj6E3txzWZCHJjHad2cnCp/O26HiReGAl7wTcfTmNdiFHhZQzm5\nJBkvWAiwuvQMNfEbnXxw6/vIDwKBgQDH7fX8gsc77JLvAWgp1MaQN/sbqVb6JeT1\nFQfR8E/WFCSmzQBtNzd5KgYuCeelwr/8DyYytvN2BzCYZXp73gI1jF3YlW5jVn74\nOY6TwQ095digwo6Z0yuxopdIOApKgAkL9PRKgNrqAf3NAyMua6lOGifzjDojC3KU\nfylQmxMn4wKBgHp2B9O/H0dEBw5JQ8W0+JX6yWQz7mEjGiR2/1W+XXb8hQ1zr709\nw1r6Gb+EghRpnZ3fBpYGGbYOMFx8wKHM+N6qW3F0ReX8v2juFGE8aRSa5oYBrWzt\nU16Idjbv8hj84cZ1PJmdyvDtpYn9rpWHOZl4rxEbPvbqkIsOMyNVqdT5AoGAOSge\nmwIIU2le2FVeohbibXiToWTYKMuMmURZ5/r72AgKMmWJKbAPe+Q3wBG01/7FRBpQ\noU8Ma0HC8s6QJbliiEyIx9JwrJWd1vkdecBHONrtA4ibm/5zD2WcOllLF+FitLhi\n3qnX6+6F0IaFGFBPJrTzlv0P4dTz/OAdv52V7GECgYEA2TttOKBAqWllgOaZOkql\nLVMJVmgR7s6tLi1+cEP8ZcapV9aRbRzTAKXm4f8AEhtlG9F9kCOvHYCYGi6JaiWJ\nZkHjeex3T+eE6Di6y5Bm/Ift5jtVhJ4jCVwHOKTMej79NPUFTJfv8hCo29haBDv6\nRXFrv+T21KCcw8k3sJeJWWQ=\n-----END PRIVATE KEY-----";
|
|
40961
41296
|
/*
|
|
40962
41297
|
* The crypto algorithm used for importing key and signing string
|
|
40963
41298
|
*/
|
|
@@ -41612,8 +41947,8 @@ const onStoryReactionAdded = (callback) => {
|
|
|
41612
41947
|
const onStoryReactionAddedLocal = (callback) => {
|
|
41613
41948
|
const client = getActiveClient();
|
|
41614
41949
|
const filter = async (payload) => {
|
|
41615
|
-
ingestInCache(payload);
|
|
41616
|
-
callback(payload.
|
|
41950
|
+
ingestInCache({ stories: [payload.story] });
|
|
41951
|
+
callback([payload.story]);
|
|
41617
41952
|
};
|
|
41618
41953
|
const disposers = [
|
|
41619
41954
|
createEventSubscriber(client, 'onStoryReactionAdded', 'local.story.reactionAdded', filter),
|
|
@@ -41642,8 +41977,8 @@ const onStoryReactionRemoved = (callback) => {
|
|
|
41642
41977
|
const onStoryReactionRemovedLocal = (callback) => {
|
|
41643
41978
|
const client = getActiveClient();
|
|
41644
41979
|
const filter = async (payload) => {
|
|
41645
|
-
ingestInCache(payload);
|
|
41646
|
-
callback(payload.
|
|
41980
|
+
ingestInCache({ stories: [payload.story] });
|
|
41981
|
+
callback([payload.story]);
|
|
41647
41982
|
};
|
|
41648
41983
|
const disposers = [
|
|
41649
41984
|
createEventSubscriber(client, 'onStoryReactionRemoved', 'local.story.reactionRemoved', filter),
|
|
@@ -42183,12 +42518,12 @@ const updateLocalList = (cacheKey, targetIds) => {
|
|
|
42183
42518
|
pushToCache(cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...storyTargets, ...targetIds])] }));
|
|
42184
42519
|
};
|
|
42185
42520
|
class GlobalStoryQueryStreamController extends QueryStreamController {
|
|
42186
|
-
constructor(query, cacheKey, notifyChange, paginationController) {
|
|
42521
|
+
constructor(query, cacheKey, notifyChange, paginationController, preparePayload) {
|
|
42187
42522
|
super(query, cacheKey);
|
|
42188
42523
|
this.notifyChange = notifyChange;
|
|
42189
42524
|
this.paginationController = paginationController;
|
|
42190
42525
|
// Fix ESLint, "Expected 'this' to be used by class method"
|
|
42191
|
-
this.preparePayload =
|
|
42526
|
+
this.preparePayload = preparePayload;
|
|
42192
42527
|
}
|
|
42193
42528
|
saveToMainDB(response) {
|
|
42194
42529
|
const client = getActiveClient();
|
|
@@ -42280,7 +42615,10 @@ class GlobalStoryLiveCollectionController extends LiveCollectionController {
|
|
|
42280
42615
|
const paginationController = new GlobalStoryPageController(query);
|
|
42281
42616
|
super(paginationController, queryStreamId, cacheKey, callback);
|
|
42282
42617
|
this.query = query;
|
|
42283
|
-
this.queryStreamController = new GlobalStoryQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), paginationController)
|
|
42618
|
+
this.queryStreamController = new GlobalStoryQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), paginationController, (data) => {
|
|
42619
|
+
const _a = prepareCommunityPayload(Object.assign(Object.assign({}, data), { feeds: [] })), rest = __rest(_a, ["feeds"]);
|
|
42620
|
+
return Object.assign(Object.assign({}, data), rest);
|
|
42621
|
+
});
|
|
42284
42622
|
this.paginationController = paginationController;
|
|
42285
42623
|
this.callback = callback.bind(this);
|
|
42286
42624
|
this.loadPage({ initial: true });
|