@amityco/ts-sdk 7.3.1-27a784d.0 → 7.3.1-3ec5a73.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.
@@ -11,5 +11,5 @@
11
11
  * @category Post API
12
12
  * @async
13
13
  * */
14
- export declare const flagPost: (postId: Amity.Post['postId'], reason: Amity.ContentFlagReason) => Promise<boolean>;
14
+ export declare const flagPost: (postId: Amity.Post['postId'], reason?: Amity.ContentFlagReason) => Promise<boolean>;
15
15
  //# sourceMappingURL=flagPost.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"flagPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/flagPost.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;KAYK;AACL,eAAO,MAAM,QAAQ,WACX,MAAM,IAAI,CAAC,QAAQ,CAAC,UACpB,MAAM,iBAAiB,KAC9B,QAAQ,OAAO,CAyBjB,CAAC"}
1
+ {"version":3,"file":"flagPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/flagPost.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;KAYK;AACL,eAAO,MAAM,QAAQ,WACX,MAAM,IAAI,CAAC,QAAQ,CAAC,WACnB,MAAM,iBAAiB,KAC/B,QAAQ,OAAO,CA2BjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ts-sdk",
3
- "version": "7.3.1-27a784d.0",
3
+ "version": "7.3.1-3ec5a73.0",
4
4
  "license": "CC-BY-ND-4.0",
5
5
  "author": "amity.co <developers@amity.co> (https://amity.co)",
6
6
  "description": "Amity Social Cloud Typescript SDK",
@@ -22,18 +22,20 @@ import { ContentFlagReasonEnum } from '~/@types';
22
22
  * */
23
23
  export const flagComment = async (
24
24
  commentId: Amity.Comment['commentId'],
25
- reason: Amity.ContentFlagReason,
25
+ reason?: Amity.ContentFlagReason,
26
26
  ): Promise<boolean> => {
27
27
  const client = getActiveClient();
28
28
  client.log('comment/flagComment', commentId);
29
29
 
30
- const isPredefinedReason = Object.entries(ContentFlagReasonEnum).some(
31
- ([key, value]) => key !== ContentFlagReasonEnum.Others && value === reason,
32
- );
30
+ const isPredefinedReason =
31
+ reason &&
32
+ Object.entries(ContentFlagReasonEnum).some(
33
+ ([key, value]) => key !== ContentFlagReasonEnum.Others && value === reason,
34
+ );
33
35
 
34
36
  const body = {
35
- reason: isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
36
- detail: isPredefinedReason ? '' : reason,
37
+ reason: reason && isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
38
+ detail: reason && !isPredefinedReason ? reason : '',
37
39
  };
38
40
 
39
41
  const { data: payload } = await client.http.post<Amity.CommentPayload>(
@@ -22,18 +22,20 @@ import { ContentFlagReasonEnum } from '~/@types';
22
22
  * */
23
23
  export const flagPost = async (
24
24
  postId: Amity.Post['postId'],
25
- reason: Amity.ContentFlagReason,
25
+ reason?: Amity.ContentFlagReason,
26
26
  ): Promise<boolean> => {
27
27
  const client = getActiveClient();
28
28
  client.log('post/flagPost', postId);
29
29
 
30
- const isPredefinedReason = Object.entries(ContentFlagReasonEnum).some(
31
- ([key, value]) => key !== ContentFlagReasonEnum.Others && value === reason,
32
- );
30
+ const isPredefinedReason =
31
+ reason &&
32
+ Object.entries(ContentFlagReasonEnum).some(
33
+ ([key, value]) => key !== ContentFlagReasonEnum.Others && value === reason,
34
+ );
33
35
 
34
36
  const body = {
35
- reason: isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
36
- detail: isPredefinedReason ? '' : reason,
37
+ reason: reason && isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
38
+ detail: reason && !isPredefinedReason ? reason : '',
37
39
  };
38
40
 
39
41
  const { data: payload } = await client.http.post<Amity.PostPayload>(