@amityco/ts-sdk-react-native 7.17.0 → 7.17.1-69773905.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 +103 -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,103 @@
|
|
|
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 RawNotificationSettings = {
|
|
75
|
+
isPushNotifiable: boolean;
|
|
76
|
+
isUserEnabled: boolean;
|
|
77
|
+
notifiableEvents: Amity.NotificationEvent[];
|
|
78
|
+
};
|
|
79
|
+
type InternalNotificationSettings = RawNotificationSettings;
|
|
80
|
+
type NotificationSettings = InternalNotificationSettings;
|
|
81
|
+
type NotificationEventPayload = {
|
|
82
|
+
moduleName?: string;
|
|
83
|
+
name?: string;
|
|
84
|
+
isPushNotifiable: boolean;
|
|
85
|
+
listenFromRoleIds?: string[];
|
|
86
|
+
};
|
|
87
|
+
type NotificationSettingsPayload = {
|
|
88
|
+
level: NotificationSettingsLevelEnum.USER;
|
|
89
|
+
isPushNotifiable: boolean;
|
|
90
|
+
notifiableEvents: NotificationEventPayload[];
|
|
91
|
+
} | {
|
|
92
|
+
level: NotificationSettingsLevelEnum.CHANNEL;
|
|
93
|
+
channelId: string;
|
|
94
|
+
isPushNotifiable: boolean;
|
|
95
|
+
} | {
|
|
96
|
+
level: NotificationSettingsLevelEnum.COMMUNITY;
|
|
97
|
+
communityId: string;
|
|
98
|
+
isPushNotifiable: boolean;
|
|
99
|
+
notifiableEvents: NotificationEventPayload[];
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# 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,aA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AC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,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 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 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,SAAS,CAAS;gBAEd,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,WAAW,CAAS;gBAEhB,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.17.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
@@ -10803,6 +10836,140 @@ const setAccessTokenHandler = (accessTokenHandler) => {
|
|
|
10803
10836
|
client.accessTokenHandler = accessTokenHandler;
|
|
10804
10837
|
};
|
|
10805
10838
|
|
|
10839
|
+
function parseRolesFilter(listenFromRoleIds, ignoreFromRoleIds) {
|
|
10840
|
+
if (ignoreFromRoleIds && ignoreFromRoleIds.length > 0) {
|
|
10841
|
+
return { type: 'not', roleIds: ignoreFromRoleIds };
|
|
10842
|
+
}
|
|
10843
|
+
if (listenFromRoleIds && listenFromRoleIds.length > 0) {
|
|
10844
|
+
return { type: exports.NotificationRolesFilterTypeEnum.ONLY, roleIds: listenFromRoleIds };
|
|
10845
|
+
}
|
|
10846
|
+
return { type: exports.NotificationRolesFilterTypeEnum.ALL };
|
|
10847
|
+
}
|
|
10848
|
+
function serializeRolesFilter(rolesFilter) {
|
|
10849
|
+
if ((rolesFilter === null || rolesFilter === void 0 ? void 0 : rolesFilter.type) === exports.NotificationRolesFilterTypeEnum.ONLY) {
|
|
10850
|
+
return { listenFromRoleIds: rolesFilter.roleIds };
|
|
10851
|
+
}
|
|
10852
|
+
return { listenFromRoleIds: [] };
|
|
10853
|
+
}
|
|
10854
|
+
class ChannelNotifications {
|
|
10855
|
+
constructor(channelId) {
|
|
10856
|
+
this.channelId = channelId;
|
|
10857
|
+
}
|
|
10858
|
+
async enable() {
|
|
10859
|
+
const client = getActiveClient();
|
|
10860
|
+
const body = {
|
|
10861
|
+
level: exports.NotificationSettingsLevelEnum.CHANNEL,
|
|
10862
|
+
channelId: this.channelId,
|
|
10863
|
+
isPushNotifiable: true,
|
|
10864
|
+
};
|
|
10865
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10866
|
+
}
|
|
10867
|
+
async disable() {
|
|
10868
|
+
const client = getActiveClient();
|
|
10869
|
+
const body = {
|
|
10870
|
+
level: exports.NotificationSettingsLevelEnum.CHANNEL,
|
|
10871
|
+
channelId: this.channelId,
|
|
10872
|
+
isPushNotifiable: false,
|
|
10873
|
+
};
|
|
10874
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10875
|
+
}
|
|
10876
|
+
async getSettings() {
|
|
10877
|
+
const client = getActiveClient();
|
|
10878
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=channel&channelId=${encodeURIComponent(this.channelId)}`);
|
|
10879
|
+
return { isEnabled: data.isPushNotifiable };
|
|
10880
|
+
}
|
|
10881
|
+
}
|
|
10882
|
+
class UserNotifications {
|
|
10883
|
+
async enable(modules) {
|
|
10884
|
+
var _a;
|
|
10885
|
+
const client = getActiveClient();
|
|
10886
|
+
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 : [];
|
|
10887
|
+
const body = {
|
|
10888
|
+
level: exports.NotificationSettingsLevelEnum.USER,
|
|
10889
|
+
isPushNotifiable: true,
|
|
10890
|
+
notifiableEvents,
|
|
10891
|
+
};
|
|
10892
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10893
|
+
}
|
|
10894
|
+
async disableAllNotifications() {
|
|
10895
|
+
const client = getActiveClient();
|
|
10896
|
+
const body = {
|
|
10897
|
+
level: exports.NotificationSettingsLevelEnum.USER,
|
|
10898
|
+
isPushNotifiable: false,
|
|
10899
|
+
notifiableEvents: [],
|
|
10900
|
+
};
|
|
10901
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10902
|
+
}
|
|
10903
|
+
async getSettings() {
|
|
10904
|
+
var _a;
|
|
10905
|
+
const client = getActiveClient();
|
|
10906
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${exports.NotificationSettingsLevelEnum.USER}`);
|
|
10907
|
+
const validModuleNames = Object.values(exports.UserNotificationModuleNameEnum);
|
|
10908
|
+
const modules = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
10909
|
+
.filter(e => e.moduleName != null && validModuleNames.includes(e.moduleName))
|
|
10910
|
+
.map(e => ({
|
|
10911
|
+
moduleName: e.moduleName,
|
|
10912
|
+
isEnabled: e.isPushNotifiable,
|
|
10913
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
10914
|
+
}));
|
|
10915
|
+
return { isEnabled: data.isPushNotifiable, modules };
|
|
10916
|
+
}
|
|
10917
|
+
}
|
|
10918
|
+
class CommunityNotifications {
|
|
10919
|
+
constructor(communityId) {
|
|
10920
|
+
this.communityId = communityId;
|
|
10921
|
+
}
|
|
10922
|
+
async enable(events) {
|
|
10923
|
+
var _a;
|
|
10924
|
+
const client = getActiveClient();
|
|
10925
|
+
const notifiableEvents = (_a = events === null || events === void 0 ? void 0 : events.map(event => (Object.assign({ moduleName: 'social', name: event.eventName, isPushNotifiable: event.isEnabled }, serializeRolesFilter(event.rolesFilter))))) !== null && _a !== void 0 ? _a : [];
|
|
10926
|
+
const body = {
|
|
10927
|
+
level: exports.NotificationSettingsLevelEnum.COMMUNITY,
|
|
10928
|
+
communityId: this.communityId,
|
|
10929
|
+
isPushNotifiable: true,
|
|
10930
|
+
notifiableEvents,
|
|
10931
|
+
};
|
|
10932
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10933
|
+
}
|
|
10934
|
+
async disable() {
|
|
10935
|
+
const client = getActiveClient();
|
|
10936
|
+
const body = {
|
|
10937
|
+
level: exports.NotificationSettingsLevelEnum.COMMUNITY,
|
|
10938
|
+
communityId: this.communityId,
|
|
10939
|
+
isPushNotifiable: false,
|
|
10940
|
+
notifiableEvents: [],
|
|
10941
|
+
};
|
|
10942
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10943
|
+
}
|
|
10944
|
+
async getSettings() {
|
|
10945
|
+
var _a;
|
|
10946
|
+
const client = getActiveClient();
|
|
10947
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${exports.NotificationSettingsLevelEnum.COMMUNITY}&communityId=${encodeURIComponent(this.communityId)}`);
|
|
10948
|
+
const validEventNames = Object.values(exports.CommunityNotificationEventNameEnum);
|
|
10949
|
+
const events = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
10950
|
+
.filter(e => e.name != null && validEventNames.includes(e.name))
|
|
10951
|
+
.map(e => ({
|
|
10952
|
+
eventName: e.name,
|
|
10953
|
+
isEnabled: e.isPushNotifiable,
|
|
10954
|
+
isNetworkEnabled: e.isNetworkEnabled,
|
|
10955
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
10956
|
+
}));
|
|
10957
|
+
return { isEnabled: data.isPushNotifiable, events };
|
|
10958
|
+
}
|
|
10959
|
+
}
|
|
10960
|
+
class Notifications {
|
|
10961
|
+
user() {
|
|
10962
|
+
return new UserNotifications();
|
|
10963
|
+
}
|
|
10964
|
+
community(communityId) {
|
|
10965
|
+
return new CommunityNotifications(communityId);
|
|
10966
|
+
}
|
|
10967
|
+
channel(channelId) {
|
|
10968
|
+
return new ChannelNotifications(channelId);
|
|
10969
|
+
}
|
|
10970
|
+
}
|
|
10971
|
+
const notifications = () => new Notifications();
|
|
10972
|
+
|
|
10806
10973
|
/**
|
|
10807
10974
|
* ```js
|
|
10808
10975
|
* import { onChannelMarkerFetched } from '@amityco/ts-sdk-react-native'
|
|
@@ -11186,6 +11353,7 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
11186
11353
|
getCurrentUserType: getCurrentUserType,
|
|
11187
11354
|
setCurrentUserType: setCurrentUserType,
|
|
11188
11355
|
setAccessTokenHandler: setAccessTokenHandler,
|
|
11356
|
+
notifications: notifications,
|
|
11189
11357
|
onConnectionError: onConnectionError,
|
|
11190
11358
|
onClientDisconnected: onClientDisconnected,
|
|
11191
11359
|
onClientBanned: onClientBanned,
|
|
@@ -13218,7 +13386,7 @@ const getWatchSessionStorage = () => {
|
|
|
13218
13386
|
return storageInstance;
|
|
13219
13387
|
};
|
|
13220
13388
|
|
|
13221
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
13389
|
+
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/KVk5NrZHXk0mkrd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f/CO0Z1wzXSp2VVD12gbrUD/0/d7MUoJ9LgC8X8f/\nn0txLHYGHbx+nf95+JUg6lV3hg==\n-----END PRIVATE KEY-----";
|
|
13222
13390
|
/*
|
|
13223
13391
|
* The crypto algorithm used for importing key and signing string
|
|
13224
13392
|
*/
|
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.17.0-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
@@ -26876,6 +26909,140 @@ const setAccessTokenHandler = (accessTokenHandler) => {
|
|
|
26876
26909
|
client.accessTokenHandler = accessTokenHandler;
|
|
26877
26910
|
};
|
|
26878
26911
|
|
|
26912
|
+
function parseRolesFilter(listenFromRoleIds, ignoreFromRoleIds) {
|
|
26913
|
+
if (ignoreFromRoleIds && ignoreFromRoleIds.length > 0) {
|
|
26914
|
+
return { type: 'not', roleIds: ignoreFromRoleIds };
|
|
26915
|
+
}
|
|
26916
|
+
if (listenFromRoleIds && listenFromRoleIds.length > 0) {
|
|
26917
|
+
return { type: NotificationRolesFilterTypeEnum.ONLY, roleIds: listenFromRoleIds };
|
|
26918
|
+
}
|
|
26919
|
+
return { type: NotificationRolesFilterTypeEnum.ALL };
|
|
26920
|
+
}
|
|
26921
|
+
function serializeRolesFilter(rolesFilter) {
|
|
26922
|
+
if ((rolesFilter === null || rolesFilter === void 0 ? void 0 : rolesFilter.type) === NotificationRolesFilterTypeEnum.ONLY) {
|
|
26923
|
+
return { listenFromRoleIds: rolesFilter.roleIds };
|
|
26924
|
+
}
|
|
26925
|
+
return { listenFromRoleIds: [] };
|
|
26926
|
+
}
|
|
26927
|
+
class ChannelNotifications {
|
|
26928
|
+
constructor(channelId) {
|
|
26929
|
+
this.channelId = channelId;
|
|
26930
|
+
}
|
|
26931
|
+
async enable() {
|
|
26932
|
+
const client = getActiveClient();
|
|
26933
|
+
const body = {
|
|
26934
|
+
level: NotificationSettingsLevelEnum.CHANNEL,
|
|
26935
|
+
channelId: this.channelId,
|
|
26936
|
+
isPushNotifiable: true,
|
|
26937
|
+
};
|
|
26938
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
26939
|
+
}
|
|
26940
|
+
async disable() {
|
|
26941
|
+
const client = getActiveClient();
|
|
26942
|
+
const body = {
|
|
26943
|
+
level: NotificationSettingsLevelEnum.CHANNEL,
|
|
26944
|
+
channelId: this.channelId,
|
|
26945
|
+
isPushNotifiable: false,
|
|
26946
|
+
};
|
|
26947
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
26948
|
+
}
|
|
26949
|
+
async getSettings() {
|
|
26950
|
+
const client = getActiveClient();
|
|
26951
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=channel&channelId=${encodeURIComponent(this.channelId)}`);
|
|
26952
|
+
return { isEnabled: data.isPushNotifiable };
|
|
26953
|
+
}
|
|
26954
|
+
}
|
|
26955
|
+
class UserNotifications {
|
|
26956
|
+
async enable(modules) {
|
|
26957
|
+
var _a;
|
|
26958
|
+
const client = getActiveClient();
|
|
26959
|
+
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 : [];
|
|
26960
|
+
const body = {
|
|
26961
|
+
level: NotificationSettingsLevelEnum.USER,
|
|
26962
|
+
isPushNotifiable: true,
|
|
26963
|
+
notifiableEvents,
|
|
26964
|
+
};
|
|
26965
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
26966
|
+
}
|
|
26967
|
+
async disableAllNotifications() {
|
|
26968
|
+
const client = getActiveClient();
|
|
26969
|
+
const body = {
|
|
26970
|
+
level: NotificationSettingsLevelEnum.USER,
|
|
26971
|
+
isPushNotifiable: false,
|
|
26972
|
+
notifiableEvents: [],
|
|
26973
|
+
};
|
|
26974
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
26975
|
+
}
|
|
26976
|
+
async getSettings() {
|
|
26977
|
+
var _a;
|
|
26978
|
+
const client = getActiveClient();
|
|
26979
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${NotificationSettingsLevelEnum.USER}`);
|
|
26980
|
+
const validModuleNames = Object.values(UserNotificationModuleNameEnum);
|
|
26981
|
+
const modules = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
26982
|
+
.filter(e => e.moduleName != null && validModuleNames.includes(e.moduleName))
|
|
26983
|
+
.map(e => ({
|
|
26984
|
+
moduleName: e.moduleName,
|
|
26985
|
+
isEnabled: e.isPushNotifiable,
|
|
26986
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
26987
|
+
}));
|
|
26988
|
+
return { isEnabled: data.isPushNotifiable, modules };
|
|
26989
|
+
}
|
|
26990
|
+
}
|
|
26991
|
+
class CommunityNotifications {
|
|
26992
|
+
constructor(communityId) {
|
|
26993
|
+
this.communityId = communityId;
|
|
26994
|
+
}
|
|
26995
|
+
async enable(events) {
|
|
26996
|
+
var _a;
|
|
26997
|
+
const client = getActiveClient();
|
|
26998
|
+
const notifiableEvents = (_a = events === null || events === void 0 ? void 0 : events.map(event => (Object.assign({ moduleName: 'social', name: event.eventName, isPushNotifiable: event.isEnabled }, serializeRolesFilter(event.rolesFilter))))) !== null && _a !== void 0 ? _a : [];
|
|
26999
|
+
const body = {
|
|
27000
|
+
level: NotificationSettingsLevelEnum.COMMUNITY,
|
|
27001
|
+
communityId: this.communityId,
|
|
27002
|
+
isPushNotifiable: true,
|
|
27003
|
+
notifiableEvents,
|
|
27004
|
+
};
|
|
27005
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27006
|
+
}
|
|
27007
|
+
async disable() {
|
|
27008
|
+
const client = getActiveClient();
|
|
27009
|
+
const body = {
|
|
27010
|
+
level: NotificationSettingsLevelEnum.COMMUNITY,
|
|
27011
|
+
communityId: this.communityId,
|
|
27012
|
+
isPushNotifiable: false,
|
|
27013
|
+
notifiableEvents: [],
|
|
27014
|
+
};
|
|
27015
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27016
|
+
}
|
|
27017
|
+
async getSettings() {
|
|
27018
|
+
var _a;
|
|
27019
|
+
const client = getActiveClient();
|
|
27020
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${NotificationSettingsLevelEnum.COMMUNITY}&communityId=${encodeURIComponent(this.communityId)}`);
|
|
27021
|
+
const validEventNames = Object.values(CommunityNotificationEventNameEnum);
|
|
27022
|
+
const events = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
27023
|
+
.filter(e => e.name != null && validEventNames.includes(e.name))
|
|
27024
|
+
.map(e => ({
|
|
27025
|
+
eventName: e.name,
|
|
27026
|
+
isEnabled: e.isPushNotifiable,
|
|
27027
|
+
isNetworkEnabled: e.isNetworkEnabled,
|
|
27028
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
27029
|
+
}));
|
|
27030
|
+
return { isEnabled: data.isPushNotifiable, events };
|
|
27031
|
+
}
|
|
27032
|
+
}
|
|
27033
|
+
class Notifications {
|
|
27034
|
+
user() {
|
|
27035
|
+
return new UserNotifications();
|
|
27036
|
+
}
|
|
27037
|
+
community(communityId) {
|
|
27038
|
+
return new CommunityNotifications(communityId);
|
|
27039
|
+
}
|
|
27040
|
+
channel(channelId) {
|
|
27041
|
+
return new ChannelNotifications(channelId);
|
|
27042
|
+
}
|
|
27043
|
+
}
|
|
27044
|
+
const notifications = () => new Notifications();
|
|
27045
|
+
|
|
26879
27046
|
/**
|
|
26880
27047
|
* ```js
|
|
26881
27048
|
* import { onChannelMarkerFetched } from '@amityco/ts-sdk-react-native'
|
|
@@ -27259,6 +27426,7 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
27259
27426
|
getCurrentUserType: getCurrentUserType,
|
|
27260
27427
|
setCurrentUserType: setCurrentUserType,
|
|
27261
27428
|
setAccessTokenHandler: setAccessTokenHandler,
|
|
27429
|
+
notifications: notifications,
|
|
27262
27430
|
onConnectionError: onConnectionError,
|
|
27263
27431
|
onClientDisconnected: onClientDisconnected,
|
|
27264
27432
|
onClientBanned: onClientBanned,
|
|
@@ -29291,7 +29459,7 @@ const getWatchSessionStorage = () => {
|
|
|
29291
29459
|
return storageInstance;
|
|
29292
29460
|
};
|
|
29293
29461
|
|
|
29294
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
29462
|
+
const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDAARz+hmBgi8pJ\nQb8LeY41gtHhk+ACMwRfhsn7GqpqRQNG2qU0755mzZuVDUqjQMGSo8THJB7O+OJs\nflbZRkFXlFoFOVNw1UpNOgwEQZ6wB9oRwzepTJAfF1sVhm/o/ixvXh1zDFNDy6yZ\npXyiiJHUVxqyjllZhxnwdvjoVtDs6hW6awG09bB9nh/TTejlUKXoAgzqVwu/1QMu\nUVViET495elEe19aUarEy+oL2iKeXCEvqda/pWNBdbieFyJvvZ08HN8dPuT88wq2\njZLEAth1vrwQ2IAa4ktaLcBQdLJgIkrbDvAiVZ8lQAjS/bq5vXQikTGvoPlC5bbn\nvuOM/3eLAgMBAAECggEAVZ+peHAghq2QVj71nX5lxsNCKa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hFlqJz1gpymi/k63tW/Ob8yedbg3WWNWyShwRMFYyY9S81ITFWM95uL6\nvF3x9rmRjwElJw9PMwVu6dmf/CO0Z1wzXSp2VVD12gbrUD/0/d7MUoJ9LgC8X8f/\nn0txLHYGHbx+nf95+JUg6lV3hg==\n-----END PRIVATE KEY-----";
|
|
29295
29463
|
/*
|
|
29296
29464
|
* The crypto algorithm used for importing key and signing string
|
|
29297
29465
|
*/
|
|
@@ -51489,4 +51657,4 @@ class AmityAttachmentProductTags {
|
|
|
51489
51657
|
}
|
|
51490
51658
|
}
|
|
51491
51659
|
|
|
51492
|
-
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 };
|
|
51660
|
+
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 };
|