@amityco/react-native-social-uikit 4.0.0-RC.23 → 4.0.0-RC.24

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.
Files changed (182) hide show
  1. package/lib/commonjs/components/CustomText/index.js +3 -4
  2. package/lib/commonjs/components/CustomText/index.js.map +1 -1
  3. package/lib/commonjs/components/Social/PostList/Components/RenderTextWithMention.js.map +1 -1
  4. package/lib/commonjs/components/StoryKit/src/Story.js +1 -1
  5. package/lib/commonjs/components/StoryKit/src/Story.js.map +1 -1
  6. package/lib/commonjs/components/StoryKit/src/helpers/StateHelpers.js +1 -1
  7. package/lib/commonjs/components/StoryKit/src/helpers/StateHelpers.js.map +1 -1
  8. package/lib/commonjs/redux/slices/bottomSheetSlice.js.map +1 -1
  9. package/lib/commonjs/v4/PublicApi/Components/AmityCommunityHeaderComponent/AmityCommunityHeaderComponent.js +3 -6
  10. package/lib/commonjs/v4/PublicApi/Components/AmityCommunityHeaderComponent/AmityCommunityHeaderComponent.js.map +1 -1
  11. package/lib/commonjs/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js +3 -1
  12. package/lib/commonjs/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js.map +1 -1
  13. package/lib/commonjs/v4/PublicApi/Components/AmityPendingPostListComponent/AmityPendingPostListComponent.js +2 -6
  14. package/lib/commonjs/v4/PublicApi/Components/AmityPendingPostListComponent/AmityPendingPostListComponent.js.map +1 -1
  15. package/lib/commonjs/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.js +3 -6
  16. package/lib/commonjs/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.js.map +1 -1
  17. package/lib/commonjs/v4/PublicApi/Components/AmityThumbnailActionComponent/AmityThumbnailActionComponent.js.map +1 -1
  18. package/lib/commonjs/v4/PublicApi/Elements/ModeratorBadgeElement/ModeratorBadgeElement.js +3 -7
  19. package/lib/commonjs/v4/PublicApi/Elements/ModeratorBadgeElement/ModeratorBadgeElement.js.map +1 -1
  20. package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js +3 -1
  21. package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js.map +1 -1
  22. package/lib/commonjs/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js +3 -6
  23. package/lib/commonjs/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js.map +1 -1
  24. package/lib/commonjs/v4/PublicApi/Pages/AmityViewStoryPage/AmityViewStoryPage.js +3 -1
  25. package/lib/commonjs/v4/PublicApi/Pages/AmityViewStoryPage/AmityViewStoryPage.js.map +1 -1
  26. package/lib/commonjs/v4/component/CommunityStories/index.js +4 -1
  27. package/lib/commonjs/v4/component/CommunityStories/index.js.map +1 -1
  28. package/lib/commonjs/v4/component/MyStories/StoryCircleItem.js +19 -4
  29. package/lib/commonjs/v4/component/MyStories/StoryCircleItem.js.map +1 -1
  30. package/lib/commonjs/v4/component/MyStories/StoryTargetView.js +4 -2
  31. package/lib/commonjs/v4/component/MyStories/StoryTargetView.js.map +1 -1
  32. package/lib/commonjs/v4/component/PostMenu/index.js +3 -8
  33. package/lib/commonjs/v4/component/PostMenu/index.js.map +1 -1
  34. package/lib/commonjs/v4/component/RenderTextWithMention/RenderTextWithMention.js.map +1 -1
  35. package/lib/commonjs/v4/component/StoryKit/src/Story.js +1 -1
  36. package/lib/commonjs/v4/component/StoryKit/src/Story.js.map +1 -1
  37. package/lib/commonjs/v4/component/StoryKit/src/StoryCircleListItem.js +3 -1
  38. package/lib/commonjs/v4/component/StoryKit/src/StoryCircleListItem.js.map +1 -1
  39. package/lib/commonjs/v4/component/StoryKit/src/StoryListItem.js +3 -1
  40. package/lib/commonjs/v4/component/StoryKit/src/StoryListItem.js.map +1 -1
  41. package/lib/commonjs/v4/component/StoryKit/src/helpers/StateHelpers.js +1 -1
  42. package/lib/commonjs/v4/component/StoryKit/src/helpers/StateHelpers.js.map +1 -1
  43. package/lib/commonjs/v4/elements/ChangeThumbnailButton/ChangeThumbnailButton.js.map +1 -1
  44. package/lib/commonjs/v4/elements/DeleteThumbnailButton/DeleteThumbnailButton.js.map +1 -1
  45. package/lib/commonjs/v4/hook/index.js +4 -4
  46. package/lib/commonjs/v4/hook/index.js.map +1 -1
  47. package/lib/commonjs/v4/hook/isModerator.js +22 -0
  48. package/lib/commonjs/v4/hook/isModerator.js.map +1 -0
  49. package/lib/commonjs/v4/hook/useStoryPermission.js +4 -3
  50. package/lib/commonjs/v4/hook/useStoryPermission.js.map +1 -1
  51. package/lib/commonjs/v4/utils/permissions.js +8 -3
  52. package/lib/commonjs/v4/utils/permissions.js.map +1 -1
  53. package/lib/module/components/CustomText/index.js +3 -4
  54. package/lib/module/components/CustomText/index.js.map +1 -1
  55. package/lib/module/components/Social/PostList/Components/RenderTextWithMention.js.map +1 -1
  56. package/lib/module/components/StoryKit/src/Story.js +1 -1
  57. package/lib/module/components/StoryKit/src/Story.js.map +1 -1
  58. package/lib/module/components/StoryKit/src/helpers/StateHelpers.js +1 -1
  59. package/lib/module/components/StoryKit/src/helpers/StateHelpers.js.map +1 -1
  60. package/lib/module/redux/slices/bottomSheetSlice.js.map +1 -1
  61. package/lib/module/v4/PublicApi/Components/AmityCommunityHeaderComponent/AmityCommunityHeaderComponent.js +4 -7
  62. package/lib/module/v4/PublicApi/Components/AmityCommunityHeaderComponent/AmityCommunityHeaderComponent.js.map +1 -1
  63. package/lib/module/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js +3 -1
  64. package/lib/module/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js.map +1 -1
  65. package/lib/module/v4/PublicApi/Components/AmityPendingPostListComponent/AmityPendingPostListComponent.js +3 -7
  66. package/lib/module/v4/PublicApi/Components/AmityPendingPostListComponent/AmityPendingPostListComponent.js.map +1 -1
  67. package/lib/module/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.js +4 -7
  68. package/lib/module/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.js.map +1 -1
  69. package/lib/module/v4/PublicApi/Components/AmityThumbnailActionComponent/AmityThumbnailActionComponent.js.map +1 -1
  70. package/lib/module/v4/PublicApi/Elements/ModeratorBadgeElement/ModeratorBadgeElement.js +4 -9
  71. package/lib/module/v4/PublicApi/Elements/ModeratorBadgeElement/ModeratorBadgeElement.js.map +1 -1
  72. package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js +3 -1
  73. package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js.map +1 -1
  74. package/lib/module/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js +4 -7
  75. package/lib/module/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js.map +1 -1
  76. package/lib/module/v4/PublicApi/Pages/AmityViewStoryPage/AmityViewStoryPage.js +3 -1
  77. package/lib/module/v4/PublicApi/Pages/AmityViewStoryPage/AmityViewStoryPage.js.map +1 -1
  78. package/lib/module/v4/component/CommunityStories/index.js +4 -1
  79. package/lib/module/v4/component/CommunityStories/index.js.map +1 -1
  80. package/lib/module/v4/component/MyStories/StoryCircleItem.js +19 -4
  81. package/lib/module/v4/component/MyStories/StoryCircleItem.js.map +1 -1
  82. package/lib/module/v4/component/MyStories/StoryTargetView.js +4 -2
  83. package/lib/module/v4/component/MyStories/StoryTargetView.js.map +1 -1
  84. package/lib/module/v4/component/PostMenu/index.js +4 -9
  85. package/lib/module/v4/component/PostMenu/index.js.map +1 -1
  86. package/lib/module/v4/component/RenderTextWithMention/RenderTextWithMention.js.map +1 -1
  87. package/lib/module/v4/component/StoryKit/src/Story.js +1 -1
  88. package/lib/module/v4/component/StoryKit/src/Story.js.map +1 -1
  89. package/lib/module/v4/component/StoryKit/src/StoryCircleListItem.js +3 -1
  90. package/lib/module/v4/component/StoryKit/src/StoryCircleListItem.js.map +1 -1
  91. package/lib/module/v4/component/StoryKit/src/StoryListItem.js +3 -1
  92. package/lib/module/v4/component/StoryKit/src/StoryListItem.js.map +1 -1
  93. package/lib/module/v4/component/StoryKit/src/helpers/StateHelpers.js +1 -1
  94. package/lib/module/v4/component/StoryKit/src/helpers/StateHelpers.js.map +1 -1
  95. package/lib/module/v4/elements/ChangeThumbnailButton/ChangeThumbnailButton.js.map +1 -1
  96. package/lib/module/v4/elements/DeleteThumbnailButton/DeleteThumbnailButton.js.map +1 -1
  97. package/lib/module/v4/hook/index.js +1 -1
  98. package/lib/module/v4/hook/index.js.map +1 -1
  99. package/lib/module/v4/hook/isModerator.js +15 -0
  100. package/lib/module/v4/hook/isModerator.js.map +1 -0
  101. package/lib/module/v4/hook/useStoryPermission.js +5 -4
  102. package/lib/module/v4/hook/useStoryPermission.js.map +1 -1
  103. package/lib/module/v4/utils/permissions.js +8 -3
  104. package/lib/module/v4/utils/permissions.js.map +1 -1
  105. package/lib/typescript/src/components/CustomText/index.d.ts.map +1 -1
  106. package/lib/typescript/src/components/StoryKit/src/Story.d.ts.map +1 -1
  107. package/lib/typescript/src/components/StoryKit/src/helpers/StateHelpers.d.ts +1 -1
  108. package/lib/typescript/src/components/StoryKit/src/helpers/StateHelpers.d.ts.map +1 -1
  109. package/lib/typescript/src/redux/slices/bottomSheetSlice.d.ts +4 -3
  110. package/lib/typescript/src/redux/slices/bottomSheetSlice.d.ts.map +1 -1
  111. package/lib/typescript/src/v4/PublicApi/Components/AmityCommunityHeaderComponent/AmityCommunityHeaderComponent.d.ts.map +1 -1
  112. package/lib/typescript/src/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.d.ts +1 -1
  113. package/lib/typescript/src/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.d.ts.map +1 -1
  114. package/lib/typescript/src/v4/PublicApi/Components/AmityPendingPostListComponent/AmityPendingPostListComponent.d.ts.map +1 -1
  115. package/lib/typescript/src/v4/PublicApi/Components/AmityPostCommentComponent/AmityPostCommentComponent.d.ts +1 -1
  116. package/lib/typescript/src/v4/PublicApi/Components/AmityPostCommentComponent/AmityPostCommentComponent.d.ts.map +1 -1
  117. package/lib/typescript/src/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.d.ts.map +1 -1
  118. package/lib/typescript/src/v4/PublicApi/Components/AmityThumbnailActionComponent/AmityThumbnailActionComponent.d.ts +2 -1
  119. package/lib/typescript/src/v4/PublicApi/Components/AmityThumbnailActionComponent/AmityThumbnailActionComponent.d.ts.map +1 -1
  120. package/lib/typescript/src/v4/PublicApi/Elements/ModeratorBadgeElement/ModeratorBadgeElement.d.ts.map +1 -1
  121. package/lib/typescript/src/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.d.ts.map +1 -1
  122. package/lib/typescript/src/v4/component/CommunityStories/index.d.ts.map +1 -1
  123. package/lib/typescript/src/v4/component/MyStories/StoryCircleItem.d.ts.map +1 -1
  124. package/lib/typescript/src/v4/component/MyStories/StoryTargetView.d.ts.map +1 -1
  125. package/lib/typescript/src/v4/component/PostMenu/index.d.ts.map +1 -1
  126. package/lib/typescript/src/v4/component/RenderTextWithMention/RenderTextWithMention.d.ts.map +1 -1
  127. package/lib/typescript/src/v4/component/StoryKit/src/Story.d.ts.map +1 -1
  128. package/lib/typescript/src/v4/component/StoryKit/src/helpers/StateHelpers.d.ts +1 -1
  129. package/lib/typescript/src/v4/component/StoryKit/src/helpers/StateHelpers.d.ts.map +1 -1
  130. package/lib/typescript/src/v4/elements/ChangeThumbnailButton/ChangeThumbnailButton.d.ts +2 -1
  131. package/lib/typescript/src/v4/elements/ChangeThumbnailButton/ChangeThumbnailButton.d.ts.map +1 -1
  132. package/lib/typescript/src/v4/elements/DeleteThumbnailButton/DeleteThumbnailButton.d.ts +2 -1
  133. package/lib/typescript/src/v4/elements/DeleteThumbnailButton/DeleteThumbnailButton.d.ts.map +1 -1
  134. package/lib/typescript/src/v4/features/community/Setting/elements/CloseCommunityDescription/CloseCommunityDescription.d.ts +2 -2
  135. package/lib/typescript/src/v4/features/community/Setting/elements/CloseCommunityDescription/CloseCommunityDescription.d.ts.map +1 -1
  136. package/lib/typescript/src/v4/hook/index.d.ts +1 -1
  137. package/lib/typescript/src/v4/hook/index.d.ts.map +1 -1
  138. package/lib/typescript/src/v4/hook/isModerator.d.ts +2 -0
  139. package/lib/typescript/src/v4/hook/isModerator.d.ts.map +1 -0
  140. package/lib/typescript/src/v4/hook/useStoryPermission.d.ts +3 -1
  141. package/lib/typescript/src/v4/hook/useStoryPermission.d.ts.map +1 -1
  142. package/lib/typescript/src/v4/utils/permissions.d.ts +1 -1
  143. package/lib/typescript/src/v4/utils/permissions.d.ts.map +1 -1
  144. package/package.json +1 -1
  145. package/src/components/CustomText/index.tsx +6 -5
  146. package/src/components/Social/PostList/Components/RenderTextWithMention.tsx +1 -1
  147. package/src/components/StoryKit/src/Story.tsx +3 -1
  148. package/src/components/StoryKit/src/helpers/StateHelpers.ts +2 -2
  149. package/src/redux/slices/bottomSheetSlice.ts +3 -2
  150. package/src/v4/PublicApi/Components/AmityCommunityHeaderComponent/AmityCommunityHeaderComponent.tsx +4 -9
  151. package/src/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.tsx +2 -2
  152. package/src/v4/PublicApi/Components/AmityPendingPostListComponent/AmityPendingPostListComponent.tsx +3 -5
  153. package/src/v4/PublicApi/Components/AmityPostCommentComponent/AmityPostCommentComponent.tsx +1 -1
  154. package/src/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.tsx +4 -5
  155. package/src/v4/PublicApi/Components/AmityThumbnailActionComponent/AmityThumbnailActionComponent.tsx +1 -1
  156. package/src/v4/PublicApi/Elements/ModeratorBadgeElement/ModeratorBadgeElement.tsx +4 -7
  157. package/src/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.tsx +1 -1
  158. package/src/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.tsx +4 -5
  159. package/src/v4/PublicApi/Pages/AmityViewStoryPage/AmityViewStoryPage.tsx +1 -1
  160. package/src/v4/component/CommunityStories/index.tsx +3 -1
  161. package/src/v4/component/MyStories/StoryCircleItem.tsx +17 -4
  162. package/src/v4/component/MyStories/StoryTargetView.tsx +4 -2
  163. package/src/v4/component/PostMenu/index.tsx +6 -8
  164. package/src/v4/component/RenderTextWithMention/RenderTextWithMention.tsx +3 -4
  165. package/src/v4/component/StoryKit/src/Story.tsx +3 -1
  166. package/src/v4/component/StoryKit/src/StoryCircleListItem.tsx +1 -1
  167. package/src/v4/component/StoryKit/src/StoryListItem.tsx +1 -1
  168. package/src/v4/component/StoryKit/src/helpers/StateHelpers.ts +2 -2
  169. package/src/v4/elements/ChangeThumbnailButton/ChangeThumbnailButton.tsx +1 -1
  170. package/src/v4/elements/DeleteThumbnailButton/DeleteThumbnailButton.tsx +1 -1
  171. package/src/v4/features/community/Setting/elements/CloseCommunityDescription/CloseCommunityDescription.tsx +2 -2
  172. package/src/v4/hook/index.ts +1 -1
  173. package/src/v4/hook/isModerator.ts +19 -0
  174. package/src/v4/hook/useStoryPermission.ts +2 -8
  175. package/src/v4/utils/permissions.ts +13 -8
  176. package/lib/commonjs/v4/hook/useIsCommunityModerator.js +0 -43
  177. package/lib/commonjs/v4/hook/useIsCommunityModerator.js.map +0 -1
  178. package/lib/module/v4/hook/useIsCommunityModerator.js +0 -36
  179. package/lib/module/v4/hook/useIsCommunityModerator.js.map +0 -1
  180. package/lib/typescript/src/v4/hook/useIsCommunityModerator.d.ts +0 -7
  181. package/lib/typescript/src/v4/hook/useIsCommunityModerator.d.ts.map +0 -1
  182. package/src/v4/hook/useIsCommunityModerator.ts +0 -35
