@amityco/ts-sdk 7.18.0 → 7.18.1-1809d4fa.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,6BAA6B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"}
|
|
@@ -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,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,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;AACxC,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
|
@@ -255,6 +255,39 @@ exports.AnalyticsSourceTypeEnum = void 0;
|
|
|
255
255
|
AnalyticsSourceTypeEnum["ROOM"] = "room";
|
|
256
256
|
})(exports.AnalyticsSourceTypeEnum || (exports.AnalyticsSourceTypeEnum = {}));
|
|
257
257
|
|
|
258
|
+
exports.UserNotificationModuleNameEnum = void 0;
|
|
259
|
+
(function (UserNotificationModuleNameEnum) {
|
|
260
|
+
UserNotificationModuleNameEnum["CHAT"] = "chat";
|
|
261
|
+
UserNotificationModuleNameEnum["SOCIAL"] = "social";
|
|
262
|
+
UserNotificationModuleNameEnum["VIDEO_STREAMING"] = "video-streaming";
|
|
263
|
+
})(exports.UserNotificationModuleNameEnum || (exports.UserNotificationModuleNameEnum = {}));
|
|
264
|
+
exports.CommunityNotificationEventNameEnum = void 0;
|
|
265
|
+
(function (CommunityNotificationEventNameEnum) {
|
|
266
|
+
CommunityNotificationEventNameEnum["POST_CREATED"] = "post.created";
|
|
267
|
+
CommunityNotificationEventNameEnum["POST_REACTED"] = "post.reacted";
|
|
268
|
+
CommunityNotificationEventNameEnum["COMMENT_CREATED"] = "comment.created";
|
|
269
|
+
CommunityNotificationEventNameEnum["COMMENT_REPLIED"] = "comment.replied";
|
|
270
|
+
CommunityNotificationEventNameEnum["COMMENT_REACTED"] = "comment.reacted";
|
|
271
|
+
CommunityNotificationEventNameEnum["STORY_CREATED"] = "story.created";
|
|
272
|
+
CommunityNotificationEventNameEnum["STORY_REACTED"] = "story.reacted";
|
|
273
|
+
CommunityNotificationEventNameEnum["STORY_COMMENT_CREATED"] = "story-comment.created";
|
|
274
|
+
CommunityNotificationEventNameEnum["LIVESTREAM_START"] = "video-streaming.didStart";
|
|
275
|
+
})(exports.CommunityNotificationEventNameEnum || (exports.CommunityNotificationEventNameEnum = {}));
|
|
276
|
+
exports.NotificationSettingsLevelEnum = void 0;
|
|
277
|
+
(function (NotificationSettingsLevelEnum) {
|
|
278
|
+
NotificationSettingsLevelEnum["USER"] = "user";
|
|
279
|
+
NotificationSettingsLevelEnum["COMMUNITY"] = "community";
|
|
280
|
+
NotificationSettingsLevelEnum["CHANNEL"] = "channel";
|
|
281
|
+
})(exports.NotificationSettingsLevelEnum || (exports.NotificationSettingsLevelEnum = {}));
|
|
282
|
+
/**
|
|
283
|
+
* `NOT` variant is intentionally excluded from public API (internal server-side use only).
|
|
284
|
+
*/
|
|
285
|
+
exports.NotificationRolesFilterTypeEnum = void 0;
|
|
286
|
+
(function (NotificationRolesFilterTypeEnum) {
|
|
287
|
+
NotificationRolesFilterTypeEnum["ALL"] = "all";
|
|
288
|
+
NotificationRolesFilterTypeEnum["ONLY"] = "only";
|
|
289
|
+
})(exports.NotificationRolesFilterTypeEnum || (exports.NotificationRolesFilterTypeEnum = {}));
|
|
290
|
+
|
|
258
291
|
function getVersion() {
|
|
259
292
|
try {
|
|
260
293
|
// the string ''v7.18.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
@@ -10783,6 +10816,140 @@ const setAccessTokenHandler = (accessTokenHandler) => {
|
|
|
10783
10816
|
client.accessTokenHandler = accessTokenHandler;
|
|
10784
10817
|
};
|
|
10785
10818
|
|
|
10819
|
+
function parseRolesFilter(listenFromRoleIds, ignoreFromRoleIds) {
|
|
10820
|
+
if (ignoreFromRoleIds && ignoreFromRoleIds.length > 0) {
|
|
10821
|
+
return { type: 'not', roleIds: ignoreFromRoleIds };
|
|
10822
|
+
}
|
|
10823
|
+
if (listenFromRoleIds && listenFromRoleIds.length > 0) {
|
|
10824
|
+
return { type: exports.NotificationRolesFilterTypeEnum.ONLY, roleIds: listenFromRoleIds };
|
|
10825
|
+
}
|
|
10826
|
+
return { type: exports.NotificationRolesFilterTypeEnum.ALL };
|
|
10827
|
+
}
|
|
10828
|
+
function serializeRolesFilter(rolesFilter) {
|
|
10829
|
+
if ((rolesFilter === null || rolesFilter === void 0 ? void 0 : rolesFilter.type) === exports.NotificationRolesFilterTypeEnum.ONLY) {
|
|
10830
|
+
return { listenFromRoleIds: rolesFilter.roleIds };
|
|
10831
|
+
}
|
|
10832
|
+
return { listenFromRoleIds: [] };
|
|
10833
|
+
}
|
|
10834
|
+
class ChannelNotifications {
|
|
10835
|
+
constructor(channelId) {
|
|
10836
|
+
this.channelId = channelId;
|
|
10837
|
+
}
|
|
10838
|
+
async enable() {
|
|
10839
|
+
const client = getActiveClient();
|
|
10840
|
+
const body = {
|
|
10841
|
+
level: exports.NotificationSettingsLevelEnum.CHANNEL,
|
|
10842
|
+
channelId: this.channelId,
|
|
10843
|
+
isPushNotifiable: true,
|
|
10844
|
+
};
|
|
10845
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10846
|
+
}
|
|
10847
|
+
async disable() {
|
|
10848
|
+
const client = getActiveClient();
|
|
10849
|
+
const body = {
|
|
10850
|
+
level: exports.NotificationSettingsLevelEnum.CHANNEL,
|
|
10851
|
+
channelId: this.channelId,
|
|
10852
|
+
isPushNotifiable: false,
|
|
10853
|
+
};
|
|
10854
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10855
|
+
}
|
|
10856
|
+
async getSettings() {
|
|
10857
|
+
const client = getActiveClient();
|
|
10858
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${exports.NotificationSettingsLevelEnum.CHANNEL}&channelId=${encodeURIComponent(this.channelId)}`);
|
|
10859
|
+
return { isEnabled: data.isPushNotifiable };
|
|
10860
|
+
}
|
|
10861
|
+
}
|
|
10862
|
+
class UserNotifications {
|
|
10863
|
+
async enable(modules) {
|
|
10864
|
+
var _a;
|
|
10865
|
+
const client = getActiveClient();
|
|
10866
|
+
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 : [];
|
|
10867
|
+
const body = {
|
|
10868
|
+
level: exports.NotificationSettingsLevelEnum.USER,
|
|
10869
|
+
isPushNotifiable: true,
|
|
10870
|
+
notifiableEvents,
|
|
10871
|
+
};
|
|
10872
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10873
|
+
}
|
|
10874
|
+
async disableAllNotifications() {
|
|
10875
|
+
const client = getActiveClient();
|
|
10876
|
+
const body = {
|
|
10877
|
+
level: exports.NotificationSettingsLevelEnum.USER,
|
|
10878
|
+
isPushNotifiable: false,
|
|
10879
|
+
notifiableEvents: [],
|
|
10880
|
+
};
|
|
10881
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10882
|
+
}
|
|
10883
|
+
async getSettings() {
|
|
10884
|
+
var _a;
|
|
10885
|
+
const client = getActiveClient();
|
|
10886
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${exports.NotificationSettingsLevelEnum.USER}`);
|
|
10887
|
+
const validModuleNames = Object.values(exports.UserNotificationModuleNameEnum);
|
|
10888
|
+
const modules = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
10889
|
+
.filter(e => e.moduleName != null && validModuleNames.includes(e.moduleName))
|
|
10890
|
+
.map(e => ({
|
|
10891
|
+
moduleName: e.moduleName,
|
|
10892
|
+
isEnabled: e.isPushNotifiable,
|
|
10893
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
10894
|
+
}));
|
|
10895
|
+
return { isEnabled: data.isPushNotifiable, modules };
|
|
10896
|
+
}
|
|
10897
|
+
}
|
|
10898
|
+
class CommunityNotifications {
|
|
10899
|
+
constructor(communityId) {
|
|
10900
|
+
this.communityId = communityId;
|
|
10901
|
+
}
|
|
10902
|
+
async enable(events) {
|
|
10903
|
+
var _a;
|
|
10904
|
+
const client = getActiveClient();
|
|
10905
|
+
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 : [];
|
|
10906
|
+
const body = {
|
|
10907
|
+
level: exports.NotificationSettingsLevelEnum.COMMUNITY,
|
|
10908
|
+
communityId: this.communityId,
|
|
10909
|
+
isPushNotifiable: true,
|
|
10910
|
+
notifiableEvents,
|
|
10911
|
+
};
|
|
10912
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10913
|
+
}
|
|
10914
|
+
async disable() {
|
|
10915
|
+
const client = getActiveClient();
|
|
10916
|
+
const body = {
|
|
10917
|
+
level: exports.NotificationSettingsLevelEnum.COMMUNITY,
|
|
10918
|
+
communityId: this.communityId,
|
|
10919
|
+
isPushNotifiable: false,
|
|
10920
|
+
notifiableEvents: [],
|
|
10921
|
+
};
|
|
10922
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
10923
|
+
}
|
|
10924
|
+
async getSettings() {
|
|
10925
|
+
var _a;
|
|
10926
|
+
const client = getActiveClient();
|
|
10927
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${exports.NotificationSettingsLevelEnum.COMMUNITY}&communityId=${encodeURIComponent(this.communityId)}`);
|
|
10928
|
+
const validEventNames = Object.values(exports.CommunityNotificationEventNameEnum);
|
|
10929
|
+
const events = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
10930
|
+
.filter(e => e.name != null && validEventNames.includes(e.name))
|
|
10931
|
+
.map(e => ({
|
|
10932
|
+
eventName: e.name,
|
|
10933
|
+
isEnabled: e.isPushNotifiable,
|
|
10934
|
+
isNetworkEnabled: e.isNetworkEnabled,
|
|
10935
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
10936
|
+
}));
|
|
10937
|
+
return { isEnabled: data.isPushNotifiable, events };
|
|
10938
|
+
}
|
|
10939
|
+
}
|
|
10940
|
+
class Notifications {
|
|
10941
|
+
user() {
|
|
10942
|
+
return new UserNotifications();
|
|
10943
|
+
}
|
|
10944
|
+
community(communityId) {
|
|
10945
|
+
return new CommunityNotifications(communityId);
|
|
10946
|
+
}
|
|
10947
|
+
channel(channelId) {
|
|
10948
|
+
return new ChannelNotifications(channelId);
|
|
10949
|
+
}
|
|
10950
|
+
}
|
|
10951
|
+
const notifications = () => new Notifications();
|
|
10952
|
+
|
|
10786
10953
|
/**
|
|
10787
10954
|
* ```js
|
|
10788
10955
|
* import { onChannelMarkerFetched } from '@amityco/ts-sdk'
|
|
@@ -11163,6 +11330,7 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
11163
11330
|
getCurrentUserType: getCurrentUserType,
|
|
11164
11331
|
setCurrentUserType: setCurrentUserType,
|
|
11165
11332
|
setAccessTokenHandler: setAccessTokenHandler,
|
|
11333
|
+
notifications: notifications,
|
|
11166
11334
|
onConnectionError: onConnectionError,
|
|
11167
11335
|
onClientDisconnected: onClientDisconnected,
|
|
11168
11336
|
onClientBanned: onClientBanned,
|
|
@@ -13195,7 +13363,7 @@ const getWatchSessionStorage = () => {
|
|
|
13195
13363
|
return storageInstance;
|
|
13196
13364
|
};
|
|
13197
13365
|
|
|
13198
|
-
const privateKey = "
|
|
13366
|
+
const privateKey = "MIIEpQIBAAKCAQEAwAEc/oZgYIvKSUG/C3mONYLR4ZPgAjMEX4bJ+xqqakUDRtqlNO+eZs2blQ1Ko0DBkqPExyQezvjibH5W2UZBV5RaBTlTcNVKTToMBEGesAfaEcM3qUyQHxdbFYZv6P4sb14dcwxTQ8usmaV8ooiR1Fcaso5ZWYcZ8Hb46FbQ7OoVumsBtPWwfZ4f003o5VCl6AIM6lcLv9UDLlFVYhE+PeXpRHtfWlGqxMvqC9oinlwhL6nWv6VjQXW4nhcib72dPBzfHT7k/PMKto2SxALYdb68ENiAGuJLWi3AUHSyYCJK2w7wIlWfJUAI0v26ub10IpExr6D5QuW2577jjP93iwIDAQABAoIBAFWfqXhwIIatkFY+9Z1+ZcbDQimgsmMIsUiQaX6Lk7e0cxOj6czDlxYtVtaPiNtow2pLkjNkjkCqiP7tEHnwdK9DvylZOTa2R15NJpK3WLcTqVIGhsn/FL5owfvFah6zSsmXZParZm5zY9NZE03ALZhOB9/cz0e3kf/EbpfeL2mW7MApyiUt5i09ycchroOpcWp73ipIxvgigtZyUGFmsQicWhUs28F0D7w4Qfk76yG3nqXeb+BAMhCaIaa/k/aAxhiZG/ygEQWQrcC8gfe+jyicMAQPDEVS9YuUMGsLjIjKuVLZzp2xirQnhc2i2zVNEIvG6soprPOBEMQugzrtX5ECgYEA3b7KAbBIbDl1e4ZSCWhHdHkiWVZHaopsR/LhqDDNhXjWjq3AesgV6k0j9EdziMn/HmmOso0bz99GTV3JZf4A9ztTLumJlkHbdVtlgOqSjrFLj12rH9KXTheyIhWSpUmm8+WB1xasFbqpvJaGo7F3pd2Fqj1XR4mp5BO7c/t7LJ0CgYEA3aouEzXQ9THRKYocdfY69EI1Il1t/d/RSqqd9BxEjxBgxkM13ZiYIn/R4WW/nCUrlmhxG44Aa2Gob4Ahfsui2xKTg/g/3Zk/rAxAEGkfOLGoenaJMD41fH4wUq3FRYwkvnaMb9Hd6f/TlBHslIRa2NN58bSBGJCyBP2b59+2+EcCgYEAixDVRXvV37GlYUOa/XVdosk5Zoe6oDGRuQm0xbNdoUBoZvDHDvme7ONWEiQha/8qtVsD+CyQ7awcPfb8kK9c0bBt+bTS6d4BkTcxkEkMgtrkBVR8Nqfu5jXsLH4VCv4G61zbMhZw8+ut+az5YX2yCN7Frj9sFlxapMRPQmzMEe0CgYEAumsAzM8ZqNv4mAK65Mnr0rhLj1cbxcKRdUYACOgtEFQpzxN/HZnTeFAe5nx3pI3uFlRHq3DFEYnT6dHMWaJQmAULYpVIwMi9L6gtyJ9fzoI6uqMtxRDMUqKdaSsTGOY/kJ6KhQ/unXi1K3XXjR+yd1+C0q+HUm1+CYxvrZYLfskCgYEArsEy+IQOiqniJ0NE2vVUF+UK/IRZaic9YKcpov5Ot7Vvzm/MnnW4N1ljVskocETBWMmPUvNSExVjPebi+rxd8fa5kY8BJScPTzMFbunZn/wjtGdcM10qdlVQ9doG61A/9P3ezFKCfS4AvF/H/59LcSx2Bh28fp3/efiVIOpVd4Y=";
|
|
13199
13367
|
/*
|
|
13200
13368
|
* The crypto algorithm used for importing key and signing string
|
|
13201
13369
|
*/
|
package/dist/index.esm.js
CHANGED
|
@@ -240,6 +240,39 @@ var AnalyticsSourceTypeEnum;
|
|
|
240
240
|
AnalyticsSourceTypeEnum["ROOM"] = "room";
|
|
241
241
|
})(AnalyticsSourceTypeEnum || (AnalyticsSourceTypeEnum = {}));
|
|
242
242
|
|
|
243
|
+
var UserNotificationModuleNameEnum;
|
|
244
|
+
(function (UserNotificationModuleNameEnum) {
|
|
245
|
+
UserNotificationModuleNameEnum["CHAT"] = "chat";
|
|
246
|
+
UserNotificationModuleNameEnum["SOCIAL"] = "social";
|
|
247
|
+
UserNotificationModuleNameEnum["VIDEO_STREAMING"] = "video-streaming";
|
|
248
|
+
})(UserNotificationModuleNameEnum || (UserNotificationModuleNameEnum = {}));
|
|
249
|
+
var CommunityNotificationEventNameEnum;
|
|
250
|
+
(function (CommunityNotificationEventNameEnum) {
|
|
251
|
+
CommunityNotificationEventNameEnum["POST_CREATED"] = "post.created";
|
|
252
|
+
CommunityNotificationEventNameEnum["POST_REACTED"] = "post.reacted";
|
|
253
|
+
CommunityNotificationEventNameEnum["COMMENT_CREATED"] = "comment.created";
|
|
254
|
+
CommunityNotificationEventNameEnum["COMMENT_REPLIED"] = "comment.replied";
|
|
255
|
+
CommunityNotificationEventNameEnum["COMMENT_REACTED"] = "comment.reacted";
|
|
256
|
+
CommunityNotificationEventNameEnum["STORY_CREATED"] = "story.created";
|
|
257
|
+
CommunityNotificationEventNameEnum["STORY_REACTED"] = "story.reacted";
|
|
258
|
+
CommunityNotificationEventNameEnum["STORY_COMMENT_CREATED"] = "story-comment.created";
|
|
259
|
+
CommunityNotificationEventNameEnum["LIVESTREAM_START"] = "video-streaming.didStart";
|
|
260
|
+
})(CommunityNotificationEventNameEnum || (CommunityNotificationEventNameEnum = {}));
|
|
261
|
+
var NotificationSettingsLevelEnum;
|
|
262
|
+
(function (NotificationSettingsLevelEnum) {
|
|
263
|
+
NotificationSettingsLevelEnum["USER"] = "user";
|
|
264
|
+
NotificationSettingsLevelEnum["COMMUNITY"] = "community";
|
|
265
|
+
NotificationSettingsLevelEnum["CHANNEL"] = "channel";
|
|
266
|
+
})(NotificationSettingsLevelEnum || (NotificationSettingsLevelEnum = {}));
|
|
267
|
+
/**
|
|
268
|
+
* `NOT` variant is intentionally excluded from public API (internal server-side use only).
|
|
269
|
+
*/
|
|
270
|
+
var NotificationRolesFilterTypeEnum;
|
|
271
|
+
(function (NotificationRolesFilterTypeEnum) {
|
|
272
|
+
NotificationRolesFilterTypeEnum["ALL"] = "all";
|
|
273
|
+
NotificationRolesFilterTypeEnum["ONLY"] = "only";
|
|
274
|
+
})(NotificationRolesFilterTypeEnum || (NotificationRolesFilterTypeEnum = {}));
|
|
275
|
+
|
|
243
276
|
function getVersion() {
|
|
244
277
|
try {
|
|
245
278
|
// the string ''v7.18.0-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
@@ -26875,6 +26908,140 @@ const setAccessTokenHandler = (accessTokenHandler) => {
|
|
|
26875
26908
|
client.accessTokenHandler = accessTokenHandler;
|
|
26876
26909
|
};
|
|
26877
26910
|
|
|
26911
|
+
function parseRolesFilter(listenFromRoleIds, ignoreFromRoleIds) {
|
|
26912
|
+
if (ignoreFromRoleIds && ignoreFromRoleIds.length > 0) {
|
|
26913
|
+
return { type: 'not', roleIds: ignoreFromRoleIds };
|
|
26914
|
+
}
|
|
26915
|
+
if (listenFromRoleIds && listenFromRoleIds.length > 0) {
|
|
26916
|
+
return { type: NotificationRolesFilterTypeEnum.ONLY, roleIds: listenFromRoleIds };
|
|
26917
|
+
}
|
|
26918
|
+
return { type: NotificationRolesFilterTypeEnum.ALL };
|
|
26919
|
+
}
|
|
26920
|
+
function serializeRolesFilter(rolesFilter) {
|
|
26921
|
+
if ((rolesFilter === null || rolesFilter === void 0 ? void 0 : rolesFilter.type) === NotificationRolesFilterTypeEnum.ONLY) {
|
|
26922
|
+
return { listenFromRoleIds: rolesFilter.roleIds };
|
|
26923
|
+
}
|
|
26924
|
+
return { listenFromRoleIds: [] };
|
|
26925
|
+
}
|
|
26926
|
+
class ChannelNotifications {
|
|
26927
|
+
constructor(channelId) {
|
|
26928
|
+
this.channelId = channelId;
|
|
26929
|
+
}
|
|
26930
|
+
async enable() {
|
|
26931
|
+
const client = getActiveClient();
|
|
26932
|
+
const body = {
|
|
26933
|
+
level: NotificationSettingsLevelEnum.CHANNEL,
|
|
26934
|
+
channelId: this.channelId,
|
|
26935
|
+
isPushNotifiable: true,
|
|
26936
|
+
};
|
|
26937
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
26938
|
+
}
|
|
26939
|
+
async disable() {
|
|
26940
|
+
const client = getActiveClient();
|
|
26941
|
+
const body = {
|
|
26942
|
+
level: NotificationSettingsLevelEnum.CHANNEL,
|
|
26943
|
+
channelId: this.channelId,
|
|
26944
|
+
isPushNotifiable: false,
|
|
26945
|
+
};
|
|
26946
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
26947
|
+
}
|
|
26948
|
+
async getSettings() {
|
|
26949
|
+
const client = getActiveClient();
|
|
26950
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${NotificationSettingsLevelEnum.CHANNEL}&channelId=${encodeURIComponent(this.channelId)}`);
|
|
26951
|
+
return { isEnabled: data.isPushNotifiable };
|
|
26952
|
+
}
|
|
26953
|
+
}
|
|
26954
|
+
class UserNotifications {
|
|
26955
|
+
async enable(modules) {
|
|
26956
|
+
var _a;
|
|
26957
|
+
const client = getActiveClient();
|
|
26958
|
+
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 : [];
|
|
26959
|
+
const body = {
|
|
26960
|
+
level: NotificationSettingsLevelEnum.USER,
|
|
26961
|
+
isPushNotifiable: true,
|
|
26962
|
+
notifiableEvents,
|
|
26963
|
+
};
|
|
26964
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
26965
|
+
}
|
|
26966
|
+
async disableAllNotifications() {
|
|
26967
|
+
const client = getActiveClient();
|
|
26968
|
+
const body = {
|
|
26969
|
+
level: NotificationSettingsLevelEnum.USER,
|
|
26970
|
+
isPushNotifiable: false,
|
|
26971
|
+
notifiableEvents: [],
|
|
26972
|
+
};
|
|
26973
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
26974
|
+
}
|
|
26975
|
+
async getSettings() {
|
|
26976
|
+
var _a;
|
|
26977
|
+
const client = getActiveClient();
|
|
26978
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${NotificationSettingsLevelEnum.USER}`);
|
|
26979
|
+
const validModuleNames = Object.values(UserNotificationModuleNameEnum);
|
|
26980
|
+
const modules = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
26981
|
+
.filter(e => e.moduleName != null && validModuleNames.includes(e.moduleName))
|
|
26982
|
+
.map(e => ({
|
|
26983
|
+
moduleName: e.moduleName,
|
|
26984
|
+
isEnabled: e.isPushNotifiable,
|
|
26985
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
26986
|
+
}));
|
|
26987
|
+
return { isEnabled: data.isPushNotifiable, modules };
|
|
26988
|
+
}
|
|
26989
|
+
}
|
|
26990
|
+
class CommunityNotifications {
|
|
26991
|
+
constructor(communityId) {
|
|
26992
|
+
this.communityId = communityId;
|
|
26993
|
+
}
|
|
26994
|
+
async enable(events) {
|
|
26995
|
+
var _a;
|
|
26996
|
+
const client = getActiveClient();
|
|
26997
|
+
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 : [];
|
|
26998
|
+
const body = {
|
|
26999
|
+
level: NotificationSettingsLevelEnum.COMMUNITY,
|
|
27000
|
+
communityId: this.communityId,
|
|
27001
|
+
isPushNotifiable: true,
|
|
27002
|
+
notifiableEvents,
|
|
27003
|
+
};
|
|
27004
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27005
|
+
}
|
|
27006
|
+
async disable() {
|
|
27007
|
+
const client = getActiveClient();
|
|
27008
|
+
const body = {
|
|
27009
|
+
level: NotificationSettingsLevelEnum.COMMUNITY,
|
|
27010
|
+
communityId: this.communityId,
|
|
27011
|
+
isPushNotifiable: false,
|
|
27012
|
+
notifiableEvents: [],
|
|
27013
|
+
};
|
|
27014
|
+
await client.http.post('/api/v3/notification/setting', body);
|
|
27015
|
+
}
|
|
27016
|
+
async getSettings() {
|
|
27017
|
+
var _a;
|
|
27018
|
+
const client = getActiveClient();
|
|
27019
|
+
const { data } = await client.http.get(`/api/v3/notification/setting?level=${NotificationSettingsLevelEnum.COMMUNITY}&communityId=${encodeURIComponent(this.communityId)}`);
|
|
27020
|
+
const validEventNames = Object.values(CommunityNotificationEventNameEnum);
|
|
27021
|
+
const events = ((_a = data.notifiableEvents) !== null && _a !== void 0 ? _a : [])
|
|
27022
|
+
.filter(e => e.name != null && validEventNames.includes(e.name))
|
|
27023
|
+
.map(e => ({
|
|
27024
|
+
eventName: e.name,
|
|
27025
|
+
isEnabled: e.isPushNotifiable,
|
|
27026
|
+
isNetworkEnabled: e.isNetworkEnabled,
|
|
27027
|
+
rolesFilter: parseRolesFilter(e.listenFromRoleIds, e.ignoreFromRoleIds),
|
|
27028
|
+
}));
|
|
27029
|
+
return { isEnabled: data.isPushNotifiable, events };
|
|
27030
|
+
}
|
|
27031
|
+
}
|
|
27032
|
+
class Notifications {
|
|
27033
|
+
user() {
|
|
27034
|
+
return new UserNotifications();
|
|
27035
|
+
}
|
|
27036
|
+
community(communityId) {
|
|
27037
|
+
return new CommunityNotifications(communityId);
|
|
27038
|
+
}
|
|
27039
|
+
channel(channelId) {
|
|
27040
|
+
return new ChannelNotifications(channelId);
|
|
27041
|
+
}
|
|
27042
|
+
}
|
|
27043
|
+
const notifications = () => new Notifications();
|
|
27044
|
+
|
|
26878
27045
|
/**
|
|
26879
27046
|
* ```js
|
|
26880
27047
|
* import { onChannelMarkerFetched } from '@amityco/ts-sdk'
|
|
@@ -27255,6 +27422,7 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
27255
27422
|
getCurrentUserType: getCurrentUserType,
|
|
27256
27423
|
setCurrentUserType: setCurrentUserType,
|
|
27257
27424
|
setAccessTokenHandler: setAccessTokenHandler,
|
|
27425
|
+
notifications: notifications,
|
|
27258
27426
|
onConnectionError: onConnectionError,
|
|
27259
27427
|
onClientDisconnected: onClientDisconnected,
|
|
27260
27428
|
onClientBanned: onClientBanned,
|
|
@@ -29287,7 +29455,7 @@ const getWatchSessionStorage = () => {
|
|
|
29287
29455
|
return storageInstance;
|
|
29288
29456
|
};
|
|
29289
29457
|
|
|
29290
|
-
const privateKey = "
|
|
29458
|
+
const privateKey = "MIIEpQIBAAKCAQEAwAEc/oZgYIvKSUG/C3mONYLR4ZPgAjMEX4bJ+xqqakUDRtqlNO+eZs2blQ1Ko0DBkqPExyQezvjibH5W2UZBV5RaBTlTcNVKTToMBEGesAfaEcM3qUyQHxdbFYZv6P4sb14dcwxTQ8usmaV8ooiR1Fcaso5ZWYcZ8Hb46FbQ7OoVumsBtPWwfZ4f003o5VCl6AIM6lcLv9UDLlFVYhE+PeXpRHtfWlGqxMvqC9oinlwhL6nWv6VjQXW4nhcib72dPBzfHT7k/PMKto2SxALYdb68ENiAGuJLWi3AUHSyYCJK2w7wIlWfJUAI0v26ub10IpExr6D5QuW2577jjP93iwIDAQABAoIBAFWfqXhwIIatkFY+9Z1+ZcbDQimgsmMIsUiQaX6Lk7e0cxOj6czDlxYtVtaPiNtow2pLkjNkjkCqiP7tEHnwdK9DvylZOTa2R15NJpK3WLcTqVIGhsn/FL5owfvFah6zSsmXZParZm5zY9NZE03ALZhOB9/cz0e3kf/EbpfeL2mW7MApyiUt5i09ycchroOpcWp73ipIxvgigtZyUGFmsQicWhUs28F0D7w4Qfk76yG3nqXeb+BAMhCaIaa/k/aAxhiZG/ygEQWQrcC8gfe+jyicMAQPDEVS9YuUMGsLjIjKuVLZzp2xirQnhc2i2zVNEIvG6soprPOBEMQugzrtX5ECgYEA3b7KAbBIbDl1e4ZSCWhHdHkiWVZHaopsR/LhqDDNhXjWjq3AesgV6k0j9EdziMn/HmmOso0bz99GTV3JZf4A9ztTLumJlkHbdVtlgOqSjrFLj12rH9KXTheyIhWSpUmm8+WB1xasFbqpvJaGo7F3pd2Fqj1XR4mp5BO7c/t7LJ0CgYEA3aouEzXQ9THRKYocdfY69EI1Il1t/d/RSqqd9BxEjxBgxkM13ZiYIn/R4WW/nCUrlmhxG44Aa2Gob4Ahfsui2xKTg/g/3Zk/rAxAEGkfOLGoenaJMD41fH4wUq3FRYwkvnaMb9Hd6f/TlBHslIRa2NN58bSBGJCyBP2b59+2+EcCgYEAixDVRXvV37GlYUOa/XVdosk5Zoe6oDGRuQm0xbNdoUBoZvDHDvme7ONWEiQha/8qtVsD+CyQ7awcPfb8kK9c0bBt+bTS6d4BkTcxkEkMgtrkBVR8Nqfu5jXsLH4VCv4G61zbMhZw8+ut+az5YX2yCN7Frj9sFlxapMRPQmzMEe0CgYEAumsAzM8ZqNv4mAK65Mnr0rhLj1cbxcKRdUYACOgtEFQpzxN/HZnTeFAe5nx3pI3uFlRHq3DFEYnT6dHMWaJQmAULYpVIwMi9L6gtyJ9fzoI6uqMtxRDMUqKdaSsTGOY/kJ6KhQ/unXi1K3XXjR+yd1+C0q+HUm1+CYxvrZYLfskCgYEArsEy+IQOiqniJ0NE2vVUF+UK/IRZaic9YKcpov5Ot7Vvzm/MnnW4N1ljVskocETBWMmPUvNSExVjPebi+rxd8fa5kY8BJScPTzMFbunZn/wjtGdcM10qdlVQ9doG61A/9P3ezFKCfS4AvF/H/59LcSx2Bh28fp3/efiVIOpVd4Y=";
|
|
29291
29459
|
/*
|
|
29292
29460
|
* The crypto algorithm used for importing key and signing string
|
|
29293
29461
|
*/
|
|
@@ -51537,4 +51705,4 @@ class AmityAttachmentProductTags {
|
|
|
51537
51705
|
}
|
|
51538
51706
|
}
|
|
51539
51707
|
|
|
51540
|
-
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 };
|
|
51708
|
+
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 };
|