@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.
- package/lib/commonjs/components/CustomText/index.js +3 -4
- package/lib/commonjs/components/CustomText/index.js.map +1 -1
- package/lib/commonjs/components/Social/PostList/Components/RenderTextWithMention.js.map +1 -1
- package/lib/commonjs/components/StoryKit/src/Story.js +1 -1
- package/lib/commonjs/components/StoryKit/src/Story.js.map +1 -1
- package/lib/commonjs/components/StoryKit/src/helpers/StateHelpers.js +1 -1
- package/lib/commonjs/components/StoryKit/src/helpers/StateHelpers.js.map +1 -1
- package/lib/commonjs/redux/slices/bottomSheetSlice.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Components/AmityCommunityHeaderComponent/AmityCommunityHeaderComponent.js +3 -6
- package/lib/commonjs/v4/PublicApi/Components/AmityCommunityHeaderComponent/AmityCommunityHeaderComponent.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js +3 -1
- package/lib/commonjs/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Components/AmityPendingPostListComponent/AmityPendingPostListComponent.js +2 -6
- package/lib/commonjs/v4/PublicApi/Components/AmityPendingPostListComponent/AmityPendingPostListComponent.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.js +3 -6
- package/lib/commonjs/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Components/AmityThumbnailActionComponent/AmityThumbnailActionComponent.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Elements/ModeratorBadgeElement/ModeratorBadgeElement.js +3 -7
- package/lib/commonjs/v4/PublicApi/Elements/ModeratorBadgeElement/ModeratorBadgeElement.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js +3 -1
- package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js +3 -6
- package/lib/commonjs/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Pages/AmityViewStoryPage/AmityViewStoryPage.js +3 -1
- package/lib/commonjs/v4/PublicApi/Pages/AmityViewStoryPage/AmityViewStoryPage.js.map +1 -1
- package/lib/commonjs/v4/component/CommunityStories/index.js +4 -1
- package/lib/commonjs/v4/component/CommunityStories/index.js.map +1 -1
- package/lib/commonjs/v4/component/MyStories/StoryCircleItem.js +19 -4
- package/lib/commonjs/v4/component/MyStories/StoryCircleItem.js.map +1 -1
- package/lib/commonjs/v4/component/MyStories/StoryTargetView.js +4 -2
- package/lib/commonjs/v4/component/MyStories/StoryTargetView.js.map +1 -1
- package/lib/commonjs/v4/component/PostMenu/index.js +3 -8
- package/lib/commonjs/v4/component/PostMenu/index.js.map +1 -1
- package/lib/commonjs/v4/component/RenderTextWithMention/RenderTextWithMention.js.map +1 -1
- package/lib/commonjs/v4/component/StoryKit/src/Story.js +1 -1
- package/lib/commonjs/v4/component/StoryKit/src/Story.js.map +1 -1
- package/lib/commonjs/v4/component/StoryKit/src/StoryCircleListItem.js +3 -1
- package/lib/commonjs/v4/component/StoryKit/src/StoryCircleListItem.js.map +1 -1
- package/lib/commonjs/v4/component/StoryKit/src/StoryListItem.js +3 -1
- package/lib/commonjs/v4/component/StoryKit/src/StoryListItem.js.map +1 -1
- package/lib/commonjs/v4/component/StoryKit/src/helpers/StateHelpers.js +1 -1
- package/lib/commonjs/v4/component/StoryKit/src/helpers/StateHelpers.js.map +1 -1
- package/lib/commonjs/v4/elements/ChangeThumbnailButton/ChangeThumbnailButton.js.map +1 -1
- package/lib/commonjs/v4/elements/DeleteThumbnailButton/DeleteThumbnailButton.js.map +1 -1
- package/lib/commonjs/v4/hook/index.js +4 -4
- package/lib/commonjs/v4/hook/index.js.map +1 -1
- package/lib/commonjs/v4/hook/isModerator.js +22 -0
- package/lib/commonjs/v4/hook/isModerator.js.map +1 -0
- package/lib/commonjs/v4/hook/useStoryPermission.js +4 -3
- package/lib/commonjs/v4/hook/useStoryPermission.js.map +1 -1
- package/lib/commonjs/v4/utils/permissions.js +8 -3
- package/lib/commonjs/v4/utils/permissions.js.map +1 -1
- package/lib/module/components/CustomText/index.js +3 -4
- package/lib/module/components/CustomText/index.js.map +1 -1
- package/lib/module/components/Social/PostList/Components/RenderTextWithMention.js.map +1 -1
- package/lib/module/components/StoryKit/src/Story.js +1 -1
- package/lib/module/components/StoryKit/src/Story.js.map +1 -1
- package/lib/module/components/StoryKit/src/helpers/StateHelpers.js +1 -1
- package/lib/module/components/StoryKit/src/helpers/StateHelpers.js.map +1 -1
- package/lib/module/redux/slices/bottomSheetSlice.js.map +1 -1
- package/lib/module/v4/PublicApi/Components/AmityCommunityHeaderComponent/AmityCommunityHeaderComponent.js +4 -7
- package/lib/module/v4/PublicApi/Components/AmityCommunityHeaderComponent/AmityCommunityHeaderComponent.js.map +1 -1
- package/lib/module/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js +3 -1
- package/lib/module/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js.map +1 -1
- package/lib/module/v4/PublicApi/Components/AmityPendingPostListComponent/AmityPendingPostListComponent.js +3 -7
- package/lib/module/v4/PublicApi/Components/AmityPendingPostListComponent/AmityPendingPostListComponent.js.map +1 -1
- package/lib/module/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.js +4 -7
- package/lib/module/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.js.map +1 -1
- package/lib/module/v4/PublicApi/Components/AmityThumbnailActionComponent/AmityThumbnailActionComponent.js.map +1 -1
- package/lib/module/v4/PublicApi/Elements/ModeratorBadgeElement/ModeratorBadgeElement.js +4 -9
- package/lib/module/v4/PublicApi/Elements/ModeratorBadgeElement/ModeratorBadgeElement.js.map +1 -1
- package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js +3 -1
- package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js.map +1 -1
- package/lib/module/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js +4 -7
- package/lib/module/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js.map +1 -1
- package/lib/module/v4/PublicApi/Pages/AmityViewStoryPage/AmityViewStoryPage.js +3 -1
- package/lib/module/v4/PublicApi/Pages/AmityViewStoryPage/AmityViewStoryPage.js.map +1 -1
- package/lib/module/v4/component/CommunityStories/index.js +4 -1
- package/lib/module/v4/component/CommunityStories/index.js.map +1 -1
- package/lib/module/v4/component/MyStories/StoryCircleItem.js +19 -4
- package/lib/module/v4/component/MyStories/StoryCircleItem.js.map +1 -1
- package/lib/module/v4/component/MyStories/StoryTargetView.js +4 -2
- package/lib/module/v4/component/MyStories/StoryTargetView.js.map +1 -1
- package/lib/module/v4/component/PostMenu/index.js +4 -9
- package/lib/module/v4/component/PostMenu/index.js.map +1 -1
- package/lib/module/v4/component/RenderTextWithMention/RenderTextWithMention.js.map +1 -1
- package/lib/module/v4/component/StoryKit/src/Story.js +1 -1
- package/lib/module/v4/component/StoryKit/src/Story.js.map +1 -1
- package/lib/module/v4/component/StoryKit/src/StoryCircleListItem.js +3 -1
- package/lib/module/v4/component/StoryKit/src/StoryCircleListItem.js.map +1 -1
- package/lib/module/v4/component/StoryKit/src/StoryListItem.js +3 -1
- package/lib/module/v4/component/StoryKit/src/StoryListItem.js.map +1 -1
- package/lib/module/v4/component/StoryKit/src/helpers/StateHelpers.js +1 -1
- package/lib/module/v4/component/StoryKit/src/helpers/StateHelpers.js.map +1 -1
- package/lib/module/v4/elements/ChangeThumbnailButton/ChangeThumbnailButton.js.map +1 -1
- package/lib/module/v4/elements/DeleteThumbnailButton/DeleteThumbnailButton.js.map +1 -1
- package/lib/module/v4/hook/index.js +1 -1
- package/lib/module/v4/hook/index.js.map +1 -1
- package/lib/module/v4/hook/isModerator.js +15 -0
- package/lib/module/v4/hook/isModerator.js.map +1 -0
- package/lib/module/v4/hook/useStoryPermission.js +5 -4
- package/lib/module/v4/hook/useStoryPermission.js.map +1 -1
- package/lib/module/v4/utils/permissions.js +8 -3
- package/lib/module/v4/utils/permissions.js.map +1 -1
- package/lib/typescript/src/components/CustomText/index.d.ts.map +1 -1
- package/lib/typescript/src/components/StoryKit/src/Story.d.ts.map +1 -1
- package/lib/typescript/src/components/StoryKit/src/helpers/StateHelpers.d.ts +1 -1
- package/lib/typescript/src/components/StoryKit/src/helpers/StateHelpers.d.ts.map +1 -1
- package/lib/typescript/src/redux/slices/bottomSheetSlice.d.ts +4 -3
- package/lib/typescript/src/redux/slices/bottomSheetSlice.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Components/AmityCommunityHeaderComponent/AmityCommunityHeaderComponent.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.d.ts +1 -1
- package/lib/typescript/src/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Components/AmityPendingPostListComponent/AmityPendingPostListComponent.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Components/AmityPostCommentComponent/AmityPostCommentComponent.d.ts +1 -1
- package/lib/typescript/src/v4/PublicApi/Components/AmityPostCommentComponent/AmityPostCommentComponent.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Components/AmityThumbnailActionComponent/AmityThumbnailActionComponent.d.ts +2 -1
- package/lib/typescript/src/v4/PublicApi/Components/AmityThumbnailActionComponent/AmityThumbnailActionComponent.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Elements/ModeratorBadgeElement/ModeratorBadgeElement.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/CommunityStories/index.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/MyStories/StoryCircleItem.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/MyStories/StoryTargetView.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/PostMenu/index.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/RenderTextWithMention/RenderTextWithMention.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/StoryKit/src/Story.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/StoryKit/src/helpers/StateHelpers.d.ts +1 -1
- package/lib/typescript/src/v4/component/StoryKit/src/helpers/StateHelpers.d.ts.map +1 -1
- package/lib/typescript/src/v4/elements/ChangeThumbnailButton/ChangeThumbnailButton.d.ts +2 -1
- package/lib/typescript/src/v4/elements/ChangeThumbnailButton/ChangeThumbnailButton.d.ts.map +1 -1
- package/lib/typescript/src/v4/elements/DeleteThumbnailButton/DeleteThumbnailButton.d.ts +2 -1
- package/lib/typescript/src/v4/elements/DeleteThumbnailButton/DeleteThumbnailButton.d.ts.map +1 -1
- package/lib/typescript/src/v4/features/community/Setting/elements/CloseCommunityDescription/CloseCommunityDescription.d.ts +2 -2
- package/lib/typescript/src/v4/features/community/Setting/elements/CloseCommunityDescription/CloseCommunityDescription.d.ts.map +1 -1
- package/lib/typescript/src/v4/hook/index.d.ts +1 -1
- package/lib/typescript/src/v4/hook/index.d.ts.map +1 -1
- package/lib/typescript/src/v4/hook/isModerator.d.ts +2 -0
- package/lib/typescript/src/v4/hook/isModerator.d.ts.map +1 -0
- package/lib/typescript/src/v4/hook/useStoryPermission.d.ts +3 -1
- package/lib/typescript/src/v4/hook/useStoryPermission.d.ts.map +1 -1
- package/lib/typescript/src/v4/utils/permissions.d.ts +1 -1
- package/lib/typescript/src/v4/utils/permissions.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/CustomText/index.tsx +6 -5
- package/src/components/Social/PostList/Components/RenderTextWithMention.tsx +1 -1
- package/src/components/StoryKit/src/Story.tsx +3 -1
- package/src/components/StoryKit/src/helpers/StateHelpers.ts +2 -2
- package/src/redux/slices/bottomSheetSlice.ts +3 -2
- package/src/v4/PublicApi/Components/AmityCommunityHeaderComponent/AmityCommunityHeaderComponent.tsx +4 -9
- package/src/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.tsx +2 -2
- package/src/v4/PublicApi/Components/AmityPendingPostListComponent/AmityPendingPostListComponent.tsx +3 -5
- package/src/v4/PublicApi/Components/AmityPostCommentComponent/AmityPostCommentComponent.tsx +1 -1
- package/src/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.tsx +4 -5
- package/src/v4/PublicApi/Components/AmityThumbnailActionComponent/AmityThumbnailActionComponent.tsx +1 -1
- package/src/v4/PublicApi/Elements/ModeratorBadgeElement/ModeratorBadgeElement.tsx +4 -7
- package/src/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.tsx +1 -1
- package/src/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.tsx +4 -5
- package/src/v4/PublicApi/Pages/AmityViewStoryPage/AmityViewStoryPage.tsx +1 -1
- package/src/v4/component/CommunityStories/index.tsx +3 -1
- package/src/v4/component/MyStories/StoryCircleItem.tsx +17 -4
- package/src/v4/component/MyStories/StoryTargetView.tsx +4 -2
- package/src/v4/component/PostMenu/index.tsx +6 -8
- package/src/v4/component/RenderTextWithMention/RenderTextWithMention.tsx +3 -4
- package/src/v4/component/StoryKit/src/Story.tsx +3 -1
- package/src/v4/component/StoryKit/src/StoryCircleListItem.tsx +1 -1
- package/src/v4/component/StoryKit/src/StoryListItem.tsx +1 -1
- package/src/v4/component/StoryKit/src/helpers/StateHelpers.ts +2 -2
- package/src/v4/elements/ChangeThumbnailButton/ChangeThumbnailButton.tsx +1 -1
- package/src/v4/elements/DeleteThumbnailButton/DeleteThumbnailButton.tsx +1 -1
- package/src/v4/features/community/Setting/elements/CloseCommunityDescription/CloseCommunityDescription.tsx +2 -2
- package/src/v4/hook/index.ts +1 -1
- package/src/v4/hook/isModerator.ts +19 -0
- package/src/v4/hook/useStoryPermission.ts +2 -8
- package/src/v4/utils/permissions.ts +13 -8
- package/lib/commonjs/v4/hook/useIsCommunityModerator.js +0 -43
- package/lib/commonjs/v4/hook/useIsCommunityModerator.js.map +0 -1
- package/lib/module/v4/hook/useIsCommunityModerator.js +0 -36
- package/lib/module/v4/hook/useIsCommunityModerator.js.map +0 -1
- package/lib/typescript/src/v4/hook/useIsCommunityModerator.d.ts +0 -7
- package/lib/typescript/src/v4/hook/useIsCommunityModerator.d.ts.map +0 -1
- 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 './
|
|
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,
|
|
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 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStoryPermission.d.ts","sourceRoot":"","sources":["../../../../../src/v4/hook/useStoryPermission.ts"],"names":[],"mappings":"
|
|
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
|
|
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,
|
|
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
|
@@ -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
|
-
|
|
14
|
-
|
|
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 |
|
|
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:
|
|
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:
|
|
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:
|
|
15
|
+
content: ReactElement;
|
|
15
16
|
height?: number;
|
|
16
17
|
};
|
|
17
18
|
|
package/src/v4/PublicApi/Components/AmityCommunityHeaderComponent/AmityCommunityHeaderComponent.tsx
CHANGED
|
@@ -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
|
-
|
|
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
|
|
65
|
-
|
|
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
|
|
package/src/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.tsx
CHANGED
|
@@ -18,13 +18,13 @@ interface AmityCreatePostMenuComponentProps {
|
|
|
18
18
|
const AmityCreatePostMenuComponent = ({
|
|
19
19
|
pageId = PageID.WildCardPage,
|
|
20
20
|
componentId = ComponentID.WildCardComponent,
|
|
21
|
-
}: AmityCreatePostMenuComponentProps):
|
|
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: {
|
package/src/v4/PublicApi/Components/AmityPendingPostListComponent/AmityPendingPostListComponent.tsx
CHANGED
|
@@ -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 {
|
|
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
|
|
52
|
-
|
|
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?:
|
|
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,
|
|
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
|
|
97
|
-
|
|
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) {
|
package/src/v4/PublicApi/Components/AmityThumbnailActionComponent/AmityThumbnailActionComponent.tsx
CHANGED
|
@@ -16,7 +16,7 @@ const AmityThumbnailActionComponent = ({
|
|
|
16
16
|
onChangeThumbnail,
|
|
17
17
|
onDeleteThumbnail,
|
|
18
18
|
pageId = PageID.WildCardPage,
|
|
19
|
-
}: AmityThumbnailActionComponentProps):
|
|
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 {
|
|
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
|
|
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 (!
|
|
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
|
|
92
|
-
|
|
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
|
|
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)
|
|
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 {
|
|
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 ||
|
|
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 ||
|
|
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 |
|
|
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:
|
|
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):
|
|
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):
|
|
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 {
|
|
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 =
|
|
8
|
+
type CloseCommunityDescriptionProps = TextProps & {
|
|
9
9
|
pageId?: PageID;
|
|
10
10
|
componentId?: ComponentID;
|
|
11
11
|
elementId?: ElementID;
|
package/src/v4/hook/index.ts
CHANGED
|
@@ -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 './
|
|
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
|
}
|