@amityco/ts-sdk-react-native 7.18.0 → 7.18.1-bb0e7abc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/domains/notificationSettings.d.ts +101 -0
- package/dist/@types/domains/notificationSettings.d.ts.map +1 -0
- package/dist/@types/index.d.ts +1 -0
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/client/api/index.d.ts +1 -0
- package/dist/client/api/index.d.ts.map +1 -1
- package/dist/client/api/notifications.d.ts +27 -0
- package/dist/client/api/notifications.d.ts.map +1 -0
- package/dist/index.cjs.js +169 -1
- package/dist/index.esm.js +170 -2
- package/dist/index.umd.js +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export declare enum UserNotificationModuleNameEnum {
|
|
2
|
+
CHAT = "chat",
|
|
3
|
+
SOCIAL = "social",
|
|
4
|
+
VIDEO_STREAMING = "video-streaming"
|
|
5
|
+
}
|
|
6
|
+
export declare enum CommunityNotificationEventNameEnum {
|
|
7
|
+
POST_CREATED = "post.created",
|
|
8
|
+
POST_REACTED = "post.reacted",
|
|
9
|
+
COMMENT_CREATED = "comment.created",
|
|
10
|
+
COMMENT_REPLIED = "comment.replied",
|
|
11
|
+
COMMENT_REACTED = "comment.reacted",
|
|
12
|
+
STORY_CREATED = "story.created",
|
|
13
|
+
STORY_REACTED = "story.reacted",
|
|
14
|
+
STORY_COMMENT_CREATED = "story-comment.created",
|
|
15
|
+
LIVESTREAM_START = "video-streaming.didStart"
|
|
16
|
+
}
|
|
17
|
+
export declare enum NotificationSettingsLevelEnum {
|
|
18
|
+
USER = "user",
|
|
19
|
+
COMMUNITY = "community",
|
|
20
|
+
CHANNEL = "channel"
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* `NOT` variant is intentionally excluded from public API (internal server-side use only).
|
|
24
|
+
*/
|
|
25
|
+
export declare enum NotificationRolesFilterTypeEnum {
|
|
26
|
+
ALL = "all",
|
|
27
|
+
ONLY = "only"
|
|
28
|
+
}
|
|
29
|
+
declare global {
|
|
30
|
+
namespace Amity {
|
|
31
|
+
type UserNotificationModuleName = UserNotificationModuleNameEnum;
|
|
32
|
+
type CommunityNotificationEventName = CommunityNotificationEventNameEnum;
|
|
33
|
+
type NotificationRolesFilter = {
|
|
34
|
+
type: NotificationRolesFilterTypeEnum.ALL;
|
|
35
|
+
} | {
|
|
36
|
+
type: NotificationRolesFilterTypeEnum.ONLY;
|
|
37
|
+
roleIds: string[];
|
|
38
|
+
} | {
|
|
39
|
+
type: 'not';
|
|
40
|
+
roleIds: string[];
|
|
41
|
+
};
|
|
42
|
+
type UserNotificationModule = {
|
|
43
|
+
moduleName: Amity.UserNotificationModuleName;
|
|
44
|
+
isEnabled: boolean;
|
|
45
|
+
rolesFilter?: Amity.NotificationRolesFilter;
|
|
46
|
+
};
|
|
47
|
+
type UserNotificationSettings = {
|
|
48
|
+
isEnabled: boolean;
|
|
49
|
+
modules: Amity.UserNotificationModule[];
|
|
50
|
+
};
|
|
51
|
+
type CommunityNotificationEvent = {
|
|
52
|
+
eventName: Amity.CommunityNotificationEventName;
|
|
53
|
+
isEnabled: boolean;
|
|
54
|
+
/** @readonly Populated by SDK on read. Silently ignored on write. */
|
|
55
|
+
isNetworkEnabled?: boolean;
|
|
56
|
+
rolesFilter?: Amity.NotificationRolesFilter;
|
|
57
|
+
};
|
|
58
|
+
type CommunityNotificationSettings = {
|
|
59
|
+
isEnabled: boolean;
|
|
60
|
+
events: Amity.CommunityNotificationEvent[];
|
|
61
|
+
};
|
|
62
|
+
type ChannelNotificationSettings = {
|
|
63
|
+
isEnabled: boolean;
|
|
64
|
+
};
|
|
65
|
+
type NotificationEvent = {
|
|
66
|
+
name: Amity.CommunityNotificationEventName | string;
|
|
67
|
+
moduleName: Amity.UserNotificationModuleName;
|
|
68
|
+
eventName: string;
|
|
69
|
+
isPushNotifiable: boolean;
|
|
70
|
+
isNetworkEnabled: boolean;
|
|
71
|
+
listenFromRoleIds: string[];
|
|
72
|
+
ignoreFromRoleIds: string[];
|
|
73
|
+
};
|
|
74
|
+
type NotificationSettings = {
|
|
75
|
+
isPushNotifiable: boolean;
|
|
76
|
+
isUserEnabled: boolean;
|
|
77
|
+
notifiableEvents: Amity.NotificationEvent[];
|
|
78
|
+
};
|
|
79
|
+
type NotificationEventPayload = {
|
|
80
|
+
moduleName?: string;
|
|
81
|
+
name?: string;
|
|
82
|
+
isPushNotifiable: boolean;
|
|
83
|
+
listenFromRoleIds?: string[];
|
|
84
|
+
};
|
|
85
|
+
type NotificationSettingsPayload = {
|
|
86
|
+
level: NotificationSettingsLevelEnum.USER;
|
|
87
|
+
isPushNotifiable: boolean;
|
|
88
|
+
notifiableEvents: NotificationEventPayload[];
|
|
89
|
+
} | {
|
|
90
|
+
level: NotificationSettingsLevelEnum.CHANNEL;
|
|
91
|
+
channelId: string;
|
|
92
|
+
isPushNotifiable: boolean;
|
|
93
|
+
} | {
|
|
94
|
+
level: NotificationSettingsLevelEnum.COMMUNITY;
|
|
95
|
+
communityId: string;
|
|
96
|
+
isPushNotifiable: boolean;
|
|
97
|
+
notifiableEvents: NotificationEventPayload[];
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=notificationSettings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notificationSettings.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/notificationSettings.ts"],"names":[],"mappings":"AAAA,oBAAY,8BAA8B;IACxC,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,eAAe,oBAAoB;CACpC;AAED,oBAAY,kCAAkC;IAC5C,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,eAAe,oBAAoB;IACnC,eAAe,oBAAoB;IACnC,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,qBAAqB,0BAA0B;IAC/C,gBAAgB,6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,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,cAAc,cAAc,CAAC;AAE7B,cAAc,gBAAgB,CAAC;AAE/B,cAAc,SAAS,CAAC;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAEhC,cAAc,eAAe,CAAC;AAE9B,cAAc,mBAAmB,CAAC;AAElC,cAAc,WAAW,CAAC;AAE1B,cAAc,cAAc,CAAC;AAE7B,cAAc,qBAAqB,CAAC;AAEpC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAE7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,iCAAiC,CAAC;AAEhD,cAAc,8BAA8B,CAAC;AAE7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAE7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AAErC,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,cAAc,cAAc,CAAC;AAE7B,cAAc,gBAAgB,CAAC;AAE/B,cAAc,SAAS,CAAC;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAEhC,cAAc,eAAe,CAAC;AAE9B,cAAc,mBAAmB,CAAC;AAElC,cAAc,WAAW,CAAC;AAE1B,cAAc,cAAc,CAAC;AAE7B,cAAc,qBAAqB,CAAC;AAEpC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAE7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,iCAAiC,CAAC;AAEhD,cAAc,8BAA8B,CAAC;AAE7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAE7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AAErC,cAAc,yBAAyB,CAAC;AAExC,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare class ChannelNotifications {
|
|
2
|
+
private readonly channelId;
|
|
3
|
+
constructor(channelId: string);
|
|
4
|
+
enable(): Promise<void>;
|
|
5
|
+
disable(): Promise<void>;
|
|
6
|
+
getSettings(): Promise<Amity.ChannelNotificationSettings>;
|
|
7
|
+
}
|
|
8
|
+
declare class UserNotifications {
|
|
9
|
+
enable(modules?: Amity.UserNotificationModule[]): Promise<void>;
|
|
10
|
+
disableAllNotifications(): Promise<void>;
|
|
11
|
+
getSettings(): Promise<Amity.UserNotificationSettings>;
|
|
12
|
+
}
|
|
13
|
+
declare class CommunityNotifications {
|
|
14
|
+
private readonly communityId;
|
|
15
|
+
constructor(communityId: string);
|
|
16
|
+
enable(events?: Amity.CommunityNotificationEvent[]): Promise<void>;
|
|
17
|
+
disable(): Promise<void>;
|
|
18
|
+
getSettings(): Promise<Amity.CommunityNotificationSettings>;
|
|
19
|
+
}
|
|
20
|
+
declare class Notifications {
|
|
21
|
+
user(): UserNotifications;
|
|
22
|
+
community(communityId: string): CommunityNotifications;
|
|
23
|
+
channel(channelId: string): ChannelNotifications;
|
|
24
|
+
}
|
|
25
|
+
export declare const notifications: () => Notifications;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../src/client/api/notifications.ts"],"names":[],"mappings":"AA8BA,cAAM,oBAAoB;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,SAAS,EAAE,MAAM;IAIvB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAUvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAUxB,WAAW,IAAI,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC;CAShE;AAED,cAAM,iBAAiB;IACf,MAAM,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,sBAAsB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB/D,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;IAYxC,WAAW,IAAI,OAAO,CAAC,KAAK,CAAC,wBAAwB,CAAC;CAkB7D;AAED,cAAM,sBAAsB;IAC1B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;gBAEzB,WAAW,EAAE,MAAM;IAIzB,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,0BAA0B,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBlE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAaxB,WAAW,IAAI,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC;CAsBlE;AAED,cAAM,aAAa;IACjB,IAAI;IAIJ,SAAS,CAAC,WAAW,EAAE,MAAM;IAI7B,OAAO,CAAC,SAAS,EAAE,MAAM;CAG1B;AAED,eAAO,MAAM,aAAa,qBAA4B,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -276,6 +276,39 @@ exports.AnalyticsSourceTypeEnum = void 0;
|
|
|
276
276
|
AnalyticsSourceTypeEnum["ROOM"] = "room";
|
|
277
277
|
})(exports.AnalyticsSourceTypeEnum || (exports.AnalyticsSourceTypeEnum = {}));
|
|
278
278
|
|
|
279
|
+
exports.UserNotificationModuleNameEnum = void 0;
|
|
280
|
+
(function (UserNotificationModuleNameEnum) {
|
|
281
|
+
UserNotificationModuleNameEnum["CHAT"] = "chat";
|
|
282
|
+
UserNotificationModuleNameEnum["SOCIAL"] = "social";
|
|
283
|
+
UserNotificationModuleNameEnum["VIDEO_STREAMING"] = "video-streaming";
|
|
284
|
+
})(exports.UserNotificationModuleNameEnum || (exports.UserNotificationModuleNameEnum = {}));
|
|
285
|
+
exports.CommunityNotificationEventNameEnum = void 0;
|
|
286
|
+
(function (CommunityNotificationEventNameEnum) {
|
|
287
|
+
CommunityNotificationEventNameEnum["POST_CREATED"] = "post.created";
|
|
288
|
+
CommunityNotificationEventNameEnum["POST_REACTED"] = "post.reacted";
|
|
289
|
+
CommunityNotificationEventNameEnum["COMMENT_CREATED"] = "comment.created";
|
|
290
|
+
CommunityNotificationEventNameEnum["COMMENT_REPLIED"] = "comment.replied";
|
|
291
|
+
CommunityNotificationEventNameEnum["COMMENT_REACTED"] = "comment.reacted";
|
|
292
|
+
CommunityNotificationEventNameEnum["STORY_CREATED"] = "story.created";
|
|
293
|
+
CommunityNotificationEventNameEnum["STORY_REACTED"] = "story.reacted";
|
|
294
|
+
CommunityNotificationEventNameEnum["STORY_COMMENT_CREATED"] = "story-comment.created";
|
|
295
|
+
CommunityNotificationEventNameEnum["LIVESTREAM_START"] = "video-streaming.didStart";
|
|
296
|
+
})(exports.CommunityNotificationEventNameEnum || (exports.CommunityNotificationEventNameEnum = {}));
|
|
297
|
+
exports.NotificationSettingsLevelEnum = void 0;
|
|
298
|
+
(function (NotificationSettingsLevelEnum) {
|
|
299
|
+
NotificationSettingsLevelEnum["USER"] = "user";
|
|
300
|
+
NotificationSettingsLevelEnum["COMMUNITY"] = "community";
|
|
301
|
+
NotificationSettingsLevelEnum["CHANNEL"] = "channel";
|
|
302
|
+
})(exports.NotificationSettingsLevelEnum || (exports.NotificationSettingsLevelEnum = {}));
|
|
303
|
+
/**
|
|
304
|
+
* `NOT` variant is intentionally excluded from public API (internal server-side use only).
|
|
305
|
+
*/
|
|
306
|
+
exports.NotificationRolesFilterTypeEnum = void 0;
|
|
307
|
+
(function (NotificationRolesFilterTypeEnum) {
|
|
308
|
+
NotificationRolesFilterTypeEnum["ALL"] = "all";
|
|
309
|
+
NotificationRolesFilterTypeEnum["ONLY"] = "only";
|
|
310
|
+
})(exports.NotificationRolesFilterTypeEnum || (exports.NotificationRolesFilterTypeEnum = {}));
|
|
311
|
+
|
|
279
312
|
function getVersion() {
|
|
280
313
|
try {
|
|
281
314
|
// the string ''v7.18.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
@@ -10947,6 +10980,140 @@ const setAccessTokenHandler = (accessTokenHandler) => {
|
|
|
10947
10980
|
client.accessTokenHandler = accessTokenHandler;
|
|
10948
10981
|
};
|
|
10949
10982
|
|
|
10983
|
+
function parseRolesFilter(listenFromRoleIds, ignoreFromRoleIds) {
|
|
10984
|
+
if (ignoreFromRoleIds && ignoreFromRoleIds.length > 0) {
|
|
10985
|
+
return { type: 'not', roleIds: ignoreFromRoleIds };
|
|
10986
|
+
}
|
|
10987
|
+
if (listenFromRoleIds && listenFromRoleIds.length > 0) {
|
|
10988
|
+
return { type: exports.NotificationRolesFilterTypeEnum.ONLY, roleIds: listenFromRoleIds };
|
|
10989
|
+
}
|
|
10990
|
+
return { type: exports.NotificationRolesFilterTypeEnum.ALL };
|
|
10991
|
+
}
|
|
10992
|
+
function serializeRolesFilter(rolesFilter) {
|
|
10993
|
+
if ((rolesFilter === null || rolesFilter === void 0 ? void 0 : rolesFilter.type) === exports.NotificationRolesFilterTypeEnum.ONLY) {
|
|
10994
|
+
return { listenFromRoleIds: rolesFilter.roleIds };
|
|
10995
|
+
}
|
|
10996
|
+
return { listenFromRoleIds: [] };
|
|
10997
|
+
}
|
|
10998
|
+
class ChannelNotifications {
|
|
10999
|
+
constructor(channelId) {
|
|
11000
|
+
this.channelId = channelId;
|
|
11001
|
+
}
|
|
11002
|
+
async enable() {
|
|
11003
|
+
const client = getActiveClient();
|
|
11004
|
+
const body = {
|
|
11005
|
+
level: exports.NotificationSettingsLevelEnum.CHANNEL,
|
|
11006
|
+
channelId: this.channelId,
|
|
11007
|
+
isPushNotifiable: true,
|
|
11008
|
+
};
|
|
11009
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
11010
|
+
}
|
|
11011
|
+
async disable() {
|
|
11012
|
+
const client = getActiveClient();
|
|
11013
|
+
const body = {
|
|
11014
|
+
level: exports.NotificationSettingsLevelEnum.CHANNEL,
|
|
11015
|
+
channelId: this.channelId,
|
|
11016
|
+
isPushNotifiable: false,
|
|
11017
|
+
};
|
|
11018
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
11019
|
+
}
|
|
11020
|
+
async getSettings() {
|
|
11021
|
+
const client = getActiveClient();
|
|
11022
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=channel&channelId=${encodeURIComponent(this.channelId)}`);
|
|
11023
|
+
return { isEnabled: data.isPushNotifiable };
|
|
11024
|
+
}
|
|
11025
|
+
}
|
|
11026
|
+
class UserNotifications {
|
|
11027
|
+
async enable(modules) {
|
|
11028
|
+
var _a;
|
|
11029
|
+
const client = getActiveClient();
|
|
11030
|
+
const notifiableEvents = (_a = modules === null || modules === void 0 ? void 0 : modules.map(module => (Object.assign({ moduleName: module.moduleName, isPushNotifiable: module.isEnabled }, serializeRolesFilter(module.rolesFilter))))) !== null && _a !== void 0 ? _a : [];
|
|
11031
|
+
const body = {
|
|
11032
|
+
level: exports.NotificationSettingsLevelEnum.USER,
|
|
11033
|
+
isPushNotifiable: true,
|
|
11034
|
+
notifiableEvents,
|
|
11035
|
+
};
|
|
11036
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
11037
|
+
}
|
|
11038
|
+
async disableAllNotifications() {
|
|
11039
|
+
const client = getActiveClient();
|
|
11040
|
+
const body = {
|
|
11041
|
+
level: exports.NotificationSettingsLevelEnum.USER,
|
|
11042
|
+
isPushNotifiable: false,
|
|
11043
|
+
notifiableEvents: [],
|
|
11044
|
+
};
|
|
11045
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
11046
|
+
}
|
|
11047
|
+
async getSettings() {
|
|
11048
|
+
var _a;
|
|
11049
|
+
const client = getActiveClient();
|
|
11050
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${exports.NotificationSettingsLevelEnum.USER}`);
|
|
11051
|
+
const validModuleNames = Object.values(exports.UserNotificationModuleNameEnum);
|
|
11052
|
+
const modules = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
11053
|
+
.filter(e => e.moduleName != null && validModuleNames.includes(e.moduleName))
|
|
11054
|
+
.map(e => ({
|
|
11055
|
+
moduleName: e.moduleName,
|
|
11056
|
+
isEnabled: e.isPushNotifiable,
|
|
11057
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
11058
|
+
}));
|
|
11059
|
+
return { isEnabled: data.isPushNotifiable, modules };
|
|
11060
|
+
}
|
|
11061
|
+
}
|
|
11062
|
+
class CommunityNotifications {
|
|
11063
|
+
constructor(communityId) {
|
|
11064
|
+
this.communityId = communityId;
|
|
11065
|
+
}
|
|
11066
|
+
async enable(events) {
|
|
11067
|
+
var _a;
|
|
11068
|
+
const client = getActiveClient();
|
|
11069
|
+
const notifiableEvents = (_a = events === null || events === void 0 ? void 0 : events.map(event => (Object.assign({ moduleName: exports.UserNotificationModuleNameEnum.SOCIAL, name: event.eventName, isPushNotifiable: event.isEnabled }, serializeRolesFilter(event.rolesFilter))))) !== null && _a !== void 0 ? _a : [];
|
|
11070
|
+
const body = {
|
|
11071
|
+
level: exports.NotificationSettingsLevelEnum.COMMUNITY,
|
|
11072
|
+
communityId: this.communityId,
|
|
11073
|
+
isPushNotifiable: true,
|
|
11074
|
+
notifiableEvents,
|
|
11075
|
+
};
|
|
11076
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
11077
|
+
}
|
|
11078
|
+
async disable() {
|
|
11079
|
+
const client = getActiveClient();
|
|
11080
|
+
const body = {
|
|
11081
|
+
level: exports.NotificationSettingsLevelEnum.COMMUNITY,
|
|
11082
|
+
communityId: this.communityId,
|
|
11083
|
+
isPushNotifiable: false,
|
|
11084
|
+
notifiableEvents: [],
|
|
11085
|
+
};
|
|
11086
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
11087
|
+
}
|
|
11088
|
+
async getSettings() {
|
|
11089
|
+
var _a;
|
|
11090
|
+
const client = getActiveClient();
|
|
11091
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${exports.NotificationSettingsLevelEnum.COMMUNITY}&communityId=${encodeURIComponent(this.communityId)}`);
|
|
11092
|
+
const validEventNames = Object.values(exports.CommunityNotificationEventNameEnum);
|
|
11093
|
+
const events = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
11094
|
+
.filter(e => e.name != null && validEventNames.includes(e.name))
|
|
11095
|
+
.map(e => ({
|
|
11096
|
+
eventName: e.name,
|
|
11097
|
+
isEnabled: e.isPushNotifiable,
|
|
11098
|
+
isNetworkEnabled: e.isNetworkEnabled,
|
|
11099
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
11100
|
+
}));
|
|
11101
|
+
return { isEnabled: data.isPushNotifiable, events };
|
|
11102
|
+
}
|
|
11103
|
+
}
|
|
11104
|
+
class Notifications {
|
|
11105
|
+
user() {
|
|
11106
|
+
return new UserNotifications();
|
|
11107
|
+
}
|
|
11108
|
+
community(communityId) {
|
|
11109
|
+
return new CommunityNotifications(communityId);
|
|
11110
|
+
}
|
|
11111
|
+
channel(channelId) {
|
|
11112
|
+
return new ChannelNotifications(channelId);
|
|
11113
|
+
}
|
|
11114
|
+
}
|
|
11115
|
+
const notifications = () => new Notifications();
|
|
11116
|
+
|
|
10950
11117
|
/**
|
|
10951
11118
|
* ```js
|
|
10952
11119
|
* import { onChannelMarkerFetched } from '@amityco/ts-sdk-react-native'
|
|
@@ -11330,6 +11497,7 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
11330
11497
|
getCurrentUserType: getCurrentUserType,
|
|
11331
11498
|
setCurrentUserType: setCurrentUserType,
|
|
11332
11499
|
setAccessTokenHandler: setAccessTokenHandler,
|
|
11500
|
+
notifications: notifications,
|
|
11333
11501
|
onConnectionError: onConnectionError,
|
|
11334
11502
|
onClientDisconnected: onClientDisconnected,
|
|
11335
11503
|
onClientBanned: onClientBanned,
|
|
@@ -13362,7 +13530,7 @@ const getWatchSessionStorage = () => {
|
|
|
13362
13530
|
return storageInstance;
|
|
13363
13531
|
};
|
|
13364
13532
|
|
|
13365
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
13533
|
+
const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDAARz+hmBgi8pJ\nQb8LeY41gtHhk+ACMwRfhsn7GqpqRQNG2qU0755mzZuVDUqjQMGSo8THJB7O+OJs\nflbZRkFXlFoFOVNw1UpNOgwEQZ6wB9oRwzepTJAfF1sVhm/o/ixvXh1zDFNDy6yZ\npXyiiJHUVxqyjllZhxnwdvjoVtDs6hW6awG09bB9nh/TTejlUKXoAgzqVwu/1QMu\nUVViET495elEe19aUarEy+oL2iKeXCEvqda/pWNBdbieFyJvvZ08HN8dPuT88wq2\njZLEAth1vrwQ2IAa4ktaLcBQdLJgIkrbDvAiVZ8lQAjS/bq5vXQikTGvoPlC5bbn\nvuOM/3eLAgMBAAECggEAVZ+peHAghq2QVj71nX5lxsNCKaCyYwixSJBpfouTt7Rz\nE6PpzMOXFi1W1o+I22jDakuSM2SOQKqI/u0QefB0r0O/KVk5NrZHXk0mkrdYtxOp\nUgaGyf8UvmjB+8VqHrNKyZdk9qtmbnNj01kTTcAtmE4H39zPR7eR/8Rul94vaZbs\nwCnKJS3mLT3J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Y-----";
|
|
13366
13534
|
/*
|
|
13367
13535
|
* The crypto algorithm used for importing key and signing string
|
|
13368
13536
|
*/
|
package/dist/index.esm.js
CHANGED
|
@@ -242,6 +242,39 @@ var AnalyticsSourceTypeEnum;
|
|
|
242
242
|
AnalyticsSourceTypeEnum["ROOM"] = "room";
|
|
243
243
|
})(AnalyticsSourceTypeEnum || (AnalyticsSourceTypeEnum = {}));
|
|
244
244
|
|
|
245
|
+
var UserNotificationModuleNameEnum;
|
|
246
|
+
(function (UserNotificationModuleNameEnum) {
|
|
247
|
+
UserNotificationModuleNameEnum["CHAT"] = "chat";
|
|
248
|
+
UserNotificationModuleNameEnum["SOCIAL"] = "social";
|
|
249
|
+
UserNotificationModuleNameEnum["VIDEO_STREAMING"] = "video-streaming";
|
|
250
|
+
})(UserNotificationModuleNameEnum || (UserNotificationModuleNameEnum = {}));
|
|
251
|
+
var CommunityNotificationEventNameEnum;
|
|
252
|
+
(function (CommunityNotificationEventNameEnum) {
|
|
253
|
+
CommunityNotificationEventNameEnum["POST_CREATED"] = "post.created";
|
|
254
|
+
CommunityNotificationEventNameEnum["POST_REACTED"] = "post.reacted";
|
|
255
|
+
CommunityNotificationEventNameEnum["COMMENT_CREATED"] = "comment.created";
|
|
256
|
+
CommunityNotificationEventNameEnum["COMMENT_REPLIED"] = "comment.replied";
|
|
257
|
+
CommunityNotificationEventNameEnum["COMMENT_REACTED"] = "comment.reacted";
|
|
258
|
+
CommunityNotificationEventNameEnum["STORY_CREATED"] = "story.created";
|
|
259
|
+
CommunityNotificationEventNameEnum["STORY_REACTED"] = "story.reacted";
|
|
260
|
+
CommunityNotificationEventNameEnum["STORY_COMMENT_CREATED"] = "story-comment.created";
|
|
261
|
+
CommunityNotificationEventNameEnum["LIVESTREAM_START"] = "video-streaming.didStart";
|
|
262
|
+
})(CommunityNotificationEventNameEnum || (CommunityNotificationEventNameEnum = {}));
|
|
263
|
+
var NotificationSettingsLevelEnum;
|
|
264
|
+
(function (NotificationSettingsLevelEnum) {
|
|
265
|
+
NotificationSettingsLevelEnum["USER"] = "user";
|
|
266
|
+
NotificationSettingsLevelEnum["COMMUNITY"] = "community";
|
|
267
|
+
NotificationSettingsLevelEnum["CHANNEL"] = "channel";
|
|
268
|
+
})(NotificationSettingsLevelEnum || (NotificationSettingsLevelEnum = {}));
|
|
269
|
+
/**
|
|
270
|
+
* `NOT` variant is intentionally excluded from public API (internal server-side use only).
|
|
271
|
+
*/
|
|
272
|
+
var NotificationRolesFilterTypeEnum;
|
|
273
|
+
(function (NotificationRolesFilterTypeEnum) {
|
|
274
|
+
NotificationRolesFilterTypeEnum["ALL"] = "all";
|
|
275
|
+
NotificationRolesFilterTypeEnum["ONLY"] = "only";
|
|
276
|
+
})(NotificationRolesFilterTypeEnum || (NotificationRolesFilterTypeEnum = {}));
|
|
277
|
+
|
|
245
278
|
function getVersion() {
|
|
246
279
|
try {
|
|
247
280
|
// the string ''v7.18.0-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
@@ -27020,6 +27053,140 @@ const setAccessTokenHandler = (accessTokenHandler) => {
|
|
|
27020
27053
|
client.accessTokenHandler = accessTokenHandler;
|
|
27021
27054
|
};
|
|
27022
27055
|
|
|
27056
|
+
function parseRolesFilter(listenFromRoleIds, ignoreFromRoleIds) {
|
|
27057
|
+
if (ignoreFromRoleIds && ignoreFromRoleIds.length > 0) {
|
|
27058
|
+
return { type: 'not', roleIds: ignoreFromRoleIds };
|
|
27059
|
+
}
|
|
27060
|
+
if (listenFromRoleIds && listenFromRoleIds.length > 0) {
|
|
27061
|
+
return { type: NotificationRolesFilterTypeEnum.ONLY, roleIds: listenFromRoleIds };
|
|
27062
|
+
}
|
|
27063
|
+
return { type: NotificationRolesFilterTypeEnum.ALL };
|
|
27064
|
+
}
|
|
27065
|
+
function serializeRolesFilter(rolesFilter) {
|
|
27066
|
+
if ((rolesFilter === null || rolesFilter === void 0 ? void 0 : rolesFilter.type) === NotificationRolesFilterTypeEnum.ONLY) {
|
|
27067
|
+
return { listenFromRoleIds: rolesFilter.roleIds };
|
|
27068
|
+
}
|
|
27069
|
+
return { listenFromRoleIds: [] };
|
|
27070
|
+
}
|
|
27071
|
+
class ChannelNotifications {
|
|
27072
|
+
constructor(channelId) {
|
|
27073
|
+
this.channelId = channelId;
|
|
27074
|
+
}
|
|
27075
|
+
async enable() {
|
|
27076
|
+
const client = getActiveClient();
|
|
27077
|
+
const body = {
|
|
27078
|
+
level: NotificationSettingsLevelEnum.CHANNEL,
|
|
27079
|
+
channelId: this.channelId,
|
|
27080
|
+
isPushNotifiable: true,
|
|
27081
|
+
};
|
|
27082
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27083
|
+
}
|
|
27084
|
+
async disable() {
|
|
27085
|
+
const client = getActiveClient();
|
|
27086
|
+
const body = {
|
|
27087
|
+
level: NotificationSettingsLevelEnum.CHANNEL,
|
|
27088
|
+
channelId: this.channelId,
|
|
27089
|
+
isPushNotifiable: false,
|
|
27090
|
+
};
|
|
27091
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27092
|
+
}
|
|
27093
|
+
async getSettings() {
|
|
27094
|
+
const client = getActiveClient();
|
|
27095
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=channel&channelId=${encodeURIComponent(this.channelId)}`);
|
|
27096
|
+
return { isEnabled: data.isPushNotifiable };
|
|
27097
|
+
}
|
|
27098
|
+
}
|
|
27099
|
+
class UserNotifications {
|
|
27100
|
+
async enable(modules) {
|
|
27101
|
+
var _a;
|
|
27102
|
+
const client = getActiveClient();
|
|
27103
|
+
const notifiableEvents = (_a = modules === null || modules === void 0 ? void 0 : modules.map(module => (Object.assign({ moduleName: module.moduleName, isPushNotifiable: module.isEnabled }, serializeRolesFilter(module.rolesFilter))))) !== null && _a !== void 0 ? _a : [];
|
|
27104
|
+
const body = {
|
|
27105
|
+
level: NotificationSettingsLevelEnum.USER,
|
|
27106
|
+
isPushNotifiable: true,
|
|
27107
|
+
notifiableEvents,
|
|
27108
|
+
};
|
|
27109
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27110
|
+
}
|
|
27111
|
+
async disableAllNotifications() {
|
|
27112
|
+
const client = getActiveClient();
|
|
27113
|
+
const body = {
|
|
27114
|
+
level: NotificationSettingsLevelEnum.USER,
|
|
27115
|
+
isPushNotifiable: false,
|
|
27116
|
+
notifiableEvents: [],
|
|
27117
|
+
};
|
|
27118
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27119
|
+
}
|
|
27120
|
+
async getSettings() {
|
|
27121
|
+
var _a;
|
|
27122
|
+
const client = getActiveClient();
|
|
27123
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${NotificationSettingsLevelEnum.USER}`);
|
|
27124
|
+
const validModuleNames = Object.values(UserNotificationModuleNameEnum);
|
|
27125
|
+
const modules = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
27126
|
+
.filter(e => e.moduleName != null && validModuleNames.includes(e.moduleName))
|
|
27127
|
+
.map(e => ({
|
|
27128
|
+
moduleName: e.moduleName,
|
|
27129
|
+
isEnabled: e.isPushNotifiable,
|
|
27130
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
27131
|
+
}));
|
|
27132
|
+
return { isEnabled: data.isPushNotifiable, modules };
|
|
27133
|
+
}
|
|
27134
|
+
}
|
|
27135
|
+
class CommunityNotifications {
|
|
27136
|
+
constructor(communityId) {
|
|
27137
|
+
this.communityId = communityId;
|
|
27138
|
+
}
|
|
27139
|
+
async enable(events) {
|
|
27140
|
+
var _a;
|
|
27141
|
+
const client = getActiveClient();
|
|
27142
|
+
const notifiableEvents = (_a = events === null || events === void 0 ? void 0 : events.map(event => (Object.assign({ moduleName: UserNotificationModuleNameEnum.SOCIAL, name: event.eventName, isPushNotifiable: event.isEnabled }, serializeRolesFilter(event.rolesFilter))))) !== null && _a !== void 0 ? _a : [];
|
|
27143
|
+
const body = {
|
|
27144
|
+
level: NotificationSettingsLevelEnum.COMMUNITY,
|
|
27145
|
+
communityId: this.communityId,
|
|
27146
|
+
isPushNotifiable: true,
|
|
27147
|
+
notifiableEvents,
|
|
27148
|
+
};
|
|
27149
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27150
|
+
}
|
|
27151
|
+
async disable() {
|
|
27152
|
+
const client = getActiveClient();
|
|
27153
|
+
const body = {
|
|
27154
|
+
level: NotificationSettingsLevelEnum.COMMUNITY,
|
|
27155
|
+
communityId: this.communityId,
|
|
27156
|
+
isPushNotifiable: false,
|
|
27157
|
+
notifiableEvents: [],
|
|
27158
|
+
};
|
|
27159
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27160
|
+
}
|
|
27161
|
+
async getSettings() {
|
|
27162
|
+
var _a;
|
|
27163
|
+
const client = getActiveClient();
|
|
27164
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${NotificationSettingsLevelEnum.COMMUNITY}&communityId=${encodeURIComponent(this.communityId)}`);
|
|
27165
|
+
const validEventNames = Object.values(CommunityNotificationEventNameEnum);
|
|
27166
|
+
const events = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
27167
|
+
.filter(e => e.name != null && validEventNames.includes(e.name))
|
|
27168
|
+
.map(e => ({
|
|
27169
|
+
eventName: e.name,
|
|
27170
|
+
isEnabled: e.isPushNotifiable,
|
|
27171
|
+
isNetworkEnabled: e.isNetworkEnabled,
|
|
27172
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
27173
|
+
}));
|
|
27174
|
+
return { isEnabled: data.isPushNotifiable, events };
|
|
27175
|
+
}
|
|
27176
|
+
}
|
|
27177
|
+
class Notifications {
|
|
27178
|
+
user() {
|
|
27179
|
+
return new UserNotifications();
|
|
27180
|
+
}
|
|
27181
|
+
community(communityId) {
|
|
27182
|
+
return new CommunityNotifications(communityId);
|
|
27183
|
+
}
|
|
27184
|
+
channel(channelId) {
|
|
27185
|
+
return new ChannelNotifications(channelId);
|
|
27186
|
+
}
|
|
27187
|
+
}
|
|
27188
|
+
const notifications = () => new Notifications();
|
|
27189
|
+
|
|
27023
27190
|
/**
|
|
27024
27191
|
* ```js
|
|
27025
27192
|
* import { onChannelMarkerFetched } from '@amityco/ts-sdk-react-native'
|
|
@@ -27403,6 +27570,7 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
27403
27570
|
getCurrentUserType: getCurrentUserType,
|
|
27404
27571
|
setCurrentUserType: setCurrentUserType,
|
|
27405
27572
|
setAccessTokenHandler: setAccessTokenHandler,
|
|
27573
|
+
notifications: notifications,
|
|
27406
27574
|
onConnectionError: onConnectionError,
|
|
27407
27575
|
onClientDisconnected: onClientDisconnected,
|
|
27408
27576
|
onClientBanned: onClientBanned,
|
|
@@ -29435,7 +29603,7 @@ const getWatchSessionStorage = () => {
|
|
|
29435
29603
|
return storageInstance;
|
|
29436
29604
|
};
|
|
29437
29605
|
|
|
29438
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
29606
|
+
const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDAARz+hmBgi8pJ\nQb8LeY41gtHhk+ACMwRfhsn7GqpqRQNG2qU0755mzZuVDUqjQMGSo8THJB7O+OJs\nflbZRkFXlFoFOVNw1UpNOgwEQZ6wB9oRwzepTJAfF1sVhm/o/ixvXh1zDFNDy6yZ\npXyiiJHUVxqyjllZhxnwdvjoVtDs6hW6awG09bB9nh/TTejlUKXoAgzqVwu/1QMu\nUVViET495elEe19aUarEy+oL2iKeXCEvqda/pWNBdbieFyJvvZ08HN8dPuT88wq2\njZLEAth1vrwQ2IAa4ktaLcBQdLJgIkrbDvAiVZ8lQAjS/bq5vXQikTGvoPlC5bbn\nvuOM/3eLAgMBAAECggEAVZ+peHAghq2QVj71nX5lxsNCKaCyYwixSJBpfouTt7Rz\nE6PpzMOXFi1W1o+I22jDakuSM2SOQKqI/u0QefB0r0O/KVk5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Jw9PMwVu6dmf/CO0Z1wzXSp2VVD12gbrUD/0/d7MUoJ9LgC8X8f/\nn0txLHYGHbx+nf95+JUg6lV3hg==\n-----END PRIVATE KEY-----";
|
|
29439
29607
|
/*
|
|
29440
29608
|
* The crypto algorithm used for importing key and signing string
|
|
29441
29609
|
*/
|
|
@@ -51677,4 +51845,4 @@ class AmityAttachmentProductTags {
|
|
|
51677
51845
|
}
|
|
51678
51846
|
}
|
|
51679
51847
|
|
|
51680
|
-
export { API_REGIONS, index$5 as AdRepository, AmityAttachmentProductTags, AmityCommunityType, AmityEventOrderOption, AmityEventOriginType, AmityEventResponseStatus, AmityEventSortOption, AmityEventStatus, AmityEventType, AnalyticsSourceTypeEnum, index$f as CategoryRepository, index$j as ChannelRepository, index$s as Client, index$e as CommentRepository, 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, 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, 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, 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 };
|
|
51848
|
+
export { API_REGIONS, index$5 as AdRepository, AmityAttachmentProductTags, AmityCommunityType, AmityEventOrderOption, AmityEventOriginType, AmityEventResponseStatus, AmityEventSortOption, AmityEventStatus, AmityEventType, 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, 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 };
|