@@ -14,7 +14,7 @@ export * from './useCommunities';
14
14
  export * from './useCommunity';
15
15
  export * from './useCategory';
16
16
  export * from './useUiKitReference';
17
- export * from './useIsCommunityModerator';
17
+ export * from './isModerator';
18
18
  export * from './useSearch';
19
19
  export * from './useTimeDifference';
20
20
  export * from './useReaction';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/v4/hook/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iCAAiC,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uDAAuD,CAAC;AACtE,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/v4/hook/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iCAAiC,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uDAAuD,CAAC;AACtE,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const isModerator: (userRoles?: string[]) => boolean;
2
+ //# sourceMappingURL=isModerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isModerator.d.ts","sourceRoot":"","sources":["../../../../../src/v4/hook/isModerator.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,GAAI,YAAY,MAAM,EAAE,YAa/C,CAAC"}
@@ -1,2 +1,4 @@
1
- export declare function useStoryPermission(communityId?: string): boolean;
1
+ export declare function useStoryPermission(communityId?: string): {
2
+ hasStoryPermission: boolean;
3
+ };
2
4
  //# sourceMappingURL=useStoryPermission.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useStoryPermission.d.ts","sourceRoot":"","sources":["../../../../../src/v4/hook/useStoryPermission.ts"],"names":[],"mappings":"AASA,wBAAgB,kBAAkB,CAAC,WAAW,CAAC,EAAE,MAAM,WAgBtD"}
