@amityco/react-native-social-uikit 4.0.0 → 4.0.1-324acbfd.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/lib/commonjs/core/assets/icons/index.js +8 -0
- package/lib/commonjs/core/assets/icons/index.js.map +1 -1
- package/lib/commonjs/core/assets/icons/visitorLimit.js +30 -0
- package/lib/commonjs/core/assets/icons/visitorLimit.js.map +1 -0
- package/lib/commonjs/core/constants/index.js +11 -1
- package/lib/commonjs/core/constants/index.js.map +1 -1
- package/lib/commonjs/core/hooks/useAuth.js +6 -2
- package/lib/commonjs/core/hooks/useAuth.js.map +1 -1
- package/lib/commonjs/core/providers/AmityUIKitProvider.js.map +1 -1
- package/lib/commonjs/core/providers/AuthProvider.js +46 -16
- package/lib/commonjs/core/providers/AuthProvider.js.map +1 -1
- package/lib/commonjs/core/routes/AmityPageRenderer.js +5 -1
- package/lib/commonjs/core/routes/AmityPageRenderer.js.map +1 -1
- package/lib/commonjs/core/routes/AmityUIKitNavigator.js +42 -1
- package/lib/commonjs/core/routes/AmityUIKitNavigator.js.map +1 -1
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/social/components/Social/CommentList/CommentList.js +7 -1
- package/lib/commonjs/social/components/Social/CommentList/CommentList.js.map +1 -1
- package/lib/commonjs/social/components/Social/CommentListItem/CommentListItem.js +16 -3
- package/lib/commonjs/social/components/Social/CommentListItem/CommentListItem.js.map +1 -1
- package/lib/commonjs/social/components/legacy/Social/ReplyCommentList/index.js +12 -2
- package/lib/commonjs/social/components/legacy/Social/ReplyCommentList/index.js.map +1 -1
- package/lib/commonjs/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.js +6 -1
- package/lib/commonjs/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.js.map +1 -1
- package/lib/commonjs/social/enums/enumUIKitID.js +2 -0
- package/lib/commonjs/social/enums/enumUIKitID.js.map +1 -1
- package/lib/commonjs/social/features/comment/components/PostComment/CommentListItem/CommentListItem.js +15 -3
- package/lib/commonjs/social/features/comment/components/PostComment/CommentListItem/CommentListItem.js.map +1 -1
- package/lib/commonjs/social/features/comment/components/PostComment/ReplyCommentList/index.js +12 -2
- package/lib/commonjs/social/features/comment/components/PostComment/ReplyCommentList/index.js.map +1 -1
- package/lib/commonjs/social/features/feed/components/TopNavigation/TopNavigation.js +5 -1
- package/lib/commonjs/social/features/feed/components/TopNavigation/TopNavigation.js.map +1 -1
- package/lib/commonjs/social/features/post/Detail/index.js +8 -2
- package/lib/commonjs/social/features/post/Detail/index.js.map +1 -1
- package/lib/commonjs/social/features/post/components/Content/Content.js +5 -1
- package/lib/commonjs/social/features/post/components/Content/Content.js.map +1 -1
- package/lib/commonjs/social/features/post/components/EngagementActions/Components/DetailStyle.js +9 -1
- package/lib/commonjs/social/features/post/components/EngagementActions/Components/DetailStyle.js.map +1 -1
- package/lib/commonjs/social/features/post/components/EngagementActions/Components/FeedStyle.js +9 -1
- package/lib/commonjs/social/features/post/components/EngagementActions/Components/FeedStyle.js.map +1 -1
- package/lib/commonjs/social/features/user/CreateProfile/CreateProfile.js +114 -0
- package/lib/commonjs/social/features/user/CreateProfile/CreateProfile.js.map +1 -0
- package/lib/commonjs/social/features/user/CreateProfile/components/ImageUpload/ImageUpload.js +78 -0
- package/lib/commonjs/social/features/user/CreateProfile/components/ImageUpload/ImageUpload.js.map +1 -0
- package/lib/commonjs/social/features/user/CreateProfile/components/ImageUpload/index.js +13 -0
- package/lib/commonjs/social/features/user/CreateProfile/components/ImageUpload/index.js.map +1 -0
- package/lib/commonjs/social/features/user/CreateProfile/components/ImageUpload/styles.js +51 -0
- package/lib/commonjs/social/features/user/CreateProfile/components/ImageUpload/styles.js.map +1 -0
- package/lib/commonjs/social/features/user/CreateProfile/components/TopBar/TopBar.js +34 -0
- package/lib/commonjs/social/features/user/CreateProfile/components/TopBar/TopBar.js.map +1 -0
- package/lib/commonjs/social/features/user/CreateProfile/components/TopBar/index.js +13 -0
- package/lib/commonjs/social/features/user/CreateProfile/components/TopBar/index.js.map +1 -0
- package/lib/commonjs/social/features/user/CreateProfile/components/TopBar/styles.js +37 -0
- package/lib/commonjs/social/features/user/CreateProfile/components/TopBar/styles.js.map +1 -0
- package/lib/commonjs/social/features/user/CreateProfile/components/index.js +28 -0
- package/lib/commonjs/social/features/user/CreateProfile/components/index.js.map +1 -0
- package/lib/commonjs/social/features/user/CreateProfile/hooks/index.js +17 -0
- package/lib/commonjs/social/features/user/CreateProfile/hooks/index.js.map +1 -0
- package/lib/commonjs/social/features/user/CreateProfile/hooks/useCreateProfile.js +194 -0
- package/lib/commonjs/social/features/user/CreateProfile/hooks/useCreateProfile.js.map +1 -0
- package/lib/commonjs/social/features/user/CreateProfile/index.js +13 -0
- package/lib/commonjs/social/features/user/CreateProfile/index.js.map +1 -0
- package/lib/commonjs/social/features/user/CreateProfile/styles.js +40 -0
- package/lib/commonjs/social/features/user/CreateProfile/styles.js.map +1 -0
- package/lib/commonjs/social/features/user/Profile/components/Header/hooks/useHeader.js +6 -1
- package/lib/commonjs/social/features/user/Profile/components/Header/hooks/useHeader.js.map +1 -1
- package/lib/commonjs/social/hooks/index.js +11 -0
- package/lib/commonjs/social/hooks/index.js.map +1 -1
- package/lib/commonjs/social/hooks/useGlobalBehavior.js +53 -0
- package/lib/commonjs/social/hooks/useGlobalBehavior.js.map +1 -0
- package/lib/commonjs/social/hooks/usePostPermission.js +4 -2
- package/lib/commonjs/social/hooks/usePostPermission.js.map +1 -1
- package/lib/commonjs/social/hooks/useStoryPermission.js +3 -2
- package/lib/commonjs/social/hooks/useStoryPermission.js.map +1 -1
- package/lib/commonjs/social/index.js +13 -0
- package/lib/commonjs/social/index.js.map +1 -1
- package/lib/commonjs/social/providers/BehaviourProvider.js +1 -0
- package/lib/commonjs/social/providers/BehaviourProvider.js.map +1 -1
- package/lib/commonjs/social/screens/CreateUserProfile/CreateUserProfile.js +20 -0
- package/lib/commonjs/social/screens/CreateUserProfile/CreateUserProfile.js.map +1 -0
- package/lib/commonjs/social/screens/CreateUserProfile/index.js +13 -0
- package/lib/commonjs/social/screens/CreateUserProfile/index.js.map +1 -0
- package/lib/commonjs/social/screens/SocialHomePage/index.js +22 -7
- package/lib/commonjs/social/screens/SocialHomePage/index.js.map +1 -1
- package/lib/commonjs/social/screens/VisitorUsageLimit/VisitorUsageLimit.js +78 -0
- package/lib/commonjs/social/screens/VisitorUsageLimit/VisitorUsageLimit.js.map +1 -0
- package/lib/commonjs/social/screens/VisitorUsageLimit/index.js +13 -0
- package/lib/commonjs/social/screens/VisitorUsageLimit/index.js.map +1 -0
- package/lib/commonjs/social/screens/VisitorUsageLimit/styles.js +50 -0
- package/lib/commonjs/social/screens/VisitorUsageLimit/styles.js.map +1 -0
- package/lib/commonjs/social/screens/index.js +11 -0
- package/lib/commonjs/social/screens/index.js.map +1 -1
- package/lib/module/core/assets/icons/index.js +1 -0
- package/lib/module/core/assets/icons/index.js.map +1 -1
- package/lib/module/core/assets/icons/visitorLimit.js +23 -0
- package/lib/module/core/assets/icons/visitorLimit.js.map +1 -0
- package/lib/module/core/constants/index.js +10 -0
- package/lib/module/core/constants/index.js.map +1 -1
- package/lib/module/core/hooks/useAuth.js +6 -2
- package/lib/module/core/hooks/useAuth.js.map +1 -1
- package/lib/module/core/providers/AmityUIKitProvider.js.map +1 -1
- package/lib/module/core/providers/AuthProvider.js +46 -16
- package/lib/module/core/providers/AuthProvider.js.map +1 -1
- package/lib/module/core/routes/AmityPageRenderer.js +5 -1
- package/lib/module/core/routes/AmityPageRenderer.js.map +1 -1
- package/lib/module/core/routes/AmityUIKitNavigator.js +42 -1
- package/lib/module/core/routes/AmityUIKitNavigator.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/social/components/Social/CommentList/CommentList.js +7 -1
- package/lib/module/social/components/Social/CommentList/CommentList.js.map +1 -1
- package/lib/module/social/components/Social/CommentListItem/CommentListItem.js +16 -3
- package/lib/module/social/components/Social/CommentListItem/CommentListItem.js.map +1 -1
- package/lib/module/social/components/legacy/Social/ReplyCommentList/index.js +12 -2
- package/lib/module/social/components/legacy/Social/ReplyCommentList/index.js.map +1 -1
- package/lib/module/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.js +7 -2
- package/lib/module/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.js.map +1 -1
- package/lib/module/social/enums/enumUIKitID.js +2 -0
- package/lib/module/social/enums/enumUIKitID.js.map +1 -1
- package/lib/module/social/features/comment/components/PostComment/CommentListItem/CommentListItem.js +16 -4
- package/lib/module/social/features/comment/components/PostComment/CommentListItem/CommentListItem.js.map +1 -1
- package/lib/module/social/features/comment/components/PostComment/ReplyCommentList/index.js +12 -2
- package/lib/module/social/features/comment/components/PostComment/ReplyCommentList/index.js.map +1 -1
- package/lib/module/social/features/feed/components/TopNavigation/TopNavigation.js +5 -1
- package/lib/module/social/features/feed/components/TopNavigation/TopNavigation.js.map +1 -1
- package/lib/module/social/features/post/Detail/index.js +8 -2
- package/lib/module/social/features/post/Detail/index.js.map +1 -1
- package/lib/module/social/features/post/components/Content/Content.js +5 -1
- package/lib/module/social/features/post/components/Content/Content.js.map +1 -1
- package/lib/module/social/features/post/components/EngagementActions/Components/DetailStyle.js +10 -2
- package/lib/module/social/features/post/components/EngagementActions/Components/DetailStyle.js.map +1 -1
- package/lib/module/social/features/post/components/EngagementActions/Components/FeedStyle.js +10 -2
- package/lib/module/social/features/post/components/EngagementActions/Components/FeedStyle.js.map +1 -1
- package/lib/module/social/features/user/CreateProfile/CreateProfile.js +107 -0
- package/lib/module/social/features/user/CreateProfile/CreateProfile.js.map +1 -0
- package/lib/module/social/features/user/CreateProfile/components/ImageUpload/ImageUpload.js +72 -0
- package/lib/module/social/features/user/CreateProfile/components/ImageUpload/ImageUpload.js.map +1 -0
- package/lib/module/social/features/user/CreateProfile/components/ImageUpload/index.js +2 -0
- package/lib/module/social/features/user/CreateProfile/components/ImageUpload/index.js.map +1 -0
- package/lib/module/social/features/user/CreateProfile/components/ImageUpload/styles.js +44 -0
- package/lib/module/social/features/user/CreateProfile/components/ImageUpload/styles.js.map +1 -0
- package/lib/module/social/features/user/CreateProfile/components/TopBar/TopBar.js +27 -0
- package/lib/module/social/features/user/CreateProfile/components/TopBar/TopBar.js.map +1 -0
- package/lib/module/social/features/user/CreateProfile/components/TopBar/index.js +2 -0
- package/lib/module/social/features/user/CreateProfile/components/TopBar/index.js.map +1 -0
- package/lib/module/social/features/user/CreateProfile/components/TopBar/styles.js +30 -0
- package/lib/module/social/features/user/CreateProfile/components/TopBar/styles.js.map +1 -0
- package/lib/module/social/features/user/CreateProfile/components/index.js +3 -0
- package/lib/module/social/features/user/CreateProfile/components/index.js.map +1 -0
- package/lib/module/social/features/user/CreateProfile/hooks/index.js +2 -0
- package/lib/module/social/features/user/CreateProfile/hooks/index.js.map +1 -0
- package/lib/module/social/features/user/CreateProfile/hooks/useCreateProfile.js +187 -0
- package/lib/module/social/features/user/CreateProfile/hooks/useCreateProfile.js.map +1 -0
- package/lib/module/social/features/user/CreateProfile/index.js +2 -0
- package/lib/module/social/features/user/CreateProfile/index.js.map +1 -0
- package/lib/module/social/features/user/CreateProfile/styles.js +33 -0
- package/lib/module/social/features/user/CreateProfile/styles.js.map +1 -0
- package/lib/module/social/features/user/Profile/components/Header/hooks/useHeader.js +7 -2
- package/lib/module/social/features/user/Profile/components/Header/hooks/useHeader.js.map +1 -1
- package/lib/module/social/hooks/index.js +1 -0
- package/lib/module/social/hooks/index.js.map +1 -1
- package/lib/module/social/hooks/useGlobalBehavior.js +45 -0
- package/lib/module/social/hooks/useGlobalBehavior.js.map +1 -0
- package/lib/module/social/hooks/usePostPermission.js +4 -2
- package/lib/module/social/hooks/usePostPermission.js.map +1 -1
- package/lib/module/social/hooks/useStoryPermission.js +3 -2
- package/lib/module/social/hooks/useStoryPermission.js.map +1 -1
- package/lib/module/social/index.js +2 -1
- package/lib/module/social/index.js.map +1 -1
- package/lib/module/social/providers/BehaviourProvider.js +1 -0
- package/lib/module/social/providers/BehaviourProvider.js.map +1 -1
- package/lib/module/social/screens/CreateUserProfile/CreateUserProfile.js +14 -0
- package/lib/module/social/screens/CreateUserProfile/CreateUserProfile.js.map +1 -0
- package/lib/module/social/screens/CreateUserProfile/index.js +2 -0
- package/lib/module/social/screens/CreateUserProfile/index.js.map +1 -0
- package/lib/module/social/screens/SocialHomePage/index.js +23 -8
- package/lib/module/social/screens/SocialHomePage/index.js.map +1 -1
- package/lib/module/social/screens/VisitorUsageLimit/VisitorUsageLimit.js +72 -0
- package/lib/module/social/screens/VisitorUsageLimit/VisitorUsageLimit.js.map +1 -0
- package/lib/module/social/screens/VisitorUsageLimit/index.js +2 -0
- package/lib/module/social/screens/VisitorUsageLimit/index.js.map +1 -0
- package/lib/module/social/screens/VisitorUsageLimit/styles.js +43 -0
- package/lib/module/social/screens/VisitorUsageLimit/styles.js.map +1 -0
- package/lib/module/social/screens/index.js +1 -0
- package/lib/module/social/screens/index.js.map +1 -1
- package/lib/typescript/core/assets/icons/index.d.ts +1 -0
- package/lib/typescript/core/assets/icons/index.d.ts.map +1 -1
- package/lib/typescript/core/assets/icons/visitorLimit.d.ts +3 -0
- package/lib/typescript/core/assets/icons/visitorLimit.d.ts.map +1 -0
- package/lib/typescript/core/constants/index.d.ts +8 -0
- package/lib/typescript/core/constants/index.d.ts.map +1 -1
- package/lib/typescript/core/hooks/useAuth.d.ts.map +1 -1
- package/lib/typescript/core/providers/AmityUIKitProvider.d.ts +2 -1
- package/lib/typescript/core/providers/AmityUIKitProvider.d.ts.map +1 -1
- package/lib/typescript/core/providers/AuthProvider.d.ts.map +1 -1
- package/lib/typescript/core/routes/AmityPageRenderer.d.ts.map +1 -1
- package/lib/typescript/core/routes/AmityUIKitNavigator.d.ts.map +1 -1
- package/lib/typescript/core/routes/RouteParamList.d.ts +1 -0
- package/lib/typescript/core/routes/RouteParamList.d.ts.map +1 -1
- package/lib/typescript/core/types/auth.d.ts +2 -0
- package/lib/typescript/core/types/auth.d.ts.map +1 -1
- package/lib/typescript/core/types/behaviour.d.ts +18 -0
- package/lib/typescript/core/types/behaviour.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/social/components/Social/CommentList/CommentList.d.ts.map +1 -1
- package/lib/typescript/social/components/Social/CommentListItem/CommentListItem.d.ts.map +1 -1
- package/lib/typescript/social/components/legacy/Social/ReplyCommentList/index.d.ts.map +1 -1
- package/lib/typescript/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.d.ts.map +1 -1
- package/lib/typescript/social/enums/enumUIKitID.d.ts +2 -0
- package/lib/typescript/social/enums/enumUIKitID.d.ts.map +1 -1
- package/lib/typescript/social/features/comment/components/PostComment/CommentListItem/CommentListItem.d.ts.map +1 -1
- package/lib/typescript/social/features/comment/components/PostComment/ReplyCommentList/index.d.ts.map +1 -1
- package/lib/typescript/social/features/feed/components/TopNavigation/TopNavigation.d.ts.map +1 -1
- package/lib/typescript/social/features/post/Detail/index.d.ts.map +1 -1
- package/lib/typescript/social/features/post/components/Content/Content.d.ts.map +1 -1
- package/lib/typescript/social/features/post/components/EngagementActions/Components/DetailStyle.d.ts.map +1 -1
- package/lib/typescript/social/features/post/components/EngagementActions/Components/FeedStyle.d.ts.map +1 -1
- package/lib/typescript/social/features/user/CreateProfile/CreateProfile.d.ts +28 -0
- package/lib/typescript/social/features/user/CreateProfile/CreateProfile.d.ts.map +1 -0
- package/lib/typescript/social/features/user/CreateProfile/components/ImageUpload/ImageUpload.d.ts +9 -0
- package/lib/typescript/social/features/user/CreateProfile/components/ImageUpload/ImageUpload.d.ts.map +1 -0
- package/lib/typescript/social/features/user/CreateProfile/components/ImageUpload/index.d.ts +2 -0
- package/lib/typescript/social/features/user/CreateProfile/components/ImageUpload/index.d.ts.map +1 -0
- package/lib/typescript/social/features/user/CreateProfile/components/ImageUpload/styles.d.ts +39 -0
- package/lib/typescript/social/features/user/CreateProfile/components/ImageUpload/styles.d.ts.map +1 -0
- package/lib/typescript/social/features/user/CreateProfile/components/TopBar/TopBar.d.ts +7 -0
- package/lib/typescript/social/features/user/CreateProfile/components/TopBar/TopBar.d.ts.map +1 -0
- package/lib/typescript/social/features/user/CreateProfile/components/TopBar/index.d.ts +2 -0
- package/lib/typescript/social/features/user/CreateProfile/components/TopBar/index.d.ts.map +1 -0
- package/lib/typescript/social/features/user/CreateProfile/components/TopBar/styles.d.ts +25 -0
- package/lib/typescript/social/features/user/CreateProfile/components/TopBar/styles.d.ts.map +1 -0
- package/lib/typescript/social/features/user/CreateProfile/components/index.d.ts +3 -0
- package/lib/typescript/social/features/user/CreateProfile/components/index.d.ts.map +1 -0
- package/lib/typescript/social/features/user/CreateProfile/hooks/index.d.ts +2 -0
- package/lib/typescript/social/features/user/CreateProfile/hooks/index.d.ts.map +1 -0
- package/lib/typescript/social/features/user/CreateProfile/hooks/useCreateProfile.d.ts +74 -0
- package/lib/typescript/social/features/user/CreateProfile/hooks/useCreateProfile.d.ts.map +1 -0
- package/lib/typescript/social/features/user/CreateProfile/index.d.ts +3 -0
- package/lib/typescript/social/features/user/CreateProfile/index.d.ts.map +1 -0
- package/lib/typescript/social/features/user/CreateProfile/styles.d.ts +28 -0
- package/lib/typescript/social/features/user/CreateProfile/styles.d.ts.map +1 -0
- package/lib/typescript/social/features/user/Profile/components/Header/hooks/useHeader.d.ts.map +1 -1
- package/lib/typescript/social/hooks/index.d.ts +1 -0
- package/lib/typescript/social/hooks/index.d.ts.map +1 -1
- package/lib/typescript/social/hooks/useGlobalBehavior.d.ts +23 -0
- package/lib/typescript/social/hooks/useGlobalBehavior.d.ts.map +1 -0
- package/lib/typescript/social/hooks/usePostPermission.d.ts.map +1 -1
- package/lib/typescript/social/hooks/useStoryPermission.d.ts.map +1 -1
- package/lib/typescript/social/index.d.ts +2 -1
- package/lib/typescript/social/index.d.ts.map +1 -1
- package/lib/typescript/social/providers/BehaviourProvider.d.ts.map +1 -1
- package/lib/typescript/social/screens/CreateUserProfile/CreateUserProfile.d.ts +7 -0
- package/lib/typescript/social/screens/CreateUserProfile/CreateUserProfile.d.ts.map +1 -0
- package/lib/typescript/social/screens/CreateUserProfile/index.d.ts +3 -0
- package/lib/typescript/social/screens/CreateUserProfile/index.d.ts.map +1 -0
- package/lib/typescript/social/screens/SocialHomePage/index.d.ts.map +1 -1
- package/lib/typescript/social/screens/VisitorUsageLimit/VisitorUsageLimit.d.ts +2 -0
- package/lib/typescript/social/screens/VisitorUsageLimit/VisitorUsageLimit.d.ts.map +1 -0
- package/lib/typescript/social/screens/VisitorUsageLimit/index.d.ts +2 -0
- package/lib/typescript/social/screens/VisitorUsageLimit/index.d.ts.map +1 -0
- package/lib/typescript/social/screens/VisitorUsageLimit/styles.d.ts +38 -0
- package/lib/typescript/social/screens/VisitorUsageLimit/styles.d.ts.map +1 -0
- package/lib/typescript/social/screens/index.d.ts +1 -0
- package/lib/typescript/social/screens/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/core/assets/icons/index.ts +1 -0
- package/src/core/assets/icons/visitorLimit.tsx +23 -0
- package/src/core/constants/index.ts +12 -0
- package/src/core/hooks/useAuth.ts +4 -0
- package/src/core/providers/AmityUIKitProvider.tsx +2 -1
- package/src/core/providers/AuthProvider.tsx +41 -12
- package/src/core/routes/AmityPageRenderer.tsx +11 -0
- package/src/core/routes/AmityUIKitNavigator.tsx +38 -1
- package/src/core/routes/RouteParamList.tsx +4 -0
- package/src/core/types/auth.ts +2 -0
- package/src/core/types/behaviour.ts +18 -0
- package/src/index.tsx +4 -0
- package/src/social/components/Social/CommentList/CommentList.tsx +5 -1
- package/src/social/components/Social/CommentListItem/CommentListItem.tsx +19 -12
- package/src/social/components/legacy/Social/ReplyCommentList/index.tsx +17 -11
- package/src/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.tsx +10 -2
- package/src/social/enums/enumUIKitID.ts +2 -0
- package/src/social/features/comment/components/PostComment/CommentListItem/CommentListItem.tsx +22 -16
- package/src/social/features/comment/components/PostComment/ReplyCommentList/index.tsx +17 -11
- package/src/social/features/feed/components/TopNavigation/TopNavigation.tsx +3 -1
- package/src/social/features/post/Detail/index.tsx +6 -2
- package/src/social/features/post/components/Content/Content.tsx +7 -4
- package/src/social/features/post/components/EngagementActions/Components/DetailStyle.tsx +7 -2
- package/src/social/features/post/components/EngagementActions/Components/FeedStyle.tsx +7 -2
- package/src/social/features/user/CreateProfile/CreateProfile.tsx +121 -0
- package/src/social/features/user/CreateProfile/components/ImageUpload/ImageUpload.tsx +85 -0
- package/src/social/features/user/CreateProfile/components/ImageUpload/index.ts +1 -0
- package/src/social/features/user/CreateProfile/components/ImageUpload/styles.ts +44 -0
- package/src/social/features/user/CreateProfile/components/TopBar/TopBar.tsx +30 -0
- package/src/social/features/user/CreateProfile/components/TopBar/index.ts +1 -0
- package/src/social/features/user/CreateProfile/components/TopBar/styles.ts +30 -0
- package/src/social/features/user/CreateProfile/components/index.ts +2 -0
- package/src/social/features/user/CreateProfile/hooks/index.ts +1 -0
- package/src/social/features/user/CreateProfile/hooks/useCreateProfile.ts +186 -0
- package/src/social/features/user/CreateProfile/index.ts +2 -0
- package/src/social/features/user/CreateProfile/styles.ts +33 -0
- package/src/social/features/user/Profile/components/Header/hooks/useHeader.ts +5 -2
- package/src/social/hooks/index.ts +1 -0
- package/src/social/hooks/useGlobalBehavior.ts +39 -0
- package/src/social/hooks/usePostPermission.ts +3 -1
- package/src/social/hooks/useStoryPermission.ts +8 -6
- package/src/social/index.tsx +2 -0
- package/src/social/providers/BehaviourProvider.tsx +1 -0
- package/src/social/screens/CreateUserProfile/CreateUserProfile.tsx +19 -0
- package/src/social/screens/CreateUserProfile/index.ts +2 -0
- package/src/social/screens/SocialHomePage/index.tsx +36 -13
- package/src/social/screens/VisitorUsageLimit/VisitorUsageLimit.tsx +78 -0
- package/src/social/screens/VisitorUsageLimit/index.ts +1 -0
- package/src/social/screens/VisitorUsageLimit/styles.ts +43 -0
- package/src/social/screens/index.ts +1 -0
- package/uikit.config.json +17 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { useStyles } from '../styles';
|
|
4
|
+
import { useForm } from 'react-hook-form';
|
|
5
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
6
|
+
import { useMutation } from '@tanstack/react-query';
|
|
7
|
+
import { Client, UserRepository } from '@amityco/ts-sdk-react-native';
|
|
8
|
+
import { useToast } from '../../../../../core/stores/slices/toastSlice';
|
|
9
|
+
import { CHARACTER_LIMIT, ERROR_CODE } from '../../../../../core/constants';
|
|
10
|
+
import { PageID } from '../../../../enums';
|
|
11
|
+
import { useAmityPage } from '../../../../hooks';
|
|
12
|
+
import { useNetInfo } from '@react-native-community/netinfo';
|
|
13
|
+
import { useUpload } from '../../../../../core/hooks';
|
|
14
|
+
|
|
15
|
+
// A visitor session is read-only, so the avatar cannot be uploaded while the
|
|
16
|
+
// page is shown (still a visitor). Instead we hold the locally picked image
|
|
17
|
+
// (just its uri) and upload it AFTER Client.login signs the user in.
|
|
18
|
+
export type LocalImage = { uri: string };
|
|
19
|
+
|
|
20
|
+
// The success toast is hosted inside this page's tree. onCreated typically
|
|
21
|
+
// tears that tree down (host swaps to the signed-in app), which would unmount
|
|
22
|
+
// the toast before it finishes fading in. Defer onCreated so the success toast
|
|
23
|
+
// stays visible across the transition. Sized to the toast fade-in + a brief
|
|
24
|
+
// display window.
|
|
25
|
+
const ON_CREATED_DELAY = 800;
|
|
26
|
+
|
|
27
|
+
const schema = z.object({
|
|
28
|
+
image: z.custom<LocalImage>().nullish(),
|
|
29
|
+
displayName: z.string().min(1).max(CHARACTER_LIMIT.USER_DISPLAY_NAME),
|
|
30
|
+
description: z.string().max(CHARACTER_LIMIT.USER_DESCRIPTION).optional(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export type CreateProfileFormValues = z.infer<typeof schema>;
|
|
34
|
+
|
|
35
|
+
type CreatedUser = { userId: string; displayName: string };
|
|
36
|
+
|
|
37
|
+
type UseCreateProfileParams = {
|
|
38
|
+
userId: string;
|
|
39
|
+
authToken?: string;
|
|
40
|
+
onCreated?: (user: CreatedUser) => void;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// The provider owns visitor login; this page performs the real signed-in login
|
|
44
|
+
// itself on save (mirroring the Web UIKit's CreateUserProfilePage). Logging in
|
|
45
|
+
// with a userId creates the user on the network if it does not exist yet and
|
|
46
|
+
// sets the initial display name — the visitor -> signed-in transition. The host
|
|
47
|
+
// then settles the session by passing the returned userId to the provider.
|
|
48
|
+
export const useCreateProfile = ({
|
|
49
|
+
userId,
|
|
50
|
+
authToken,
|
|
51
|
+
onCreated,
|
|
52
|
+
}: UseCreateProfileParams) => {
|
|
53
|
+
const { styles, theme } = useStyles();
|
|
54
|
+
const { accessibilityId } = useAmityPage({
|
|
55
|
+
pageId: PageID.create_user_profile_page,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const { showToast, hideToast } = useToast();
|
|
59
|
+
const { isConnected } = useNetInfo();
|
|
60
|
+
const { uploadImage } = useUpload();
|
|
61
|
+
|
|
62
|
+
// Tracks the deferred onCreated call so it can be cleared if the page
|
|
63
|
+
// unmounts before it fires.
|
|
64
|
+
const onCreatedTimer = useRef<ReturnType<typeof setTimeout> | undefined>(
|
|
65
|
+
undefined
|
|
66
|
+
);
|
|
67
|
+
useEffect(() => () => clearTimeout(onCreatedTimer.current), []);
|
|
68
|
+
|
|
69
|
+
const {
|
|
70
|
+
watch,
|
|
71
|
+
control,
|
|
72
|
+
handleSubmit,
|
|
73
|
+
formState: { isValid, isSubmitting },
|
|
74
|
+
} = useForm<CreateProfileFormValues>({
|
|
75
|
+
resolver: zodResolver(schema),
|
|
76
|
+
mode: 'onChange',
|
|
77
|
+
defaultValues: {
|
|
78
|
+
image: null,
|
|
79
|
+
displayName: '',
|
|
80
|
+
description: '',
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const sessionHandler: Amity.SessionHandler = {
|
|
85
|
+
sessionWillRenewAccessToken(renewal) {
|
|
86
|
+
renewal.renew();
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const { mutateAsync } = useMutation<
|
|
91
|
+
CreatedUser,
|
|
92
|
+
Error,
|
|
93
|
+
CreateProfileFormValues
|
|
94
|
+
>({
|
|
95
|
+
mutationKey: ['create-user-profile', userId],
|
|
96
|
+
onMutate: () => {
|
|
97
|
+
// Long-running toast shown while the SDK calls run, matching the loading
|
|
98
|
+
// toast used by other composers (e.g. PollPostComposer).
|
|
99
|
+
showToast({ message: 'Creating profile...', type: 'loading' });
|
|
100
|
+
},
|
|
101
|
+
mutationFn: async (data) => {
|
|
102
|
+
let loginParam: Amity.ConnectClientParams = {
|
|
103
|
+
userId,
|
|
104
|
+
displayName: data.displayName || undefined,
|
|
105
|
+
};
|
|
106
|
+
if (authToken && authToken.length > 0) {
|
|
107
|
+
loginParam = { ...loginParam, authToken };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
await Client.login(loginParam, sessionHandler);
|
|
111
|
+
|
|
112
|
+
// The avatar upload is a write, which a visitor session cannot perform.
|
|
113
|
+
// Now that login has signed the user in, upload the locally picked image
|
|
114
|
+
// and then apply the remaining profile fields (about + avatar).
|
|
115
|
+
let avatarFileId: string | undefined;
|
|
116
|
+
if (data.image?.uri) {
|
|
117
|
+
const uploaded = await uploadImage({ file: data.image.uri });
|
|
118
|
+
avatarFileId = uploaded?.data?.[0]?.fileId;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// displayName is set during login; apply the remaining fields here.
|
|
122
|
+
const payload: Parameters<typeof UserRepository.updateUser>[1] = {
|
|
123
|
+
description: data.description || undefined,
|
|
124
|
+
avatarFileId,
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
if (payload.description != null || payload.avatarFileId != null) {
|
|
128
|
+
await UserRepository.updateUser(userId, payload);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return { userId, displayName: data.displayName || '' };
|
|
132
|
+
},
|
|
133
|
+
onSuccess: (createdUser) => {
|
|
134
|
+
// Replace the loading toast in-place (no hideToast first — a hide->show
|
|
135
|
+
// double dispatch can cancel the success toast's fade-in before it shows).
|
|
136
|
+
showToast({
|
|
137
|
+
type: 'success',
|
|
138
|
+
message: 'Successfully created your profile!',
|
|
139
|
+
});
|
|
140
|
+
// Defer the transition briefly so the toast starts showing here before the
|
|
141
|
+
// host swaps screens. The toast state is shared (Redux), so it keeps
|
|
142
|
+
// displaying on the destination (signed-in) screen too.
|
|
143
|
+
onCreatedTimer.current = setTimeout(
|
|
144
|
+
() => onCreated?.(createdUser),
|
|
145
|
+
ON_CREATED_DELAY
|
|
146
|
+
);
|
|
147
|
+
},
|
|
148
|
+
onError: (error) => {
|
|
149
|
+
hideToast();
|
|
150
|
+
if (error.message?.includes(ERROR_CODE.BLOCKED_WORD)) {
|
|
151
|
+
showToast({
|
|
152
|
+
type: 'informative',
|
|
153
|
+
message: "Your profile wasn't saved as it contains a blocked word.",
|
|
154
|
+
});
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
showToast({
|
|
158
|
+
type: 'informative',
|
|
159
|
+
message: 'Failed to save your profile. Please try again.',
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
const onSubmit = async (data: CreateProfileFormValues) => {
|
|
165
|
+
if (isConnected === false) {
|
|
166
|
+
showToast({
|
|
167
|
+
type: 'informative',
|
|
168
|
+
message: 'Failed to save your profile. Please try again.',
|
|
169
|
+
});
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
await mutateAsync(data);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
return {
|
|
176
|
+
styles,
|
|
177
|
+
theme,
|
|
178
|
+
watch,
|
|
179
|
+
control,
|
|
180
|
+
handleSubmit,
|
|
181
|
+
onSubmit,
|
|
182
|
+
isValid,
|
|
183
|
+
isSubmitting,
|
|
184
|
+
accessibilityId,
|
|
185
|
+
};
|
|
186
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { useTheme } from 'react-native-paper';
|
|
3
|
+
import type { MyMD3Theme } from '../../../../core/providers/AmityUIKitProvider';
|
|
4
|
+
|
|
5
|
+
export const useStyles = () => {
|
|
6
|
+
const theme = useTheme<MyMD3Theme>();
|
|
7
|
+
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
container: {
|
|
10
|
+
flex: 1,
|
|
11
|
+
backgroundColor: theme.colors.background,
|
|
12
|
+
},
|
|
13
|
+
keyboardAvoidingView: {
|
|
14
|
+
flex: 1,
|
|
15
|
+
},
|
|
16
|
+
contentContainer: {
|
|
17
|
+
paddingVertical: 16,
|
|
18
|
+
},
|
|
19
|
+
inputContainer: {
|
|
20
|
+
paddingHorizontal: 16,
|
|
21
|
+
paddingTop: 24,
|
|
22
|
+
},
|
|
23
|
+
submitButtonContainer: {
|
|
24
|
+
padding: 16,
|
|
25
|
+
borderTopWidth: 1,
|
|
26
|
+
paddingBottom: 16,
|
|
27
|
+
borderTopColor: theme.colors.baseShade4,
|
|
28
|
+
backgroundColor: theme.colors.background,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return { styles, theme };
|
|
33
|
+
};
|
|
@@ -8,7 +8,7 @@ import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
|
8
8
|
import { RootStackParamList } from '../../../../../../../core/routes/RouteParamList';
|
|
9
9
|
import { UserRelationshipTab } from '../../../../../../types';
|
|
10
10
|
import { useBehaviour } from '../../../../../../providers/BehaviourProvider';
|
|
11
|
-
import { useBlockUser } from '../../../../../../hooks';
|
|
11
|
+
import { useBlockUser, useGlobalBehavior } from '../../../../../../hooks';
|
|
12
12
|
import useAuth from '../../../../../../../core/hooks/useAuth';
|
|
13
13
|
import { useFollowUser } from '../../../../../../hooks/queries/useFollowUser';
|
|
14
14
|
import useSocialSettings from '../../../../../../../core/hooks/useSocialSettings';
|
|
@@ -31,6 +31,7 @@ export function useHeader(user?: Amity.User) {
|
|
|
31
31
|
const { openBottomSheet, closeBottomSheet, bottomSheetHeight } =
|
|
32
32
|
useBottomSheet();
|
|
33
33
|
const { showToast } = useToast();
|
|
34
|
+
const { handleGlobalBehavior } = useGlobalBehavior();
|
|
34
35
|
const {
|
|
35
36
|
followUser,
|
|
36
37
|
unfollowUser,
|
|
@@ -56,7 +57,9 @@ export function useHeader(user?: Amity.User) {
|
|
|
56
57
|
|
|
57
58
|
const handleFollow = () => {
|
|
58
59
|
if (!user?.userId) return;
|
|
59
|
-
|
|
60
|
+
handleGlobalBehavior({
|
|
61
|
+
defaultBehavior: () => followUser(user.userId),
|
|
62
|
+
});
|
|
60
63
|
};
|
|
61
64
|
|
|
62
65
|
const handleUnfollow = () => {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import useAuth from '../../core/hooks/useAuth';
|
|
3
|
+
import { useBehaviour } from '../providers/BehaviourProvider';
|
|
4
|
+
import { useToast } from '../../core/stores/slices/toastSlice';
|
|
5
|
+
import { VISITOR_USER_ACTION_TOAST } from '../../core/constants';
|
|
6
|
+
|
|
7
|
+
const TOAST_DURATION = 3000;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Mirrors the Web UIKit's useGlobalBehavior: gate a restricted action behind
|
|
11
|
+
* the visitor/bot check. For signed-in users the default behaviour runs; for
|
|
12
|
+
* visitors the AmityGlobalBehavior.handleVisitorUserAction override is
|
|
13
|
+
* called when provided, otherwise a "create an account or sign in" toast is
|
|
14
|
+
* shown.
|
|
15
|
+
*/
|
|
16
|
+
export const useGlobalBehavior = () => {
|
|
17
|
+
const { isVisitorOrBot } = useAuth();
|
|
18
|
+
const { AmityGlobalBehavior } = useBehaviour();
|
|
19
|
+
const { showToast } = useToast();
|
|
20
|
+
|
|
21
|
+
const handleGlobalBehavior = useCallback(
|
|
22
|
+
({ defaultBehavior }: { defaultBehavior?: () => void }) => {
|
|
23
|
+
if (isVisitorOrBot) {
|
|
24
|
+
if (AmityGlobalBehavior?.handleVisitorUserAction) {
|
|
25
|
+
return AmityGlobalBehavior.handleVisitorUserAction();
|
|
26
|
+
}
|
|
27
|
+
return showToast({
|
|
28
|
+
message: VISITOR_USER_ACTION_TOAST,
|
|
29
|
+
type: 'informative',
|
|
30
|
+
duration: TOAST_DURATION,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return defaultBehavior?.();
|
|
34
|
+
},
|
|
35
|
+
[isVisitorOrBot, AmityGlobalBehavior, showToast]
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return { handleGlobalBehavior, isVisitorOrBot };
|
|
39
|
+
};
|
|
@@ -12,13 +12,14 @@ type UsePostPermissionParams = {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export function usePostPermission({ community }: UsePostPermissionParams) {
|
|
15
|
-
const { client } = useAuth();
|
|
15
|
+
const { client, isVisitorOrBot } = useAuth();
|
|
16
16
|
const [hasPostPermission, setHasPostPermission] = useState(false);
|
|
17
17
|
|
|
18
18
|
const isOnlyAdminCanPost =
|
|
19
19
|
community?.postSetting === CommunityPostSettings.ONLY_ADMIN_CAN_POST;
|
|
20
20
|
|
|
21
21
|
useEffect(() => {
|
|
22
|
+
if (isVisitorOrBot) return;
|
|
22
23
|
if (!community?.communityId || !client?.userId) return;
|
|
23
24
|
|
|
24
25
|
CommunityRepository.Membership.getMembers(
|
|
@@ -41,6 +42,7 @@ export function usePostPermission({ community }: UsePostPermissionParams) {
|
|
|
41
42
|
client?.userId,
|
|
42
43
|
isOnlyAdminCanPost,
|
|
43
44
|
community?.isJoined,
|
|
45
|
+
isVisitorOrBot,
|
|
44
46
|
]);
|
|
45
47
|
|
|
46
48
|
return hasPostPermission;
|
|
@@ -4,17 +4,19 @@ import useSocialSettings from '../../core/hooks/useSocialSettings';
|
|
|
4
4
|
import { checkStoryPermission, isAdmin } from '../utils/permissions';
|
|
5
5
|
|
|
6
6
|
export function useStoryPermission(communityId?: string) {
|
|
7
|
-
const { client } = useAuth();
|
|
7
|
+
const { client, isVisitorOrBot } = useAuth();
|
|
8
8
|
const { socialSettings } = useSocialSettings();
|
|
9
9
|
const user = useUser(client?.userId || '');
|
|
10
10
|
|
|
11
11
|
const isGlobalAdmin = isAdmin(user?.roles);
|
|
12
12
|
|
|
13
|
-
const hasStoryPermission =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const hasStoryPermission =
|
|
14
|
+
!isVisitorOrBot &&
|
|
15
|
+
(!communityId
|
|
16
|
+
? socialSettings?.story?.allowAllUserToCreateStory
|
|
17
|
+
: socialSettings?.story?.allowAllUserToCreateStory ||
|
|
18
|
+
isGlobalAdmin ||
|
|
19
|
+
checkStoryPermission(client, communityId));
|
|
18
20
|
|
|
19
21
|
return { hasStoryPermission };
|
|
20
22
|
}
|
package/src/social/index.tsx
CHANGED
|
@@ -2,6 +2,7 @@ export { default as AmityCreateStoryPage } from './features/story/Create';
|
|
|
2
2
|
export { default as AmityDraftStoryPage } from './features/story/Draft/Draft';
|
|
3
3
|
export { default as AmityViewStoryPage } from './features/story/View/View';
|
|
4
4
|
export { default as AmitySocialHomePage } from './screens/SocialHomePage';
|
|
5
|
+
export { VisitorUsageLimit } from './screens/VisitorUsageLimit';
|
|
5
6
|
export { default as AmitySocialGlobalSearchPage } from './screens/SocialGlobalSearch';
|
|
6
7
|
export { default as AmityPostDetailPage } from './features/post/Detail';
|
|
7
8
|
export { default as AmityPostTargetSelectionPage } from './features/post/TargetSelection';
|
|
@@ -22,6 +23,7 @@ export { default as AmityLivestreamPlayerPage } from './features/livestream/Play
|
|
|
22
23
|
export {
|
|
23
24
|
UserRelationshipScreen as AmityUserRelationshipPage,
|
|
24
25
|
EditUserScreen as AmityEditUserProfilePage,
|
|
26
|
+
CreateUserProfileScreen as AmityCreateProfilePage,
|
|
25
27
|
UserProfileScreen as AmityUserProfilePage,
|
|
26
28
|
BlockedUsersScreen as AmityBlockedUsersPage,
|
|
27
29
|
UserPendingFollowRequests as AmityUserPendingFollowRequestsPage,
|
|
@@ -14,6 +14,7 @@ export const BehaviourProvider = ({
|
|
|
14
14
|
}: IBehavioudProviderProps) => {
|
|
15
15
|
const defaultBehaviour = useMemo(
|
|
16
16
|
() => ({
|
|
17
|
+
AmityGlobalBehavior: {},
|
|
17
18
|
AmitySocialHomePageBehaviour: {},
|
|
18
19
|
AmityGlobalFeedComponentBehavior: {},
|
|
19
20
|
AmityPostContentComponentBehavior: {},
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CreateProfile,
|
|
3
|
+
CreateProfileProps,
|
|
4
|
+
} from '../../features/user/CreateProfile';
|
|
5
|
+
|
|
6
|
+
export type CreateUserProfilePageProps = CreateProfileProps;
|
|
7
|
+
|
|
8
|
+
// Unlike EditUserScreen, this page is rendered directly by the host (e.g. in
|
|
9
|
+
// visitor mode) and driven by props, mirroring the Web UIKit's
|
|
10
|
+
// AmityCreateProfilePage usage — not by a navigation route.
|
|
11
|
+
export function CreateUserProfileScreen(props: CreateUserProfilePageProps) {
|
|
12
|
+
return <CreateProfile {...props} />;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// AmityPageRenderer derives its navigator's initialRouteName from the wrapped
|
|
16
|
+
// component's displayName. This must match the pass-through route registered
|
|
17
|
+
// for this page in AmityPageRenderer, otherwise React Navigation throws
|
|
18
|
+
// "Couldn't find a screen named '...' to use as 'initialRouteName'".
|
|
19
|
+
CreateUserProfileScreen.displayName = 'AmityCreateUserProfilePage';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useCallback, useRef, useState } from 'react';
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { StyleSheet, View } from 'react-native';
|
|
4
4
|
import CustomSocialTab from '../../components/CustomSocialTab/CustomSocialTab';
|
|
5
5
|
import { useUiKitConfig } from '../../hooks';
|
|
@@ -20,7 +20,7 @@ const PROFILE_TAB = 'Profile';
|
|
|
20
20
|
|
|
21
21
|
const AmitySocialHomePage = () => {
|
|
22
22
|
const theme = useTheme() as MyMD3Theme;
|
|
23
|
-
const { client } = useAuth();
|
|
23
|
+
const { client, isVisitorOrBot } = useAuth();
|
|
24
24
|
|
|
25
25
|
const styles = StyleSheet.create({
|
|
26
26
|
container: {
|
|
@@ -52,8 +52,25 @@ const AmitySocialHomePage = () => {
|
|
|
52
52
|
keys: ['text'],
|
|
53
53
|
}) as string[];
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
// Web parity (SocialHomePage): visitors land on the community browsing tab
|
|
56
|
+
// and never see Newsfeed / My Communities / Profile. Pick the visitor default
|
|
57
|
+
// at first render (lazy initializer) so a visitor never sees a one-frame flash
|
|
58
|
+
// of the Newsfeed tab before an effect could correct it.
|
|
59
|
+
const [activeTab, setActiveTab] = useState<string>(() =>
|
|
60
|
+
isVisitorOrBot ? exploreTab : newsFeedTab
|
|
61
|
+
);
|
|
62
|
+
const visitedTabs = useRef<Set<string>>(
|
|
63
|
+
new Set([isVisitorOrBot ? exploreTab : newsFeedTab])
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
// If the visitor flag resolves after mount (session establishing), still
|
|
67
|
+
// switch to the community browsing tab.
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (isVisitorOrBot) {
|
|
70
|
+
visitedTabs.current.add(exploreTab);
|
|
71
|
+
setActiveTab(exploreTab);
|
|
72
|
+
}
|
|
73
|
+
}, [isVisitorOrBot, exploreTab]);
|
|
57
74
|
|
|
58
75
|
const onTabChange = useCallback(
|
|
59
76
|
(tabName: string) => {
|
|
@@ -85,21 +102,27 @@ const AmitySocialHomePage = () => {
|
|
|
85
102
|
<CustomSocialTab
|
|
86
103
|
activeTab={activeTab}
|
|
87
104
|
onTabChange={onTabChange}
|
|
88
|
-
tabNames={
|
|
105
|
+
tabNames={
|
|
106
|
+
isVisitorOrBot
|
|
107
|
+
? [exploreTab]
|
|
108
|
+
: [newsFeedTab, exploreTab, myCommunitiesTab, PROFILE_TAB]
|
|
109
|
+
}
|
|
89
110
|
/>
|
|
90
111
|
<Divider />
|
|
91
|
-
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
112
|
+
{!isVisitorOrBot && (
|
|
113
|
+
<View style={tabStyle(newsFeedTab)}>
|
|
114
|
+
<AmityNewsFeedComponent
|
|
115
|
+
pageId={PageID.social_home_page}
|
|
116
|
+
onPressExploreCommunity={onPressExploreCommunity}
|
|
117
|
+
/>
|
|
118
|
+
</View>
|
|
119
|
+
)}
|
|
97
120
|
{visitedTabs.current.has(exploreTab) && (
|
|
98
121
|
<View style={tabStyle(exploreTab)}>
|
|
99
122
|
<AmityExploreComponent pageId={PageID.social_home_page} />
|
|
100
123
|
</View>
|
|
101
124
|
)}
|
|
102
|
-
{visitedTabs.current.has(myCommunitiesTab) && (
|
|
125
|
+
{!isVisitorOrBot && visitedTabs.current.has(myCommunitiesTab) && (
|
|
103
126
|
<View style={tabStyle(myCommunitiesTab)}>
|
|
104
127
|
<AmityMyCommunitiesComponent
|
|
105
128
|
pageId={PageID.social_home_page}
|
|
@@ -107,7 +130,7 @@ const AmitySocialHomePage = () => {
|
|
|
107
130
|
/>
|
|
108
131
|
</View>
|
|
109
132
|
)}
|
|
110
|
-
{visitedTabs.current.has(PROFILE_TAB) && (
|
|
133
|
+
{!isVisitorOrBot && visitedTabs.current.has(PROFILE_TAB) && (
|
|
111
134
|
<View style={tabStyle(PROFILE_TAB)}>
|
|
112
135
|
<UserProfile inline stickyTab={false} userId={client?.userId ?? ''} />
|
|
113
136
|
</View>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { useCallback, useEffect } from 'react';
|
|
2
|
+
import { BackHandler, TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
4
|
+
import { SvgXml } from 'react-native-svg';
|
|
5
|
+
import { useStyles } from './styles';
|
|
6
|
+
import { Typography } from '../../../core/components/Typography/Typography';
|
|
7
|
+
import { visitorLimit } from '../../../core/assets/icons';
|
|
8
|
+
import { useToast } from '../../../core/stores/slices/toastSlice';
|
|
9
|
+
import { useBehaviour } from '../../providers/BehaviourProvider';
|
|
10
|
+
import { VISITOR_USAGE_LIMIT_MESSAGE } from '../../../core/constants';
|
|
11
|
+
|
|
12
|
+
const TOAST_DURATION = 3000;
|
|
13
|
+
|
|
14
|
+
export function VisitorUsageLimit() {
|
|
15
|
+
const { styles, theme } = useStyles();
|
|
16
|
+
const { showToast } = useToast();
|
|
17
|
+
const { AmityGlobalBehavior } = useBehaviour();
|
|
18
|
+
|
|
19
|
+
const showSignInToast = useCallback(() => {
|
|
20
|
+
showToast({
|
|
21
|
+
message: VISITOR_USAGE_LIMIT_MESSAGE.TOAST,
|
|
22
|
+
type: 'informative',
|
|
23
|
+
duration: TOAST_DURATION,
|
|
24
|
+
});
|
|
25
|
+
}, []);
|
|
26
|
+
|
|
27
|
+
// Toast appears on the initial usage-limit trigger only; a dismissed
|
|
28
|
+
// sign-in flow returning to this page must not re-show it.
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
showSignInToast();
|
|
31
|
+
}, [showSignInToast]);
|
|
32
|
+
|
|
33
|
+
// Dead-end page: swallow the Android hardware back press so the user
|
|
34
|
+
// cannot navigate away from the error state.
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const subscription = BackHandler.addEventListener(
|
|
37
|
+
'hardwareBackPress',
|
|
38
|
+
() => true
|
|
39
|
+
);
|
|
40
|
+
return () => subscription.remove();
|
|
41
|
+
}, []);
|
|
42
|
+
|
|
43
|
+
const onPressSignIn = () => {
|
|
44
|
+
if (AmityGlobalBehavior?.handleVisitorUsageLimitSignIn) {
|
|
45
|
+
return AmityGlobalBehavior.handleVisitorUsageLimitSignIn();
|
|
46
|
+
}
|
|
47
|
+
showSignInToast();
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<SafeAreaView style={styles.container} edges={['top', 'left']}>
|
|
52
|
+
<View style={styles.contentContainer}>
|
|
53
|
+
<SvgXml
|
|
54
|
+
width={60}
|
|
55
|
+
height={40}
|
|
56
|
+
style={styles.icon}
|
|
57
|
+
xml={visitorLimit()}
|
|
58
|
+
color={theme.colors.secondaryShade4}
|
|
59
|
+
/>
|
|
60
|
+
<Typography.TitleBold style={styles.title}>
|
|
61
|
+
{VISITOR_USAGE_LIMIT_MESSAGE.TITLE}
|
|
62
|
+
</Typography.TitleBold>
|
|
63
|
+
<Typography.Caption style={styles.subtitle}>
|
|
64
|
+
{VISITOR_USAGE_LIMIT_MESSAGE.SUBTITLE}
|
|
65
|
+
</Typography.Caption>
|
|
66
|
+
<TouchableOpacity
|
|
67
|
+
style={styles.signInButton}
|
|
68
|
+
onPress={onPressSignIn}
|
|
69
|
+
accessibilityRole="button"
|
|
70
|
+
>
|
|
71
|
+
<Typography.BodyBold style={styles.signInText}>
|
|
72
|
+
{VISITOR_USAGE_LIMIT_MESSAGE.SIGN_IN}
|
|
73
|
+
</Typography.BodyBold>
|
|
74
|
+
</TouchableOpacity>
|
|
75
|
+
</View>
|
|
76
|
+
</SafeAreaView>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { VisitorUsageLimit } from './VisitorUsageLimit';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { useTheme } from 'react-native-paper';
|
|
3
|
+
import type { MyMD3Theme } from '../../../core/providers/AmityUIKitProvider';
|
|
4
|
+
|
|
5
|
+
export const useStyles = () => {
|
|
6
|
+
const theme = useTheme<MyMD3Theme>();
|
|
7
|
+
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
container: {
|
|
10
|
+
flex: 1,
|
|
11
|
+
backgroundColor: theme.colors.background,
|
|
12
|
+
},
|
|
13
|
+
contentContainer: {
|
|
14
|
+
flex: 1,
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
paddingHorizontal: 32,
|
|
17
|
+
flexDirection: 'column',
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
},
|
|
20
|
+
icon: {
|
|
21
|
+
marginBottom: 16,
|
|
22
|
+
},
|
|
23
|
+
title: {
|
|
24
|
+
textAlign: 'center',
|
|
25
|
+
color: theme.colors.baseShade3,
|
|
26
|
+
},
|
|
27
|
+
subtitle: {
|
|
28
|
+
textAlign: 'center',
|
|
29
|
+
color: theme.colors.baseShade3,
|
|
30
|
+
},
|
|
31
|
+
signInButton: {
|
|
32
|
+
marginTop: 16,
|
|
33
|
+
borderRadius: 8,
|
|
34
|
+
paddingVertical: 10,
|
|
35
|
+
paddingHorizontal: 16,
|
|
36
|
+
},
|
|
37
|
+
signInText: {
|
|
38
|
+
color: theme.colors.primary,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return { styles, theme };
|
|
43
|
+
};
|
package/uikit.config.json
CHANGED
|
@@ -657,6 +657,23 @@
|
|
|
657
657
|
"text": "Save"
|
|
658
658
|
},
|
|
659
659
|
|
|
660
|
+
"create_user_profile_page/*/*": {},
|
|
661
|
+
"create_user_profile_page/*/back_button": {
|
|
662
|
+
"image": "value"
|
|
663
|
+
},
|
|
664
|
+
"create_user_profile_page/*/title": {
|
|
665
|
+
"text": "Create profile"
|
|
666
|
+
},
|
|
667
|
+
"create_user_profile_page/*/user_display_name_title": {
|
|
668
|
+
"text": "Display name"
|
|
669
|
+
},
|
|
670
|
+
"create_user_profile_page/*/user_about_title": {
|
|
671
|
+
"text": "About"
|
|
672
|
+
},
|
|
673
|
+
"create_user_profile_page/*/create_user_profile_button": {
|
|
674
|
+
"text": "Save"
|
|
675
|
+
},
|
|
676
|
+
|
|
660
677
|
"blocked_users_page/*/*": {},
|
|
661
678
|
"blocked_users_page/*/back_button": {
|
|
662
679
|
"image": "value"
|