@amityco/ts-sdk-react-native 7.17.0 → 7.17.1-0a0c83b0.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 +109 -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 +176 -1
- package/dist/index.esm.js +177 -2
- package/dist/index.umd.js +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
export declare enum UserNotificationModuleNameEnum {
|
|
2
|
+
CHAT = "chat",
|
|
3
|
+
SOCIAL = "social",
|
|
4
|
+
VIDEO_STREAMING = "video-streaming"
|
|
5
|
+
}
|
|
6
|
+
export declare enum ChannelNotificationEventNameEnum {
|
|
7
|
+
MESSAGE_CREATED = "message.created",
|
|
8
|
+
MESSAGE_REACTED = "message.reacted",
|
|
9
|
+
MENTION_CREATED = "mention.created",
|
|
10
|
+
POLL_VOTE_CREATED = "poll.vote.created"
|
|
11
|
+
}
|
|
12
|
+
export declare enum CommunityNotificationEventNameEnum {
|
|
13
|
+
POST_CREATED = "post.created",
|
|
14
|
+
POST_REACTED = "post.reacted",
|
|
15
|
+
COMMENT_CREATED = "comment.created",
|
|
16
|
+
COMMENT_REPLIED = "comment.replied",
|
|
17
|
+
COMMENT_REACTED = "comment.reacted",
|
|
18
|
+
STORY_CREATED = "story.created",
|
|
19
|
+
STORY_REACTED = "story.reacted",
|
|
20
|
+
STORY_COMMENT_CREATED = "story-comment.created",
|
|
21
|
+
LIVESTREAM_START = "video-streaming.didStart"
|
|
22
|
+
}
|
|
23
|
+
export declare enum NotificationSettingsLevelEnum {
|
|
24
|
+
USER = "user",
|
|
25
|
+
COMMUNITY = "community",
|
|
26
|
+
CHANNEL = "channel"
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* `NOT` variant is intentionally excluded from public API (internal server-side use only).
|
|
30
|
+
*/
|
|
31
|
+
export declare enum NotificationRolesFilterTypeEnum {
|
|
32
|
+
ALL = "all",
|
|
33
|
+
ONLY = "only"
|
|
34
|
+
}
|
|
35
|
+
declare global {
|
|
36
|
+
namespace Amity {
|
|
37
|
+
type UserNotificationModuleName = UserNotificationModuleNameEnum;
|
|
38
|
+
type CommunityNotificationEventName = CommunityNotificationEventNameEnum;
|
|
39
|
+
type NotificationRolesFilter = {
|
|
40
|
+
type: NotificationRolesFilterTypeEnum.ALL;
|
|
41
|
+
} | {
|
|
42
|
+
type: NotificationRolesFilterTypeEnum.ONLY;
|
|
43
|
+
roleIds: string[];
|
|
44
|
+
} | {
|
|
45
|
+
type: 'not';
|
|
46
|
+
roleIds: string[];
|
|
47
|
+
};
|
|
48
|
+
type UserNotificationModule = {
|
|
49
|
+
moduleName: Amity.UserNotificationModuleName;
|
|
50
|
+
isEnabled: boolean;
|
|
51
|
+
rolesFilter?: Amity.NotificationRolesFilter;
|
|
52
|
+
};
|
|
53
|
+
type UserNotificationSettings = {
|
|
54
|
+
isEnabled: boolean;
|
|
55
|
+
modules: Amity.UserNotificationModule[];
|
|
56
|
+
};
|
|
57
|
+
type CommunityNotificationEvent = {
|
|
58
|
+
eventName: Amity.CommunityNotificationEventName;
|
|
59
|
+
isEnabled: boolean;
|
|
60
|
+
/** @readonly Populated by SDK on read. Silently ignored on write. */
|
|
61
|
+
isNetworkEnabled?: boolean;
|
|
62
|
+
rolesFilter?: Amity.NotificationRolesFilter;
|
|
63
|
+
};
|
|
64
|
+
type CommunityNotificationSettings = {
|
|
65
|
+
isEnabled: boolean;
|
|
66
|
+
events: Amity.CommunityNotificationEvent[];
|
|
67
|
+
};
|
|
68
|
+
type ChannelNotificationSettings = {
|
|
69
|
+
isEnabled: boolean;
|
|
70
|
+
};
|
|
71
|
+
type NotificationEvent = {
|
|
72
|
+
name: Amity.CommunityNotificationEventName | string;
|
|
73
|
+
moduleName: Amity.UserNotificationModuleName;
|
|
74
|
+
eventName: string;
|
|
75
|
+
isPushNotifiable: boolean;
|
|
76
|
+
isNetworkEnabled: boolean;
|
|
77
|
+
listenFromRoleIds: string[];
|
|
78
|
+
ignoreFromRoleIds: string[];
|
|
79
|
+
};
|
|
80
|
+
type RawNotificationSettings = {
|
|
81
|
+
isPushNotifiable: boolean;
|
|
82
|
+
isUserEnabled: boolean;
|
|
83
|
+
notifiableEvents: Amity.NotificationEvent[];
|
|
84
|
+
};
|
|
85
|
+
type InternalNotificationSettings = RawNotificationSettings;
|
|
86
|
+
type NotificationSettings = InternalNotificationSettings;
|
|
87
|
+
type NotificationEventPayload = {
|
|
88
|
+
moduleName?: string;
|
|
89
|
+
name?: string;
|
|
90
|
+
isPushNotifiable: boolean;
|
|
91
|
+
listenFromRoleIds?: string[];
|
|
92
|
+
};
|
|
93
|
+
type NotificationSettingsPayload = {
|
|
94
|
+
level: NotificationSettingsLevelEnum.USER;
|
|
95
|
+
isPushNotifiable: boolean;
|
|
96
|
+
notifiableEvents: NotificationEventPayload[];
|
|
97
|
+
} | {
|
|
98
|
+
level: NotificationSettingsLevelEnum.CHANNEL;
|
|
99
|
+
channelId: string;
|
|
100
|
+
isPushNotifiable: boolean;
|
|
101
|
+
} | {
|
|
102
|
+
level: NotificationSettingsLevelEnum.COMMUNITY;
|
|
103
|
+
communityId: string;
|
|
104
|
+
isPushNotifiable: boolean;
|
|
105
|
+
notifiableEvents: NotificationEventPayload[];
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
//# 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,8BA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,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,46 @@ 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.ChannelNotificationEventNameEnum = void 0;
|
|
286
|
+
(function (ChannelNotificationEventNameEnum) {
|
|
287
|
+
ChannelNotificationEventNameEnum["MESSAGE_CREATED"] = "message.created";
|
|
288
|
+
ChannelNotificationEventNameEnum["MESSAGE_REACTED"] = "message.reacted";
|
|
289
|
+
ChannelNotificationEventNameEnum["MENTION_CREATED"] = "mention.created";
|
|
290
|
+
ChannelNotificationEventNameEnum["POLL_VOTE_CREATED"] = "poll.vote.created";
|
|
291
|
+
})(exports.ChannelNotificationEventNameEnum || (exports.ChannelNotificationEventNameEnum = {}));
|
|
292
|
+
exports.CommunityNotificationEventNameEnum = void 0;
|
|
293
|
+
(function (CommunityNotificationEventNameEnum) {
|
|
294
|
+
CommunityNotificationEventNameEnum["POST_CREATED"] = "post.created";
|
|
295
|
+
CommunityNotificationEventNameEnum["POST_REACTED"] = "post.reacted";
|
|
296
|
+
CommunityNotificationEventNameEnum["COMMENT_CREATED"] = "comment.created";
|
|
297
|
+
CommunityNotificationEventNameEnum["COMMENT_REPLIED"] = "comment.replied";
|
|
298
|
+
CommunityNotificationEventNameEnum["COMMENT_REACTED"] = "comment.reacted";
|
|
299
|
+
CommunityNotificationEventNameEnum["STORY_CREATED"] = "story.created";
|
|
300
|
+
CommunityNotificationEventNameEnum["STORY_REACTED"] = "story.reacted";
|
|
301
|
+
CommunityNotificationEventNameEnum["STORY_COMMENT_CREATED"] = "story-comment.created";
|
|
302
|
+
CommunityNotificationEventNameEnum["LIVESTREAM_START"] = "video-streaming.didStart";
|
|
303
|
+
})(exports.CommunityNotificationEventNameEnum || (exports.CommunityNotificationEventNameEnum = {}));
|
|
304
|
+
exports.NotificationSettingsLevelEnum = void 0;
|
|
305
|
+
(function (NotificationSettingsLevelEnum) {
|
|
306
|
+
NotificationSettingsLevelEnum["USER"] = "user";
|
|
307
|
+
NotificationSettingsLevelEnum["COMMUNITY"] = "community";
|
|
308
|
+
NotificationSettingsLevelEnum["CHANNEL"] = "channel";
|
|
309
|
+
})(exports.NotificationSettingsLevelEnum || (exports.NotificationSettingsLevelEnum = {}));
|
|
310
|
+
/**
|
|
311
|
+
* `NOT` variant is intentionally excluded from public API (internal server-side use only).
|
|
312
|
+
*/
|
|
313
|
+
exports.NotificationRolesFilterTypeEnum = void 0;
|
|
314
|
+
(function (NotificationRolesFilterTypeEnum) {
|
|
315
|
+
NotificationRolesFilterTypeEnum["ALL"] = "all";
|
|
316
|
+
NotificationRolesFilterTypeEnum["ONLY"] = "only";
|
|
317
|
+
})(exports.NotificationRolesFilterTypeEnum || (exports.NotificationRolesFilterTypeEnum = {}));
|
|
318
|
+
|
|
279
319
|
function getVersion() {
|
|
280
320
|
try {
|
|
281
321
|
// the string ''v7.17.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
@@ -10803,6 +10843,140 @@ const setAccessTokenHandler = (accessTokenHandler) => {
|
|
|
10803
10843
|
client.accessTokenHandler = accessTokenHandler;
|
|
10804
10844
|
};
|
|
10805
10845
|
|
|
10846
|
+
function parseRolesFilter(listenFromRoleIds, ignoreFromRoleIds) {
|
|
10847
|
+
if (ignoreFromRoleIds && ignoreFromRoleIds.length > 0) {
|
|
10848
|
+
return { type: 'not', roleIds: ignoreFromRoleIds };
|
|
10849
|
+
}
|
|
10850
|
+
if (listenFromRoleIds && listenFromRoleIds.length > 0) {
|
|
10851
|
+
return { type: exports.NotificationRolesFilterTypeEnum.ONLY, roleIds: listenFromRoleIds };
|
|
10852
|
+
}
|
|
10853
|
+
return { type: exports.NotificationRolesFilterTypeEnum.ALL };
|
|
10854
|
+
}
|
|
10855
|
+
function serializeRolesFilter(rolesFilter) {
|
|
10856
|
+
if ((rolesFilter === null || rolesFilter === void 0 ? void 0 : rolesFilter.type) === exports.NotificationRolesFilterTypeEnum.ONLY) {
|
|
10857
|
+
return { listenFromRoleIds: rolesFilter.roleIds };
|
|
10858
|
+
}
|
|
10859
|
+
return { listenFromRoleIds: [] };
|
|
10860
|
+
}
|
|
10861
|
+
class ChannelNotifications {
|
|
10862
|
+
constructor(channelId) {
|
|
10863
|
+
this.channelId = channelId;
|
|
10864
|
+
}
|
|
10865
|
+
async enable() {
|
|
10866
|
+
const client = getActiveClient();
|
|
10867
|
+
const body = {
|
|
10868
|
+
level: exports.NotificationSettingsLevelEnum.CHANNEL,
|
|
10869
|
+
channelId: this.channelId,
|
|
10870
|
+
isPushNotifiable: true,
|
|
10871
|
+
};
|
|
10872
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10873
|
+
}
|
|
10874
|
+
async disable() {
|
|
10875
|
+
const client = getActiveClient();
|
|
10876
|
+
const body = {
|
|
10877
|
+
level: exports.NotificationSettingsLevelEnum.CHANNEL,
|
|
10878
|
+
channelId: this.channelId,
|
|
10879
|
+
isPushNotifiable: false,
|
|
10880
|
+
};
|
|
10881
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10882
|
+
}
|
|
10883
|
+
async getSettings() {
|
|
10884
|
+
const client = getActiveClient();
|
|
10885
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=channel&channelId=${encodeURIComponent(this.channelId)}`);
|
|
10886
|
+
return { isEnabled: data.isPushNotifiable };
|
|
10887
|
+
}
|
|
10888
|
+
}
|
|
10889
|
+
class UserNotifications {
|
|
10890
|
+
async enable(modules) {
|
|
10891
|
+
var _a;
|
|
10892
|
+
const client = getActiveClient();
|
|
10893
|
+
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 : [];
|
|
10894
|
+
const body = {
|
|
10895
|
+
level: exports.NotificationSettingsLevelEnum.USER,
|
|
10896
|
+
isPushNotifiable: true,
|
|
10897
|
+
notifiableEvents,
|
|
10898
|
+
};
|
|
10899
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10900
|
+
}
|
|
10901
|
+
async disableAllNotifications() {
|
|
10902
|
+
const client = getActiveClient();
|
|
10903
|
+
const body = {
|
|
10904
|
+
level: exports.NotificationSettingsLevelEnum.USER,
|
|
10905
|
+
isPushNotifiable: false,
|
|
10906
|
+
notifiableEvents: [],
|
|
10907
|
+
};
|
|
10908
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10909
|
+
}
|
|
10910
|
+
async getSettings() {
|
|
10911
|
+
var _a;
|
|
10912
|
+
const client = getActiveClient();
|
|
10913
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${exports.NotificationSettingsLevelEnum.USER}`);
|
|
10914
|
+
const validModuleNames = Object.values(exports.UserNotificationModuleNameEnum);
|
|
10915
|
+
const modules = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
10916
|
+
.filter(e => e.moduleName != null && validModuleNames.includes(e.moduleName))
|
|
10917
|
+
.map(e => ({
|
|
10918
|
+
moduleName: e.moduleName,
|
|
10919
|
+
isEnabled: e.isPushNotifiable,
|
|
10920
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
10921
|
+
}));
|
|
10922
|
+
return { isEnabled: data.isPushNotifiable, modules };
|
|
10923
|
+
}
|
|
10924
|
+
}
|
|
10925
|
+
class CommunityNotifications {
|
|
10926
|
+
constructor(communityId) {
|
|
10927
|
+
this.communityId = communityId;
|
|
10928
|
+
}
|
|
10929
|
+
async enable(events) {
|
|
10930
|
+
var _a;
|
|
10931
|
+
const client = getActiveClient();
|
|
10932
|
+
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 : [];
|
|
10933
|
+
const body = {
|
|
10934
|
+
level: exports.NotificationSettingsLevelEnum.COMMUNITY,
|
|
10935
|
+
communityId: this.communityId,
|
|
10936
|
+
isPushNotifiable: true,
|
|
10937
|
+
notifiableEvents,
|
|
10938
|
+
};
|
|
10939
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10940
|
+
}
|
|
10941
|
+
async disable() {
|
|
10942
|
+
const client = getActiveClient();
|
|
10943
|
+
const body = {
|
|
10944
|
+
level: exports.NotificationSettingsLevelEnum.COMMUNITY,
|
|
10945
|
+
communityId: this.communityId,
|
|
10946
|
+
isPushNotifiable: false,
|
|
10947
|
+
notifiableEvents: [],
|
|
10948
|
+
};
|
|
10949
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10950
|
+
}
|
|
10951
|
+
async getSettings() {
|
|
10952
|
+
var _a;
|
|
10953
|
+
const client = getActiveClient();
|
|
10954
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${exports.NotificationSettingsLevelEnum.COMMUNITY}&communityId=${encodeURIComponent(this.communityId)}`);
|
|
10955
|
+
const validEventNames = Object.values(exports.CommunityNotificationEventNameEnum);
|
|
10956
|
+
const events = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
10957
|
+
.filter(e => e.name != null && validEventNames.includes(e.name))
|
|
10958
|
+
.map(e => ({
|
|
10959
|
+
eventName: e.name,
|
|
10960
|
+
isEnabled: e.isPushNotifiable,
|
|
10961
|
+
isNetworkEnabled: e.isNetworkEnabled,
|
|
10962
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
10963
|
+
}));
|
|
10964
|
+
return { isEnabled: data.isPushNotifiable, events };
|
|
10965
|
+
}
|
|
10966
|
+
}
|
|
10967
|
+
class Notifications {
|
|
10968
|
+
user() {
|
|
10969
|
+
return new UserNotifications();
|
|
10970
|
+
}
|
|
10971
|
+
community(communityId) {
|
|
10972
|
+
return new CommunityNotifications(communityId);
|
|
10973
|
+
}
|
|
10974
|
+
channel(channelId) {
|
|
10975
|
+
return new ChannelNotifications(channelId);
|
|
10976
|
+
}
|
|
10977
|
+
}
|
|
10978
|
+
const notifications = () => new Notifications();
|
|
10979
|
+
|
|
10806
10980
|
/**
|
|
10807
10981
|
* ```js
|
|
10808
10982
|
* import { onChannelMarkerFetched } from '@amityco/ts-sdk-react-native'
|
|
@@ -11186,6 +11360,7 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
11186
11360
|
getCurrentUserType: getCurrentUserType,
|
|
11187
11361
|
setCurrentUserType: setCurrentUserType,
|
|
11188
11362
|
setAccessTokenHandler: setAccessTokenHandler,
|
|
11363
|
+
notifications: notifications,
|
|
11189
11364
|
onConnectionError: onConnectionError,
|
|
11190
11365
|
onClientDisconnected: onClientDisconnected,
|
|
11191
11366
|
onClientBanned: onClientBanned,
|
|
@@ -13218,7 +13393,7 @@ const getWatchSessionStorage = () => {
|
|
|
13218
13393
|
return storageInstance;
|
|
13219
13394
|
};
|
|
13220
13395
|
|
|
13221
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
13396
|
+
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\nwCnKJS3mLT3JxyGug6lxanveKkjG+CKC1nJQYWaxCJxaFSzbwXQPvDhB+TvrIbee\npd5v4EAyEJohpr+T9oDGGJkb/KARBZCtwLyB976PKJwwBA8MRVL1i5QwawuMiMq5\nUtnOnbGKtCeFzaLbNU0Qi8bqyims84EQxC6DOu1fkQKBgQDdvsoBsEhsOXV7hlIJ\naEd0eSJZVkdqimxH8uGoMM2FeNaOrcB6yBXqTSP0R3OIyf8eaY6yjRvP30ZNXcll\n/gD3O1Mu6YmWQdt1W2WA6pKOsUuPXasf0pdOF7IiFZKlSabz5YHXFqwVuqm8loaj\nsXel3YWqPVdHiankE7tz+3ssnQKBgQDdqi4TNdD1MdEpihx19jr0QjUiXW3939FK\nqp30HESPEGDGQzXdmJgif9HhZb+cJSuWaHEbjgBrYahvgCF+y6LbEpOD+D/dmT+s\nDEAQaR84sah6dokwPjV8fjBSrcVFjCS+doxv0d3p/9OUEeyUhFrY03nxtIEYkLIE\n/Zvn37b4RwKBgQCLENVFe9XfsaVhQ5r9dV2iyTlmh7qgMZG5CbTFs12hQGhm8McO\n+Z7s41YSJCFr/yq1WwP4LJDtrBw99vyQr1zRsG35tNLp3gGRNzGQSQyC2uQFVHw2\np+7mNewsfhUK/gbrXNsyFnDz6635rPlhfbII3sWuP2wWXFqkxE9CbMwR7QKBgQC6\nawDMzxmo2/iYArrkyevSuEuPVxvFwpF1RgAI6C0QVCnPE38dmdN4UB7mfHekje4W\nVEercMURidPp0cxZolCYBQtilUjAyL0vqC3In1/Ogjq6oy3FEMxSop1pKxMY5j+Q\nnoqFD+6deLUrddeNH7J3X4LSr4dSbX4JjG+tlgt+yQKBgQCuwTL4hA6KqeInQ0Ta\n9VQX5Qr8hFlqJz1gpymi/k63tW/Ob8yedbg3WWNWyShwRMFYyY9S81ITFWM95uL6\nvF3x9rmRjwElJw9PMwVu6dmf/CO0Z1wzXSp2VVD12gbrUD/0/d7MUoJ9LgC8X8f/\nn0txLHYGHbx+nf95+JUg6lV3hg==\n-----END PRIVATE KEY-----";
|
|
13222
13397
|
/*
|
|
13223
13398
|
* The crypto algorithm used for importing key and signing string
|
|
13224
13399
|
*/
|
package/dist/index.esm.js
CHANGED
|
@@ -242,6 +242,46 @@ 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 ChannelNotificationEventNameEnum;
|
|
252
|
+
(function (ChannelNotificationEventNameEnum) {
|
|
253
|
+
ChannelNotificationEventNameEnum["MESSAGE_CREATED"] = "message.created";
|
|
254
|
+
ChannelNotificationEventNameEnum["MESSAGE_REACTED"] = "message.reacted";
|
|
255
|
+
ChannelNotificationEventNameEnum["MENTION_CREATED"] = "mention.created";
|
|
256
|
+
ChannelNotificationEventNameEnum["POLL_VOTE_CREATED"] = "poll.vote.created";
|
|
257
|
+
})(ChannelNotificationEventNameEnum || (ChannelNotificationEventNameEnum = {}));
|
|
258
|
+
var CommunityNotificationEventNameEnum;
|
|
259
|
+
(function (CommunityNotificationEventNameEnum) {
|
|
260
|
+
CommunityNotificationEventNameEnum["POST_CREATED"] = "post.created";
|
|
261
|
+
CommunityNotificationEventNameEnum["POST_REACTED"] = "post.reacted";
|
|
262
|
+
CommunityNotificationEventNameEnum["COMMENT_CREATED"] = "comment.created";
|
|
263
|
+
CommunityNotificationEventNameEnum["COMMENT_REPLIED"] = "comment.replied";
|
|
264
|
+
CommunityNotificationEventNameEnum["COMMENT_REACTED"] = "comment.reacted";
|
|
265
|
+
CommunityNotificationEventNameEnum["STORY_CREATED"] = "story.created";
|
|
266
|
+
CommunityNotificationEventNameEnum["STORY_REACTED"] = "story.reacted";
|
|
267
|
+
CommunityNotificationEventNameEnum["STORY_COMMENT_CREATED"] = "story-comment.created";
|
|
268
|
+
CommunityNotificationEventNameEnum["LIVESTREAM_START"] = "video-streaming.didStart";
|
|
269
|
+
})(CommunityNotificationEventNameEnum || (CommunityNotificationEventNameEnum = {}));
|
|
270
|
+
var NotificationSettingsLevelEnum;
|
|
271
|
+
(function (NotificationSettingsLevelEnum) {
|
|
272
|
+
NotificationSettingsLevelEnum["USER"] = "user";
|
|
273
|
+
NotificationSettingsLevelEnum["COMMUNITY"] = "community";
|
|
274
|
+
NotificationSettingsLevelEnum["CHANNEL"] = "channel";
|
|
275
|
+
})(NotificationSettingsLevelEnum || (NotificationSettingsLevelEnum = {}));
|
|
276
|
+
/**
|
|
277
|
+
* `NOT` variant is intentionally excluded from public API (internal server-side use only).
|
|
278
|
+
*/
|
|
279
|
+
var NotificationRolesFilterTypeEnum;
|
|
280
|
+
(function (NotificationRolesFilterTypeEnum) {
|
|
281
|
+
NotificationRolesFilterTypeEnum["ALL"] = "all";
|
|
282
|
+
NotificationRolesFilterTypeEnum["ONLY"] = "only";
|
|
283
|
+
})(NotificationRolesFilterTypeEnum || (NotificationRolesFilterTypeEnum = {}));
|
|
284
|
+
|
|
245
285
|
function getVersion() {
|
|
246
286
|
try {
|
|
247
287
|
// the string ''v7.17.0-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
@@ -26876,6 +26916,140 @@ const setAccessTokenHandler = (accessTokenHandler) => {
|
|
|
26876
26916
|
client.accessTokenHandler = accessTokenHandler;
|
|
26877
26917
|
};
|
|
26878
26918
|
|
|
26919
|
+
function parseRolesFilter(listenFromRoleIds, ignoreFromRoleIds) {
|
|
26920
|
+
if (ignoreFromRoleIds && ignoreFromRoleIds.length > 0) {
|
|
26921
|
+
return { type: 'not', roleIds: ignoreFromRoleIds };
|
|
26922
|
+
}
|
|
26923
|
+
if (listenFromRoleIds && listenFromRoleIds.length > 0) {
|
|
26924
|
+
return { type: NotificationRolesFilterTypeEnum.ONLY, roleIds: listenFromRoleIds };
|
|
26925
|
+
}
|
|
26926
|
+
return { type: NotificationRolesFilterTypeEnum.ALL };
|
|
26927
|
+
}
|
|
26928
|
+
function serializeRolesFilter(rolesFilter) {
|
|
26929
|
+
if ((rolesFilter === null || rolesFilter === void 0 ? void 0 : rolesFilter.type) === NotificationRolesFilterTypeEnum.ONLY) {
|
|
26930
|
+
return { listenFromRoleIds: rolesFilter.roleIds };
|
|
26931
|
+
}
|
|
26932
|
+
return { listenFromRoleIds: [] };
|
|
26933
|
+
}
|
|
26934
|
+
class ChannelNotifications {
|
|
26935
|
+
constructor(channelId) {
|
|
26936
|
+
this.channelId = channelId;
|
|
26937
|
+
}
|
|
26938
|
+
async enable() {
|
|
26939
|
+
const client = getActiveClient();
|
|
26940
|
+
const body = {
|
|
26941
|
+
level: NotificationSettingsLevelEnum.CHANNEL,
|
|
26942
|
+
channelId: this.channelId,
|
|
26943
|
+
isPushNotifiable: true,
|
|
26944
|
+
};
|
|
26945
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
26946
|
+
}
|
|
26947
|
+
async disable() {
|
|
26948
|
+
const client = getActiveClient();
|
|
26949
|
+
const body = {
|
|
26950
|
+
level: NotificationSettingsLevelEnum.CHANNEL,
|
|
26951
|
+
channelId: this.channelId,
|
|
26952
|
+
isPushNotifiable: false,
|
|
26953
|
+
};
|
|
26954
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
26955
|
+
}
|
|
26956
|
+
async getSettings() {
|
|
26957
|
+
const client = getActiveClient();
|
|
26958
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=channel&channelId=${encodeURIComponent(this.channelId)}`);
|
|
26959
|
+
return { isEnabled: data.isPushNotifiable };
|
|
26960
|
+
}
|
|
26961
|
+
}
|
|
26962
|
+
class UserNotifications {
|
|
26963
|
+
async enable(modules) {
|
|
26964
|
+
var _a;
|
|
26965
|
+
const client = getActiveClient();
|
|
26966
|
+
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 : [];
|
|
26967
|
+
const body = {
|
|
26968
|
+
level: NotificationSettingsLevelEnum.USER,
|
|
26969
|
+
isPushNotifiable: true,
|
|
26970
|
+
notifiableEvents,
|
|
26971
|
+
};
|
|
26972
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
26973
|
+
}
|
|
26974
|
+
async disableAllNotifications() {
|
|
26975
|
+
const client = getActiveClient();
|
|
26976
|
+
const body = {
|
|
26977
|
+
level: NotificationSettingsLevelEnum.USER,
|
|
26978
|
+
isPushNotifiable: false,
|
|
26979
|
+
notifiableEvents: [],
|
|
26980
|
+
};
|
|
26981
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
26982
|
+
}
|
|
26983
|
+
async getSettings() {
|
|
26984
|
+
var _a;
|
|
26985
|
+
const client = getActiveClient();
|
|
26986
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${NotificationSettingsLevelEnum.USER}`);
|
|
26987
|
+
const validModuleNames = Object.values(UserNotificationModuleNameEnum);
|
|
26988
|
+
const modules = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
26989
|
+
.filter(e => e.moduleName != null && validModuleNames.includes(e.moduleName))
|
|
26990
|
+
.map(e => ({
|
|
26991
|
+
moduleName: e.moduleName,
|
|
26992
|
+
isEnabled: e.isPushNotifiable,
|
|
26993
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
26994
|
+
}));
|
|
26995
|
+
return { isEnabled: data.isPushNotifiable, modules };
|
|
26996
|
+
}
|
|
26997
|
+
}
|
|
26998
|
+
class CommunityNotifications {
|
|
26999
|
+
constructor(communityId) {
|
|
27000
|
+
this.communityId = communityId;
|
|
27001
|
+
}
|
|
27002
|
+
async enable(events) {
|
|
27003
|
+
var _a;
|
|
27004
|
+
const client = getActiveClient();
|
|
27005
|
+
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 : [];
|
|
27006
|
+
const body = {
|
|
27007
|
+
level: NotificationSettingsLevelEnum.COMMUNITY,
|
|
27008
|
+
communityId: this.communityId,
|
|
27009
|
+
isPushNotifiable: true,
|
|
27010
|
+
notifiableEvents,
|
|
27011
|
+
};
|
|
27012
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27013
|
+
}
|
|
27014
|
+
async disable() {
|
|
27015
|
+
const client = getActiveClient();
|
|
27016
|
+
const body = {
|
|
27017
|
+
level: NotificationSettingsLevelEnum.COMMUNITY,
|
|
27018
|
+
communityId: this.communityId,
|
|
27019
|
+
isPushNotifiable: false,
|
|
27020
|
+
notifiableEvents: [],
|
|
27021
|
+
};
|
|
27022
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27023
|
+
}
|
|
27024
|
+
async getSettings() {
|
|
27025
|
+
var _a;
|
|
27026
|
+
const client = getActiveClient();
|
|
27027
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${NotificationSettingsLevelEnum.COMMUNITY}&communityId=${encodeURIComponent(this.communityId)}`);
|
|
27028
|
+
const validEventNames = Object.values(CommunityNotificationEventNameEnum);
|
|
27029
|
+
const events = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
27030
|
+
.filter(e => e.name != null && validEventNames.includes(e.name))
|
|
27031
|
+
.map(e => ({
|
|
27032
|
+
eventName: e.name,
|
|
27033
|
+
isEnabled: e.isPushNotifiable,
|
|
27034
|
+
isNetworkEnabled: e.isNetworkEnabled,
|
|
27035
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
27036
|
+
}));
|
|
27037
|
+
return { isEnabled: data.isPushNotifiable, events };
|
|
27038
|
+
}
|
|
27039
|
+
}
|
|
27040
|
+
class Notifications {
|
|
27041
|
+
user() {
|
|
27042
|
+
return new UserNotifications();
|
|
27043
|
+
}
|
|
27044
|
+
community(communityId) {
|
|
27045
|
+
return new CommunityNotifications(communityId);
|
|
27046
|
+
}
|
|
27047
|
+
channel(channelId) {
|
|
27048
|
+
return new ChannelNotifications(channelId);
|
|
27049
|
+
}
|
|
27050
|
+
}
|
|
27051
|
+
const notifications = () => new Notifications();
|
|
27052
|
+
|
|
26879
27053
|
/**
|
|
26880
27054
|
* ```js
|
|
26881
27055
|
* import { onChannelMarkerFetched } from '@amityco/ts-sdk-react-native'
|
|
@@ -27259,6 +27433,7 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
27259
27433
|
getCurrentUserType: getCurrentUserType,
|
|
27260
27434
|
setCurrentUserType: setCurrentUserType,
|
|
27261
27435
|
setAccessTokenHandler: setAccessTokenHandler,
|
|
27436
|
+
notifications: notifications,
|
|
27262
27437
|
onConnectionError: onConnectionError,
|
|
27263
27438
|
onClientDisconnected: onClientDisconnected,
|
|
27264
27439
|
onClientBanned: onClientBanned,
|
|
@@ -29291,7 +29466,7 @@ const getWatchSessionStorage = () => {
|
|
|
29291
29466
|
return storageInstance;
|
|
29292
29467
|
};
|
|
29293
29468
|
|
|
29294
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
29469
|
+
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\nwCnKJS3mL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E KEY-----";
|
|
29295
29470
|
/*
|
|
29296
29471
|
* The crypto algorithm used for importing key and signing string
|
|
29297
29472
|
*/
|
|
@@ -51489,4 +51664,4 @@ class AmityAttachmentProductTags {
|
|
|
51489
51664
|
}
|
|
51490
51665
|
}
|
|
51491
51666
|
|
|
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 };
|
|
51667
|
+
export { API_REGIONS, index$5 as AdRepository, AmityAttachmentProductTags, AmityCommunityType, AmityEventOrderOption, AmityEventOriginType, AmityEventResponseStatus, AmityEventSortOption, AmityEventStatus, AmityEventType, AnalyticsSourceTypeEnum, index$f as CategoryRepository, ChannelNotificationEventNameEnum, 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 };
|