@amityco/ts-sdk 7.3.1-b3a17de.0 → 7.3.1-e2dead4.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,MA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AK,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',
@@ -15909,19 +15921,25 @@ getDeliveredUsers.locally = (query) => {
15909
15921
  /**
15910
15922
  * ```js
15911
15923
  * import { MessageRepository } from '@amityco/ts-sdk'
15912
- * const flagged = await MessageRepository.flagMessage(messageId)
15924
+ * const flagged = await MessageRepository.flagMessage(messageId, reason)
15913
15925
  * ```
15914
15926
  *
15915
15927
  * @param messageId of the message to flag
15928
+ * @param reason the reason to flag the message
15916
15929
  * @returns the created report result
15917
15930
  *
15918
15931
  * @category Message API
15919
15932
  * @async
15920
15933
  * */
15921
- const flagMessage = async (messageId) => {
15934
+ const flagMessage = async (messageId, reason) => {
15922
15935
  const client = getActiveClient();
15923
15936
  client.log('message/flag', messageId);
15924
- const { data: payload } = await client.http.post(`/api/v5/messages/${encodeURIComponent(messageId)}/flags`);
15937
+ const isPredefinedReason = Object.entries(exports.ContentFlagReasonEnum).some(([key, value]) => key !== exports.ContentFlagReasonEnum.Others && value === reason);
15938
+ const body = {
15939
+ reason: isPredefinedReason ? reason : exports.ContentFlagReasonEnum.Others,
15940
+ detail: isPredefinedReason ? '' : reason,
15941
+ };
15942
+ const { data: payload } = await client.http.post(`/api/v5/messages/${encodeURIComponent(messageId)}/flags`, body);
15925
15943
  if (client.cache) {
15926
15944
  const messagePayload = await prepareMessagePayload(payload);
15927
15945
  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',
@@ -32001,19 +32013,25 @@ getDeliveredUsers.locally = (query) => {
32001
32013
  /**
32002
32014
  * ```js
32003
32015
  * import { MessageRepository } from '@amityco/ts-sdk'
32004
- * const flagged = await MessageRepository.flagMessage(messageId)
32016
+ * const flagged = await MessageRepository.flagMessage(messageId, reason)
32005
32017
  * ```
32006
32018
  *
32007
32019
  * @param messageId of the message to flag
32020
+ * @param reason the reason to flag the message
32008
32021
  * @returns the created report result
32009
32022
  *
32010
32023
  * @category Message API
32011
32024
  * @async
32012
32025
  * */
32013
- const flagMessage = async (messageId) => {
32026
+ const flagMessage = async (messageId, reason) => {
32014
32027
  const client = getActiveClient();
32015
32028
  client.log('message/flag', messageId);
32016
- const { data: payload } = await client.http.post(`/api/v5/messages/${encodeURIComponent(messageId)}/flags`);
32029
+ const isPredefinedReason = Object.entries(ContentFlagReasonEnum).some(([key, value]) => key !== ContentFlagReasonEnum.Others && value === reason);
32030
+ const body = {
32031
+ reason: isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
32032
+ detail: isPredefinedReason ? '' : reason,
32033
+ };
32034
+ const { data: payload } = await client.http.post(`/api/v5/messages/${encodeURIComponent(messageId)}/flags`, body);
32017
32035
  if (client.cache) {
32018
32036
  const messagePayload = await prepareMessagePayload(payload);
32019
32037
  ingestInCache(messagePayload);
@@ -42497,4 +42515,4 @@ var index = /*#__PURE__*/Object.freeze({
42497
42515
  onNotificationTraySeenUpdated: onNotificationTraySeenUpdated
42498
42516
  });
42499
42517
 
42500
- 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 };
42518
+ 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 };