1
+ {"version":3,"file":"useStoryPermission.d.ts","sourceRoot":"","sources":["../../../../../src/v4/hook/useStoryPermission.ts"],"names":[],"mappings":"AAKA,wBAAgB,kBAAkB,CAAC,WAAW,CAAC,EAAE,MAAM;;EActD"}
@@ -3,5 +3,5 @@ export declare const checkEditCommunityPermission: (communityId?: string) => boo
3
3
  export declare const checkEditRolePermission: (communityId: string) => boolean;
4
4
  export declare const isModerator: (roles?: string[]) => boolean;
5
5
  export declare const isAdmin: (roles?: string[]) => boolean;
6
- export declare const checkStoryPermission: (client: Amity.Client, communityId: string) => boolean;
6
+ export declare const checkStoryPermission: (client: Amity.Client | null | undefined, communityId?: string) => boolean;
7
7
  //# sourceMappingURL=permissions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../../../src/v4/utils/permissions.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,8BAA8B,GAAI,aAAa,MAAM,YAOjE,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,cAAc,MAAM,YAOhE,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,aAAa,MAAM,YAQ1D,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,QAAO,MAAM,EAAO,YAW/C,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,QAAO,MAAM,EAAO,YAI3C,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,KAAK,CAAC,MAAM,EACpB,aAAa,MAAM,YASpB,CAAC"}
