@amityco/ts-sdk 7.22.1-ef6b9414.0 → 7.23.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/errors.d.ts +2 -1
- package/dist/@types/core/errors.d.ts.map +1 -1
- package/dist/@types/core/events.d.ts +5 -1
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +5 -1
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/block.d.ts +5 -0
- package/dist/@types/domains/block.d.ts.map +1 -1
- package/dist/@types/domains/channel.d.ts +11 -0
- package/dist/@types/domains/channel.d.ts.map +1 -1
- package/dist/@types/domains/client.d.ts +23 -0
- package/dist/@types/domains/client.d.ts.map +1 -1
- package/dist/@types/domains/comment.d.ts +1 -0
- package/dist/@types/domains/comment.d.ts.map +1 -1
- package/dist/@types/domains/post.d.ts +1 -0
- package/dist/@types/domains/post.d.ts.map +1 -1
- package/dist/channelRepository/observers/index.d.ts +1 -0
- package/dist/channelRepository/observers/index.d.ts.map +1 -1
- package/dist/channelRepository/observers/searchChannels/SearchChannelLiveCollectionController.d.ts +14 -0
- package/dist/channelRepository/observers/searchChannels/SearchChannelLiveCollectionController.d.ts.map +1 -0
- package/dist/channelRepository/observers/searchChannels/SearchChannelPaginationController.d.ts +10 -0
- package/dist/channelRepository/observers/searchChannels/SearchChannelPaginationController.d.ts.map +1 -0
- package/dist/channelRepository/observers/searchChannels/SearchChannelQueryStreamController.d.ts +13 -0
- package/dist/channelRepository/observers/searchChannels/SearchChannelQueryStreamController.d.ts.map +1 -0
- package/dist/channelRepository/observers/searchChannels.d.ts +21 -0
- package/dist/channelRepository/observers/searchChannels.d.ts.map +1 -0
- package/dist/channelRepository/observers/tests/integrations/searchChannels.integration.test.d.ts +2 -0
- package/dist/channelRepository/observers/tests/integrations/searchChannels.integration.test.d.ts.map +1 -0
- package/dist/client/api/autoSubscription.d.ts +47 -0
- package/dist/client/api/autoSubscription.d.ts.map +1 -0
- package/dist/client/api/createClient.d.ts.map +1 -1
- package/dist/client/api/getCoreUserSettings.d.ts +16 -0
- package/dist/client/api/getCoreUserSettings.d.ts.map +1 -0
- package/dist/client/api/getForYouFeedSetting.d.ts +17 -0
- package/dist/client/api/getForYouFeedSetting.d.ts.map +1 -0
- package/dist/client/api/index.d.ts +3 -0
- package/dist/client/api/index.d.ts.map +1 -1
- package/dist/client/api/setupLoginSubscriptions.d.ts.map +1 -1
- package/dist/client/utils/autoSubscriptionManager.d.ts +21 -0
- package/dist/client/utils/autoSubscriptionManager.d.ts.map +1 -0
- package/dist/client/utils/subscribeGlobalTopic.d.ts +6 -1
- package/dist/client/utils/subscribeGlobalTopic.d.ts.map +1 -1
- package/dist/client/utils/tests/autoSubscriptionManager.test.d.ts +2 -0
- package/dist/client/utils/tests/autoSubscriptionManager.test.d.ts.map +1 -0
- package/dist/commentRepository/observers/getComments/CommentLiveCollectionController.d.ts.map +1 -1
- package/dist/commentRepository/observers/tests/integrations/getCommentsExcludeBlockUser.integration.test.d.ts +2 -0
- package/dist/commentRepository/observers/tests/integrations/getCommentsExcludeBlockUser.integration.test.d.ts.map +1 -0
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.d.ts.map +1 -1
- package/dist/core/query/filtering.d.ts +32 -0
- package/dist/core/query/filtering.d.ts.map +1 -1
- package/dist/feedRepository/observers/getForYouFeed/CursorController.d.ts +2 -0
- package/dist/feedRepository/observers/getForYouFeed/CursorController.d.ts.map +1 -1
- package/dist/feedRepository/observers/getForYouFeed/PaginationController.d.ts +5 -4
- package/dist/feedRepository/observers/getForYouFeed/PaginationController.d.ts.map +1 -1
- package/dist/index.cjs.js +1442 -269
- package/dist/index.esm.js +1440 -270
- package/dist/index.umd.js +3 -3
- package/dist/postRepository/observers/getPosts/PostLiveCollectionController.d.ts.map +1 -1
- package/dist/postRepository/observers/tests/getPostsExcludeBlockUser.test.d.ts +2 -0
- package/dist/postRepository/observers/tests/getPostsExcludeBlockUser.test.d.ts.map +1 -0
- package/dist/userRepository/api/getAllBlockedUsers.d.ts.map +1 -1
- package/dist/userRepository/api/getAllBlockingUsers.d.ts +20 -0
- package/dist/userRepository/api/getAllBlockingUsers.d.ts.map +1 -0
- package/dist/userRepository/api/index.d.ts +1 -0
- package/dist/userRepository/api/index.d.ts.map +1 -1
- package/dist/userRepository/api/tests/integration/getAllBlockingUsers.integration.test.d.ts +2 -0
- package/dist/userRepository/api/tests/integration/getAllBlockingUsers.integration.test.d.ts.map +1 -0
- package/dist/userRepository/observers/getBlockedUsers/BlockedUserLiveCollectionController.d.ts.map +1 -1
- package/dist/userRepository/observers/getBlockedUsers/BlockedUserQueryStreamController.d.ts +4 -3
- package/dist/userRepository/observers/getBlockedUsers/BlockedUserQueryStreamController.d.ts.map +1 -1
- package/dist/userRepository/observers/getBlockingUsers/LiveCollectionController.d.ts +13 -0
- package/dist/userRepository/observers/getBlockingUsers/LiveCollectionController.d.ts.map +1 -0
- package/dist/userRepository/observers/getBlockingUsers/PaginationController.d.ts +5 -0
- package/dist/userRepository/observers/getBlockingUsers/PaginationController.d.ts.map +1 -0
- package/dist/userRepository/observers/getBlockingUsers/QueryStreamController.d.ts +16 -0
- package/dist/userRepository/observers/getBlockingUsers/QueryStreamController.d.ts.map +1 -0
- package/dist/userRepository/observers/getBlockingUsers.d.ts +17 -0
- package/dist/userRepository/observers/getBlockingUsers.d.ts.map +1 -0
- package/dist/userRepository/observers/index.d.ts +1 -0
- package/dist/userRepository/observers/index.d.ts.map +1 -1
- package/dist/userRepository/observers/tests/integrations/getBlockingUsers.integration.test.d.ts +2 -0
- package/dist/userRepository/observers/tests/integrations/getBlockingUsers.integration.test.d.ts.map +1 -0
- package/dist/userRepository/relationship/block/enum/index.d.ts +5 -0
- package/dist/userRepository/relationship/block/enum/index.d.ts.map +1 -0
- package/dist/userRepository/relationship/block/events/index.d.ts +3 -0
- package/dist/userRepository/relationship/block/events/index.d.ts.map +1 -0
- package/dist/userRepository/relationship/block/events/onUserDidBlock.d.ts +20 -0
- package/dist/userRepository/relationship/block/events/onUserDidBlock.d.ts.map +1 -0
- package/dist/userRepository/relationship/block/events/onUserDidUnblock.d.ts +20 -0
- package/dist/userRepository/relationship/block/events/onUserDidUnblock.d.ts.map +1 -0
- package/dist/userRepository/relationship/block/index.d.ts +1 -0
- package/dist/userRepository/relationship/block/index.d.ts.map +1 -1
- package/dist/userRepository/relationship/block/utils/blockRealtimeOnLoginHandler.d.ts +12 -0
- package/dist/userRepository/relationship/block/utils/blockRealtimeOnLoginHandler.d.ts.map +1 -0
- package/dist/userRepository/relationship/block/utils/createBlockEventSubscriber.d.ts +11 -0
- package/dist/userRepository/relationship/block/utils/createBlockEventSubscriber.d.ts.map +1 -0
- package/dist/userRepository/services/BlockedUserSyncEngine/blockedUserSyncEngine.d.ts +13 -13
- package/dist/userRepository/services/BlockedUserSyncEngine/blockedUserSyncEngine.d.ts.map +1 -1
- package/dist/userRepository/services/BlockingUserSyncEngine/blockingUserSyncEngine.d.ts +56 -0
- package/dist/userRepository/services/BlockingUserSyncEngine/blockingUserSyncEngine.d.ts.map +1 -0
- package/dist/userRepository/services/BlockingUserSyncEngine/blockingUserSyncEngineOnLoginHandler.d.ts +3 -0
- package/dist/userRepository/services/BlockingUserSyncEngine/blockingUserSyncEngineOnLoginHandler.d.ts.map +1 -0
- package/dist/userRepository/utils/prepareBlockingUserPayload.d.ts +2 -0
- package/dist/userRepository/utils/prepareBlockingUserPayload.d.ts.map +1 -0
- package/dist/utils/tests/dummy/block.d.ts +16 -0
- package/dist/utils/tests/dummy/block.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -13,6 +13,13 @@ var MembershipAcceptanceTypeEnum;
|
|
|
13
13
|
MembershipAcceptanceTypeEnum["AUTOMATIC"] = "automatic";
|
|
14
14
|
MembershipAcceptanceTypeEnum["INVITATION"] = "invitation";
|
|
15
15
|
})(MembershipAcceptanceTypeEnum || (MembershipAcceptanceTypeEnum = {}));
|
|
16
|
+
var AmityAutoSubscription;
|
|
17
|
+
(function (AmityAutoSubscription) {
|
|
18
|
+
AmityAutoSubscription["CHAT"] = "chat";
|
|
19
|
+
AmityAutoSubscription["NETWORK"] = "network";
|
|
20
|
+
AmityAutoSubscription["LIVESTREAM"] = "livestream";
|
|
21
|
+
AmityAutoSubscription["BLOCK"] = "block";
|
|
22
|
+
})(AmityAutoSubscription || (AmityAutoSubscription = {}));
|
|
16
23
|
|
|
17
24
|
var UserTypeEnum;
|
|
18
25
|
(function (UserTypeEnum) {
|
|
@@ -291,8 +298,8 @@ var NotificationRolesFilterTypeEnum;
|
|
|
291
298
|
|
|
292
299
|
function getVersion() {
|
|
293
300
|
try {
|
|
294
|
-
// the string ''v7.
|
|
295
|
-
return 'v7.
|
|
301
|
+
// the string ''v7.23.0-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
302
|
+
return 'v7.23.0-esm';
|
|
296
303
|
}
|
|
297
304
|
catch (error) {
|
|
298
305
|
return '__dev__';
|
|
@@ -697,6 +704,95 @@ function createSnapshot(data, options) {
|
|
|
697
704
|
return Object.assign(Object.assign({}, options), { data });
|
|
698
705
|
}
|
|
699
706
|
|
|
707
|
+
/* eslint-disable max-classes-per-file */
|
|
708
|
+
/**
|
|
709
|
+
* Generic ASC error
|
|
710
|
+
* @category Errors
|
|
711
|
+
*/
|
|
712
|
+
class ASCError extends Error {
|
|
713
|
+
/**
|
|
714
|
+
* @param message A custom error message
|
|
715
|
+
* @param code A normalized error code
|
|
716
|
+
* @param level A normalized failure level descriptor
|
|
717
|
+
*/
|
|
718
|
+
constructor(message, code, level) {
|
|
719
|
+
super(`Amity SDK (${code}): ${message}`);
|
|
720
|
+
this.code = code;
|
|
721
|
+
this.level = level;
|
|
722
|
+
this.type = 'ASC';
|
|
723
|
+
this.timestamp = Date.now();
|
|
724
|
+
if (Error.captureStackTrace)
|
|
725
|
+
Error.captureStackTrace(this, ASCError);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
/**
|
|
729
|
+
* API level error
|
|
730
|
+
* @category Errors
|
|
731
|
+
*/
|
|
732
|
+
class ASCApiError extends ASCError {
|
|
733
|
+
/**
|
|
734
|
+
* @param code A normalized error code
|
|
735
|
+
* @param level A normalized failure level descriptor
|
|
736
|
+
*/
|
|
737
|
+
// eslint-disable-next-line no-useless-constructor
|
|
738
|
+
constructor(message, code, level) {
|
|
739
|
+
super(message, code, level);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Unexpected error
|
|
744
|
+
* @category Errors
|
|
745
|
+
*/
|
|
746
|
+
class ASCUnknownError extends ASCError {
|
|
747
|
+
/**
|
|
748
|
+
* @param code A normalized error code
|
|
749
|
+
* @param level A normalized failure level descriptor
|
|
750
|
+
*/
|
|
751
|
+
constructor(code = 800000 /* Amity.ClientError.UNKNOWN_ERROR */, level = "fatal" /* Amity.ErrorLevel.FATAL */) {
|
|
752
|
+
super('Unexpected error', code, level);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Network related error
|
|
757
|
+
* @category Errors
|
|
758
|
+
*/
|
|
759
|
+
class ASCConnectionError extends ASCError {
|
|
760
|
+
/**
|
|
761
|
+
* @param message A custom error message
|
|
762
|
+
*/
|
|
763
|
+
constructor(event, message = 'SDK client is having connection issues') {
|
|
764
|
+
super(`${message} (${event})`, event === 'disconnected'
|
|
765
|
+
? 800211 /* Amity.ClientError.DISCONNECTED */
|
|
766
|
+
: 800210 /* Amity.ClientError.CONNECTION_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
767
|
+
this.event = event;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
let activeClient = null;
|
|
772
|
+
/**
|
|
773
|
+
* Get the active client
|
|
774
|
+
*
|
|
775
|
+
* @returns the active client instance
|
|
776
|
+
*
|
|
777
|
+
* @hidden
|
|
778
|
+
*/
|
|
779
|
+
const getActiveClient = () => {
|
|
780
|
+
if (!activeClient) {
|
|
781
|
+
throw new ASCError('There is no active client', 800000 /* Amity.ClientError.UNKNOWN_ERROR */, "fatal" /* Amity.ErrorLevel.FATAL */);
|
|
782
|
+
}
|
|
783
|
+
return activeClient;
|
|
784
|
+
};
|
|
785
|
+
/**
|
|
786
|
+
* Sets the active client
|
|
787
|
+
*
|
|
788
|
+
* @param client the client to assume as currently active client
|
|
789
|
+
*
|
|
790
|
+
* @hidden
|
|
791
|
+
*/
|
|
792
|
+
const setActiveClient = (client) => {
|
|
793
|
+
activeClient = client;
|
|
794
|
+
};
|
|
795
|
+
|
|
700
796
|
/** @hidden */
|
|
701
797
|
const idResolvers = {
|
|
702
798
|
user: ({ userId }) => userId,
|
|
@@ -824,95 +920,6 @@ function getFutureDate(date = new Date().toISOString()) {
|
|
|
824
920
|
return new Date(new Date(date).getTime() + 1).toISOString();
|
|
825
921
|
}
|
|
826
922
|
|
|
827
|
-
/* eslint-disable max-classes-per-file */
|
|
828
|
-
/**
|
|
829
|
-
* Generic ASC error
|
|
830
|
-
* @category Errors
|
|
831
|
-
*/
|
|
832
|
-
class ASCError extends Error {
|
|
833
|
-
/**
|
|
834
|
-
* @param message A custom error message
|
|
835
|
-
* @param code A normalized error code
|
|
836
|
-
* @param level A normalized failure level descriptor
|
|
837
|
-
*/
|
|
838
|
-
constructor(message, code, level) {
|
|
839
|
-
super(`Amity SDK (${code}): ${message}`);
|
|
840
|
-
this.code = code;
|
|
841
|
-
this.level = level;
|
|
842
|
-
this.type = 'ASC';
|
|
843
|
-
this.timestamp = Date.now();
|
|
844
|
-
if (Error.captureStackTrace)
|
|
845
|
-
Error.captureStackTrace(this, ASCError);
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
/**
|
|
849
|
-
* API level error
|
|
850
|
-
* @category Errors
|
|
851
|
-
*/
|
|
852
|
-
class ASCApiError extends ASCError {
|
|
853
|
-
/**
|
|
854
|
-
* @param code A normalized error code
|
|
855
|
-
* @param level A normalized failure level descriptor
|
|
856
|
-
*/
|
|
857
|
-
// eslint-disable-next-line no-useless-constructor
|
|
858
|
-
constructor(message, code, level) {
|
|
859
|
-
super(message, code, level);
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
/**
|
|
863
|
-
* Unexpected error
|
|
864
|
-
* @category Errors
|
|
865
|
-
*/
|
|
866
|
-
class ASCUnknownError extends ASCError {
|
|
867
|
-
/**
|
|
868
|
-
* @param code A normalized error code
|
|
869
|
-
* @param level A normalized failure level descriptor
|
|
870
|
-
*/
|
|
871
|
-
constructor(code = 800000 /* Amity.ClientError.UNKNOWN_ERROR */, level = "fatal" /* Amity.ErrorLevel.FATAL */) {
|
|
872
|
-
super('Unexpected error', code, level);
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
/**
|
|
876
|
-
* Network related error
|
|
877
|
-
* @category Errors
|
|
878
|
-
*/
|
|
879
|
-
class ASCConnectionError extends ASCError {
|
|
880
|
-
/**
|
|
881
|
-
* @param message A custom error message
|
|
882
|
-
*/
|
|
883
|
-
constructor(event, message = 'SDK client is having connection issues') {
|
|
884
|
-
super(`${message} (${event})`, event === 'disconnected'
|
|
885
|
-
? 800211 /* Amity.ClientError.DISCONNECTED */
|
|
886
|
-
: 800210 /* Amity.ClientError.CONNECTION_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
887
|
-
this.event = event;
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
let activeClient = null;
|
|
892
|
-
/**
|
|
893
|
-
* Get the active client
|
|
894
|
-
*
|
|
895
|
-
* @returns the active client instance
|
|
896
|
-
*
|
|
897
|
-
* @hidden
|
|
898
|
-
*/
|
|
899
|
-
const getActiveClient = () => {
|
|
900
|
-
if (!activeClient) {
|
|
901
|
-
throw new ASCError('There is no active client', 800000 /* Amity.ClientError.UNKNOWN_ERROR */, "fatal" /* Amity.ErrorLevel.FATAL */);
|
|
902
|
-
}
|
|
903
|
-
return activeClient;
|
|
904
|
-
};
|
|
905
|
-
/**
|
|
906
|
-
* Sets the active client
|
|
907
|
-
*
|
|
908
|
-
* @param client the client to assume as currently active client
|
|
909
|
-
*
|
|
910
|
-
* @hidden
|
|
911
|
-
*/
|
|
912
|
-
const setActiveClient = (client) => {
|
|
913
|
-
activeClient = client;
|
|
914
|
-
};
|
|
915
|
-
|
|
916
923
|
/**
|
|
917
924
|
* ```js
|
|
918
925
|
* import { enableCache } from '@amityco/ts-sdk'
|
|
@@ -1420,6 +1427,65 @@ const filterBySearchTerm = (collection, searchTerm) => {
|
|
|
1420
1427
|
return m.user && ((_a = m.user.displayName) === null || _a === void 0 ? void 0 : _a.match(containsMatcher));
|
|
1421
1428
|
});
|
|
1422
1429
|
};
|
|
1430
|
+
/**
|
|
1431
|
+
* The ids of users in a block relationship with the current user — in BOTH
|
|
1432
|
+
* directions — derived synchronously from the local follow cache. For every
|
|
1433
|
+
* `status === 'blocked'` row that involves the current user, the OTHER party
|
|
1434
|
+
* is collected: `from === me` (users I blocked, outgoing) contributes `to`;
|
|
1435
|
+
* `to === me` (users who blocked me, incoming) contributes `from`.
|
|
1436
|
+
*
|
|
1437
|
+
* @returns a set of block-related user ids (both directions)
|
|
1438
|
+
*
|
|
1439
|
+
* @hidden
|
|
1440
|
+
*/
|
|
1441
|
+
const getBlockUsersId = () => {
|
|
1442
|
+
var _a;
|
|
1443
|
+
const { userId } = getActiveClient();
|
|
1444
|
+
const ids = new Set();
|
|
1445
|
+
((_a = queryCache(['follow', 'get'])) !== null && _a !== void 0 ? _a : [])
|
|
1446
|
+
.map(entry => entry.data)
|
|
1447
|
+
.filter(follow => (follow === null || follow === void 0 ? void 0 : follow.status) === 'blocked' && (follow.from === userId || follow.to === userId))
|
|
1448
|
+
.forEach(follow => {
|
|
1449
|
+
ids.add(follow.from === userId ? follow.to : follow.from);
|
|
1450
|
+
});
|
|
1451
|
+
return ids;
|
|
1452
|
+
};
|
|
1453
|
+
/**
|
|
1454
|
+
* Filter out posts whose author or any mentionee is in a block relationship
|
|
1455
|
+
* with the current user, in either direction (see {@link getBlockUsersId}).
|
|
1456
|
+
*
|
|
1457
|
+
* @param collection the post collection to filter
|
|
1458
|
+
* @returns a filtered collection excluding posts involving block-related users
|
|
1459
|
+
*
|
|
1460
|
+
* @hidden
|
|
1461
|
+
*/
|
|
1462
|
+
const filterPostsByBlockUsers = (collection) => {
|
|
1463
|
+
const blockUsersId = getBlockUsersId();
|
|
1464
|
+
if (blockUsersId.size === 0)
|
|
1465
|
+
return collection;
|
|
1466
|
+
return collection.filter(post => {
|
|
1467
|
+
var _a, _b;
|
|
1468
|
+
if (blockUsersId.has(post.postedUserId))
|
|
1469
|
+
return false;
|
|
1470
|
+
const mentionedUserIds = (_b = (_a = post.mentionees) === null || _a === void 0 ? void 0 : _a.flatMap(mention => (mention.type === 'user' ? mention.userIds : []))) !== null && _b !== void 0 ? _b : [];
|
|
1471
|
+
return !mentionedUserIds.some(id => blockUsersId.has(id));
|
|
1472
|
+
});
|
|
1473
|
+
};
|
|
1474
|
+
/**
|
|
1475
|
+
* Filter out comments whose creator is in a block relationship with the
|
|
1476
|
+
* current user, in either direction (see {@link getBlockUsersId}).
|
|
1477
|
+
*
|
|
1478
|
+
* @param collection the comment collection to filter
|
|
1479
|
+
* @returns a filtered collection excluding comments from block-related users
|
|
1480
|
+
*
|
|
1481
|
+
* @hidden
|
|
1482
|
+
*/
|
|
1483
|
+
const filterCommentsByBlockUsers = (collection) => {
|
|
1484
|
+
const blockUsersId = getBlockUsersId();
|
|
1485
|
+
if (blockUsersId.size === 0)
|
|
1486
|
+
return collection;
|
|
1487
|
+
return collection.filter(comment => !blockUsersId.has(comment.userId));
|
|
1488
|
+
};
|
|
1423
1489
|
|
|
1424
1490
|
// Note:
|
|
1425
1491
|
// this file should contain a suite of sorting utilities to help the
|
|
@@ -1890,13 +1956,13 @@ class NetworkActivitiesWatcher {
|
|
|
1890
1956
|
this._listener.clear();
|
|
1891
1957
|
}
|
|
1892
1958
|
}
|
|
1893
|
-
let instance$
|
|
1959
|
+
let instance$b;
|
|
1894
1960
|
var NetworkActivitiesWatcher$1 = {
|
|
1895
1961
|
getInstance: () => {
|
|
1896
|
-
if (!instance$
|
|
1897
|
-
instance$
|
|
1962
|
+
if (!instance$b) {
|
|
1963
|
+
instance$b = new NetworkActivitiesWatcher();
|
|
1898
1964
|
}
|
|
1899
|
-
return instance$
|
|
1965
|
+
return instance$b;
|
|
1900
1966
|
},
|
|
1901
1967
|
};
|
|
1902
1968
|
|
|
@@ -20735,18 +20801,149 @@ var mqtt$1 = {exports: {}};
|
|
|
20735
20801
|
|
|
20736
20802
|
var mqtt = /*@__PURE__*/getDefaultExportFromCjs(mqtt$1.exports);
|
|
20737
20803
|
|
|
20804
|
+
class SessionWatcher {
|
|
20805
|
+
constructor() {
|
|
20806
|
+
this._sessionState = "notLoggedIn" /* Amity.SessionStates.NOT_LOGGED_IN */;
|
|
20807
|
+
this._listener = new Map();
|
|
20808
|
+
}
|
|
20809
|
+
onSessionStateChange(callback) {
|
|
20810
|
+
this._listener.set(callback, callback);
|
|
20811
|
+
return () => {
|
|
20812
|
+
this._listener.delete(callback);
|
|
20813
|
+
};
|
|
20814
|
+
}
|
|
20815
|
+
setSessionState(state, reason) {
|
|
20816
|
+
if (this._sessionState === state)
|
|
20817
|
+
return;
|
|
20818
|
+
this._sessionState = state;
|
|
20819
|
+
this._listener.forEach(cb => cb(state, reason));
|
|
20820
|
+
}
|
|
20821
|
+
destroy() {
|
|
20822
|
+
this._listener.clear();
|
|
20823
|
+
}
|
|
20824
|
+
}
|
|
20825
|
+
let instance$a;
|
|
20826
|
+
var SessionWatcher$1 = {
|
|
20827
|
+
getInstance: () => {
|
|
20828
|
+
if (!instance$a) {
|
|
20829
|
+
instance$a = new SessionWatcher();
|
|
20830
|
+
}
|
|
20831
|
+
return instance$a;
|
|
20832
|
+
},
|
|
20833
|
+
};
|
|
20834
|
+
|
|
20835
|
+
/**
|
|
20836
|
+
* ```js
|
|
20837
|
+
* import { onSessionStateChange } from '@amityco/ts-sdk'
|
|
20838
|
+
* const dispose = onSessionStateChange((state: Amity.SessionStates) => {
|
|
20839
|
+
* // ...
|
|
20840
|
+
* })
|
|
20841
|
+
* ```
|
|
20842
|
+
*
|
|
20843
|
+
* Fired when any {@link Amity.Client} has a session state change
|
|
20844
|
+
*
|
|
20845
|
+
* @param callback The function to call when the event was fired
|
|
20846
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
20847
|
+
*
|
|
20848
|
+
* @category Client Events
|
|
20849
|
+
*/
|
|
20850
|
+
const onSessionStateChange = (callback) => SessionWatcher$1.getInstance().onSessionStateChange(callback);
|
|
20851
|
+
|
|
20852
|
+
const TOPICS = {
|
|
20853
|
+
[AmityAutoSubscription.NETWORK]: [getNetworkTopic],
|
|
20854
|
+
[AmityAutoSubscription.CHAT]: [
|
|
20855
|
+
getSmartFeedChannelTopic,
|
|
20856
|
+
getSmartFeedSubChannelTopic,
|
|
20857
|
+
getSmartFeedMessageTopic,
|
|
20858
|
+
],
|
|
20859
|
+
[AmityAutoSubscription.LIVESTREAM]: [getLiveStreamTopic],
|
|
20860
|
+
[AmityAutoSubscription.BLOCK]: [getMyFollowersTopic, getMyFollowingsTopic],
|
|
20861
|
+
};
|
|
20862
|
+
const DEFAULT_TOPICS = [
|
|
20863
|
+
AmityAutoSubscription.CHAT,
|
|
20864
|
+
AmityAutoSubscription.NETWORK,
|
|
20865
|
+
AmityAutoSubscription.LIVESTREAM,
|
|
20866
|
+
AmityAutoSubscription.BLOCK,
|
|
20867
|
+
];
|
|
20868
|
+
const ALL_FEATURES = Object.values(AmityAutoSubscription);
|
|
20869
|
+
/** Ref-counted, reconnect-resilient registry of the managed auto-subscriptions. */
|
|
20870
|
+
class AutoSubscriptionManager {
|
|
20871
|
+
constructor() {
|
|
20872
|
+
this.refCountByFeature = new Map();
|
|
20873
|
+
this.disposers = new Map();
|
|
20874
|
+
this.seed();
|
|
20875
|
+
}
|
|
20876
|
+
seed() {
|
|
20877
|
+
this.refCountByFeature.clear();
|
|
20878
|
+
DEFAULT_TOPICS.forEach(feature => this.refCountByFeature.set(feature, 1));
|
|
20879
|
+
}
|
|
20880
|
+
isActive(feature) {
|
|
20881
|
+
var _a;
|
|
20882
|
+
return ((_a = this.refCountByFeature.get(feature)) !== null && _a !== void 0 ? _a : 0) > 0;
|
|
20883
|
+
}
|
|
20884
|
+
subscribeTopics(feature) {
|
|
20885
|
+
this.unsubscribeTopics(feature);
|
|
20886
|
+
this.disposers.set(feature, TOPICS[feature].map(buildTopic => subscribeTopic(buildTopic())));
|
|
20887
|
+
}
|
|
20888
|
+
unsubscribeTopics(feature) {
|
|
20889
|
+
var _a;
|
|
20890
|
+
((_a = this.disposers.get(feature)) !== null && _a !== void 0 ? _a : []).forEach(dispose => dispose());
|
|
20891
|
+
this.disposers.delete(feature);
|
|
20892
|
+
}
|
|
20893
|
+
/** Subscribe every enabled handle's topics, converging the broker to the registry. Called on each (re)connect. */
|
|
20894
|
+
initialize() {
|
|
20895
|
+
ALL_FEATURES.forEach(feature => {
|
|
20896
|
+
if (this.isActive(feature))
|
|
20897
|
+
this.subscribeTopics(feature);
|
|
20898
|
+
});
|
|
20899
|
+
}
|
|
20900
|
+
subscribe(feature) {
|
|
20901
|
+
var _a;
|
|
20902
|
+
const next = ((_a = this.refCountByFeature.get(feature)) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
20903
|
+
this.refCountByFeature.set(feature, next);
|
|
20904
|
+
if (next === 1)
|
|
20905
|
+
this.subscribeTopics(feature);
|
|
20906
|
+
}
|
|
20907
|
+
unsubscribe(feature) {
|
|
20908
|
+
var _a;
|
|
20909
|
+
const next = Math.max(0, ((_a = this.refCountByFeature.get(feature)) !== null && _a !== void 0 ? _a : 0) - 1);
|
|
20910
|
+
this.refCountByFeature.set(feature, next);
|
|
20911
|
+
if (next === 0)
|
|
20912
|
+
this.unsubscribeTopics(feature);
|
|
20913
|
+
}
|
|
20914
|
+
subscriptions() {
|
|
20915
|
+
return ALL_FEATURES.map(feature => ({
|
|
20916
|
+
feature,
|
|
20917
|
+
isActive: this.isActive(feature),
|
|
20918
|
+
isSystem: true,
|
|
20919
|
+
topicCount: TOPICS[feature].length,
|
|
20920
|
+
}));
|
|
20921
|
+
}
|
|
20922
|
+
reset() {
|
|
20923
|
+
ALL_FEATURES.forEach(feature => this.unsubscribeTopics(feature));
|
|
20924
|
+
this.disposers.clear();
|
|
20925
|
+
this.seed();
|
|
20926
|
+
}
|
|
20927
|
+
}
|
|
20928
|
+
let instance$9 = null;
|
|
20929
|
+
const getAutoSubscriptionManager = () => {
|
|
20930
|
+
if (!instance$9)
|
|
20931
|
+
instance$9 = new AutoSubscriptionManager();
|
|
20932
|
+
return instance$9;
|
|
20933
|
+
};
|
|
20934
|
+
/** Resets the registry to its default baseline when the session ends. */
|
|
20935
|
+
const resetAutoSubscriptionsOnLogout = () => onSessionStateChange(state => {
|
|
20936
|
+
if (state !== "established" /* Amity.SessionStates.ESTABLISHED */)
|
|
20937
|
+
getAutoSubscriptionManager().reset();
|
|
20938
|
+
});
|
|
20939
|
+
|
|
20940
|
+
/**
|
|
20941
|
+
* (Re)subscribes the managed auto-subscription registry on every (re)connect.
|
|
20942
|
+
* The hardcoded topic list was promoted to the toggleable, ref-counted registry
|
|
20943
|
+
* in {@link getAutoSubscriptionManager} — see `client.manageAutoSubscriptions`.
|
|
20944
|
+
*/
|
|
20738
20945
|
const subscribeGlobalTopic = () => {
|
|
20739
|
-
|
|
20740
|
-
subscribeTopic(getNetworkTopic()),
|
|
20741
|
-
subscribeTopic(getSmartFeedChannelTopic()),
|
|
20742
|
-
subscribeTopic(getSmartFeedSubChannelTopic()),
|
|
20743
|
-
subscribeTopic(getSmartFeedMessageTopic()),
|
|
20744
|
-
// subscribing to user topic is necessary to handle ban event
|
|
20745
|
-
subscribeTopic(getUserTopic(getActiveUser())),
|
|
20746
|
-
subscribeTopic(getMarkerUserFeedTopic()),
|
|
20747
|
-
subscribeTopic(getLiveStreamTopic()),
|
|
20748
|
-
];
|
|
20749
|
-
return () => disposers.forEach(fn => fn());
|
|
20946
|
+
getAutoSubscriptionManager().initialize();
|
|
20750
20947
|
};
|
|
20751
20948
|
|
|
20752
20949
|
class OnMemoryStorage {
|
|
@@ -21956,7 +22153,7 @@ getSubChannel$1.locally = (subChannelId) => {
|
|
|
21956
22153
|
};
|
|
21957
22154
|
};
|
|
21958
22155
|
|
|
21959
|
-
const getMessagePreviewSetting$
|
|
22156
|
+
const getMessagePreviewSetting$2 = async () => {
|
|
21960
22157
|
const client = getActiveClient();
|
|
21961
22158
|
return client.getMessagePreviewSetting(false);
|
|
21962
22159
|
};
|
|
@@ -21991,7 +22188,7 @@ const isLastestMessageOnChannel = (message) => {
|
|
|
21991
22188
|
convertDateStringToTimestamp(cache.createdAt) <= convertDateStringToTimestamp(message.createdAt));
|
|
21992
22189
|
};
|
|
21993
22190
|
const handleMessageCreatedOnSubChannel = async (message) => {
|
|
21994
|
-
const messagePreviewSetting = await getMessagePreviewSetting$
|
|
22191
|
+
const messagePreviewSetting = await getMessagePreviewSetting$2();
|
|
21995
22192
|
const { channelId, messageId: messagePreviewId, creatorId, createdAt, updatedAt, data, dataType, subChannelId, channelSegment: segment, isDeleted, } = message;
|
|
21996
22193
|
// 1. get subChannel from cache, if not exist fetch from server
|
|
21997
22194
|
const subChannelCache = await getSubChannelCache(subChannelId);
|
|
@@ -23171,54 +23368,6 @@ getChannelByIds$1.locally = (channelIds) => {
|
|
|
23171
23368
|
};
|
|
23172
23369
|
};
|
|
23173
23370
|
|
|
23174
|
-
class SessionWatcher {
|
|
23175
|
-
constructor() {
|
|
23176
|
-
this._sessionState = "notLoggedIn" /* Amity.SessionStates.NOT_LOGGED_IN */;
|
|
23177
|
-
this._listener = new Map();
|
|
23178
|
-
}
|
|
23179
|
-
onSessionStateChange(callback) {
|
|
23180
|
-
this._listener.set(callback, callback);
|
|
23181
|
-
return () => {
|
|
23182
|
-
this._listener.delete(callback);
|
|
23183
|
-
};
|
|
23184
|
-
}
|
|
23185
|
-
setSessionState(state, reason) {
|
|
23186
|
-
if (this._sessionState === state)
|
|
23187
|
-
return;
|
|
23188
|
-
this._sessionState = state;
|
|
23189
|
-
this._listener.forEach(cb => cb(state, reason));
|
|
23190
|
-
}
|
|
23191
|
-
destroy() {
|
|
23192
|
-
this._listener.clear();
|
|
23193
|
-
}
|
|
23194
|
-
}
|
|
23195
|
-
let instance$8;
|
|
23196
|
-
var SessionWatcher$1 = {
|
|
23197
|
-
getInstance: () => {
|
|
23198
|
-
if (!instance$8) {
|
|
23199
|
-
instance$8 = new SessionWatcher();
|
|
23200
|
-
}
|
|
23201
|
-
return instance$8;
|
|
23202
|
-
},
|
|
23203
|
-
};
|
|
23204
|
-
|
|
23205
|
-
/**
|
|
23206
|
-
* ```js
|
|
23207
|
-
* import { onSessionStateChange } from '@amityco/ts-sdk'
|
|
23208
|
-
* const dispose = onSessionStateChange((state: Amity.SessionStates) => {
|
|
23209
|
-
* // ...
|
|
23210
|
-
* })
|
|
23211
|
-
* ```
|
|
23212
|
-
*
|
|
23213
|
-
* Fired when any {@link Amity.Client} has a session state change
|
|
23214
|
-
*
|
|
23215
|
-
* @param callback The function to call when the event was fired
|
|
23216
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
23217
|
-
*
|
|
23218
|
-
* @category Client Events
|
|
23219
|
-
*/
|
|
23220
|
-
const onSessionStateChange = (callback) => SessionWatcher$1.getInstance().onSessionStateChange(callback);
|
|
23221
|
-
|
|
23222
23371
|
const setIntervalTask = (handler, timeout) => {
|
|
23223
23372
|
const timer = setInterval(handler, timeout);
|
|
23224
23373
|
return () => clearInterval(timer);
|
|
@@ -23390,7 +23539,7 @@ const convertMessagePreviewSetting = (chatSetting) => {
|
|
|
23390
23539
|
* @category private
|
|
23391
23540
|
* @async
|
|
23392
23541
|
*/
|
|
23393
|
-
const getMessagePreviewSetting = async (refresh = true) => {
|
|
23542
|
+
const getMessagePreviewSetting$1 = async (refresh = true) => {
|
|
23394
23543
|
var _a;
|
|
23395
23544
|
const messagePreviewSetting = (_a = pullFromCache([
|
|
23396
23545
|
'MessagePreviewSetting',
|
|
@@ -23411,7 +23560,7 @@ const getMessagePreviewSetting = async (refresh = true) => {
|
|
|
23411
23560
|
*/
|
|
23412
23561
|
const initializeMessagePreviewSetting = async () => {
|
|
23413
23562
|
var _a;
|
|
23414
|
-
const newMessagePreviewSetting = await getMessagePreviewSetting();
|
|
23563
|
+
const newMessagePreviewSetting = await getMessagePreviewSetting$1();
|
|
23415
23564
|
const messagePreviewSetting = (_a = pullFromCache([
|
|
23416
23565
|
'MessagePreviewSetting',
|
|
23417
23566
|
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
@@ -23482,6 +23631,26 @@ const getSocialSettings = async () => {
|
|
|
23482
23631
|
return data.socialNetworkSetting;
|
|
23483
23632
|
};
|
|
23484
23633
|
|
|
23634
|
+
/**
|
|
23635
|
+
* ```js
|
|
23636
|
+
* import { createClient } from '@amityco/ts-sdk'
|
|
23637
|
+
* const client = createClient(apiKey, apiRegion)
|
|
23638
|
+
* const userSettings = await client.getCoreUserSettings()
|
|
23639
|
+
* ```
|
|
23640
|
+
*
|
|
23641
|
+
* Fetches a {@link Amity.CoreUserSettings} object
|
|
23642
|
+
*
|
|
23643
|
+
* @returns A Promise of {@link Amity.CoreUserSettings} object
|
|
23644
|
+
*
|
|
23645
|
+
* @category Client API
|
|
23646
|
+
* @async
|
|
23647
|
+
*/
|
|
23648
|
+
const getCoreUserSettings = async () => {
|
|
23649
|
+
const client = getActiveClient();
|
|
23650
|
+
const { data } = await client.http.get(`/api/v3/network-settings/users`);
|
|
23651
|
+
return data;
|
|
23652
|
+
};
|
|
23653
|
+
|
|
23485
23654
|
/* begin_public_function
|
|
23486
23655
|
id: client.getProductCatalogueSetting
|
|
23487
23656
|
*/
|
|
@@ -23505,6 +23674,33 @@ const getProductCatalogueSetting = async () => {
|
|
|
23505
23674
|
};
|
|
23506
23675
|
/* end_public_function */
|
|
23507
23676
|
|
|
23677
|
+
/* begin_public_function
|
|
23678
|
+
id: client.getForYouFeedSetting
|
|
23679
|
+
*/
|
|
23680
|
+
/**
|
|
23681
|
+
* ```js
|
|
23682
|
+
* import { Client } from '@amityco/ts-sdk'
|
|
23683
|
+
* const forYouFeedSetting = await Client.getForYouFeedSetting()
|
|
23684
|
+
* ```
|
|
23685
|
+
*
|
|
23686
|
+
* Fetches the network-level {@link Amity.ForYouFeedSetting} — whether the For You
|
|
23687
|
+
* feed feature is enabled for the current network. Use `forYouFeed.enabled` as a
|
|
23688
|
+
* feature gate before querying {@link getForYouFeed}.
|
|
23689
|
+
*
|
|
23690
|
+
* @returns A Promise of {@link Amity.ForYouFeedSetting} object
|
|
23691
|
+
*
|
|
23692
|
+
* @category Client API
|
|
23693
|
+
* @async
|
|
23694
|
+
*/
|
|
23695
|
+
const getForYouFeedSetting = async () => {
|
|
23696
|
+
var _a, _b;
|
|
23697
|
+
const client = getActiveClient();
|
|
23698
|
+
const { data } = await client.http.get(`/api/v3/network-settings/for-you-feed`);
|
|
23699
|
+
// Surface only `enabled`; ignore server-side ranking config (scoringConfig, etc.)
|
|
23700
|
+
return { forYouFeed: { enabled: (_b = (_a = data.forYouFeed) === null || _a === void 0 ? void 0 : _a.enabled) !== null && _b !== void 0 ? _b : false } };
|
|
23701
|
+
};
|
|
23702
|
+
/* end_public_function */
|
|
23703
|
+
|
|
23508
23704
|
const checkUserPermission = (userId, permission) => {
|
|
23509
23705
|
var _a;
|
|
23510
23706
|
const user = (_a = pullFromCache(['user', 'get', userId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
@@ -24292,13 +24488,13 @@ class AnalyticsEngine {
|
|
|
24292
24488
|
this._eventCapturer.resetAllBuckets();
|
|
24293
24489
|
}
|
|
24294
24490
|
}
|
|
24295
|
-
let instance$
|
|
24491
|
+
let instance$8;
|
|
24296
24492
|
var AnalyticsEngine$1 = {
|
|
24297
24493
|
getInstance: () => {
|
|
24298
|
-
if (!instance$
|
|
24299
|
-
instance$
|
|
24494
|
+
if (!instance$8) {
|
|
24495
|
+
instance$8 = new AnalyticsEngine();
|
|
24300
24496
|
}
|
|
24301
|
-
return instance$
|
|
24497
|
+
return instance$8;
|
|
24302
24498
|
},
|
|
24303
24499
|
};
|
|
24304
24500
|
|
|
@@ -24525,12 +24721,12 @@ class MessageReadReceiptSyncEngine {
|
|
|
24525
24721
|
}
|
|
24526
24722
|
}
|
|
24527
24723
|
}
|
|
24528
|
-
let instance$
|
|
24724
|
+
let instance$7 = null;
|
|
24529
24725
|
var ReadReceiptSyncEngine = {
|
|
24530
24726
|
getInstance: () => {
|
|
24531
|
-
if (!instance$
|
|
24532
|
-
instance$
|
|
24533
|
-
return instance$
|
|
24727
|
+
if (!instance$7)
|
|
24728
|
+
instance$7 = new MessageReadReceiptSyncEngine();
|
|
24729
|
+
return instance$7;
|
|
24534
24730
|
},
|
|
24535
24731
|
};
|
|
24536
24732
|
|
|
@@ -24784,12 +24980,12 @@ class LegacyMessageReadReceiptSyncEngine {
|
|
|
24784
24980
|
}
|
|
24785
24981
|
}
|
|
24786
24982
|
}
|
|
24787
|
-
let instance$
|
|
24983
|
+
let instance$6 = null;
|
|
24788
24984
|
var LegacyReadReceiptSyncEngine = {
|
|
24789
24985
|
getInstance: () => {
|
|
24790
|
-
if (!instance$
|
|
24791
|
-
instance$
|
|
24792
|
-
return instance$
|
|
24986
|
+
if (!instance$6)
|
|
24987
|
+
instance$6 = new LegacyMessageReadReceiptSyncEngine();
|
|
24988
|
+
return instance$6;
|
|
24793
24989
|
},
|
|
24794
24990
|
};
|
|
24795
24991
|
|
|
@@ -25035,12 +25231,12 @@ class ObjectResolverEngine {
|
|
|
25035
25231
|
this.stopResolver();
|
|
25036
25232
|
}
|
|
25037
25233
|
}
|
|
25038
|
-
let instance$
|
|
25234
|
+
let instance$5 = null;
|
|
25039
25235
|
var ObjectResolverEngine$1 = {
|
|
25040
25236
|
getInstance: () => {
|
|
25041
|
-
if (!instance$
|
|
25042
|
-
instance$
|
|
25043
|
-
return instance$
|
|
25237
|
+
if (!instance$5)
|
|
25238
|
+
instance$5 = new ObjectResolverEngine();
|
|
25239
|
+
return instance$5;
|
|
25044
25240
|
},
|
|
25045
25241
|
};
|
|
25046
25242
|
|
|
@@ -25190,13 +25386,13 @@ class LiveReactionSyncEngine {
|
|
|
25190
25386
|
this.stopReactionsSync();
|
|
25191
25387
|
}
|
|
25192
25388
|
}
|
|
25193
|
-
let instance$
|
|
25389
|
+
let instance$4;
|
|
25194
25390
|
var ReactionSyncEngine = {
|
|
25195
25391
|
getInstance: () => {
|
|
25196
|
-
if (!instance$
|
|
25197
|
-
instance$
|
|
25392
|
+
if (!instance$4) {
|
|
25393
|
+
instance$4 = new LiveReactionSyncEngine();
|
|
25198
25394
|
}
|
|
25199
|
-
return instance$
|
|
25395
|
+
return instance$4;
|
|
25200
25396
|
},
|
|
25201
25397
|
};
|
|
25202
25398
|
|
|
@@ -25226,19 +25422,20 @@ function prepareBlockedUserPayload(response) {
|
|
|
25226
25422
|
}), users: users.map(convertRawUserToInternalUser) });
|
|
25227
25423
|
}
|
|
25228
25424
|
|
|
25229
|
-
const BLOCK_LIST_LIMIT = 100;
|
|
25230
|
-
const TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
25425
|
+
const BLOCK_LIST_LIMIT$1 = 100;
|
|
25426
|
+
const TTL_MS$1 = 5 * 60 * 1000; // 5 minutes
|
|
25231
25427
|
/**
|
|
25232
25428
|
* Session-scoped singleton engine that manages TTL-based fetching and caching
|
|
25233
25429
|
* of blocked users. Provides a lazy `ensureFetched()` gate for the
|
|
25234
25430
|
* `getAllBlockedUsers()` API.
|
|
25235
25431
|
*
|
|
25236
25432
|
* Key behaviours:
|
|
25237
|
-
* - `
|
|
25238
|
-
* - `
|
|
25433
|
+
* - `onSessionEstablished()` is a no-op — fetch is lazy, triggered only by consumer call
|
|
25434
|
+
* - `onSessionDestroyed()` resets `lastFetchedAt` to null (ensures fresh fetch on next session)
|
|
25239
25435
|
* - `ensureFetched()` fetches from server only when cache is expired or never fetched
|
|
25240
25436
|
* - `lastFetchedAt` is only updated on successful fetch
|
|
25241
|
-
* -
|
|
25437
|
+
* - reads query the follow cache live, so block/unblock changes are reflected
|
|
25438
|
+
* even within the TTL window
|
|
25242
25439
|
*
|
|
25243
25440
|
* @internal
|
|
25244
25441
|
*/
|
|
@@ -25246,12 +25443,7 @@ class BlockedUserSyncEngine {
|
|
|
25246
25443
|
constructor() {
|
|
25247
25444
|
/** Epoch ms of last successful fetch. null = never fetched in this session. */
|
|
25248
25445
|
this.lastFetchedAt = null;
|
|
25249
|
-
/** Ordered list of userId strings from the most recent successful fetch. */
|
|
25250
|
-
this.blockedUserIds = [];
|
|
25251
25446
|
}
|
|
25252
|
-
// ---------------------------------------------------------------------------
|
|
25253
|
-
// SessionComponent lifecycle
|
|
25254
|
-
// ---------------------------------------------------------------------------
|
|
25255
25447
|
/** No-op — fetch is lazy, triggered by consumer calling getAllBlockedUsers(). */
|
|
25256
25448
|
// eslint-disable-next-line class-methods-use-this
|
|
25257
25449
|
onSessionEstablished() {
|
|
@@ -25260,24 +25452,17 @@ class BlockedUserSyncEngine {
|
|
|
25260
25452
|
/** Resets state so the next session starts with a cold cache. */
|
|
25261
25453
|
onSessionDestroyed() {
|
|
25262
25454
|
this.lastFetchedAt = null;
|
|
25263
|
-
this.blockedUserIds = [];
|
|
25264
25455
|
}
|
|
25265
25456
|
/** No-op for this engine. */
|
|
25266
25457
|
// eslint-disable-next-line class-methods-use-this
|
|
25267
25458
|
onTokenExpired() {
|
|
25268
25459
|
// intentionally empty
|
|
25269
25460
|
}
|
|
25270
|
-
// ---------------------------------------------------------------------------
|
|
25271
|
-
// Cache helpers
|
|
25272
|
-
// ---------------------------------------------------------------------------
|
|
25273
25461
|
isCacheExpired() {
|
|
25274
25462
|
if (this.lastFetchedAt === null)
|
|
25275
25463
|
return true;
|
|
25276
|
-
return Date.now() - this.lastFetchedAt > TTL_MS;
|
|
25464
|
+
return Date.now() - this.lastFetchedAt > TTL_MS$1;
|
|
25277
25465
|
}
|
|
25278
|
-
// ---------------------------------------------------------------------------
|
|
25279
|
-
// Core fetch gate
|
|
25280
|
-
// ---------------------------------------------------------------------------
|
|
25281
25466
|
/**
|
|
25282
25467
|
* Ensures the local store is populated with fresh blocked-user data.
|
|
25283
25468
|
*
|
|
@@ -25293,52 +25478,50 @@ class BlockedUserSyncEngine {
|
|
|
25293
25478
|
if (!this.isCacheExpired())
|
|
25294
25479
|
return;
|
|
25295
25480
|
const client = getActiveClient();
|
|
25296
|
-
const { data } = await client.http.get('/api/v4/me/user-blocks', { params: { options: { limit: BLOCK_LIST_LIMIT }, isDeleted: false } });
|
|
25481
|
+
const { data } = await client.http.get('/api/v4/me/user-blocks', { params: { options: { limit: BLOCK_LIST_LIMIT$1 }, isDeleted: false } });
|
|
25297
25482
|
const cachedAt = client.cache && Date.now();
|
|
25298
25483
|
const payload = prepareBlockedUserPayload(data);
|
|
25299
25484
|
if (client.cache) {
|
|
25300
25485
|
ingestInCache(payload, { cachedAt });
|
|
25301
25486
|
}
|
|
25302
|
-
// Keep the ordered list of blocked user IDs for getCachedUsers()
|
|
25303
|
-
this.blockedUserIds = payload.users.map(u => u.userId);
|
|
25304
25487
|
// Only update timestamp on success — failure leaves it unchanged so the
|
|
25305
25488
|
// next call retries.
|
|
25306
25489
|
this.lastFetchedAt = Date.now();
|
|
25307
25490
|
}
|
|
25308
|
-
// ---------------------------------------------------------------------------
|
|
25309
|
-
// Local store read
|
|
25310
|
-
// ---------------------------------------------------------------------------
|
|
25311
25491
|
/**
|
|
25312
|
-
* Returns blocked
|
|
25313
|
-
*
|
|
25314
|
-
*
|
|
25315
|
-
*
|
|
25316
|
-
* - Hard limit of 100 results
|
|
25492
|
+
* Returns the blocked users by querying the follow cache live — the outgoing
|
|
25493
|
+
* direction (`from === me`, `status === 'blocked'`). Reading the cache (not a
|
|
25494
|
+
* fetched snapshot) means `blockUser()` / `unblockUser()` changes are reflected
|
|
25495
|
+
* even within the TTL window.
|
|
25317
25496
|
*
|
|
25318
|
-
*
|
|
25319
|
-
*
|
|
25497
|
+
* Applies the spec-mandated query:
|
|
25498
|
+
* - filter `from === currentUserId`, `status === 'blocked'`, blocked user not deleted
|
|
25499
|
+
* - sort by `updatedAt` DESC
|
|
25500
|
+
* - hard limit of 100 results
|
|
25320
25501
|
*/
|
|
25502
|
+
// eslint-disable-next-line class-methods-use-this
|
|
25321
25503
|
getCachedUsers() {
|
|
25504
|
+
var _a;
|
|
25322
25505
|
const client = getActiveClient();
|
|
25323
|
-
if (!client.cache)
|
|
25324
|
-
// No cache available — fall back to the in-memory list from the last fetch
|
|
25506
|
+
if (!client.cache)
|
|
25325
25507
|
return [];
|
|
25326
|
-
}
|
|
25327
|
-
return
|
|
25328
|
-
.map(
|
|
25508
|
+
const { userId } = client;
|
|
25509
|
+
return ((_a = queryCache(['follow', 'get'])) !== null && _a !== void 0 ? _a : [])
|
|
25510
|
+
.map(entry => entry.data)
|
|
25511
|
+
.filter(follow => (follow === null || follow === void 0 ? void 0 : follow.status) === 'blocked' && follow.from === userId)
|
|
25512
|
+
.sort((a, b) => { var _a, _b; return (((_a = a.updatedAt) !== null && _a !== void 0 ? _a : '') < ((_b = b.updatedAt) !== null && _b !== void 0 ? _b : '') ? 1 : -1); })
|
|
25513
|
+
.map(follow => { var _a; return (_a = pullFromCache(['user', 'get', follow.to])) === null || _a === void 0 ? void 0 : _a.data; })
|
|
25329
25514
|
.filter((user) => user != null && user.isDeleted !== true)
|
|
25330
|
-
.slice(0, BLOCK_LIST_LIMIT)
|
|
25515
|
+
.slice(0, BLOCK_LIST_LIMIT$1)
|
|
25516
|
+
.map(userLinkedObject);
|
|
25331
25517
|
}
|
|
25332
25518
|
}
|
|
25333
|
-
|
|
25334
|
-
// Module-level singleton
|
|
25335
|
-
// ---------------------------------------------------------------------------
|
|
25336
|
-
let instance$2 = null;
|
|
25519
|
+
let instance$3 = null;
|
|
25337
25520
|
var BlockedUserSyncEngine$1 = {
|
|
25338
25521
|
getInstance: () => {
|
|
25339
|
-
if (!instance$
|
|
25340
|
-
instance$
|
|
25341
|
-
return instance$
|
|
25522
|
+
if (!instance$3)
|
|
25523
|
+
instance$3 = new BlockedUserSyncEngine();
|
|
25524
|
+
return instance$3;
|
|
25342
25525
|
},
|
|
25343
25526
|
};
|
|
25344
25527
|
|
|
@@ -25360,6 +25543,224 @@ var blockedUserSyncEngineOnLoginHandler = () => {
|
|
|
25360
25543
|
};
|
|
25361
25544
|
};
|
|
25362
25545
|
|
|
25546
|
+
function prepareBlockingUserPayload(response) {
|
|
25547
|
+
const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
|
|
25548
|
+
return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
|
|
25549
|
+
const followUser = users.find(user => user.userId === follow.from);
|
|
25550
|
+
return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
|
|
25551
|
+
}), users: users.map(convertRawUserToInternalUser) });
|
|
25552
|
+
}
|
|
25553
|
+
|
|
25554
|
+
const BLOCK_LIST_LIMIT = 100;
|
|
25555
|
+
const TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
25556
|
+
/**
|
|
25557
|
+
* Session-scoped singleton engine that manages TTL-based fetching and caching
|
|
25558
|
+
* of blocking users (the "blocked-by" list — users who blocked the current
|
|
25559
|
+
* user). Provides a lazy `ensureFetched()` gate for the `getAllBlockingUsers()`
|
|
25560
|
+
* API. Directional inverse of {@link BlockedUserSyncEngine}.
|
|
25561
|
+
*
|
|
25562
|
+
* Key behaviours:
|
|
25563
|
+
* - `onSessionEstablished()` is a no-op — fetch is lazy, triggered only by consumer call
|
|
25564
|
+
* - `onSessionDestroyed()` resets `lastFetchedAt` to null (ensures fresh fetch on next session)
|
|
25565
|
+
* - `ensureFetched()` fetches from server only when cache is expired or never fetched
|
|
25566
|
+
* - `lastFetchedAt` is only updated on successful fetch
|
|
25567
|
+
* - reads query the follow cache live, so block/unblock changes are reflected
|
|
25568
|
+
* even within the TTL window
|
|
25569
|
+
*
|
|
25570
|
+
* @internal
|
|
25571
|
+
*/
|
|
25572
|
+
class BlockingUserSyncEngine {
|
|
25573
|
+
constructor() {
|
|
25574
|
+
/** Epoch ms of last successful fetch. null = never fetched in this session. */
|
|
25575
|
+
this.lastFetchedAt = null;
|
|
25576
|
+
}
|
|
25577
|
+
/** No-op — fetch is lazy, triggered by consumer calling getAllBlockingUsers(). */
|
|
25578
|
+
// eslint-disable-next-line class-methods-use-this
|
|
25579
|
+
onSessionEstablished() {
|
|
25580
|
+
// intentionally empty
|
|
25581
|
+
}
|
|
25582
|
+
/** Resets state so the next session starts with a cold cache. */
|
|
25583
|
+
onSessionDestroyed() {
|
|
25584
|
+
this.lastFetchedAt = null;
|
|
25585
|
+
}
|
|
25586
|
+
/** No-op for this engine. */
|
|
25587
|
+
// eslint-disable-next-line class-methods-use-this
|
|
25588
|
+
onTokenExpired() {
|
|
25589
|
+
// intentionally empty
|
|
25590
|
+
}
|
|
25591
|
+
isCacheExpired() {
|
|
25592
|
+
if (this.lastFetchedAt === null)
|
|
25593
|
+
return true;
|
|
25594
|
+
return Date.now() - this.lastFetchedAt > TTL_MS;
|
|
25595
|
+
}
|
|
25596
|
+
/**
|
|
25597
|
+
* Ensures the local store is populated with fresh blocking-user data.
|
|
25598
|
+
*
|
|
25599
|
+
* - If the cache is still within the 5-minute TTL window: resolves immediately
|
|
25600
|
+
* (no server call).
|
|
25601
|
+
* - If the cache is expired (or never fetched): fetches from the server,
|
|
25602
|
+
* persists the payload to the cache, and updates `lastFetchedAt`.
|
|
25603
|
+
*
|
|
25604
|
+
* On failure the error propagates to the caller and `lastFetchedAt` is NOT
|
|
25605
|
+
* updated, so the next call will retry.
|
|
25606
|
+
*/
|
|
25607
|
+
async ensureFetched() {
|
|
25608
|
+
if (!this.isCacheExpired())
|
|
25609
|
+
return;
|
|
25610
|
+
const client = getActiveClient();
|
|
25611
|
+
const { data } = await client.http.get('/api/v4/me/blockers', { params: { options: { limit: BLOCK_LIST_LIMIT }, isDeleted: false } });
|
|
25612
|
+
const cachedAt = client.cache && Date.now();
|
|
25613
|
+
const payload = prepareBlockingUserPayload(data);
|
|
25614
|
+
if (client.cache) {
|
|
25615
|
+
ingestInCache(payload, { cachedAt });
|
|
25616
|
+
}
|
|
25617
|
+
// Only update timestamp on success — failure leaves it unchanged so the
|
|
25618
|
+
// next call retries.
|
|
25619
|
+
this.lastFetchedAt = Date.now();
|
|
25620
|
+
}
|
|
25621
|
+
/**
|
|
25622
|
+
* Returns the "blocked-by" users by querying the follow cache live — the
|
|
25623
|
+
* incoming direction (`to === me`, `status === 'blocked'`). Reading the cache
|
|
25624
|
+
* (not a fetched snapshot) means RTE `user.didBlock` / `user.didUnblock`
|
|
25625
|
+
* changes are reflected even within the TTL window.
|
|
25626
|
+
*
|
|
25627
|
+
* Applies the spec-mandated query (REQ-012/013/014):
|
|
25628
|
+
* - filter `to === currentUserId`, `status === 'blocked'`, blocker not deleted
|
|
25629
|
+
* - sort by `updatedAt` DESC
|
|
25630
|
+
* - hard limit of 100 results
|
|
25631
|
+
*/
|
|
25632
|
+
// eslint-disable-next-line class-methods-use-this
|
|
25633
|
+
getCachedUsers() {
|
|
25634
|
+
var _a;
|
|
25635
|
+
const client = getActiveClient();
|
|
25636
|
+
if (!client.cache)
|
|
25637
|
+
return [];
|
|
25638
|
+
const { userId } = client;
|
|
25639
|
+
return ((_a = queryCache(['follow', 'get'])) !== null && _a !== void 0 ? _a : [])
|
|
25640
|
+
.map(entry => entry.data)
|
|
25641
|
+
.filter(follow => (follow === null || follow === void 0 ? void 0 : follow.status) === 'blocked' && follow.to === userId)
|
|
25642
|
+
.sort((a, b) => { var _a, _b; return (((_a = a.updatedAt) !== null && _a !== void 0 ? _a : '') < ((_b = b.updatedAt) !== null && _b !== void 0 ? _b : '') ? 1 : -1); })
|
|
25643
|
+
.map(follow => { var _a; return (_a = pullFromCache(['user', 'get', follow.from])) === null || _a === void 0 ? void 0 : _a.data; })
|
|
25644
|
+
.filter((user) => user != null && user.isDeleted !== true)
|
|
25645
|
+
.slice(0, BLOCK_LIST_LIMIT)
|
|
25646
|
+
.map(userLinkedObject);
|
|
25647
|
+
}
|
|
25648
|
+
}
|
|
25649
|
+
let instance$2 = null;
|
|
25650
|
+
var BlockingUserSyncEngine$1 = {
|
|
25651
|
+
getInstance: () => {
|
|
25652
|
+
if (!instance$2)
|
|
25653
|
+
instance$2 = new BlockingUserSyncEngine();
|
|
25654
|
+
return instance$2;
|
|
25655
|
+
},
|
|
25656
|
+
};
|
|
25657
|
+
|
|
25658
|
+
var blockingUserSyncEngineOnLoginHandler = () => {
|
|
25659
|
+
const blockingUserSyncEngine = BlockingUserSyncEngine$1.getInstance();
|
|
25660
|
+
onSessionStateChange(state => {
|
|
25661
|
+
if (state === "established" /* Amity.SessionStates.ESTABLISHED */) {
|
|
25662
|
+
blockingUserSyncEngine.onSessionEstablished();
|
|
25663
|
+
}
|
|
25664
|
+
else if (state === "tokenExpired" /* Amity.SessionStates.TOKEN_EXPIRED */) {
|
|
25665
|
+
blockingUserSyncEngine.onTokenExpired();
|
|
25666
|
+
}
|
|
25667
|
+
else {
|
|
25668
|
+
blockingUserSyncEngine.onSessionDestroyed();
|
|
25669
|
+
}
|
|
25670
|
+
});
|
|
25671
|
+
return () => {
|
|
25672
|
+
blockingUserSyncEngine.onSessionDestroyed();
|
|
25673
|
+
};
|
|
25674
|
+
};
|
|
25675
|
+
|
|
25676
|
+
function prepareFollowersPayload(response) {
|
|
25677
|
+
const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
|
|
25678
|
+
return Object.assign(Object.assign({}, rest), { follows, users: users.map(convertRawUserToInternalUser) });
|
|
25679
|
+
}
|
|
25680
|
+
function prepareFollowingsPayload(response) {
|
|
25681
|
+
const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
|
|
25682
|
+
return Object.assign(Object.assign({}, rest), { follows, users: users.map(convertRawUserToInternalUser) });
|
|
25683
|
+
}
|
|
25684
|
+
function prepareFollowStatusPayload(response) {
|
|
25685
|
+
const { follows } = response, rest = __rest(response, ["follows"]);
|
|
25686
|
+
return Object.assign(Object.assign({}, rest), { follows });
|
|
25687
|
+
}
|
|
25688
|
+
|
|
25689
|
+
/**
|
|
25690
|
+
* Subscribes to a block MQTT event (`user.didBlock` / `user.didUnblock`),
|
|
25691
|
+
* ingests the carried `FollowersPayload` (follows + users) into the cache so
|
|
25692
|
+
* the block-relationship rows (`['follow', 'get', from#to]`) and user rows are
|
|
25693
|
+
* kept current, then forwards the affected {@link Amity.FollowStatus} to the
|
|
25694
|
+
* caller.
|
|
25695
|
+
*
|
|
25696
|
+
* @hidden
|
|
25697
|
+
*/
|
|
25698
|
+
const createBlockEventSubscriber = (event, callback) => {
|
|
25699
|
+
const client = getActiveClient();
|
|
25700
|
+
const filter = (data) => {
|
|
25701
|
+
const payload = prepareFollowersPayload(data);
|
|
25702
|
+
if (client.cache) {
|
|
25703
|
+
ingestInCache(payload);
|
|
25704
|
+
}
|
|
25705
|
+
callback(payload.follows[0]);
|
|
25706
|
+
};
|
|
25707
|
+
return createEventSubscriber(client, event, event, filter);
|
|
25708
|
+
};
|
|
25709
|
+
|
|
25710
|
+
/**
|
|
25711
|
+
* ```js
|
|
25712
|
+
* import { onUserDidBlock } from '@amityco/ts-sdk'
|
|
25713
|
+
* const dispose = onUserDidBlock(status => {
|
|
25714
|
+
* // ...
|
|
25715
|
+
* })
|
|
25716
|
+
* ```
|
|
25717
|
+
*
|
|
25718
|
+
* Fired when a block relationship is created in real time — either a user
|
|
25719
|
+
* blocks the current user (incoming) or the current user blocks someone on
|
|
25720
|
+
* another device (outgoing). The local block-relationship store is updated
|
|
25721
|
+
* before the callback runs.
|
|
25722
|
+
*
|
|
25723
|
+
* @param callback The function to call when the event was fired
|
|
25724
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
25725
|
+
*
|
|
25726
|
+
* @category Block Events
|
|
25727
|
+
*/
|
|
25728
|
+
const onUserDidBlock = (callback) => createBlockEventSubscriber('user.didBlock', callback);
|
|
25729
|
+
|
|
25730
|
+
/**
|
|
25731
|
+
* ```js
|
|
25732
|
+
* import { onUserDidUnblock } from '@amityco/ts-sdk'
|
|
25733
|
+
* const dispose = onUserDidUnblock(status => {
|
|
25734
|
+
* // ...
|
|
25735
|
+
* })
|
|
25736
|
+
* ```
|
|
25737
|
+
*
|
|
25738
|
+
* Fired when a block relationship is removed in real time — either a user
|
|
25739
|
+
* unblocks the current user (incoming) or the current user unblocks someone on
|
|
25740
|
+
* another device (outgoing). The local block-relationship store is updated
|
|
25741
|
+
* before the callback runs.
|
|
25742
|
+
*
|
|
25743
|
+
* @param callback The function to call when the event was fired
|
|
25744
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
25745
|
+
*
|
|
25746
|
+
* @category Block Events
|
|
25747
|
+
*/
|
|
25748
|
+
const onUserDidUnblock = (callback) => createBlockEventSubscriber('user.didUnblock', callback);
|
|
25749
|
+
|
|
25750
|
+
/**
|
|
25751
|
+
* Keeps the follow cache current for incoming/outgoing block changes for the
|
|
25752
|
+
* whole session — the ingest happens as a side effect inside
|
|
25753
|
+
* createBlockEventSubscriber, so the one-shot `getAllBlockedUsers()` /
|
|
25754
|
+
* `getAllBlockingUsers()` reflect RTE block/unblock within the TTL window.
|
|
25755
|
+
*
|
|
25756
|
+
* Registered via `setupLoginSubscriptions`; the returned unsubscriber is torn
|
|
25757
|
+
* down on logout.
|
|
25758
|
+
*/
|
|
25759
|
+
var blockRealtimeOnLoginHandler = () => {
|
|
25760
|
+
const disposers = [onUserDidBlock(() => { }), onUserDidUnblock(() => { })];
|
|
25761
|
+
return () => disposers.forEach(dispose => dispose());
|
|
25762
|
+
};
|
|
25763
|
+
|
|
25363
25764
|
class CursorController {
|
|
25364
25765
|
constructor(networkId, userId) {
|
|
25365
25766
|
this.networkId = networkId;
|
|
@@ -25399,7 +25800,11 @@ class CursorController {
|
|
|
25399
25800
|
const parsed = JSON.parse(raw);
|
|
25400
25801
|
if (typeof (parsed === null || parsed === void 0 ? void 0 : parsed.cursor) !== 'string' || typeof (parsed === null || parsed === void 0 ? void 0 : parsed.expiredAt) !== 'number')
|
|
25401
25802
|
return null;
|
|
25402
|
-
return {
|
|
25803
|
+
return {
|
|
25804
|
+
cursor: parsed.cursor,
|
|
25805
|
+
expiredAt: parsed.expiredAt,
|
|
25806
|
+
reachedEndOfFeed: parsed.reachedEndOfFeed === true,
|
|
25807
|
+
};
|
|
25403
25808
|
}
|
|
25404
25809
|
catch (_a) {
|
|
25405
25810
|
return null;
|
|
@@ -25408,6 +25813,15 @@ class CursorController {
|
|
|
25408
25813
|
async set(value) {
|
|
25409
25814
|
await setItem(this.key, JSON.stringify(value));
|
|
25410
25815
|
}
|
|
25816
|
+
async markReachedEndOfFeed(expiredAt) {
|
|
25817
|
+
var _a;
|
|
25818
|
+
const stored = await this.get();
|
|
25819
|
+
await this.set({
|
|
25820
|
+
cursor: (_a = stored === null || stored === void 0 ? void 0 : stored.cursor) !== null && _a !== void 0 ? _a : '',
|
|
25821
|
+
expiredAt,
|
|
25822
|
+
reachedEndOfFeed: true,
|
|
25823
|
+
});
|
|
25824
|
+
}
|
|
25411
25825
|
async clear() {
|
|
25412
25826
|
await setItem(this.key, '');
|
|
25413
25827
|
}
|
|
@@ -25602,7 +26016,7 @@ const setupLoginSubscriptions = (unsubWatcher) => {
|
|
|
25602
26016
|
// NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
|
|
25603
26017
|
// the channel because currently backend can't handle this, so every time a user is banned from
|
|
25604
26018
|
// a channel or the channel is deleted the channel's unread count will not be reset to zero
|
|
25605
|
-
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler(), blockedUserSyncEngineOnLoginHandler(), CursorController.clearOnLogout());
|
|
26019
|
+
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler(), blockedUserSyncEngineOnLoginHandler(), blockingUserSyncEngineOnLoginHandler(), blockRealtimeOnLoginHandler(), resetAutoSubscriptionsOnLogout(), CursorController.clearOnLogout());
|
|
25606
26020
|
if (client.useLegacyUnreadCount) {
|
|
25607
26021
|
subscriptions.push(readReceiptSyncEngineOnLoginHandler());
|
|
25608
26022
|
}
|
|
@@ -26683,14 +27097,17 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
|
|
|
26683
27097
|
validateUrls,
|
|
26684
27098
|
validateTexts,
|
|
26685
27099
|
getFeedSettings,
|
|
27100
|
+
getCoreUserSettings,
|
|
26686
27101
|
getSocialSettings,
|
|
27102
|
+
getChatSettings,
|
|
26687
27103
|
getVisitorDeviceId: getDeviceId,
|
|
26688
|
-
getMessagePreviewSetting,
|
|
27104
|
+
getMessagePreviewSetting: getMessagePreviewSetting$1,
|
|
26689
27105
|
use: () => setActiveClient(client),
|
|
26690
27106
|
isUnreadCountEnabled,
|
|
26691
27107
|
useLegacyUnreadCount,
|
|
26692
27108
|
getMarkerSyncConsistentMode,
|
|
26693
27109
|
getProductCatalogueSetting,
|
|
27110
|
+
getForYouFeedSetting,
|
|
26694
27111
|
/**
|
|
26695
27112
|
* Prefix for the deviceId key in the local storage or async storage.
|
|
26696
27113
|
* This is allow user to have multiple SDK client and Mqtt client within the same app.
|
|
@@ -27327,6 +27744,71 @@ class Notifications {
|
|
|
27327
27744
|
}
|
|
27328
27745
|
const notifications = () => new Notifications();
|
|
27329
27746
|
|
|
27747
|
+
/* begin_public_function
|
|
27748
|
+
id: client.enable_auto_subscriptions
|
|
27749
|
+
*/
|
|
27750
|
+
/**
|
|
27751
|
+
* ```js
|
|
27752
|
+
* import { Client, AmityAutoSubscription } from '@amityco/ts-sdk'
|
|
27753
|
+
* Client.enableAutoSubscriptions([AmityAutoSubscription.BLOCK])
|
|
27754
|
+
* ```
|
|
27755
|
+
*
|
|
27756
|
+
* Enables one or more managed auto-subscription handles. Managed handles are
|
|
27757
|
+
* re-applied on every (re)connect and ref-counted. All handles are on by
|
|
27758
|
+
* default; use this to re-enable handles previously turned off via
|
|
27759
|
+
* {@link disableAutoSubscriptions}. Synchronous fire-and-forget — the registry
|
|
27760
|
+
* updates immediately and the broker subscribe is retried on reconnect.
|
|
27761
|
+
*
|
|
27762
|
+
* @param features the {@link AmityAutoSubscription} handles to enable
|
|
27763
|
+
*
|
|
27764
|
+
* @category Client API
|
|
27765
|
+
*/
|
|
27766
|
+
const enableAutoSubscriptions = (features) => {
|
|
27767
|
+
const manager = getAutoSubscriptionManager();
|
|
27768
|
+
features.forEach(feature => manager.subscribe(feature));
|
|
27769
|
+
};
|
|
27770
|
+
/* end_public_function */
|
|
27771
|
+
/* begin_public_function
|
|
27772
|
+
id: client.disable_auto_subscriptions
|
|
27773
|
+
*/
|
|
27774
|
+
/**
|
|
27775
|
+
* ```js
|
|
27776
|
+
* import { Client, AmityAutoSubscription } from '@amityco/ts-sdk'
|
|
27777
|
+
* Client.disableAutoSubscriptions([AmityAutoSubscription.LIVESTREAM])
|
|
27778
|
+
* ```
|
|
27779
|
+
*
|
|
27780
|
+
* Disables one or more managed auto-subscription handles. The change persists
|
|
27781
|
+
* across reconnect (it is not silently re-enabled) until
|
|
27782
|
+
* {@link enableAutoSubscriptions} is called again. Synchronous fire-and-forget.
|
|
27783
|
+
*
|
|
27784
|
+
* @param features the {@link AmityAutoSubscription} handles to disable
|
|
27785
|
+
*
|
|
27786
|
+
* @category Client API
|
|
27787
|
+
*/
|
|
27788
|
+
const disableAutoSubscriptions = (features) => {
|
|
27789
|
+
const manager = getAutoSubscriptionManager();
|
|
27790
|
+
features.forEach(feature => manager.unsubscribe(feature));
|
|
27791
|
+
};
|
|
27792
|
+
/* end_public_function */
|
|
27793
|
+
/* begin_public_function
|
|
27794
|
+
id: client.auto_subscriptions
|
|
27795
|
+
*/
|
|
27796
|
+
/**
|
|
27797
|
+
* ```js
|
|
27798
|
+
* import { Client } from '@amityco/ts-sdk'
|
|
27799
|
+
* Client.autoSubscriptions().forEach(s => console.log(s.feature, s.isActive, s.topicCount))
|
|
27800
|
+
* ```
|
|
27801
|
+
*
|
|
27802
|
+
* Inspects the managed auto-subscription registry — each handle's `isActive`,
|
|
27803
|
+
* `isSystem`, and `topicCount`.
|
|
27804
|
+
*
|
|
27805
|
+
* @returns a snapshot of the managed subscription registry
|
|
27806
|
+
*
|
|
27807
|
+
* @category Client API
|
|
27808
|
+
*/
|
|
27809
|
+
const autoSubscriptions = () => getAutoSubscriptionManager().subscriptions();
|
|
27810
|
+
/* end_public_function */
|
|
27811
|
+
|
|
27330
27812
|
/**
|
|
27331
27813
|
* ```js
|
|
27332
27814
|
* import { onChannelMarkerFetched } from '@amityco/ts-sdk'
|
|
@@ -27701,6 +28183,7 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
27701
28183
|
getSocialSettings: getSocialSettings,
|
|
27702
28184
|
getShareableLinkConfiguration: getShareableLinkConfiguration,
|
|
27703
28185
|
getProductCatalogueSetting: getProductCatalogueSetting,
|
|
28186
|
+
getForYouFeedSetting: getForYouFeedSetting,
|
|
27704
28187
|
loginAsVisitor: loginAsVisitor,
|
|
27705
28188
|
loginAsBot: loginAsBot,
|
|
27706
28189
|
getCurrentUser: getCurrentUser,
|
|
@@ -27708,7 +28191,11 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
27708
28191
|
setCurrentUserType: setCurrentUserType,
|
|
27709
28192
|
setAccessTokenHandler: setAccessTokenHandler,
|
|
27710
28193
|
getChatSettings: getChatSettings,
|
|
28194
|
+
getCoreUserSettings: getCoreUserSettings,
|
|
27711
28195
|
notifications: notifications,
|
|
28196
|
+
enableAutoSubscriptions: enableAutoSubscriptions,
|
|
28197
|
+
disableAutoSubscriptions: disableAutoSubscriptions,
|
|
28198
|
+
autoSubscriptions: autoSubscriptions,
|
|
27712
28199
|
onConnectionError: onConnectionError,
|
|
27713
28200
|
onClientDisconnected: onClientDisconnected,
|
|
27714
28201
|
onClientBanned: onClientBanned,
|
|
@@ -27726,19 +28213,6 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
27726
28213
|
getMarkerSyncConsistentMode: getMarkerSyncConsistentMode
|
|
27727
28214
|
});
|
|
27728
28215
|
|
|
27729
|
-
function prepareFollowersPayload(response) {
|
|
27730
|
-
const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
|
|
27731
|
-
return Object.assign(Object.assign({}, rest), { follows, users: users.map(convertRawUserToInternalUser) });
|
|
27732
|
-
}
|
|
27733
|
-
function prepareFollowingsPayload(response) {
|
|
27734
|
-
const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
|
|
27735
|
-
return Object.assign(Object.assign({}, rest), { follows, users: users.map(convertRawUserToInternalUser) });
|
|
27736
|
-
}
|
|
27737
|
-
function prepareFollowStatusPayload(response) {
|
|
27738
|
-
const { follows } = response, rest = __rest(response, ["follows"]);
|
|
27739
|
-
return Object.assign(Object.assign({}, rest), { follows });
|
|
27740
|
-
}
|
|
27741
|
-
|
|
27742
28216
|
/* begin_public_function
|
|
27743
28217
|
id: user.relationship.block
|
|
27744
28218
|
*/
|
|
@@ -28916,6 +29390,8 @@ var index$r = /*#__PURE__*/Object.freeze({
|
|
|
28916
29390
|
__proto__: null,
|
|
28917
29391
|
blockUser: blockUser,
|
|
28918
29392
|
unBlockUser: unBlockUser,
|
|
29393
|
+
onUserDidBlock: onUserDidBlock,
|
|
29394
|
+
onUserDidUnblock: onUserDidUnblock,
|
|
28919
29395
|
follow: follow,
|
|
28920
29396
|
unfollow: unfollow,
|
|
28921
29397
|
acceptMyFollower: acceptMyFollower,
|
|
@@ -29745,7 +30221,7 @@ const getWatchSessionStorage = () => {
|
|
|
29745
30221
|
return storageInstance;
|
|
29746
30222
|
};
|
|
29747
30223
|
|
|
29748
|
-
const privateKey = "
|
|
30224
|
+
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-----";
|
|
29749
30225
|
/*
|
|
29750
30226
|
* The crypto algorithm used for importing key and signing string
|
|
29751
30227
|
*/
|
|
@@ -31630,7 +32106,7 @@ const createEventResponseSubscriber = (event, callback) => {
|
|
|
31630
32106
|
const eventResponse = pullFromCache([
|
|
31631
32107
|
'eventResponse',
|
|
31632
32108
|
'get',
|
|
31633
|
-
|
|
32109
|
+
unpackedPayload.eventResponses[0].userId,
|
|
31634
32110
|
]);
|
|
31635
32111
|
callback(eventResponse.data);
|
|
31636
32112
|
}
|
|
@@ -32294,7 +32770,38 @@ const getAllBlockedUsers = async () => {
|
|
|
32294
32770
|
const engine = BlockedUserSyncEngine$1.getInstance();
|
|
32295
32771
|
// Ensure data is fetched (no-op if cache is fresh)
|
|
32296
32772
|
await engine.ensureFetched();
|
|
32297
|
-
|
|
32773
|
+
return engine.getCachedUsers();
|
|
32774
|
+
};
|
|
32775
|
+
/* end_public_function */
|
|
32776
|
+
|
|
32777
|
+
/* begin_public_function
|
|
32778
|
+
id: user.get_all_blocking_users
|
|
32779
|
+
*/
|
|
32780
|
+
/**
|
|
32781
|
+
* ```js
|
|
32782
|
+
* import { UserRepository } from '@amityco/ts-sdk'
|
|
32783
|
+
* const blockingUsers = await UserRepository.getAllBlockingUsers()
|
|
32784
|
+
* ```
|
|
32785
|
+
*
|
|
32786
|
+
* Returns all users who have blocked the current user
|
|
32787
|
+
* non-paginated list (limit 100) with TTL-based caching (5-minute window). Within the
|
|
32788
|
+
* TTL window, subsequent calls resolve instantly from the local store without any
|
|
32789
|
+
* server call. After the TTL expires, the next call triggers a fresh server fetch.
|
|
32790
|
+
*
|
|
32791
|
+
* The directional inverse of {@link getAllBlockedUsers}.
|
|
32792
|
+
*
|
|
32793
|
+
* @returns A promise that resolves to an array of blocking {@link Amity.User} objects
|
|
32794
|
+
*
|
|
32795
|
+
* @category Block API
|
|
32796
|
+
* @async
|
|
32797
|
+
*/
|
|
32798
|
+
const getAllBlockingUsers = async () => {
|
|
32799
|
+
const client = getActiveClient();
|
|
32800
|
+
client.log('user/getAllBlockingUsers');
|
|
32801
|
+
const engine = BlockingUserSyncEngine$1.getInstance();
|
|
32802
|
+
// Ensure data is fetched (no-op if cache is fresh)
|
|
32803
|
+
await engine.ensureFetched();
|
|
32804
|
+
// Read from the engine's bounded ID list — O(blocking users) not O(cache size)
|
|
32298
32805
|
return engine.getCachedUsers();
|
|
32299
32806
|
};
|
|
32300
32807
|
/* end_public_function */
|
|
@@ -32677,6 +33184,12 @@ class BlockedUserPaginationController extends PaginationController {
|
|
|
32677
33184
|
}
|
|
32678
33185
|
}
|
|
32679
33186
|
|
|
33187
|
+
var EnumBlockActions;
|
|
33188
|
+
(function (EnumBlockActions) {
|
|
33189
|
+
EnumBlockActions["OnBlocked"] = "onBlocked";
|
|
33190
|
+
EnumBlockActions["OnUnblocked"] = "onUnblocked";
|
|
33191
|
+
})(EnumBlockActions || (EnumBlockActions = {}));
|
|
33192
|
+
|
|
32680
33193
|
class BlockedUserQueryStreamController extends QueryStreamController {
|
|
32681
33194
|
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
32682
33195
|
super(query, cacheKey);
|
|
@@ -32706,11 +33219,16 @@ class BlockedUserQueryStreamController extends QueryStreamController {
|
|
|
32706
33219
|
}
|
|
32707
33220
|
reactor(action) {
|
|
32708
33221
|
return (targetUser) => {
|
|
32709
|
-
var _a;
|
|
32710
|
-
|
|
33222
|
+
var _a, _b;
|
|
33223
|
+
const isRemoval = action === EnumFollowActions.OnFollowed || action === EnumBlockActions.OnUnblocked;
|
|
33224
|
+
const isAddition = action === EnumBlockActions.OnBlocked;
|
|
33225
|
+
if (isRemoval || isAddition) {
|
|
32711
33226
|
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
32712
|
-
const
|
|
32713
|
-
|
|
33227
|
+
const ids = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
33228
|
+
const data = isAddition
|
|
33229
|
+
? [...new Set([...ids, targetUser.userId])]
|
|
33230
|
+
: ids.filter(id => id !== targetUser.userId);
|
|
33231
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data }));
|
|
32714
33232
|
}
|
|
32715
33233
|
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
32716
33234
|
};
|
|
@@ -32765,7 +33283,6 @@ class BlockedUserLiveCollectionController extends LiveCollectionController {
|
|
|
32765
33283
|
fn: onUserDeleted$2,
|
|
32766
33284
|
action: EnumUserActions.OnUserDeleted,
|
|
32767
33285
|
},
|
|
32768
|
-
// In the case of unblocking a user, we need to subscribe to the follow events
|
|
32769
33286
|
{
|
|
32770
33287
|
fn: convertEventPayload(onLocalUserFollowed, 'to', 'user'),
|
|
32771
33288
|
action: EnumFollowActions.OnFollowed,
|
|
@@ -32774,6 +33291,28 @@ class BlockedUserLiveCollectionController extends LiveCollectionController {
|
|
|
32774
33291
|
fn: convertEventPayload(onUserFollowed, 'to', 'user'),
|
|
32775
33292
|
action: EnumFollowActions.OnFollowed,
|
|
32776
33293
|
},
|
|
33294
|
+
{
|
|
33295
|
+
fn: (reactor) => onUserDidBlock(status => {
|
|
33296
|
+
var _a;
|
|
33297
|
+
if (status.from !== getActiveClient().userId)
|
|
33298
|
+
return;
|
|
33299
|
+
const blocked = (_a = pullFromCache(['user', 'get', status.to])) === null || _a === void 0 ? void 0 : _a.data;
|
|
33300
|
+
if (blocked)
|
|
33301
|
+
reactor(blocked);
|
|
33302
|
+
}),
|
|
33303
|
+
action: EnumBlockActions.OnBlocked,
|
|
33304
|
+
},
|
|
33305
|
+
{
|
|
33306
|
+
fn: (reactor) => onUserDidUnblock(status => {
|
|
33307
|
+
var _a;
|
|
33308
|
+
if (status.from !== getActiveClient().userId)
|
|
33309
|
+
return;
|
|
33310
|
+
const blocked = (_a = pullFromCache(['user', 'get', status.to])) === null || _a === void 0 ? void 0 : _a.data;
|
|
33311
|
+
if (blocked)
|
|
33312
|
+
reactor(blocked);
|
|
33313
|
+
}),
|
|
33314
|
+
action: EnumBlockActions.OnUnblocked,
|
|
33315
|
+
},
|
|
32777
33316
|
]);
|
|
32778
33317
|
}
|
|
32779
33318
|
notifyChange({ origin, loading, error }) {
|
|
@@ -32841,6 +33380,184 @@ const getBlockedUsers = (params, callback, config) => {
|
|
|
32841
33380
|
};
|
|
32842
33381
|
/* end_public_function */
|
|
32843
33382
|
|
|
33383
|
+
class BlockingUserQueryStreamController extends QueryStreamController {
|
|
33384
|
+
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
33385
|
+
super(query, cacheKey);
|
|
33386
|
+
this.notifyChange = notifyChange;
|
|
33387
|
+
this.preparePayload = preparePayload;
|
|
33388
|
+
}
|
|
33389
|
+
async saveToMainDB(response) {
|
|
33390
|
+
const processedPayload = await this.preparePayload(response);
|
|
33391
|
+
const client = getActiveClient();
|
|
33392
|
+
const cachedAt = client.cache && Date.now();
|
|
33393
|
+
if (client.cache) {
|
|
33394
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
33395
|
+
}
|
|
33396
|
+
}
|
|
33397
|
+
appendToQueryStream(response, direction, refresh = false) {
|
|
33398
|
+
var _a, _b;
|
|
33399
|
+
if (refresh) {
|
|
33400
|
+
pushToCache(this.cacheKey, {
|
|
33401
|
+
data: response.users.map(getResolver('user')),
|
|
33402
|
+
});
|
|
33403
|
+
}
|
|
33404
|
+
else {
|
|
33405
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
33406
|
+
const users = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
33407
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...users, ...response.users.map(getResolver('user'))])] }));
|
|
33408
|
+
}
|
|
33409
|
+
}
|
|
33410
|
+
reactor(action) {
|
|
33411
|
+
return (user) => {
|
|
33412
|
+
var _a, _b;
|
|
33413
|
+
if (user &&
|
|
33414
|
+
(action === EnumBlockActions.OnBlocked || action === EnumBlockActions.OnUnblocked)) {
|
|
33415
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
33416
|
+
const ids = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
33417
|
+
const data = action === EnumBlockActions.OnBlocked
|
|
33418
|
+
? [...new Set([...ids, user.userId])]
|
|
33419
|
+
: ids.filter(id => id !== user.userId);
|
|
33420
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data }));
|
|
33421
|
+
}
|
|
33422
|
+
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
33423
|
+
};
|
|
33424
|
+
}
|
|
33425
|
+
subscribeRTE(createSubscriber) {
|
|
33426
|
+
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
33427
|
+
}
|
|
33428
|
+
}
|
|
33429
|
+
|
|
33430
|
+
class BlockingUserPaginationController extends PaginationController {
|
|
33431
|
+
async getRequest(queryParams, token) {
|
|
33432
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_SIZE } = queryParams, params = __rest(queryParams, ["limit"]);
|
|
33433
|
+
const options = token ? { token } : { limit };
|
|
33434
|
+
const { data: queryResponse } = await this.http.get('/api/v4/me/blockers', {
|
|
33435
|
+
params: Object.assign(Object.assign({}, params), { options, isDeleted: false }),
|
|
33436
|
+
});
|
|
33437
|
+
return queryResponse;
|
|
33438
|
+
}
|
|
33439
|
+
}
|
|
33440
|
+
|
|
33441
|
+
class BlockingUserLiveCollectionController extends LiveCollectionController {
|
|
33442
|
+
constructor(callback) {
|
|
33443
|
+
const queryStreamId = `blocking-users-${getActiveClient().userId}`;
|
|
33444
|
+
const query = {};
|
|
33445
|
+
const cacheKey = ['blockingUsers', 'collection', queryStreamId];
|
|
33446
|
+
const paginationController = new BlockingUserPaginationController(query);
|
|
33447
|
+
super(paginationController, queryStreamId, cacheKey, callback);
|
|
33448
|
+
this.queryStreamController = new BlockingUserQueryStreamController(query, this.cacheKey, this.notifyChange.bind(this), prepareBlockingUserPayload);
|
|
33449
|
+
this.callback = callback.bind(this);
|
|
33450
|
+
this.loadPage({ initial: true });
|
|
33451
|
+
}
|
|
33452
|
+
setup() {
|
|
33453
|
+
var _a;
|
|
33454
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
33455
|
+
if (!collection) {
|
|
33456
|
+
pushToCache(this.cacheKey, {
|
|
33457
|
+
data: [],
|
|
33458
|
+
params: {},
|
|
33459
|
+
});
|
|
33460
|
+
}
|
|
33461
|
+
}
|
|
33462
|
+
async persistModel(queryPayload) {
|
|
33463
|
+
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
33464
|
+
}
|
|
33465
|
+
persistQueryStream({ response, direction, refresh, }) {
|
|
33466
|
+
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
33467
|
+
}
|
|
33468
|
+
startSubscription() {
|
|
33469
|
+
return this.queryStreamController.subscribeRTE([
|
|
33470
|
+
{
|
|
33471
|
+
fn: onUserDeleted$2,
|
|
33472
|
+
action: EnumUserActions.OnUserDeleted,
|
|
33473
|
+
},
|
|
33474
|
+
{
|
|
33475
|
+
fn: (reactor) => onUserDidBlock(status => {
|
|
33476
|
+
var _a;
|
|
33477
|
+
if (status.to !== getActiveClient().userId)
|
|
33478
|
+
return;
|
|
33479
|
+
const blocker = (_a = pullFromCache(['user', 'get', status.from])) === null || _a === void 0 ? void 0 : _a.data;
|
|
33480
|
+
if (blocker)
|
|
33481
|
+
reactor(blocker);
|
|
33482
|
+
}),
|
|
33483
|
+
action: EnumBlockActions.OnBlocked,
|
|
33484
|
+
},
|
|
33485
|
+
{
|
|
33486
|
+
fn: (reactor) => onUserDidUnblock(status => {
|
|
33487
|
+
var _a;
|
|
33488
|
+
if (status.to !== getActiveClient().userId)
|
|
33489
|
+
return;
|
|
33490
|
+
const blocker = (_a = pullFromCache(['user', 'get', status.from])) === null || _a === void 0 ? void 0 : _a.data;
|
|
33491
|
+
if (blocker)
|
|
33492
|
+
reactor(blocker);
|
|
33493
|
+
}),
|
|
33494
|
+
action: EnumBlockActions.OnUnblocked,
|
|
33495
|
+
},
|
|
33496
|
+
]);
|
|
33497
|
+
}
|
|
33498
|
+
notifyChange({ origin, loading, error }) {
|
|
33499
|
+
var _a, _b;
|
|
33500
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
33501
|
+
if (!collection)
|
|
33502
|
+
return;
|
|
33503
|
+
const data = this.applyFilter((_b = collection.data
|
|
33504
|
+
.map(id => pullFromCache(['user', 'get', id]))
|
|
33505
|
+
.filter(isNonNullable)
|
|
33506
|
+
.map(({ data }) => data)
|
|
33507
|
+
.map(LinkedObject.user)) !== null && _b !== void 0 ? _b : []);
|
|
33508
|
+
if (!this.shouldNotify(data) && origin === 'event')
|
|
33509
|
+
return;
|
|
33510
|
+
this.callback({
|
|
33511
|
+
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
33512
|
+
data,
|
|
33513
|
+
hasNextPage: !!this.paginationController.getNextToken(),
|
|
33514
|
+
loading,
|
|
33515
|
+
error,
|
|
33516
|
+
});
|
|
33517
|
+
}
|
|
33518
|
+
applyFilter(data) {
|
|
33519
|
+
let users = data;
|
|
33520
|
+
users = users.filter(user => user.isDeleted == null || user.isDeleted === false);
|
|
33521
|
+
return users;
|
|
33522
|
+
}
|
|
33523
|
+
}
|
|
33524
|
+
|
|
33525
|
+
/* begin_public_function
|
|
33526
|
+
id: user.get_blocking_users
|
|
33527
|
+
*/
|
|
33528
|
+
/**
|
|
33529
|
+
* ```js
|
|
33530
|
+
* import { UserRepository } from '@amityco/ts-sdk'
|
|
33531
|
+
* const unsubscribe = UserRepository.getBlockingUsers(({ data: users }) => {
|
|
33532
|
+
* console.log(users)
|
|
33533
|
+
* })
|
|
33534
|
+
* ```
|
|
33535
|
+
*
|
|
33536
|
+
* Observe the {@link Amity.User}s who have blocked the current user
|
|
33537
|
+
*
|
|
33538
|
+
* @param callback to receive updates on the blocking {@link Amity.User}s
|
|
33539
|
+
* @returns {@link Amity.Unsubscriber} to unsubscribe from collection
|
|
33540
|
+
*
|
|
33541
|
+
* @category User API
|
|
33542
|
+
*/
|
|
33543
|
+
const getBlockingUsers = (callback) => {
|
|
33544
|
+
const { log, cache } = getActiveClient();
|
|
33545
|
+
if (!cache)
|
|
33546
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
33547
|
+
const timestamp = Date.now();
|
|
33548
|
+
log(`getBlockingUsers(tmpid: ${timestamp}) > listen`);
|
|
33549
|
+
const blockingUserLiveCollection = new BlockingUserLiveCollectionController(callback);
|
|
33550
|
+
const disposers = blockingUserLiveCollection.startSubscription();
|
|
33551
|
+
const cacheKey = blockingUserLiveCollection.getCacheKey();
|
|
33552
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
33553
|
+
return () => {
|
|
33554
|
+
log(`getBlockingUsers(tmpid: ${timestamp}) > dispose`);
|
|
33555
|
+
disposers.forEach(fn => fn());
|
|
33556
|
+
dropFromCache(cacheKey);
|
|
33557
|
+
};
|
|
33558
|
+
};
|
|
33559
|
+
/* end_public_function */
|
|
33560
|
+
|
|
32844
33561
|
class SearchUserPaginationController extends PaginationController {
|
|
32845
33562
|
async getRequest(queryParams, token) {
|
|
32846
33563
|
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, displayName } = queryParams, params = __rest(queryParams, ["limit", "displayName"]);
|
|
@@ -33107,6 +33824,7 @@ var index$q = /*#__PURE__*/Object.freeze({
|
|
|
33107
33824
|
unflagUser: unflagUser,
|
|
33108
33825
|
isUserFlaggedByMe: isUserFlaggedByMe,
|
|
33109
33826
|
getAllBlockedUsers: getAllBlockedUsers,
|
|
33827
|
+
getAllBlockingUsers: getAllBlockingUsers,
|
|
33110
33828
|
onUserUpdated: onUserUpdated,
|
|
33111
33829
|
onUserDeleted: onUserDeleted$2,
|
|
33112
33830
|
onUserFlagged: onUserFlagged,
|
|
@@ -33115,6 +33833,7 @@ var index$q = /*#__PURE__*/Object.freeze({
|
|
|
33115
33833
|
getUser: getUser,
|
|
33116
33834
|
getUsers: getUsers,
|
|
33117
33835
|
getBlockedUsers: getBlockedUsers,
|
|
33836
|
+
getBlockingUsers: getBlockingUsers,
|
|
33118
33837
|
searchUserByDisplayName: searchUserByDisplayName,
|
|
33119
33838
|
getReachedUsers: getReachedUsers,
|
|
33120
33839
|
get AmityUserSearchMatchType () { return AmityUserSearchMatchType; }
|
|
@@ -39215,6 +39934,405 @@ const getArchivedChannels = (params, callback) => {
|
|
|
39215
39934
|
};
|
|
39216
39935
|
/* end_public_function */
|
|
39217
39936
|
|
|
39937
|
+
class SearchChannelPaginationController extends PaginationController {
|
|
39938
|
+
async getRequest(queryParams, token) {
|
|
39939
|
+
const { query, exactMatch, isMemberOnly, types, tags, sortBy, orderBy, limit = COLLECTION_DEFAULT_PAGINATION_SIZE, } = queryParams;
|
|
39940
|
+
const options = token ? { token } : { limit: Math.min(100, Math.max(1, limit)) };
|
|
39941
|
+
const { data: queryResponse } = await this.http.get(`/api/v2/search/channels`, {
|
|
39942
|
+
params: {
|
|
39943
|
+
query,
|
|
39944
|
+
exactMatch,
|
|
39945
|
+
isMemberOnly,
|
|
39946
|
+
types,
|
|
39947
|
+
tags,
|
|
39948
|
+
sortBy,
|
|
39949
|
+
orderBy,
|
|
39950
|
+
options,
|
|
39951
|
+
},
|
|
39952
|
+
});
|
|
39953
|
+
return queryResponse;
|
|
39954
|
+
}
|
|
39955
|
+
}
|
|
39956
|
+
|
|
39957
|
+
class SearchChannelQueryStreamController extends QueryStreamController {
|
|
39958
|
+
constructor(query, cacheKey, notifyChange) {
|
|
39959
|
+
super(query, cacheKey);
|
|
39960
|
+
this.notifyChange = notifyChange;
|
|
39961
|
+
}
|
|
39962
|
+
async saveToMainDB(response) {
|
|
39963
|
+
const processedPayload = await prepareChannelPayload(response);
|
|
39964
|
+
const client = getActiveClient();
|
|
39965
|
+
const cachedAt = client.cache && Date.now();
|
|
39966
|
+
if (client.cache) {
|
|
39967
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
39968
|
+
}
|
|
39969
|
+
}
|
|
39970
|
+
appendToQueryStream(response, direction, refresh = false) {
|
|
39971
|
+
var _a, _b;
|
|
39972
|
+
if (refresh) {
|
|
39973
|
+
pushToCache(this.cacheKey, {
|
|
39974
|
+
data: response.channels.map(getResolver('channel')),
|
|
39975
|
+
});
|
|
39976
|
+
return;
|
|
39977
|
+
}
|
|
39978
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
39979
|
+
const existing = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
39980
|
+
const incoming = response.channels.map(getResolver('channel'));
|
|
39981
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: direction === "prev" /* Amity.LiveCollectionPageDirection.PREV */
|
|
39982
|
+
? [...new Set([...incoming, ...existing])]
|
|
39983
|
+
: [...new Set([...existing, ...incoming])] }));
|
|
39984
|
+
}
|
|
39985
|
+
reactor() {
|
|
39986
|
+
return () => this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
39987
|
+
}
|
|
39988
|
+
subscribeRTE(createSubscriber) {
|
|
39989
|
+
return createSubscriber.map(subscriber => subscriber.fn(this.reactor()));
|
|
39990
|
+
}
|
|
39991
|
+
}
|
|
39992
|
+
|
|
39993
|
+
/* eslint-disable no-use-before-define */
|
|
39994
|
+
const getMessagePreviewSetting = () => {
|
|
39995
|
+
const client = getActiveClient();
|
|
39996
|
+
return client.getMessagePreviewSetting(false);
|
|
39997
|
+
};
|
|
39998
|
+
class SearchChannelLiveCollectionController extends LiveCollectionController {
|
|
39999
|
+
constructor(query, callback) {
|
|
40000
|
+
const queryStreamId = hash(query);
|
|
40001
|
+
const cacheKey = ['channel', 'search', queryStreamId];
|
|
40002
|
+
const paginationController = new SearchChannelPaginationController(query);
|
|
40003
|
+
super(paginationController, queryStreamId, cacheKey, callback);
|
|
40004
|
+
this.queryStreamController = new SearchChannelQueryStreamController(query, this.cacheKey, this.notifyChange.bind(this));
|
|
40005
|
+
this.callback = callback.bind(this);
|
|
40006
|
+
this.loadPage({ initial: true });
|
|
40007
|
+
}
|
|
40008
|
+
startSubscription() {
|
|
40009
|
+
return this.queryStreamController.subscribeRTE(this.getSubscriptions());
|
|
40010
|
+
}
|
|
40011
|
+
notifyChange({ origin, loading, error }) {
|
|
40012
|
+
var _a, _b;
|
|
40013
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
40014
|
+
if (!collection)
|
|
40015
|
+
return;
|
|
40016
|
+
const data = (_b = collection.data
|
|
40017
|
+
.map(channelId => pullFromCache(['channel', 'get', channelId]))
|
|
40018
|
+
.filter(Boolean)
|
|
40019
|
+
.map(cached => constructChannelObject(cached.data))) !== null && _b !== void 0 ? _b : [];
|
|
40020
|
+
if (!this.shouldNotify(data) && origin === 'event')
|
|
40021
|
+
return;
|
|
40022
|
+
this.callback({
|
|
40023
|
+
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
40024
|
+
data,
|
|
40025
|
+
hasNextPage: !!this.paginationController.getNextToken(),
|
|
40026
|
+
loading,
|
|
40027
|
+
error,
|
|
40028
|
+
});
|
|
40029
|
+
}
|
|
40030
|
+
setup() {
|
|
40031
|
+
var _a;
|
|
40032
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
40033
|
+
if (!collection) {
|
|
40034
|
+
pushToCache(this.cacheKey, {
|
|
40035
|
+
data: [],
|
|
40036
|
+
params: {},
|
|
40037
|
+
});
|
|
40038
|
+
}
|
|
40039
|
+
}
|
|
40040
|
+
async persistModel(response) {
|
|
40041
|
+
await this.queryStreamController.saveToMainDB(response);
|
|
40042
|
+
}
|
|
40043
|
+
persistQueryStream({ response, direction, refresh, }) {
|
|
40044
|
+
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
40045
|
+
}
|
|
40046
|
+
shouldAbort(targetChannelId) {
|
|
40047
|
+
var _a;
|
|
40048
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
40049
|
+
if (!collection)
|
|
40050
|
+
return true;
|
|
40051
|
+
return !collection.data.find(channelId => channelId === targetChannelId);
|
|
40052
|
+
}
|
|
40053
|
+
getSubscriptions() {
|
|
40054
|
+
return [
|
|
40055
|
+
{
|
|
40056
|
+
fn: convertEventPayload((callback) => {
|
|
40057
|
+
return onMessageCreatedMqtt(message => {
|
|
40058
|
+
var _a;
|
|
40059
|
+
const cacheData = (_a = pullFromCache([
|
|
40060
|
+
'channel',
|
|
40061
|
+
'get',
|
|
40062
|
+
message.channelId,
|
|
40063
|
+
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
40064
|
+
if (!cacheData)
|
|
40065
|
+
return;
|
|
40066
|
+
updateChannelCache(cacheData, {
|
|
40067
|
+
lastActivity: message.createdAt,
|
|
40068
|
+
});
|
|
40069
|
+
callback(message);
|
|
40070
|
+
});
|
|
40071
|
+
}, 'channelId', 'channel'),
|
|
40072
|
+
action: "onUpdate" /* Amity.ChannelActionType.OnUpdate */,
|
|
40073
|
+
},
|
|
40074
|
+
{
|
|
40075
|
+
fn: convertEventPayload((callback) => {
|
|
40076
|
+
return onMessageCreatedLocal(message => {
|
|
40077
|
+
var _a;
|
|
40078
|
+
const cacheData = (_a = pullFromCache([
|
|
40079
|
+
'channel',
|
|
40080
|
+
'get',
|
|
40081
|
+
message.channelId,
|
|
40082
|
+
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
40083
|
+
if (!cacheData)
|
|
40084
|
+
return;
|
|
40085
|
+
updateChannelCache(cacheData, {
|
|
40086
|
+
lastActivity: message.createdAt,
|
|
40087
|
+
});
|
|
40088
|
+
callback(message);
|
|
40089
|
+
});
|
|
40090
|
+
}, 'channelId', 'channel'),
|
|
40091
|
+
action: "onUpdate" /* Amity.ChannelActionType.OnUpdate */,
|
|
40092
|
+
},
|
|
40093
|
+
{ fn: onChannelDeleted, action: "onDelete" /* Amity.ChannelActionType.OnDelete */ },
|
|
40094
|
+
{ fn: onChannelUpdated, action: "onUpdate" /* Amity.ChannelActionType.OnUpdate */ },
|
|
40095
|
+
{ fn: onChannelSetMuted, action: "onMute" /* Amity.ChannelActionType.OnMute */ },
|
|
40096
|
+
{
|
|
40097
|
+
fn: (reactor) => onChannelArchived(payload => {
|
|
40098
|
+
const channels = payload.archives
|
|
40099
|
+
.map(archive => {
|
|
40100
|
+
var _a;
|
|
40101
|
+
return (_a = pullFromCache(['channel', 'get', archive.channelId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
40102
|
+
})
|
|
40103
|
+
.filter((c) => Boolean(c));
|
|
40104
|
+
if (channels.length > 0)
|
|
40105
|
+
reactor(channels);
|
|
40106
|
+
}),
|
|
40107
|
+
action: "onArchived" /* Amity.ChannelActionType.OnArchived */,
|
|
40108
|
+
},
|
|
40109
|
+
{
|
|
40110
|
+
fn: (reactor) => onChannelUnarchived(payload => {
|
|
40111
|
+
const channels = payload.archives
|
|
40112
|
+
.map(archive => {
|
|
40113
|
+
var _a;
|
|
40114
|
+
return (_a = pullFromCache(['channel', 'get', archive.channelId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
40115
|
+
})
|
|
40116
|
+
.filter((c) => Boolean(c));
|
|
40117
|
+
if (channels.length > 0)
|
|
40118
|
+
reactor(channels);
|
|
40119
|
+
}),
|
|
40120
|
+
action: "onUnarchived" /* Amity.ChannelActionType.OnUnarchived */,
|
|
40121
|
+
},
|
|
40122
|
+
{
|
|
40123
|
+
fn: convertEventPayload(onChannelMarkerFetched, 'entityId', 'channel'),
|
|
40124
|
+
action: "onUpdate" /* Amity.ChannelActionType.OnUpdate */,
|
|
40125
|
+
},
|
|
40126
|
+
{
|
|
40127
|
+
fn: convertEventPayload(onChannelMarkerUpdated, 'entityId', 'channel'),
|
|
40128
|
+
action: "onUpdate" /* Amity.ChannelActionType.OnUpdate */,
|
|
40129
|
+
},
|
|
40130
|
+
{
|
|
40131
|
+
fn: convertEventPayload((callback) => {
|
|
40132
|
+
const updateMessagePreview = async (message) => {
|
|
40133
|
+
var _a;
|
|
40134
|
+
const messagePreviewSetting = await getMessagePreviewSetting();
|
|
40135
|
+
if (messagePreviewSetting === "no-message-preview" /* Amity.MessagePreviewSetting.NO_MESSAGE_PREVIEW */)
|
|
40136
|
+
return;
|
|
40137
|
+
handleMessageCreated(message);
|
|
40138
|
+
if (this.shouldAbort(message.channelId))
|
|
40139
|
+
return;
|
|
40140
|
+
const channel = (_a = pullFromCache([
|
|
40141
|
+
'channel',
|
|
40142
|
+
'get',
|
|
40143
|
+
message.channelId,
|
|
40144
|
+
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
40145
|
+
if (!channel)
|
|
40146
|
+
return;
|
|
40147
|
+
updateChannelCache(channel, {
|
|
40148
|
+
messagePreviewId: message.messageId,
|
|
40149
|
+
});
|
|
40150
|
+
callback(message);
|
|
40151
|
+
};
|
|
40152
|
+
return onMessageCreatedMqtt(updateMessagePreview);
|
|
40153
|
+
}, 'channelId', 'channel'),
|
|
40154
|
+
action: "onUpdate" /* Amity.ChannelActionType.OnUpdate */,
|
|
40155
|
+
},
|
|
40156
|
+
{
|
|
40157
|
+
fn: convertEventPayload((callback) => {
|
|
40158
|
+
const updateMessagePreview = async (message) => {
|
|
40159
|
+
var _a;
|
|
40160
|
+
const messagePreviewSetting = await getMessagePreviewSetting();
|
|
40161
|
+
if (messagePreviewSetting === "no-message-preview" /* Amity.MessagePreviewSetting.NO_MESSAGE_PREVIEW */)
|
|
40162
|
+
return;
|
|
40163
|
+
handleMessageCreated(message);
|
|
40164
|
+
if (this.shouldAbort(message.channelId))
|
|
40165
|
+
return;
|
|
40166
|
+
const channel = (_a = pullFromCache([
|
|
40167
|
+
'channel',
|
|
40168
|
+
'get',
|
|
40169
|
+
message.channelId,
|
|
40170
|
+
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
40171
|
+
if (!channel)
|
|
40172
|
+
return;
|
|
40173
|
+
updateChannelCache(channel, {
|
|
40174
|
+
messagePreviewId: message.messageId,
|
|
40175
|
+
});
|
|
40176
|
+
callback(message);
|
|
40177
|
+
};
|
|
40178
|
+
return onMessageCreatedLocal(updateMessagePreview);
|
|
40179
|
+
}, 'channelId', 'channel'),
|
|
40180
|
+
action: "onUpdate" /* Amity.ChannelActionType.OnUpdate */,
|
|
40181
|
+
},
|
|
40182
|
+
{
|
|
40183
|
+
fn: convertEventPayload((callback) => {
|
|
40184
|
+
const updateMessagePreview = async (message) => {
|
|
40185
|
+
const messagePreviewSetting = await getMessagePreviewSetting();
|
|
40186
|
+
if (messagePreviewSetting === "no-message-preview" /* Amity.MessagePreviewSetting.NO_MESSAGE_PREVIEW */)
|
|
40187
|
+
return;
|
|
40188
|
+
handleMessageUpdated(message);
|
|
40189
|
+
if (this.shouldAbort(message.channelId))
|
|
40190
|
+
return;
|
|
40191
|
+
callback(message);
|
|
40192
|
+
};
|
|
40193
|
+
return onMessageUpdated(updateMessagePreview);
|
|
40194
|
+
}, 'channelId', 'channel'),
|
|
40195
|
+
action: "onUpdate" /* Amity.ChannelActionType.OnUpdate */,
|
|
40196
|
+
},
|
|
40197
|
+
{
|
|
40198
|
+
fn: convertEventPayload((callback) => {
|
|
40199
|
+
const updateMessagePreview = async (message) => {
|
|
40200
|
+
const messagePreviewSetting = await getMessagePreviewSetting();
|
|
40201
|
+
if (messagePreviewSetting === "no-message-preview" /* Amity.MessagePreviewSetting.NO_MESSAGE_PREVIEW */)
|
|
40202
|
+
return;
|
|
40203
|
+
if (messagePreviewSetting ===
|
|
40204
|
+
"message-preview-include-deleted" /* Amity.MessagePreviewSetting.MESSAGE_PREVIEW_INCLUDE_DELETED */)
|
|
40205
|
+
await handleMessageUpdated(message);
|
|
40206
|
+
if (this.shouldAbort(message.channelId))
|
|
40207
|
+
return;
|
|
40208
|
+
if (messagePreviewSetting ===
|
|
40209
|
+
"message-preview-not-include-deleted" /* Amity.MessagePreviewSetting.MESSAGE_PREVIEW_NOT_INCLUDE_DELETED */) {
|
|
40210
|
+
await getChannel$1(message.channelId);
|
|
40211
|
+
}
|
|
40212
|
+
callback(message);
|
|
40213
|
+
};
|
|
40214
|
+
return onMessageDeleted(updateMessagePreview);
|
|
40215
|
+
}, 'channelId', 'channel'),
|
|
40216
|
+
action: "onUpdate" /* Amity.ChannelActionType.OnUpdate */,
|
|
40217
|
+
},
|
|
40218
|
+
{
|
|
40219
|
+
fn: convertEventPayload((callback) => {
|
|
40220
|
+
const updateMessagePreview = async (subChannel) => {
|
|
40221
|
+
var _a;
|
|
40222
|
+
const collections = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
40223
|
+
if (!collections)
|
|
40224
|
+
return;
|
|
40225
|
+
const channelId = collections.data.find(channel => {
|
|
40226
|
+
const messagePreviewCache = getChannelMessagePreview(channel);
|
|
40227
|
+
return (messagePreviewCache === null || messagePreviewCache === void 0 ? void 0 : messagePreviewCache.subChannelId) === subChannel.subChannelId;
|
|
40228
|
+
});
|
|
40229
|
+
if (!channelId)
|
|
40230
|
+
return;
|
|
40231
|
+
await getChannel$1(subChannel.channelId);
|
|
40232
|
+
callback(subChannel);
|
|
40233
|
+
};
|
|
40234
|
+
return onSubChannelDeleted(updateMessagePreview);
|
|
40235
|
+
}, 'channelId', 'channel'),
|
|
40236
|
+
action: "onUpdate" /* Amity.ChannelActionType.OnUpdate */,
|
|
40237
|
+
},
|
|
40238
|
+
{
|
|
40239
|
+
fn: convertEventPayload((callback) => {
|
|
40240
|
+
const updateMessagePreview = async (subChannel) => {
|
|
40241
|
+
var _a;
|
|
40242
|
+
const messagePreviewSetting = await getMessagePreviewSetting();
|
|
40243
|
+
if (messagePreviewSetting === "no-message-preview" /* Amity.MessagePreviewSetting.NO_MESSAGE_PREVIEW */)
|
|
40244
|
+
return;
|
|
40245
|
+
const collections = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
40246
|
+
if (!collections)
|
|
40247
|
+
return;
|
|
40248
|
+
await handleSubChannelUpdated(subChannel);
|
|
40249
|
+
if (this.shouldAbort(subChannel.channelId))
|
|
40250
|
+
return;
|
|
40251
|
+
callback(subChannel);
|
|
40252
|
+
};
|
|
40253
|
+
return onSubChannelUpdated(updateMessagePreview);
|
|
40254
|
+
}, 'channelId', 'channel'),
|
|
40255
|
+
action: "onUpdate" /* Amity.ChannelActionType.OnUpdate */,
|
|
40256
|
+
},
|
|
40257
|
+
{
|
|
40258
|
+
fn: (callback) => {
|
|
40259
|
+
const handleUserFeedMarkerResolved = async (marker) => {
|
|
40260
|
+
if (marker.feedMarkers) {
|
|
40261
|
+
const channels = marker.feedMarkers
|
|
40262
|
+
.map(feedMarker => {
|
|
40263
|
+
var _a;
|
|
40264
|
+
return (_a = pullFromCache([
|
|
40265
|
+
'channel',
|
|
40266
|
+
'get',
|
|
40267
|
+
feedMarker.entityId,
|
|
40268
|
+
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
40269
|
+
})
|
|
40270
|
+
.filter(Boolean);
|
|
40271
|
+
callback(channels);
|
|
40272
|
+
}
|
|
40273
|
+
};
|
|
40274
|
+
return onUserMessageFeedMarkerResolved(handleUserFeedMarkerResolved);
|
|
40275
|
+
},
|
|
40276
|
+
action: "OnResolveUnread" /* Amity.ChannelActionType.OnResolveUnread */,
|
|
40277
|
+
},
|
|
40278
|
+
{
|
|
40279
|
+
fn: convertEventPayload(onChannelUnreadInfoUpdatedLocal, 'channelId', 'channel'),
|
|
40280
|
+
action: "onUpdate" /* Amity.ChannelActionType.OnUpdate */,
|
|
40281
|
+
},
|
|
40282
|
+
{
|
|
40283
|
+
fn: convertEventPayload((callback) => {
|
|
40284
|
+
const processPayload = (payloads) => {
|
|
40285
|
+
payloads.forEach(callback);
|
|
40286
|
+
};
|
|
40287
|
+
return onChannelUnreadUpdatedLocal(processPayload);
|
|
40288
|
+
}, 'channelId', 'channel'),
|
|
40289
|
+
action: "onUpdate" /* Amity.ChannelActionType.OnUpdate */,
|
|
40290
|
+
},
|
|
40291
|
+
];
|
|
40292
|
+
}
|
|
40293
|
+
}
|
|
40294
|
+
|
|
40295
|
+
/* begin_public_function
|
|
40296
|
+
id: channel.search
|
|
40297
|
+
*/
|
|
40298
|
+
/**
|
|
40299
|
+
* ```js
|
|
40300
|
+
* import { ChannelRepository } from '@amityco/ts-sdk';
|
|
40301
|
+
*
|
|
40302
|
+
* const unsubscribe = ChannelRepository.searchChannels(
|
|
40303
|
+
* { query: 'hello' },
|
|
40304
|
+
* response => response.data,
|
|
40305
|
+
* );
|
|
40306
|
+
* ```
|
|
40307
|
+
*
|
|
40308
|
+
* Live collection of {@link Amity.Channel}s matching the search query. Backed by
|
|
40309
|
+
* `GET /api/v2/search/channels`.
|
|
40310
|
+
*
|
|
40311
|
+
* @param params Search parameters.
|
|
40312
|
+
* @param callback Called whenever new data are available.
|
|
40313
|
+
* @returns An {@link Amity.Unsubscriber} function to stop observing.
|
|
40314
|
+
*
|
|
40315
|
+
* @category Channel Live Collection
|
|
40316
|
+
*/
|
|
40317
|
+
const searchChannels = (params, callback) => {
|
|
40318
|
+
const { log, cache } = getActiveClient();
|
|
40319
|
+
if (!cache)
|
|
40320
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
40321
|
+
const timestamp = Date.now();
|
|
40322
|
+
log(`searchChannels(tmpid: ${timestamp}) > listen`);
|
|
40323
|
+
const searchChannelLiveCollection = new SearchChannelLiveCollectionController(params, callback);
|
|
40324
|
+
const disposers = searchChannelLiveCollection.startSubscription();
|
|
40325
|
+
const cacheKey = searchChannelLiveCollection.getCacheKey();
|
|
40326
|
+
disposers.push(() => {
|
|
40327
|
+
dropFromCache(cacheKey);
|
|
40328
|
+
});
|
|
40329
|
+
return () => {
|
|
40330
|
+
log(`searchChannels(tmpid: ${timestamp}) > dispose`);
|
|
40331
|
+
disposers.forEach(fn => fn());
|
|
40332
|
+
};
|
|
40333
|
+
};
|
|
40334
|
+
/* end_public_function */
|
|
40335
|
+
|
|
39218
40336
|
/* begin_public_function
|
|
39219
40337
|
id: channel.member.add
|
|
39220
40338
|
*/
|
|
@@ -39848,6 +40966,7 @@ var index$j = /*#__PURE__*/Object.freeze({
|
|
|
39848
40966
|
getChannels: getChannels,
|
|
39849
40967
|
getTotalChannelsUnread: getTotalChannelsUnread,
|
|
39850
40968
|
getArchivedChannels: getArchivedChannels,
|
|
40969
|
+
searchChannels: searchChannels,
|
|
39851
40970
|
MARKER_INCLUDED_CHANNEL_TYPE: MARKER_INCLUDED_CHANNEL_TYPE,
|
|
39852
40971
|
isUnreadCountSupport: isUnreadCountSupport,
|
|
39853
40972
|
convertFromRaw: convertFromRaw,
|
|
@@ -43743,7 +44862,7 @@ class CommentLiveCollectionController extends LiveCollectionController {
|
|
|
43743
44862
|
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
43744
44863
|
}
|
|
43745
44864
|
startSubscription() {
|
|
43746
|
-
|
|
44865
|
+
const disposers = this.queryStreamController.subscribeRTE([
|
|
43747
44866
|
{ fn: onCommentCreatedLocal, action: EnumCommentActions.OnCommentCreated },
|
|
43748
44867
|
{ fn: onCommentDeleteLocal, action: EnumCommentActions.OnCommentDeleted },
|
|
43749
44868
|
{ fn: onCommentCreated, action: EnumCommentActions.OnCommentCreated },
|
|
@@ -43756,6 +44875,11 @@ class CommentLiveCollectionController extends LiveCollectionController {
|
|
|
43756
44875
|
{ fn: onLocalCommentReactionAdded, action: EnumCommentActions.OnCommentReactionAdded },
|
|
43757
44876
|
{ fn: onLocalCommentReactionRemoved, action: EnumCommentActions.OnCommentReactionRemoved },
|
|
43758
44877
|
]);
|
|
44878
|
+
if (this.query.excludeBlockUserComments) {
|
|
44879
|
+
const refresh = () => this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
44880
|
+
disposers.push(onUserDidBlock(refresh), onUserDidUnblock(refresh));
|
|
44881
|
+
}
|
|
44882
|
+
return disposers;
|
|
43759
44883
|
}
|
|
43760
44884
|
notifyChange({ origin, loading, error }) {
|
|
43761
44885
|
var _a, _b;
|
|
@@ -43808,6 +44932,9 @@ class CommentLiveCollectionController extends LiveCollectionController {
|
|
|
43808
44932
|
comments = comments.filter(comment => { var _a; return (_a = this.query.dataTypes) === null || _a === void 0 ? void 0 : _a.values.some(value => { var _a; return (_a = comment.dataTypes) === null || _a === void 0 ? void 0 : _a.includes(value); }); });
|
|
43809
44933
|
}
|
|
43810
44934
|
}
|
|
44935
|
+
if (this.query.excludeBlockUserComments) {
|
|
44936
|
+
comments = filterCommentsByBlockUsers(comments);
|
|
44937
|
+
}
|
|
43811
44938
|
switch (this.query.sortBy) {
|
|
43812
44939
|
case 'firstCreated':
|
|
43813
44940
|
comments = comments.sort(sortByFirstCreated);
|
|
@@ -44911,45 +46038,80 @@ class ForYouFeedPaginationController extends PaginationController {
|
|
|
44911
46038
|
constructor(query) {
|
|
44912
46039
|
super(query);
|
|
44913
46040
|
this.checkedDisk = false;
|
|
46041
|
+
this.hasDeliveredPost = false;
|
|
44914
46042
|
this.cursor = CursorController.current();
|
|
44915
46043
|
}
|
|
44916
46044
|
async getRequest(_queryParams, token) {
|
|
44917
|
-
|
|
44918
|
-
|
|
46045
|
+
var _a, _b, _c, _d, _e;
|
|
46046
|
+
const isFirstPage = token === undefined;
|
|
46047
|
+
let stored = null;
|
|
46048
|
+
// On the first page of a fresh collection, load the saved cursor from disk once.
|
|
46049
|
+
// Drop it if the snapshot has already expired so we start fresh.
|
|
46050
|
+
if (isFirstPage && !this.checkedDisk && this.cursor) {
|
|
44919
46051
|
this.checkedDisk = true;
|
|
44920
|
-
|
|
44921
|
-
if (stored &&
|
|
44922
|
-
effectiveToken = stored.cursor;
|
|
44923
|
-
}
|
|
44924
|
-
else if (stored) {
|
|
46052
|
+
stored = await this.cursor.get();
|
|
46053
|
+
if (stored && CursorController.isExpired(stored.expiredAt)) {
|
|
44925
46054
|
await this.cursor.clear();
|
|
46055
|
+
stored = null;
|
|
44926
46056
|
}
|
|
44927
46057
|
}
|
|
44928
|
-
|
|
44929
|
-
|
|
44930
|
-
|
|
44931
|
-
|
|
44932
|
-
|
|
44933
|
-
|
|
46058
|
+
// Already paged to the end before. Ask the BE fresh (no cursor) and check if it's
|
|
46059
|
+
// still the same snapshot the user finished.
|
|
46060
|
+
if (isFirstPage && (stored === null || stored === void 0 ? void 0 : stored.reachedEndOfFeed)) {
|
|
46061
|
+
const fresh = await this.fetch();
|
|
46062
|
+
const freshExpiredAt = Date.parse((_b = (_a = fresh.paging) === null || _a === void 0 ? void 0 : _a.expiredAt) !== null && _b !== void 0 ? _b : '');
|
|
46063
|
+
const rolledOver = !Number.isNaN(freshExpiredAt) && freshExpiredAt !== stored.expiredAt;
|
|
46064
|
+
// New snapshot → serve it. Same snapshot → user has seen it all, show empty.
|
|
46065
|
+
if (rolledOver) {
|
|
46066
|
+
await this.persistCursor(fresh);
|
|
46067
|
+
if (fresh.posts.length > 0)
|
|
46068
|
+
this.hasDeliveredPost = true;
|
|
46069
|
+
return fresh;
|
|
46070
|
+
}
|
|
46071
|
+
return Object.assign(Object.assign({}, fresh), { posts: [], paging: {} });
|
|
46072
|
+
}
|
|
46073
|
+
// Resume from the saved cursor on re-entry; otherwise use the live-collection token.
|
|
46074
|
+
const effectiveToken = isFirstPage && stored ? stored.cursor : token;
|
|
46075
|
+
const response = await this.fetch(effectiveToken);
|
|
46076
|
+
if (response.posts.length > 0)
|
|
46077
|
+
this.hasDeliveredPost = true;
|
|
46078
|
+
if ((_c = response.paging) === null || _c === void 0 ? void 0 : _c.next) {
|
|
46079
|
+
// More pages left → advance the saved cursor.
|
|
46080
|
+
await this.persistCursor(response);
|
|
46081
|
+
}
|
|
46082
|
+
else if (this.hasDeliveredPost && this.cursor) {
|
|
46083
|
+
// Reached the end and mark end of feed
|
|
46084
|
+
const expiredAt = Date.parse((_e = (_d = response.paging) === null || _d === void 0 ? void 0 : _d.expiredAt) !== null && _e !== void 0 ? _e : '');
|
|
46085
|
+
if (!Number.isNaN(expiredAt))
|
|
46086
|
+
await this.cursor.markReachedEndOfFeed(expiredAt);
|
|
46087
|
+
}
|
|
46088
|
+
return response;
|
|
46089
|
+
}
|
|
46090
|
+
async fetch(token) {
|
|
46091
|
+
const options = { limit: COLLECTION_DEFAULT_PAGINATION_SIZE };
|
|
46092
|
+
if (token)
|
|
46093
|
+
options.token = token;
|
|
44934
46094
|
try {
|
|
44935
|
-
|
|
46095
|
+
const { data } = await this.http.get(API_ENDPOINTS.forYouFeed, {
|
|
46096
|
+
params: { options },
|
|
46097
|
+
});
|
|
46098
|
+
return data;
|
|
44936
46099
|
}
|
|
44937
46100
|
catch (error) {
|
|
44938
46101
|
if (error instanceof ASCApiError && error.code === 400300 /* Amity.ServerError.FORBIDDEN */) {
|
|
44939
46102
|
throw new AmityForYouFeedDisabledError();
|
|
44940
46103
|
}
|
|
44941
46104
|
const recoverable = error instanceof ASCApiError && error.code === 400322 /* Amity.ServerError.FEED_SNAPSHOT_EXPIRED */;
|
|
44942
|
-
if (recoverable &&
|
|
46105
|
+
if (recoverable && token !== undefined) {
|
|
44943
46106
|
if (this.cursor)
|
|
44944
46107
|
await this.cursor.clear();
|
|
44945
|
-
|
|
44946
|
-
|
|
44947
|
-
|
|
44948
|
-
|
|
46108
|
+
const { data } = await this.http.get(API_ENDPOINTS.forYouFeed, {
|
|
46109
|
+
params: { options: { limit: COLLECTION_DEFAULT_PAGINATION_SIZE } },
|
|
46110
|
+
});
|
|
46111
|
+
return data;
|
|
44949
46112
|
}
|
|
46113
|
+
throw error;
|
|
44950
46114
|
}
|
|
44951
|
-
await this.persistCursor(queryResponse);
|
|
44952
|
-
return queryResponse;
|
|
44953
46115
|
}
|
|
44954
46116
|
async persistCursor(response) {
|
|
44955
46117
|
var _a, _b;
|
|
@@ -46117,7 +47279,12 @@ class PostLiveCollectionController extends LiveCollectionController {
|
|
|
46117
47279
|
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
46118
47280
|
}
|
|
46119
47281
|
startSubscription() {
|
|
46120
|
-
|
|
47282
|
+
const disposers = this.queryStreamController.subscribeRTE(getPostSubscription(this.cacheKey));
|
|
47283
|
+
if (this.query.excludeBlockUserPosts) {
|
|
47284
|
+
const refresh = () => this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
47285
|
+
disposers.push(onUserDidBlock(refresh), onUserDidUnblock(refresh));
|
|
47286
|
+
}
|
|
47287
|
+
return disposers;
|
|
46121
47288
|
}
|
|
46122
47289
|
notifyChange({ origin, loading, error }) {
|
|
46123
47290
|
var _a, _b;
|
|
@@ -46163,6 +47330,9 @@ class PostLiveCollectionController extends LiveCollectionController {
|
|
|
46163
47330
|
const sortBy = this.query.sortBy || 'lastCreated';
|
|
46164
47331
|
posts = posts.filter(post => !exceedsUntilAtBoundary(post.createdAt, validatedUntilAt, sortBy));
|
|
46165
47332
|
}
|
|
47333
|
+
if (this.query.excludeBlockUserPosts) {
|
|
47334
|
+
posts = filterPostsByBlockUsers(posts);
|
|
47335
|
+
}
|
|
46166
47336
|
switch (this.query.sortBy) {
|
|
46167
47337
|
case 'firstCreated':
|
|
46168
47338
|
posts = posts.sort(sortByFirstCreated);
|
|
@@ -52828,4 +53998,4 @@ class AmityAttachmentProductTags {
|
|
|
52828
53998
|
}
|
|
52829
53999
|
}
|
|
52830
54000
|
|
|
52831
|
-
export { API_REGIONS, index$5 as AdRepository, AmityAttachmentProductTags, AmityChannelNotificationModeEnum, AmityCommunityType, AmityEventOrderOption, AmityEventOriginType, AmityEventResponseStatus, AmityEventSortOption, AmityEventStatus, AmityEventType, AmitySharableContentType, AnalyticsSourceTypeEnum, index$f as CategoryRepository, index$j as ChannelRepository, index$s as Client, index$e as CommentRepository, CommunityNotificationEventNameEnum, CommunityPostSettingMaps, CommunityPostSettings, index$g as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, DefaultCommunityPostSetting, index$1 as EventRepository, FeedDataTypeEnum, index$d as FeedRepository, FeedSortByEnum, FeedSourceEnum, FeedTypeEnum, FileAccessTypeEnum, index$p as FileRepository, FileType, GET_WATCHER_URLS, index$3 as InvitationRepository, InvitationSortByEnum, InvitationStatusEnum, InvitationTargetTypeEnum, InvitationTypeEnum, JoinRequestStatusEnum, JoinResultStatusEnum, index$2 as LiveReactionRepository, index$7 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$n as MessageRepository, NotificationRolesFilterTypeEnum, NotificationSettingsLevelEnum, index$8 as PollRepository, PostContentType, index$b as PostRepository, PostStructureType, index as ProductRepository, index$o as ReactionRepository, index$9 as RoomPresenceRepository, index$c as RoomRepository, SearchUsersByEnum, index$6 as StoryRepository, index$a as StreamRepository, index$m as SubChannelRepository, SubscriptionLevels, UserNotificationModuleNameEnum, index$q as UserRepository, UserTypeEnum, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, exceedsUntilAtBoundary, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, filterByUntilAt, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveReactionTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkId, getNetworkTopic, getPostTopic, getRole, getRoomStreamerTopic, getRoomWatcherTopic, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index$4 as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, validateUntilAt, wipeCache };
|
|
54001
|
+
export { API_REGIONS, index$5 as AdRepository, AmityAttachmentProductTags, AmityAutoSubscription, AmityChannelNotificationModeEnum, AmityCommunityType, AmityEventOrderOption, AmityEventOriginType, AmityEventResponseStatus, AmityEventSortOption, AmityEventStatus, AmityEventType, AmitySharableContentType, AnalyticsSourceTypeEnum, index$f as CategoryRepository, index$j as ChannelRepository, index$s as Client, index$e as CommentRepository, CommunityNotificationEventNameEnum, CommunityPostSettingMaps, CommunityPostSettings, index$g as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, DefaultCommunityPostSetting, index$1 as EventRepository, FeedDataTypeEnum, index$d as FeedRepository, FeedSortByEnum, FeedSourceEnum, FeedTypeEnum, FileAccessTypeEnum, index$p as FileRepository, FileType, GET_WATCHER_URLS, index$3 as InvitationRepository, InvitationSortByEnum, InvitationStatusEnum, InvitationTargetTypeEnum, InvitationTypeEnum, JoinRequestStatusEnum, JoinResultStatusEnum, index$2 as LiveReactionRepository, index$7 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$n as MessageRepository, NotificationRolesFilterTypeEnum, NotificationSettingsLevelEnum, index$8 as PollRepository, PostContentType, index$b as PostRepository, PostStructureType, index as ProductRepository, index$o as ReactionRepository, index$9 as RoomPresenceRepository, index$c as RoomRepository, SearchUsersByEnum, index$6 as StoryRepository, index$a as StreamRepository, index$m as SubChannelRepository, SubscriptionLevels, UserNotificationModuleNameEnum, index$q as UserRepository, UserTypeEnum, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, exceedsUntilAtBoundary, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, filterByUntilAt, filterCommentsByBlockUsers, filterPostsByBlockUsers, getBlockUsersId, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveReactionTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkId, getNetworkTopic, getPostTopic, getRole, getRoomStreamerTopic, getRoomWatcherTopic, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index$4 as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, validateUntilAt, wipeCache };
|