@amityco/ts-sdk-react-native 7.22.0 → 7.22.1-f15e84ea.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,6B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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;CAWhE;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.22.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
@@ -11023,6 +11056,140 @@ const setAccessTokenHandler = (accessTokenHandler) => {
|
|
|
11023
11056
|
client.accessTokenHandler = accessTokenHandler;
|
|
11024
11057
|
};
|
|
11025
11058
|
|
|
11059
|
+
function parseRolesFilter(listenFromRoleIds, ignoreFromRoleIds) {
|
|
11060
|
+
if (ignoreFromRoleIds && ignoreFromRoleIds.length > 0) {
|
|
11061
|
+
return { type: 'not', roleIds: ignoreFromRoleIds };
|
|
11062
|
+
}
|
|
11063
|
+
if (listenFromRoleIds && listenFromRoleIds.length > 0) {
|
|
11064
|
+
return { type: exports.NotificationRolesFilterTypeEnum.ONLY, roleIds: listenFromRoleIds };
|
|
11065
|
+
}
|
|
11066
|
+
return { type: exports.NotificationRolesFilterTypeEnum.ALL };
|
|
11067
|
+
}
|
|
11068
|
+
function serializeRolesFilter(rolesFilter) {
|
|
11069
|
+
if ((rolesFilter === null || rolesFilter === void 0 ? void 0 : rolesFilter.type) === exports.NotificationRolesFilterTypeEnum.ONLY) {
|
|
11070
|
+
return { listenFromRoleIds: rolesFilter.roleIds };
|
|
11071
|
+
}
|
|
11072
|
+
return { listenFromRoleIds: [] };
|
|
11073
|
+
}
|
|
11074
|
+
class ChannelNotifications {
|
|
11075
|
+
constructor(channelId) {
|
|
11076
|
+
this.channelId = channelId;
|
|
11077
|
+
}
|
|
11078
|
+
async enable() {
|
|
11079
|
+
const client = getActiveClient();
|
|
11080
|
+
const body = {
|
|
11081
|
+
level: exports.NotificationSettingsLevelEnum.CHANNEL,
|
|
11082
|
+
channelId: this.channelId,
|
|
11083
|
+
isPushNotifiable: true,
|
|
11084
|
+
};
|
|
11085
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
11086
|
+
}
|
|
11087
|
+
async disable() {
|
|
11088
|
+
const client = getActiveClient();
|
|
11089
|
+
const body = {
|
|
11090
|
+
level: exports.NotificationSettingsLevelEnum.CHANNEL,
|
|
11091
|
+
channelId: this.channelId,
|
|
11092
|
+
isPushNotifiable: false,
|
|
11093
|
+
};
|
|
11094
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
11095
|
+
}
|
|
11096
|
+
async getSettings() {
|
|
11097
|
+
const client = getActiveClient();
|
|
11098
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${exports.NotificationSettingsLevelEnum.CHANNEL}&channelId=${encodeURIComponent(this.channelId)}`);
|
|
11099
|
+
return { isEnabled: data.isPushNotifiable };
|
|
11100
|
+
}
|
|
11101
|
+
}
|
|
11102
|
+
class UserNotifications {
|
|
11103
|
+
async enable(modules) {
|
|
11104
|
+
var _a;
|
|
11105
|
+
const client = getActiveClient();
|
|
11106
|
+
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 : [];
|
|
11107
|
+
const body = {
|
|
11108
|
+
level: exports.NotificationSettingsLevelEnum.USER,
|
|
11109
|
+
isPushNotifiable: true,
|
|
11110
|
+
notifiableEvents,
|
|
11111
|
+
};
|
|
11112
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
11113
|
+
}
|
|
11114
|
+
async disableAllNotifications() {
|
|
11115
|
+
const client = getActiveClient();
|
|
11116
|
+
const body = {
|
|
11117
|
+
level: exports.NotificationSettingsLevelEnum.USER,
|
|
11118
|
+
isPushNotifiable: false,
|
|
11119
|
+
notifiableEvents: [],
|
|
11120
|
+
};
|
|
11121
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
11122
|
+
}
|
|
11123
|
+
async getSettings() {
|
|
11124
|
+
var _a;
|
|
11125
|
+
const client = getActiveClient();
|
|
11126
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${exports.NotificationSettingsLevelEnum.USER}`);
|
|
11127
|
+
const validModuleNames = Object.values(exports.UserNotificationModuleNameEnum);
|
|
11128
|
+
const modules = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
11129
|
+
.filter(e => e.moduleName != null && validModuleNames.includes(e.moduleName))
|
|
11130
|
+
.map(e => ({
|
|
11131
|
+
moduleName: e.moduleName,
|
|
11132
|
+
isEnabled: e.isPushNotifiable,
|
|
11133
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
11134
|
+
}));
|
|
11135
|
+
return { isEnabled: data.isPushNotifiable, modules };
|
|
11136
|
+
}
|
|
11137
|
+
}
|
|
11138
|
+
class CommunityNotifications {
|
|
11139
|
+
constructor(communityId) {
|
|
11140
|
+
this.communityId = communityId;
|
|
11141
|
+
}
|
|
11142
|
+
async enable(events) {
|
|
11143
|
+
var _a;
|
|
11144
|
+
const client = getActiveClient();
|
|
11145
|
+
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 : [];
|
|
11146
|
+
const body = {
|
|
11147
|
+
level: exports.NotificationSettingsLevelEnum.COMMUNITY,
|
|
11148
|
+
communityId: this.communityId,
|
|
11149
|
+
isPushNotifiable: true,
|
|
11150
|
+
notifiableEvents,
|
|
11151
|
+
};
|
|
11152
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
11153
|
+
}
|
|
11154
|
+
async disable() {
|
|
11155
|
+
const client = getActiveClient();
|
|
11156
|
+
const body = {
|
|
11157
|
+
level: exports.NotificationSettingsLevelEnum.COMMUNITY,
|
|
11158
|
+
communityId: this.communityId,
|
|
11159
|
+
isPushNotifiable: false,
|
|
11160
|
+
notifiableEvents: [],
|
|
11161
|
+
};
|
|
11162
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
11163
|
+
}
|
|
11164
|
+
async getSettings() {
|
|
11165
|
+
var _a;
|
|
11166
|
+
const client = getActiveClient();
|
|
11167
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${exports.NotificationSettingsLevelEnum.COMMUNITY}&communityId=${encodeURIComponent(this.communityId)}`);
|
|
11168
|
+
const validEventNames = Object.values(exports.CommunityNotificationEventNameEnum);
|
|
11169
|
+
const events = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
11170
|
+
.filter(e => e.name != null && validEventNames.includes(e.name))
|
|
11171
|
+
.map(e => ({
|
|
11172
|
+
eventName: e.name,
|
|
11173
|
+
isEnabled: e.isPushNotifiable,
|
|
11174
|
+
isNetworkEnabled: e.isNetworkEnabled,
|
|
11175
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
11176
|
+
}));
|
|
11177
|
+
return { isEnabled: data.isPushNotifiable, events };
|
|
11178
|
+
}
|
|
11179
|
+
}
|
|
11180
|
+
class Notifications {
|
|
11181
|
+
user() {
|
|
11182
|
+
return new UserNotifications();
|
|
11183
|
+
}
|
|
11184
|
+
community(communityId) {
|
|
11185
|
+
return new CommunityNotifications(communityId);
|
|
11186
|
+
}
|
|
11187
|
+
channel(channelId) {
|
|
11188
|
+
return new ChannelNotifications(channelId);
|
|
11189
|
+
}
|
|
11190
|
+
}
|
|
11191
|
+
const notifications = () => new Notifications();
|
|
11192
|
+
|
|
11026
11193
|
/**
|
|
11027
11194
|
* ```js
|
|
11028
11195
|
* import { onChannelMarkerFetched } from '@amityco/ts-sdk-react-native'
|
|
@@ -11406,6 +11573,7 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
11406
11573
|
getCurrentUserType: getCurrentUserType,
|
|
11407
11574
|
setCurrentUserType: setCurrentUserType,
|
|
11408
11575
|
setAccessTokenHandler: setAccessTokenHandler,
|
|
11576
|
+
notifications: notifications,
|
|
11409
11577
|
onConnectionError: onConnectionError,
|
|
11410
11578
|
onClientDisconnected: onClientDisconnected,
|
|
11411
11579
|
onClientBanned: onClientBanned,
|
|
@@ -13442,7 +13610,7 @@ const getWatchSessionStorage = () => {
|
|
|
13442
13610
|
return storageInstance;
|
|
13443
13611
|
};
|
|
13444
13612
|
|
|
13445
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
13613
|
+
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/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+JUg6lV3hg==\n-----END PRIVATE KEY-----";
|
|
13446
13614
|
/*
|
|
13447
13615
|
* The crypto algorithm used for importing key and signing string
|
|
13448
13616
|
*/
|
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.22.0-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
@@ -27096,6 +27129,140 @@ const setAccessTokenHandler = (accessTokenHandler) => {
|
|
|
27096
27129
|
client.accessTokenHandler = accessTokenHandler;
|
|
27097
27130
|
};
|
|
27098
27131
|
|
|
27132
|
+
function parseRolesFilter(listenFromRoleIds, ignoreFromRoleIds) {
|
|
27133
|
+
if (ignoreFromRoleIds && ignoreFromRoleIds.length > 0) {
|
|
27134
|
+
return { type: 'not', roleIds: ignoreFromRoleIds };
|
|
27135
|
+
}
|
|
27136
|
+
if (listenFromRoleIds && listenFromRoleIds.length > 0) {
|
|
27137
|
+
return { type: NotificationRolesFilterTypeEnum.ONLY, roleIds: listenFromRoleIds };
|
|
27138
|
+
}
|
|
27139
|
+
return { type: NotificationRolesFilterTypeEnum.ALL };
|
|
27140
|
+
}
|
|
27141
|
+
function serializeRolesFilter(rolesFilter) {
|
|
27142
|
+
if ((rolesFilter === null || rolesFilter === void 0 ? void 0 : rolesFilter.type) === NotificationRolesFilterTypeEnum.ONLY) {
|
|
27143
|
+
return { listenFromRoleIds: rolesFilter.roleIds };
|
|
27144
|
+
}
|
|
27145
|
+
return { listenFromRoleIds: [] };
|
|
27146
|
+
}
|
|
27147
|
+
class ChannelNotifications {
|
|
27148
|
+
constructor(channelId) {
|
|
27149
|
+
this.channelId = channelId;
|
|
27150
|
+
}
|
|
27151
|
+
async enable() {
|
|
27152
|
+
const client = getActiveClient();
|
|
27153
|
+
const body = {
|
|
27154
|
+
level: NotificationSettingsLevelEnum.CHANNEL,
|
|
27155
|
+
channelId: this.channelId,
|
|
27156
|
+
isPushNotifiable: true,
|
|
27157
|
+
};
|
|
27158
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27159
|
+
}
|
|
27160
|
+
async disable() {
|
|
27161
|
+
const client = getActiveClient();
|
|
27162
|
+
const body = {
|
|
27163
|
+
level: NotificationSettingsLevelEnum.CHANNEL,
|
|
27164
|
+
channelId: this.channelId,
|
|
27165
|
+
isPushNotifiable: false,
|
|
27166
|
+
};
|
|
27167
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27168
|
+
}
|
|
27169
|
+
async getSettings() {
|
|
27170
|
+
const client = getActiveClient();
|
|
27171
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${NotificationSettingsLevelEnum.CHANNEL}&channelId=${encodeURIComponent(this.channelId)}`);
|
|
27172
|
+
return { isEnabled: data.isPushNotifiable };
|
|
27173
|
+
}
|
|
27174
|
+
}
|
|
27175
|
+
class UserNotifications {
|
|
27176
|
+
async enable(modules) {
|
|
27177
|
+
var _a;
|
|
27178
|
+
const client = getActiveClient();
|
|
27179
|
+
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 : [];
|
|
27180
|
+
const body = {
|
|
27181
|
+
level: NotificationSettingsLevelEnum.USER,
|
|
27182
|
+
isPushNotifiable: true,
|
|
27183
|
+
notifiableEvents,
|
|
27184
|
+
};
|
|
27185
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27186
|
+
}
|
|
27187
|
+
async disableAllNotifications() {
|
|
27188
|
+
const client = getActiveClient();
|
|
27189
|
+
const body = {
|
|
27190
|
+
level: NotificationSettingsLevelEnum.USER,
|
|
27191
|
+
isPushNotifiable: false,
|
|
27192
|
+
notifiableEvents: [],
|
|
27193
|
+
};
|
|
27194
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27195
|
+
}
|
|
27196
|
+
async getSettings() {
|
|
27197
|
+
var _a;
|
|
27198
|
+
const client = getActiveClient();
|
|
27199
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${NotificationSettingsLevelEnum.USER}`);
|
|
27200
|
+
const validModuleNames = Object.values(UserNotificationModuleNameEnum);
|
|
27201
|
+
const modules = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
27202
|
+
.filter(e => e.moduleName != null && validModuleNames.includes(e.moduleName))
|
|
27203
|
+
.map(e => ({
|
|
27204
|
+
moduleName: e.moduleName,
|
|
27205
|
+
isEnabled: e.isPushNotifiable,
|
|
27206
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
27207
|
+
}));
|
|
27208
|
+
return { isEnabled: data.isPushNotifiable, modules };
|
|
27209
|
+
}
|
|
27210
|
+
}
|
|
27211
|
+
class CommunityNotifications {
|
|
27212
|
+
constructor(communityId) {
|
|
27213
|
+
this.communityId = communityId;
|
|
27214
|
+
}
|
|
27215
|
+
async enable(events) {
|
|
27216
|
+
var _a;
|
|
27217
|
+
const client = getActiveClient();
|
|
27218
|
+
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 : [];
|
|
27219
|
+
const body = {
|
|
27220
|
+
level: NotificationSettingsLevelEnum.COMMUNITY,
|
|
27221
|
+
communityId: this.communityId,
|
|
27222
|
+
isPushNotifiable: true,
|
|
27223
|
+
notifiableEvents,
|
|
27224
|
+
};
|
|
27225
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27226
|
+
}
|
|
27227
|
+
async disable() {
|
|
27228
|
+
const client = getActiveClient();
|
|
27229
|
+
const body = {
|
|
27230
|
+
level: NotificationSettingsLevelEnum.COMMUNITY,
|
|
27231
|
+
communityId: this.communityId,
|
|
27232
|
+
isPushNotifiable: false,
|
|
27233
|
+
notifiableEvents: [],
|
|
27234
|
+
};
|
|
27235
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27236
|
+
}
|
|
27237
|
+
async getSettings() {
|
|
27238
|
+
var _a;
|
|
27239
|
+
const client = getActiveClient();
|
|
27240
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${NotificationSettingsLevelEnum.COMMUNITY}&communityId=${encodeURIComponent(this.communityId)}`);
|
|
27241
|
+
const validEventNames = Object.values(CommunityNotificationEventNameEnum);
|
|
27242
|
+
const events = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
27243
|
+
.filter(e => e.name != null && validEventNames.includes(e.name))
|
|
27244
|
+
.map(e => ({
|
|
27245
|
+
eventName: e.name,
|
|
27246
|
+
isEnabled: e.isPushNotifiable,
|
|
27247
|
+
isNetworkEnabled: e.isNetworkEnabled,
|
|
27248
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
27249
|
+
}));
|
|
27250
|
+
return { isEnabled: data.isPushNotifiable, events };
|
|
27251
|
+
}
|
|
27252
|
+
}
|
|
27253
|
+
class Notifications {
|
|
27254
|
+
user() {
|
|
27255
|
+
return new UserNotifications();
|
|
27256
|
+
}
|
|
27257
|
+
community(communityId) {
|
|
27258
|
+
return new CommunityNotifications(communityId);
|
|
27259
|
+
}
|
|
27260
|
+
channel(channelId) {
|
|
27261
|
+
return new ChannelNotifications(channelId);
|
|
27262
|
+
}
|
|
27263
|
+
}
|
|
27264
|
+
const notifications = () => new Notifications();
|
|
27265
|
+
|
|
27099
27266
|
/**
|
|
27100
27267
|
* ```js
|
|
27101
27268
|
* import { onChannelMarkerFetched } from '@amityco/ts-sdk-react-native'
|
|
@@ -27479,6 +27646,7 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
27479
27646
|
getCurrentUserType: getCurrentUserType,
|
|
27480
27647
|
setCurrentUserType: setCurrentUserType,
|
|
27481
27648
|
setAccessTokenHandler: setAccessTokenHandler,
|
|
27649
|
+
notifications: notifications,
|
|
27482
27650
|
onConnectionError: onConnectionError,
|
|
27483
27651
|
onClientDisconnected: onClientDisconnected,
|
|
27484
27652
|
onClientBanned: onClientBanned,
|
|
@@ -29515,7 +29683,7 @@ const getWatchSessionStorage = () => {
|
|
|
29515
29683
|
return storageInstance;
|
|
29516
29684
|
};
|
|
29517
29685
|
|
|
29518
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
29686
|
+
const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDAARz+hmBgi8pJ\nQb8LeY41gtHhk+ACMwRfhsn7GqpqRQNG2qU0755mzZuVDUqjQMGSo8THJB7O+OJs\nflbZRkFXlFoFOVNw1UpNOgwEQZ6wB9oRwzepTJAfF1sVhm/o/ixvXh1zDFNDy6yZ\npXyiiJHUVxqyjllZhxnwdvjoVtDs6hW6awG09bB9nh/TTejlUKXoAgzqVwu/1QMu\nUVViET495elEe19aUarEy+oL2iKeXCEvqda/pWNBdbieFyJvvZ08HN8dPuT88wq2\njZLEAth1vrwQ2IAa4ktaLcBQdLJgIkrbDvAiVZ8lQAjS/bq5vXQikTGvoPlC5bbn\nvuOM/3eLAgMBAAECggEAVZ+peHAghq2QVj71nX5lxsNCKaCyYwixSJBpfouTt7Rz\n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ob8yedbg3WWNWyShwRMFYyY9S81ITFWM95uL6\nvF3x9rmRjwElJw9PMwVu6dmf/CO0Z1wzXSp2VVD12gbrUD/0/d7MUoJ9LgC8X8f/\nn0txLHYGHbx+nf95+JUg6lV3hg==\n-----END PRIVATE KEY-----";
|
|
29519
29687
|
/*
|
|
29520
29688
|
* The crypto algorithm used for importing key and signing string
|
|
29521
29689
|
*/
|
|
@@ -51873,4 +52041,4 @@ class AmityAttachmentProductTags {
|
|
|
51873
52041
|
}
|
|
51874
52042
|
}
|
|
51875
52043
|
|
|
51876
|
-
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 };
|
|
52044
|
+
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 };
|