1
+ {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../../../src/v4/utils/permissions.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,8BAA8B,GAAI,aAAa,MAAM,YAOjE,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,cAAc,MAAM,YAOhE,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,aAAa,MAAM,YAQ1D,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,QAAO,MAAM,EAAO,YAW/C,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,QAAO,MAAM,EAAO,YAI3C,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,KAAK,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,EACvC,cAAc,MAAM,KACnB,OAaF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/react-native-social-uikit",
3
- "version": "4.0.0-RC.23",
3
+ "version": "4.0.0-RC.24",
4
4
  "description": "Social UIKit",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -9,13 +9,14 @@ interface CustomTextProps {
9
9
  ellipsizeMode?: 'tail' | 'head' | 'middle' | 'clip' | undefined;
10
10
  }
11
11
 
12
- const CustomText: React.FC<CustomTextProps> = (
13
- { children, style, numberOfLines, ellipsizeMode = 'tail' }: CustomTextProps,
14
- props
15
- ) => {
12
+ const CustomText: React.FC<CustomTextProps> = ({
13
+ children,
14
+ style,
15
+ numberOfLines,
16
+ ellipsizeMode = 'tail',
17
+ }) => {
16
18
  return (
17
19
  <Text
18
- {...props}
19
20
  style={[styles.text, style]}
20
21
  numberOfLines={numberOfLines}
21
22
  ellipsizeMode={ellipsizeMode}
@@ -27,7 +27,7 @@ const RenderTextWithMention: React.FC<IrenderTextWithMention> = ({
27
27
  });
28
28
  };
29
29
  let currentPosition = 0;
30
- const result: (string | JSX.Element)[][] = mentionPositionArr.map(
30
+ const result: (string | React.ReactElement)[][] = mentionPositionArr.map(
31
31
  ({ index, length, userId }, i) => {
32
32
  // Add non-highlighted text before the mention
33
33
  const nonHighlightedText = textPost.slice(currentPosition, index);
@@ -45,7 +45,9 @@ export const Story = ({
45
45
  const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
46
46
  const [currentPage, setCurrentPage] = useState<number>(0);
47
47
  const [selectedData, setSelectedData] = useState<IUserStory[]>([]);
48
- const cube = useRef<CubeNavigationHorizontal | AndroidCubeEffect>();
48
+ const cube = useRef<CubeNavigationHorizontal | AndroidCubeEffect | null>(
49
+ null
50
+ );
49
51
 
50
52
  // Component Functions
51
53
  const _handleStoryItemPress = (item: IUserStory, index?: number) => {
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useRef } from 'react';
2
2
 
3
- export function usePrevious(value: any) {
4
- const ref = useRef();
3
+ export function usePrevious<T>(value: T): T | undefined {
4
+ const ref = useRef<T | undefined>(undefined);
5
5
  useEffect(() => {
6
6
  ref.current = value;
7
7
  });
@@ -1,17 +1,18 @@
1
1
  import { ComponentID, PageID } from '../../v4/enum';
2
2
  import { PayloadAction, createSlice } from '@reduxjs/toolkit';
3
3
  import { RootState, useUIKitDispatch, useUIKitSelector } from '../store';
4
+ import { ReactElement } from 'react';
4
5
 
5
6
  export interface BottomSheetState {
6
7
  open: boolean;
7
- content: JSX.Element | null;
8
+ content: ReactElement | null;
8
9
  height?: number;
9
10
  pageId?: PageID;
10
11
  componentId?: ComponentID;
11
12
  }
12
13
 
13
14
  type OpenBottomSheetPayload = {
14
- content: JSX.Element;
15
+ content: ReactElement;
15
16
  height?: number;
16
17
  };
17
18
 
@@ -1,11 +1,8 @@
1
1
  import React, { memo, useState, FC } from 'react';
2
2
  import { View } from 'react-native';
3
3
  import { ComponentID, PageID } from '../../../enum';
4
- import {
5
- useAmityComponent,
6
- useCommunity,
7
- useIsCommunityModerator,
8
- } from '../../../hook';
4
+ import { useAmityComponent, useCommunity, useUser } from '../../../hook';
5
+ import { isModerator } from '../../../hook/isModerator';
9
6
  import { useStyles } from './styles';
10
7
  import CommunityCover from '../../../elements/CommunityCover/CommunityCover';
11
8
  import CommunityPrivateBadge from '../../../elements/CommunityPrivateBadge/CommunityPrivateBadge';
@@ -61,10 +58,8 @@ const AmityCommunityHeaderComponent: FC<AmityCommunityHeaderComponentProps> = ({
61
58
  componentId,
62
59
  });
63
60
 
64
- const { isCommunityModerator } = useIsCommunityModerator({
65
- communityId: community?.communityId,
66
- userId: client?.userId,
67
- });
61
+ const currentUser = useUser(client?.userId || '');
62
+ const isCommunityModerator = isModerator(currentUser?.roles);
68
63
 
69
64
  const styles = useStyles(themeStyles);
70
65
 
@@ -18,13 +18,13 @@ interface AmityCreatePostMenuComponentProps {
18
18
  const AmityCreatePostMenuComponent = ({
19
19
  pageId = PageID.WildCardPage,
20
20
  componentId = ComponentID.WildCardComponent,
21
- }: AmityCreatePostMenuComponentProps): JSX.Element => {
21
+ }: AmityCreatePostMenuComponentProps): React.ReactElement => {
22
22
  const navigation = useNavigation<StackNavigationProp<RootStackParamList>>();
23
23
  const { themeStyles } = useAmityComponent({ pageId, componentId });
24
24
 
25
25
  const { AmityCreatePostMenuComponentBehavior } = useBehaviour();
26
26
 
27
- const hasStoryPermission = useStoryPermission();
27
+ const { hasStoryPermission } = useStoryPermission();
28
28
 
29
29
  const styles = StyleSheet.create({
30
30
  container: {
@@ -17,7 +17,7 @@ import PostContent from '../../../../v4/component/PostContent';
17
17
  import FormDescription from '../../../../v4/elements/FormDescription';
18
18
  import { usePostCollection } from '../../../../v4/hook/collections/usePostCollection';
19
19
  import ActionButton from '../../../../v4/elements/ActionButton';
20
- import { useIsCommunityModerator } from '../../../../v4/hook';
20
+ import { isModerator, useUser } from '../../../../v4/hook';
21
21
  import { usePendingPostQuery } from '../../../../v4/hook/usePendingPostQuery';
22
22
  import { SvgXml } from 'react-native-svg';
23
23
  import { Title } from '../../../../v4/elements';
@@ -48,10 +48,8 @@ const usePendingPostList = ({
48
48
  },
49
49
  });
50
50
 
51
- const { isCommunityModerator } = useIsCommunityModerator({
52
- communityId: community.communityId,
53
- userId: client.userId,
54
- });
51
+ const currentUser = useUser(client.userId || '');
52
+ const isCommunityModerator = isModerator(currentUser?.roles);
55
53
 
56
54
  useEffect(() => {
57
55
  onPendingPostCountChange?.(collection.data.length);
@@ -45,7 +45,7 @@ type AmityPostCommentComponentType = {
45
45
  disabledInteraction?: boolean;
46
46
  setReplyUserName?: (arg: string) => void;
47
47
  setReplyCommentId?: (arg: string) => void;
48
- ListHeaderComponent?: JSX.Element;
48
+ ListHeaderComponent?: React.ReactElement;
49
49
  };
50
50
 
51
51
  const commentListLimit = 10;
@@ -18,7 +18,8 @@ import { IMentionPosition } from '../../../types/type';
18
18
  import { RootStackParamList } from '../../../routes/RouteParamList';
19
19
  import { ComponentID, ElementID, PageID } from '../../../enum';
20
20
  import AvatarElement from '../../Elements/CommonElements/AvatarElement';
21
- import { useAmityComponent, useIsCommunityModerator } from '../../../hook';
21
+ import { useAmityComponent, useUser } from '../../../hook';
22
+ import { isModerator } from '../../../hook/isModerator';
22
23
  import ModeratorBadgeElement from '../../Elements/ModeratorBadgeElement/ModeratorBadgeElement';
23
24
  import AmityPostEngagementActionsComponent from '../AmityPostEngagementActionsComponent/AmityPostEngagementActionsComponent';
24
25
  import {
@@ -93,10 +94,8 @@ const AmityPostContentComponent: FC<AmityPostContentComponentProps> = ({
93
94
  } = post ?? {};
94
95
  const mentionPosition = metadata?.mentioned;
95
96
 
96
- const { isCommunityModerator } = useIsCommunityModerator({
97
- communityId: targetType === 'community' && targetId,
98
- userId: creator?.userId,
99
- });
97
+ const creatorUser = useUser(creator?.userId || '');
98
+ const isCommunityModerator = isModerator(creatorUser?.roles);
100
99
 
101
100
  useEffect(() => {
102
101
  if (mentionPosition) {
@@ -16,7 +16,7 @@ const AmityThumbnailActionComponent = ({
16
16
  onChangeThumbnail,
17
17
  onDeleteThumbnail,
18
18
  pageId = PageID.WildCardPage,
19
- }: AmityThumbnailActionComponentProps): JSX.Element => {
19
+ }: AmityThumbnailActionComponentProps): React.ReactElement => {
20
20
  const componentId = ComponentID.thumbnail_action;
21
21
  const { themeStyles } = useAmityComponent({ pageId, componentId });
22
22
  const styles = useStyles(themeStyles);
@@ -1,10 +1,10 @@
1
1
  import { TextProps, Text, View } from 'react-native';
2
2
  import React, { FC, memo } from 'react';
3
3
  import { ComponentID, ElementID, PageID } from '../../../enum/enumUIKitID';
4
- import { useAmityElement } from '../../../hook';
4
+ import { useAmityElement, useUser } from '../../../hook';
5
5
  import ImageElement from '../CommonElements/ImageElement';
6
6
  import { useStyles } from './styles';
7
- import { useIsCommunityModerator } from '../../../hook';
7
+ import { isModerator } from '../../../hook/isModerator';
8
8
 
9
9
  type ModeratorBadgeElementType = Partial<TextProps> & {
10
10
  pageID: PageID;
@@ -20,10 +20,7 @@ const ModeratorBadgeElement: FC<ModeratorBadgeElementType> = ({
20
20
  communityId,
21
21
  ...props
22
22
  }) => {
23
- const { isCommunityModerator } = useIsCommunityModerator({
24
- communityId,
25
- userId,
26
- });
23
+ const user = useUser(userId || '');
27
24
  const elementID = ElementID.moderator_badge;
28
25
  const { isExcluded, config, accessibilityId, themeStyles } = useAmityElement({
29
26
  pageId: pageID,
@@ -32,7 +29,7 @@ const ModeratorBadgeElement: FC<ModeratorBadgeElementType> = ({
32
29
  });
33
30
  const styles = useStyles(themeStyles);
34
31
  if (isExcluded) return null;
35
- if (!isCommunityModerator || !communityId || !userId) return null;
32
+ if (!isModerator(user?.roles) || !communityId || !userId) return null;
36
33
  const text = (config?.text as string) ?? '';
37
34
 
38
35
  return (
@@ -279,7 +279,7 @@ function CommunityProfileActions({ pageId, communityId, styles }) {
279
279
  NativeStackNavigationProp<RootStackParamList, 'CreatePost'>
280
280
  >();
281
281
 
282
- const hasStoryPermission = useStoryPermission(communityId);
282
+ const { hasStoryPermission } = useStoryPermission(communityId);
283
283
 
284
284
  const hasPostPermission = usePostPermission({ community });
285
285
 
@@ -23,9 +23,10 @@ import {
23
23
  import {
24
24
  TSearchItem,
25
25
  useAmityPage,
26
- useIsCommunityModerator,
27
26
  useRequestPermission,
27
+ useUser,
28
28
  } from '../../../hook';
29
+ import { isModerator } from '../../../hook/isModerator';
29
30
  import { useStyles } from './styles';
30
31
  import { AmityPostComposerMode, AmityPostComposerPageType } from '../../types';
31
32
  import { IDisplayImage, IMentionPosition } from '../../../../v4/types/type';
@@ -88,10 +89,8 @@ const AmityPostComposerPage: FC<AmityPostComposerPageType> = ({
88
89
  const dispatch = useUIKitDispatch();
89
90
  const { addPostToGlobalFeed, updateByPostId } = globalfeedSlice.actions;
90
91
 
91
- const { isCommunityModerator } = useIsCommunityModerator({
92
- communityId: community?.communityId,
93
- userId: (client as Amity.Client)?.userId,
94
- });
92
+ const currentUser = useUser((client as Amity.Client)?.userId || '');
93
+ const isCommunityModerator = isModerator(currentUser?.roles);
95
94
  const { showToastMessage, hideToastMessage } = uiSlice.actions;
96
95
  const [inputMessage, setInputMessage] = useState<string>(
97
96
  (post?.data as Amity.ContentDataText)?.text ?? ''
@@ -34,7 +34,7 @@ const AmityViewStoryPage: FC<IAmityViewStoryPage> = ({
34
34
  }) => {
35
35
  const { client } = useAuth();
36
36
  const userId = (client as Amity.Client).userId;
37
- const hasStoryPermission = useStoryPermission(targetId);
37
+ const { hasStoryPermission } = useStoryPermission(targetId);
38
38
  const styles = useStyles();
39
39
  const { getStories, stories, loading } = useStory();
40
40
  const { getImage } = useFile();
@@ -30,7 +30,7 @@ const CommunityStories = ({ communityId, community }: ICommunityStories) => {
30
30
  useNavigation() as NativeStackNavigationProp<RootStackParamList>;
31
31
  const styles = useStyles();
32
32
  const { getUiKitConfig } = useConfig();
33
- const hasStoryPermission = useStoryPermission(communityId);
33
+ const { hasStoryPermission } = useStoryPermission(communityId);
34
34
  const { getStoryTarget, storyTarget, stories, getStories } = useStory();
35
35
  const { getImage } = useFile();
36
36
  const [avatarUrl, setAvatarUrl] = useState(undefined);
@@ -185,6 +185,8 @@ const CommunityStories = ({ communityId, community }: ICommunityStories) => {
185
185
  return null;
186
186
  }
187
187
 
188
+ if (!hasStoryPermission && stories.length === 0) return null;
189
+
188
190
  return (
189
191
  <View style={styles.container}>
190
192
  <View style={styles.storyItemWrap}>{renderCommunityStory()}</View>
@@ -27,7 +27,8 @@ const StoryCircleItem: FC<IStoryCircleItem> = ({
27
27
  const theme = useTheme() as MyMD3Theme;
28
28
  const [avatarUrl, setAvatarUrl] = useState(null);
29
29
  const [communityData, setCommunityData] = useState<Amity.Community>(null);
30
- const hasStoryPermission = useStoryPermission(storyTarget.targetId);
30
+ const [communityLoading, setCommunityLoading] = useState(true);
31
+ const { hasStoryPermission } = useStoryPermission(storyTarget.targetId);
31
32
  const { getImage } = useFile();
32
33
  const { getUiKitConfig } = useConfig();
33
34
  const styles = useStyles();
@@ -43,13 +44,17 @@ const StoryCircleItem: FC<IStoryCircleItem> = ({
43
44
  : ['#e2e2e2', '#e2e2e2'];
44
45
 
45
46
  useEffect(() => {
46
- if (storyTarget.targetType !== 'community') return;
47
- CommunityRepository.getCommunity(
47
+ if (storyTarget.targetType !== 'community') return null;
48
+ const unsubscribe = CommunityRepository.getCommunity(
48
49
  storyTarget.targetId,
49
50
  async ({ error, loading, data }) => {
50
- if (error) return;
51
+ if (error) {
52
+ setCommunityLoading(false);
53
+ return;
54
+ }
51
55
  if (!loading) {
52
56
  setCommunityData(data);
57
+ setCommunityLoading(false);
53
58
  const avatarImage = await getImage({
54
59
  fileId: data.avatarFileId,
55
60
  imageSize: ImageSizeState.small,
@@ -58,9 +63,17 @@ const StoryCircleItem: FC<IStoryCircleItem> = ({
58
63
  }
59
64
  }
60
65
  );
66
+ return () => unsubscribe();
61
67
  }, [getImage, storyTarget.targetId, storyTarget.targetType]);
62
68
 
63
69
  if (storyTarget.targetType !== 'community') return null;
70
+
71
+ // Global story feed: only show stories from communities the user has joined.
72
+ // Public community stories are visible on the community profile page,
73
+ // but must NOT appear in the global story feed for non-members.
74
+ // Private community stories are never returned by the SDK for non-members,
75
+ // but we guard here as an extra safety net.
76
+ if (!communityLoading && !communityData?.isJoined) return null;
64
77
  return (
65
78
  <TouchableOpacity
66
79
  key={storyTarget.targetId}
@@ -24,9 +24,11 @@ const StoryTargetView: FC<IStorytargetView> = ({
24
24
  setViewStory,
25
25
  onClose,
26
26
  }) => {
27
- const cube = useRef<CubeNavigationHorizontal | AndroidCubeEffect>();
27
+ const cube = useRef<CubeNavigationHorizontal | AndroidCubeEffect | null>(
28
+ null
29
+ );
28
30
  const communityId = globalStoryTargets[currentCommunityIndex].targetId;
29
- const hasStoryPermission = useStoryPermission(communityId);
31
+ const { hasStoryPermission } = useStoryPermission(communityId);
30
32
 
31
33
  const navigation =
32
34
  useNavigation() as NativeStackNavigationProp<RootStackParamList>;
@@ -18,7 +18,7 @@ import { useStyles } from './styles';
18
18
  import { getCommunityById } from '../../../providers/Social/communities-sdk';
19
19
  import { useNavigation } from '@react-navigation/native';
20
20
  import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
21
- import { useIsCommunityModerator } from '../../hook';
21
+ import { isModerator, useUser } from '../../hook';
22
22
  import {
23
23
  deletePostById,
24
24
  reportTargetById,
@@ -69,11 +69,7 @@ export function PostMenu({ pageId, componentId, post }: PostMenuProps) {
69
69
  const { postId, targetType, targetId } = post ?? {};
70
70
 
71
71
  const myId = (client as Amity.Client).userId;
72
-
73
- const { isCommunityModerator: isIAmModerator } = useIsCommunityModerator({
74
- communityId: targetType === 'community' && targetId,
75
- userId: myId,
76
- });
72
+ const currentUser = useUser(myId);
77
73
 
78
74
  useEffect(() => {
79
75
  if (targetType === 'community' && targetId) {
@@ -254,7 +250,8 @@ export function PostMenu({ pageId, componentId, post }: PostMenuProps) {
254
250
  },
255
251
  ],
256
252
  },
257
- (post?.creator?.userId === myId || isIAmModerator) &&
253
+ (post?.creator?.userId === myId ||
254
+ isModerator(currentUser?.roles)) &&
258
255
  ((childrenPost?.dataType !== 'room' &&
259
256
  childrenPost?.dataType !== 'poll') ||
260
257
  (childrenPost?.dataType === 'poll' &&
@@ -312,7 +309,8 @@ export function PostMenu({ pageId, componentId, post }: PostMenuProps) {
312
309
  </Typography.BodyBold>
313
310
  </TouchableOpacity>
314
311
  )}
315
- {(post?.creator?.userId === myId || isIAmModerator) && (
312
+ {(post?.creator?.userId === myId ||
313
+ isModerator(currentUser?.roles)) && (
316
314
  <TouchableOpacity style={styles.menuItem} onPress={onDeletePost}>
317
315
  <SvgXml
318
316
  width="24"
@@ -88,8 +88,8 @@ const RenderTextWithMention: React.FC<IrenderTextWithMention> = ({
88
88
  }
89
89
 
90
90
  let currentPosition = 0;
91
- const result: (string | JSX.Element)[][] = heightlightTextPositions.map(
92
- ({ index, length, userId, link }, i) => {
91
+ const result: (string | React.ReactElement)[][] =
92
+ heightlightTextPositions.map(({ index, length, userId, link }, i) => {
93
93
  // Add non-highlighted text before the mention
94
94
  const nonHighlightedText = textPost.slice(currentPosition, index);
95
95
  // Add highlighted text
@@ -109,8 +109,7 @@ const RenderTextWithMention: React.FC<IrenderTextWithMention> = ({
109
109
 
110
110
  // Return an array of non-highlighted and highlighted text
111
111
  return [nonHighlightedText, highlightedText];
112
- }
113
- );
112
+ });
114
113
 
115
114
  // Add any remaining non-highlighted text after the mentions
116
115
  const remainingText = textPost.slice(currentPosition);
@@ -22,7 +22,9 @@ export const Story = ({
22
22
  const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
23
23
  const [currentPage, setCurrentPage] = useState<number>(0);
24
24
  const [selectedData, setSelectedData] = useState<IUserStory[]>([]);
25
- const cube = useRef<CubeNavigationHorizontal | AndroidCubeEffect>();
25
+ const cube = useRef<CubeNavigationHorizontal | AndroidCubeEffect | null>(
26
+ null
27
+ );
26
28
  // Component Functions
27
29
  const _handleStoryItemPress = (item: IUserStory, index?: number) => {
28
30
  if (item?.stories?.length === 0) return;
@@ -25,7 +25,7 @@ const StoryCircleListItem = ({
25
25
  const styles = useStyles();
26
26
  const [, setIsPressed] = useState(item?.seen);
27
27
  const prevSeen = usePrevious(item?.seen);
28
- const hasStoryPermission = useStoryPermission(item.user_id);
28
+ const { hasStoryPermission } = useStoryPermission(item.user_id);
29
29
  const { getUiKitConfig } = useConfig();
30
30
  const storyRingColor: string[] = item?.seen
31
31
  ? ['#e2e2e2', '#e2e2e2']
@@ -61,7 +61,7 @@ export const StoryListItem = ({
61
61
  isModerator,
62
62
  }: StoryListItemProps) => {
63
63
  const styles = useStyles();
64
- const hasStoryPermission = useStoryPermission(userId);
64
+ const { hasStoryPermission } = useStoryPermission(userId);
65
65
  const { getUiKitConfig } = useConfig();
66
66
  const storyReactionBgColor =
67
67
  (getUiKitConfig({
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useRef } from 'react';
2
2
 
3
- export function usePrevious(value: any) {
4
- const ref = useRef();
3
+ export function usePrevious<T>(value: T): T | undefined {
4
+ const ref = useRef<T | undefined>(undefined);
5
5
  useEffect(() => {
6
6
  ref.current = value;
7
7
  });
@@ -16,7 +16,7 @@ const ChangeThumbnailButton = ({
16
16
  pageId = PageID.WildCardPage,
17
17
  componentId = ComponentID.WildCardComponent,
18
18
  ...props
19
- }: ChangeThumbnailButtonProps): JSX.Element => {
19
+ }: ChangeThumbnailButtonProps): React.ReactElement => {
20
20
  const { themeStyles, config } = useAmityElement({
21
21
  pageId,
22
22
  componentId,
@@ -16,7 +16,7 @@ const ChangeThumbnailButton = ({
16
16
  pageId = PageID.WildCardPage,
17
17
  componentId = ComponentID.WildCardComponent,
18
18
  ...props
19
- }: ChangeThumbnailButtonProps): JSX.Element => {
19
+ }: ChangeThumbnailButtonProps): React.ReactElement => {
20
20
  const { themeStyles, config } = useAmityElement({
21
21
  pageId,
22
22
  componentId,
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import { TouchableOpacityProps } from 'react-native';
2
+ import { TextProps } from 'react-native';
3
3
  import { useAmityElement } from '../../../../../../v4/hook';
4
4
  import { ComponentID, ElementID, PageID } from '../../../../../../v4/enum';
5
5
  import { useStyles } from './styles';
6
6
  import { Typography } from '../../../../../../v4/component/Typography/Typography';
7
7
 
8
- type CloseCommunityDescriptionProps = TouchableOpacityProps & {
8
+ type CloseCommunityDescriptionProps = TextProps & {
9
9
  pageId?: PageID;
10
10
  componentId?: ComponentID;
11
11
  elementId?: ElementID;
@@ -14,7 +14,7 @@ export * from './useCommunities';
14
14
  export * from './useCommunity';
15
15
  export * from './useCategory';
16
16
  export * from './useUiKitReference';
17
- export * from './useIsCommunityModerator';
17
+ export * from './isModerator';
18
18
  export * from './useSearch';
19
19
  export * from './useTimeDifference';
20
20
  export * from './useReaction';
@@ -0,0 +1,19 @@
1
+ import { MemberRoles } from '../constants';
2
+
3
+ const { COMMUNITY_MODERATOR, CHANNEL_MODERATOR, MODERATOR, SUPER_MODERATOR } =
4
+ MemberRoles;
5
+
6
+ export const isModerator = (userRoles?: string[]) => {
7
+ if (!userRoles?.length) {
8
+ return false;
9
+ }
10
+
11
+ const roles: string[] = [
12
+ COMMUNITY_MODERATOR,
13
+ CHANNEL_MODERATOR,
14
+ MODERATOR,
15
+ SUPER_MODERATOR,
16
+ ];
17
+
18
+ return userRoles.some((role) => roles.includes(role));
19
+ };
@@ -1,11 +1,7 @@
1
1
  import useAuth from '../../hooks/useAuth';
2
2
  import { useUser } from './useUser';
3
3
  import useSocialSettings from '../core/hooks/useSocialSettings';
4
- import {
5
- isAdmin,
6
- isModerator,
7
- checkStoryPermission,
8
- } from '../utils/permissions';
4
+ import { checkStoryPermission, isAdmin } from '../utils/permissions';
9
5
 
10
6
  export function useStoryPermission(communityId?: string) {
11
7
  const { client } = useAuth();
@@ -13,14 +9,12 @@ export function useStoryPermission(communityId?: string) {
13
9
  const user = useUser(client?.userId || '');
14
10
 
15
11
  const isGlobalAdmin = isAdmin(user?.roles);
16
- const isModeratorUser = isModerator(user?.roles);
17
12
 
18
13
  const hasStoryPermission = !communityId
19
14
  ? socialSettings?.story?.allowAllUserToCreateStory
20
15
  : socialSettings?.story?.allowAllUserToCreateStory ||
21
16
  isGlobalAdmin ||
22
- isModeratorUser ||
23
17
  checkStoryPermission(client, communityId);
24
18
 
25
- return hasStoryPermission;
19
+ return { hasStoryPermission };
26
20
  }