@amityco/ts-sdk 7.2.1-50ce75a.0 → 7.2.1-88f63a0b.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/.eslintrc.json CHANGED
@@ -29,7 +29,8 @@
29
29
  "import/no-unresolved": "off",
30
30
  "no-shadow": "off",
31
31
  "no-unused-vars": "off",
32
- "no-console": ["warn", { "allow": ["warn", "error"] }]
32
+ "no-console": ["warn", { "allow": ["warn", "error"] }],
33
+ "@typescript-eslint/ban-types": "off"
33
34
  },
34
35
  "settings": {
35
36
  "import/resolver": {
@@ -5,8 +5,20 @@ export declare const ContentFeedType: Readonly<{
5
5
  POST: "post";
6
6
  MESSAGE: "message";
7
7
  }>;
8
+ export declare enum ContentFlagReasonEnum {
9
+ CommunityGuidelines = "Against community guidelines",
10
+ HarassmentOrBullying = "Harassment or bullying",
11
+ SelfHarmOrSuicide = "Self-harm or suicide",
12
+ ViolenceOrThreateningContent = "Violence or threatening content",
13
+ SellingRestrictedItems = "Selling and promoting restricted items",
14
+ SexualContentOrNudity = "Sexual message or nudity",
15
+ SpamOrScams = "Spam or scams",
16
+ FalseInformation = "False information or misinformation",
17
+ Others = "Others"
18
+ }
8
19
  declare global {
9
20
  namespace Amity {
21
+ type ContentFlagReason = Exclude<`${ContentFlagReasonEnum}`, `${ContentFlagReasonEnum.Others}`> | (string & {});
10
22
  type ContentType = 'text' | 'image' | 'file' | 'video' | 'poll' | 'json' | string;
11
23
  type ContentFeedType = ValueOf<typeof ContentFeedType>;
12
24
  type ContentDataText = {
@@ -1 +1 @@
1
- {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/content.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;;;EAM1B,CAAC;AAEH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,M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AAK,WAAW,CAAC,CAAC,SAAS,WAAW,IAAI,CAAC,SAAS,MAAM,GACtD,eAAe,GACf,CAAC,SAAS,MAAM,GAChB,eAAe,GACf,CAAC,SAAS,OAAO,GACjB,gBAAgB,GAChB,CAAC,SAAS,OAAO,GACjB,gBAAgB,GAChB,CAAC,SAAS,MAAM,GAChB,eAAe,GACf,CAAC,SAAS,MAAM,GAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvB,CAAC,SAAS,MAAM,GAChB,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,KAAK,CAAC;QAEV,KAAK,OAAO,CAAC,CAAC,SAAS,WAAW,IAAI;YAEpC,QAAQ,CAAC,EAAE,CAAC,CAAC;YACb,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC;YAChB,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;SACvB,CAAC;QAEF,KAAK,kBAAkB,GAAG;YACxB,WAAW,EAAE,MAAM,CAAC;YACpB,OAAO,EAAE,OAAO,CAAC;SAClB,CAAC;QAEF,KAAK,mBAAmB,GAAG;YACzB,WAAW,EAAE,OAAO,CAAC;YACrB,OAAO,EAAE,OAAO,CAAC;YACjB,kBAAkB,EAAE,MAAM,CAAC;YAC3B,eAAe,EAAE;gBACf,aAAa,EAAE,KAAK,CAAC,eAAe,CAAC;gBACrC,aAAa,EAAE,KAAK,CAAC,eAAe,CAAC;aACtC,CAAC;SACH,CAAC;QAEF,KAAK,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,MAAM,GAAG,OAAO,IAAI,CAAC,SAAS,MAAM,GAC5E,kBAAkB,GAClB,CAAC,SAAS,OAAO,GACjB,mBAAmB,GACnB,KAAK,CAAC;KACX;CACF"}
package/dist/index.cjs.js CHANGED
@@ -80,7 +80,19 @@ const ContentFeedType = Object.freeze({
80
80
  CHAT: 'chat',
81
81
  POST: 'post',
82
82
  MESSAGE: 'message',
83
- });
83
+ });
84
+ exports.ContentFlagReasonEnum = void 0;
85
+ (function (ContentFlagReasonEnum) {
86
+ ContentFlagReasonEnum["CommunityGuidelines"] = "Against community guidelines";
87
+ ContentFlagReasonEnum["HarassmentOrBullying"] = "Harassment or bullying";
88
+ ContentFlagReasonEnum["SelfHarmOrSuicide"] = "Self-harm or suicide";
89
+ ContentFlagReasonEnum["ViolenceOrThreateningContent"] = "Violence or threatening content";
90
+ ContentFlagReasonEnum["SellingRestrictedItems"] = "Selling and promoting restricted items";
91
+ ContentFlagReasonEnum["SexualContentOrNudity"] = "Sexual message or nudity";
92
+ ContentFlagReasonEnum["SpamOrScams"] = "Spam or scams";
93
+ ContentFlagReasonEnum["FalseInformation"] = "False information or misinformation";
94
+ ContentFlagReasonEnum["Others"] = "Others";
95
+ })(exports.ContentFlagReasonEnum || (exports.ContentFlagReasonEnum = {}));
84
96
 
85
97
  const MessageContentType = Object.freeze({
86
98
  TEXT: 'text',
@@ -15824,15 +15836,23 @@ getDeliveredUsers.locally = (query) => {
15824
15836
  * ```
15825
15837
  *
15826
15838
  * @param messageId of the message to flag
15839
+ * @param reason the reason to flag the message
15827
15840
  * @returns the created report result
15828
15841
  *
15829
15842
  * @category Message API
15830
15843
  * @async
15831
15844
  * */
15832
- const flagMessage = async (messageId) => {
15845
+ const flagMessage = async (messageId, reason) => {
15833
15846
  const client = getActiveClient();
15834
15847
  client.log('message/flag', messageId);
15835
- const { data: payload } = await client.http.post(`/api/v5/messages/${encodeURIComponent(messageId)}/flags`);
15848
+ const isPredefinedReason = Object.values(exports.ContentFlagReasonEnum)
15849
+ .filter(value => value !== exports.ContentFlagReasonEnum.Others)
15850
+ .includes(reason);
15851
+ const body = {
15852
+ reason: isPredefinedReason ? reason : exports.ContentFlagReasonEnum.Others,
15853
+ detail: isPredefinedReason ? '' : reason,
15854
+ };
15855
+ const { data: payload } = await client.http.post(`/api/v5/messages/${encodeURIComponent(messageId)}/flags`, body);
15836
15856
  if (client.cache) {
15837
15857
  const messagePayload = await prepareMessagePayload(payload);
15838
15858
  ingestInCache(messagePayload);
package/dist/index.esm.js CHANGED
@@ -65,7 +65,19 @@ const ContentFeedType = Object.freeze({
65
65
  CHAT: 'chat',
66
66
  POST: 'post',
67
67
  MESSAGE: 'message',
68
- });
68
+ });
69
+ var ContentFlagReasonEnum;
70
+ (function (ContentFlagReasonEnum) {
71
+ ContentFlagReasonEnum["CommunityGuidelines"] = "Against community guidelines";
72
+ ContentFlagReasonEnum["HarassmentOrBullying"] = "Harassment or bullying";
73
+ ContentFlagReasonEnum["SelfHarmOrSuicide"] = "Self-harm or suicide";
74
+ ContentFlagReasonEnum["ViolenceOrThreateningContent"] = "Violence or threatening content";
75
+ ContentFlagReasonEnum["SellingRestrictedItems"] = "Selling and promoting restricted items";
76
+ ContentFlagReasonEnum["SexualContentOrNudity"] = "Sexual message or nudity";
77
+ ContentFlagReasonEnum["SpamOrScams"] = "Spam or scams";
78
+ ContentFlagReasonEnum["FalseInformation"] = "False information or misinformation";
79
+ ContentFlagReasonEnum["Others"] = "Others";
80
+ })(ContentFlagReasonEnum || (ContentFlagReasonEnum = {}));
69
81
 
70
82
  const MessageContentType = Object.freeze({
71
83
  TEXT: 'text',
@@ -31916,15 +31928,23 @@ getDeliveredUsers.locally = (query) => {
31916
31928
  * ```
31917
31929
  *
31918
31930
  * @param messageId of the message to flag
31931
+ * @param reason the reason to flag the message
31919
31932
  * @returns the created report result
31920
31933
  *
31921
31934
  * @category Message API
31922
31935
  * @async
31923
31936
  * */
31924
- const flagMessage = async (messageId) => {
31937
+ const flagMessage = async (messageId, reason) => {
31925
31938
  const client = getActiveClient();
31926
31939
  client.log('message/flag', messageId);
31927
- const { data: payload } = await client.http.post(`/api/v5/messages/${encodeURIComponent(messageId)}/flags`);
31940
+ const isPredefinedReason = Object.values(ContentFlagReasonEnum)
31941
+ .filter(value => value !== ContentFlagReasonEnum.Others)
31942
+ .includes(reason);
31943
+ const body = {
31944
+ reason: isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
31945
+ detail: isPredefinedReason ? '' : reason,
31946
+ };
31947
+ const { data: payload } = await client.http.post(`/api/v5/messages/${encodeURIComponent(messageId)}/flags`, body);
31928
31948
  if (client.cache) {
31929
31949
  const messagePayload = await prepareMessagePayload(payload);
31930
31950
  ingestInCache(messagePayload);
@@ -42408,4 +42428,4 @@ var index = /*#__PURE__*/Object.freeze({
42408
42428
  onNotificationTraySeenUpdated: onNotificationTraySeenUpdated
42409
42429
  });
42410
42430
 
42411
- export { API_REGIONS, index$1 as AdRepository, index$9 as CategoryRepository, index$d as ChannelRepository, index$m as Client, index$7 as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$a as CommunityRepository, ContentFeedType, DefaultCommunityPostSetting, index$8 as FeedRepository, FileAccessTypeEnum, index$j as FileRepository, FileType, index$3 as LiveStreamPlayer, MessageContentType, index$h as MessageRepository, index$4 as PollRepository, PostContentType, index$6 as PostRepository, index$i as ReactionRepository, index$2 as StoryRepository, index$5 as StreamRepository, index$g as SubChannelRepository, SubscriptionLevels, index$k as UserRepository, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index 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, wipeCache };
42431
+ export { API_REGIONS, index$1 as AdRepository, index$9 as CategoryRepository, index$d as ChannelRepository, index$m as Client, index$7 as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$a as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, DefaultCommunityPostSetting, index$8 as FeedRepository, FileAccessTypeEnum, index$j as FileRepository, FileType, index$3 as LiveStreamPlayer, MessageContentType, index$h as MessageRepository, index$4 as PollRepository, PostContentType, index$6 as PostRepository, index$i as ReactionRepository, index$2 as StoryRepository, index$5 as StreamRepository, index$g as SubChannelRepository, SubscriptionLevels, index$k as UserRepository, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index 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, wipeCache };