@amityco/react-native-social-uikit 4.0.2-8e4d4f3a.0 → 4.0.2-a91dab2.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.
Files changed (277) hide show
  1. package/lib/commonjs/core/assets/icons/index.js +8 -0
  2. package/lib/commonjs/core/assets/icons/index.js.map +1 -1
  3. package/lib/commonjs/core/assets/icons/visitorLimit.js +26 -0
  4. package/lib/commonjs/core/assets/icons/visitorLimit.js.map +1 -0
  5. package/lib/commonjs/core/constants/index.js +11 -1
  6. package/lib/commonjs/core/constants/index.js.map +1 -1
  7. package/lib/commonjs/core/hooks/useAuth.js +6 -2
  8. package/lib/commonjs/core/hooks/useAuth.js.map +1 -1
  9. package/lib/commonjs/core/providers/AmityUIKitProvider.js +10 -3
  10. package/lib/commonjs/core/providers/AmityUIKitProvider.js.map +1 -1
  11. package/lib/commonjs/core/providers/AuthProvider.js +44 -16
  12. package/lib/commonjs/core/providers/AuthProvider.js.map +1 -1
  13. package/lib/commonjs/core/routes/AmityUIKitNavigator.js +23 -1
  14. package/lib/commonjs/core/routes/AmityUIKitNavigator.js.map +1 -1
  15. package/lib/commonjs/social/components/PollContent/PollOption.js +12 -12
  16. package/lib/commonjs/social/components/PollContent/PollOption.js.map +1 -1
  17. package/lib/commonjs/social/components/PostMenu/index.js +9 -2
  18. package/lib/commonjs/social/components/PostMenu/index.js.map +1 -1
  19. package/lib/commonjs/social/components/Social/CommentList/CommentList.js +6 -1
  20. package/lib/commonjs/social/components/Social/CommentList/CommentList.js.map +1 -1
  21. package/lib/commonjs/social/components/Social/CommentListItem/CommentListItem.js +24 -6
  22. package/lib/commonjs/social/components/Social/CommentListItem/CommentListItem.js.map +1 -1
  23. package/lib/commonjs/social/components/Social/CommentListItem/styles.js +3 -2
  24. package/lib/commonjs/social/components/Social/CommentListItem/styles.js.map +1 -1
  25. package/lib/commonjs/social/components/legacy/Social/ReplyCommentList/index.js +14 -2
  26. package/lib/commonjs/social/components/legacy/Social/ReplyCommentList/index.js.map +1 -1
  27. package/lib/commonjs/social/elements/CommunityCreatePostButton/CommunityCreatePostButton.js +3 -1
  28. package/lib/commonjs/social/elements/CommunityCreatePostButton/CommunityCreatePostButton.js.map +1 -1
  29. package/lib/commonjs/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.js +6 -1
  30. package/lib/commonjs/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.js.map +1 -1
  31. package/lib/commonjs/social/features/comment/components/PostComment/CommentListItem/CommentListItem.js +17 -3
  32. package/lib/commonjs/social/features/comment/components/PostComment/CommentListItem/CommentListItem.js.map +1 -1
  33. package/lib/commonjs/social/features/comment/components/PostComment/ReplyCommentList/index.js +17 -3
  34. package/lib/commonjs/social/features/comment/components/PostComment/ReplyCommentList/index.js.map +1 -1
  35. package/lib/commonjs/social/features/comment/components/PostComment/ReplyCommentList/styles.js +8 -0
  36. package/lib/commonjs/social/features/comment/components/PostComment/ReplyCommentList/styles.js.map +1 -1
  37. package/lib/commonjs/social/features/feed/components/TopNavigation/TopNavigation.js +5 -1
  38. package/lib/commonjs/social/features/feed/components/TopNavigation/TopNavigation.js.map +1 -1
  39. package/lib/commonjs/social/features/livestream/Player/Player.js +9 -6
  40. package/lib/commonjs/social/features/livestream/Player/Player.js.map +1 -1
  41. package/lib/commonjs/social/features/post/Detail/index.js +6 -2
  42. package/lib/commonjs/social/features/post/Detail/index.js.map +1 -1
  43. package/lib/commonjs/social/features/post/components/EngagementActions/Components/DetailStyle.js +16 -10
  44. package/lib/commonjs/social/features/post/components/EngagementActions/Components/DetailStyle.js.map +1 -1
  45. package/lib/commonjs/social/features/post/components/EngagementActions/Components/FeedStyle.js +17 -9
  46. package/lib/commonjs/social/features/post/components/EngagementActions/Components/FeedStyle.js.map +1 -1
  47. package/lib/commonjs/social/features/story/View/components/AmityViewStoryItem.js +19 -21
  48. package/lib/commonjs/social/features/story/View/components/AmityViewStoryItem.js.map +1 -1
  49. package/lib/commonjs/social/features/user/Profile/components/Header/hooks/useHeader.js +28 -19
  50. package/lib/commonjs/social/features/user/Profile/components/Header/hooks/useHeader.js.map +1 -1
  51. package/lib/commonjs/social/features/user/Profile/components/Header/styles.js +2 -0
  52. package/lib/commonjs/social/features/user/Profile/components/Header/styles.js.map +1 -1
  53. package/lib/commonjs/social/features/user/Profile/elements/Menu/hooks/useMenu.js +15 -4
  54. package/lib/commonjs/social/features/user/Profile/elements/Menu/hooks/useMenu.js.map +1 -1
  55. package/lib/commonjs/social/features/visitor/UsageLimit/UsageLimit.js +46 -0
  56. package/lib/commonjs/social/features/visitor/UsageLimit/UsageLimit.js.map +1 -0
  57. package/lib/commonjs/social/features/visitor/UsageLimit/hooks/index.js +13 -0
  58. package/lib/commonjs/social/features/visitor/UsageLimit/hooks/index.js.map +1 -0
  59. package/lib/commonjs/social/features/visitor/UsageLimit/hooks/useUsageLimit.js +54 -0
  60. package/lib/commonjs/social/features/visitor/UsageLimit/hooks/useUsageLimit.js.map +1 -0
  61. package/lib/commonjs/social/features/visitor/UsageLimit/index.js +13 -0
  62. package/lib/commonjs/social/features/visitor/UsageLimit/index.js.map +1 -0
  63. package/lib/commonjs/social/features/visitor/UsageLimit/styles.js +52 -0
  64. package/lib/commonjs/social/features/visitor/UsageLimit/styles.js.map +1 -0
  65. package/lib/commonjs/social/hooks/index.js +22 -0
  66. package/lib/commonjs/social/hooks/index.js.map +1 -1
  67. package/lib/commonjs/social/hooks/useGlobalBehavior.js +44 -0
  68. package/lib/commonjs/social/hooks/useGlobalBehavior.js.map +1 -0
  69. package/lib/commonjs/social/hooks/useInteractionBehavior.js +50 -0
  70. package/lib/commonjs/social/hooks/useInteractionBehavior.js.map +1 -0
  71. package/lib/commonjs/social/hooks/usePostPermission.js +4 -2
  72. package/lib/commonjs/social/hooks/usePostPermission.js.map +1 -1
  73. package/lib/commonjs/social/hooks/useStoryPermission.js +3 -2
  74. package/lib/commonjs/social/hooks/useStoryPermission.js.map +1 -1
  75. package/lib/commonjs/social/providers/BehaviourProvider.js +1 -0
  76. package/lib/commonjs/social/providers/BehaviourProvider.js.map +1 -1
  77. package/lib/commonjs/social/screens/CommunityProfile/components/Header/Header.js +9 -2
  78. package/lib/commonjs/social/screens/CommunityProfile/components/Header/Header.js.map +1 -1
  79. package/lib/commonjs/social/screens/SocialHomePage/index.js +23 -6
  80. package/lib/commonjs/social/screens/SocialHomePage/index.js.map +1 -1
  81. package/lib/commonjs/social/screens/VisitorUsageLimit/VisitorUsageLimit.js +11 -0
  82. package/lib/commonjs/social/screens/VisitorUsageLimit/VisitorUsageLimit.js.map +1 -0
  83. package/lib/commonjs/social/screens/VisitorUsageLimit/index.js +13 -0
  84. package/lib/commonjs/social/screens/VisitorUsageLimit/index.js.map +1 -0
  85. package/lib/module/core/assets/icons/index.js +1 -0
  86. package/lib/module/core/assets/icons/index.js.map +1 -1
  87. package/lib/module/core/assets/icons/visitorLimit.js +19 -0
  88. package/lib/module/core/assets/icons/visitorLimit.js.map +1 -0
  89. package/lib/module/core/constants/index.js +10 -0
  90. package/lib/module/core/constants/index.js.map +1 -1
  91. package/lib/module/core/hooks/useAuth.js +6 -2
  92. package/lib/module/core/hooks/useAuth.js.map +1 -1
  93. package/lib/module/core/providers/AmityUIKitProvider.js +10 -3
  94. package/lib/module/core/providers/AmityUIKitProvider.js.map +1 -1
  95. package/lib/module/core/providers/AuthProvider.js +44 -16
  96. package/lib/module/core/providers/AuthProvider.js.map +1 -1
  97. package/lib/module/core/routes/AmityUIKitNavigator.js +23 -1
  98. package/lib/module/core/routes/AmityUIKitNavigator.js.map +1 -1
  99. package/lib/module/social/components/PollContent/PollOption.js +12 -12
  100. package/lib/module/social/components/PollContent/PollOption.js.map +1 -1
  101. package/lib/module/social/components/PostMenu/index.js +10 -3
  102. package/lib/module/social/components/PostMenu/index.js.map +1 -1
  103. package/lib/module/social/components/Social/CommentList/CommentList.js +6 -1
  104. package/lib/module/social/components/Social/CommentList/CommentList.js.map +1 -1
  105. package/lib/module/social/components/Social/CommentListItem/CommentListItem.js +24 -6
  106. package/lib/module/social/components/Social/CommentListItem/CommentListItem.js.map +1 -1
  107. package/lib/module/social/components/Social/CommentListItem/styles.js +3 -2
  108. package/lib/module/social/components/Social/CommentListItem/styles.js.map +1 -1
  109. package/lib/module/social/components/legacy/Social/ReplyCommentList/index.js +14 -2
  110. package/lib/module/social/components/legacy/Social/ReplyCommentList/index.js.map +1 -1
  111. package/lib/module/social/elements/CommunityCreatePostButton/CommunityCreatePostButton.js +3 -1
  112. package/lib/module/social/elements/CommunityCreatePostButton/CommunityCreatePostButton.js.map +1 -1
  113. package/lib/module/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.js +7 -2
  114. package/lib/module/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.js.map +1 -1
  115. package/lib/module/social/features/comment/components/PostComment/CommentListItem/CommentListItem.js +18 -4
  116. package/lib/module/social/features/comment/components/PostComment/CommentListItem/CommentListItem.js.map +1 -1
  117. package/lib/module/social/features/comment/components/PostComment/ReplyCommentList/index.js +17 -3
  118. package/lib/module/social/features/comment/components/PostComment/ReplyCommentList/index.js.map +1 -1
  119. package/lib/module/social/features/comment/components/PostComment/ReplyCommentList/styles.js +8 -0
  120. package/lib/module/social/features/comment/components/PostComment/ReplyCommentList/styles.js.map +1 -1
  121. package/lib/module/social/features/feed/components/TopNavigation/TopNavigation.js +5 -1
  122. package/lib/module/social/features/feed/components/TopNavigation/TopNavigation.js.map +1 -1
  123. package/lib/module/social/features/livestream/Player/Player.js +9 -6
  124. package/lib/module/social/features/livestream/Player/Player.js.map +1 -1
  125. package/lib/module/social/features/post/Detail/index.js +6 -2
  126. package/lib/module/social/features/post/Detail/index.js.map +1 -1
  127. package/lib/module/social/features/post/components/EngagementActions/Components/DetailStyle.js +17 -11
  128. package/lib/module/social/features/post/components/EngagementActions/Components/DetailStyle.js.map +1 -1
  129. package/lib/module/social/features/post/components/EngagementActions/Components/FeedStyle.js +18 -10
  130. package/lib/module/social/features/post/components/EngagementActions/Components/FeedStyle.js.map +1 -1
  131. package/lib/module/social/features/story/View/components/AmityViewStoryItem.js +20 -22
  132. package/lib/module/social/features/story/View/components/AmityViewStoryItem.js.map +1 -1
  133. package/lib/module/social/features/user/Profile/components/Header/hooks/useHeader.js +29 -20
  134. package/lib/module/social/features/user/Profile/components/Header/hooks/useHeader.js.map +1 -1
  135. package/lib/module/social/features/user/Profile/components/Header/styles.js +2 -0
  136. package/lib/module/social/features/user/Profile/components/Header/styles.js.map +1 -1
  137. package/lib/module/social/features/user/Profile/elements/Menu/hooks/useMenu.js +16 -4
  138. package/lib/module/social/features/user/Profile/elements/Menu/hooks/useMenu.js.map +1 -1
  139. package/lib/module/social/features/visitor/UsageLimit/UsageLimit.js +40 -0
  140. package/lib/module/social/features/visitor/UsageLimit/UsageLimit.js.map +1 -0
  141. package/lib/module/social/features/visitor/UsageLimit/hooks/index.js +2 -0
  142. package/lib/module/social/features/visitor/UsageLimit/hooks/index.js.map +1 -0
  143. package/lib/module/social/features/visitor/UsageLimit/hooks/useUsageLimit.js +47 -0
  144. package/lib/module/social/features/visitor/UsageLimit/hooks/useUsageLimit.js.map +1 -0
  145. package/lib/module/social/features/visitor/UsageLimit/index.js +2 -0
  146. package/lib/module/social/features/visitor/UsageLimit/index.js.map +1 -0
  147. package/lib/module/social/features/visitor/UsageLimit/styles.js +45 -0
  148. package/lib/module/social/features/visitor/UsageLimit/styles.js.map +1 -0
  149. package/lib/module/social/hooks/index.js +2 -0
  150. package/lib/module/social/hooks/index.js.map +1 -1
  151. package/lib/module/social/hooks/useGlobalBehavior.js +36 -0
  152. package/lib/module/social/hooks/useGlobalBehavior.js.map +1 -0
  153. package/lib/module/social/hooks/useInteractionBehavior.js +43 -0
  154. package/lib/module/social/hooks/useInteractionBehavior.js.map +1 -0
  155. package/lib/module/social/hooks/usePostPermission.js +4 -2
  156. package/lib/module/social/hooks/usePostPermission.js.map +1 -1
  157. package/lib/module/social/hooks/useStoryPermission.js +3 -2
  158. package/lib/module/social/hooks/useStoryPermission.js.map +1 -1
  159. package/lib/module/social/providers/BehaviourProvider.js +1 -0
  160. package/lib/module/social/providers/BehaviourProvider.js.map +1 -1
  161. package/lib/module/social/screens/CommunityProfile/components/Header/Header.js +10 -3
  162. package/lib/module/social/screens/CommunityProfile/components/Header/Header.js.map +1 -1
  163. package/lib/module/social/screens/SocialHomePage/index.js +25 -8
  164. package/lib/module/social/screens/SocialHomePage/index.js.map +1 -1
  165. package/lib/module/social/screens/VisitorUsageLimit/VisitorUsageLimit.js +5 -0
  166. package/lib/module/social/screens/VisitorUsageLimit/VisitorUsageLimit.js.map +1 -0
  167. package/lib/module/social/screens/VisitorUsageLimit/index.js +2 -0
  168. package/lib/module/social/screens/VisitorUsageLimit/index.js.map +1 -0
  169. package/lib/typescript/core/assets/icons/index.d.ts +1 -0
  170. package/lib/typescript/core/assets/icons/index.d.ts.map +1 -1
  171. package/lib/typescript/core/assets/icons/visitorLimit.d.ts +3 -0
  172. package/lib/typescript/core/assets/icons/visitorLimit.d.ts.map +1 -0
  173. package/lib/typescript/core/constants/index.d.ts +10 -0
  174. package/lib/typescript/core/constants/index.d.ts.map +1 -1
  175. package/lib/typescript/core/hooks/useAuth.d.ts.map +1 -1
  176. package/lib/typescript/core/providers/AmityUIKitProvider.d.ts +7 -2
  177. package/lib/typescript/core/providers/AmityUIKitProvider.d.ts.map +1 -1
  178. package/lib/typescript/core/providers/AuthProvider.d.ts.map +1 -1
  179. package/lib/typescript/core/routes/AmityUIKitNavigator.d.ts.map +1 -1
  180. package/lib/typescript/core/types/auth.d.ts +2 -0
  181. package/lib/typescript/core/types/auth.d.ts.map +1 -1
  182. package/lib/typescript/core/types/behaviour.d.ts +6 -0
  183. package/lib/typescript/core/types/behaviour.d.ts.map +1 -1
  184. package/lib/typescript/social/components/PollContent/PollOption.d.ts.map +1 -1
  185. package/lib/typescript/social/components/PostMenu/index.d.ts.map +1 -1
  186. package/lib/typescript/social/components/Social/CommentList/CommentList.d.ts.map +1 -1
  187. package/lib/typescript/social/components/Social/CommentListItem/CommentListItem.d.ts.map +1 -1
  188. package/lib/typescript/social/components/Social/CommentListItem/styles.d.ts +2 -1
  189. package/lib/typescript/social/components/Social/CommentListItem/styles.d.ts.map +1 -1
  190. package/lib/typescript/social/components/legacy/Social/ReplyCommentList/index.d.ts.map +1 -1
  191. package/lib/typescript/social/elements/CommunityCreatePostButton/CommunityCreatePostButton.d.ts.map +1 -1
  192. package/lib/typescript/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.d.ts.map +1 -1
  193. package/lib/typescript/social/features/comment/components/PostComment/CommentListItem/CommentListItem.d.ts.map +1 -1
  194. package/lib/typescript/social/features/comment/components/PostComment/ReplyCommentList/index.d.ts.map +1 -1
  195. package/lib/typescript/social/features/comment/components/PostComment/ReplyCommentList/styles.d.ts +8 -0
  196. package/lib/typescript/social/features/comment/components/PostComment/ReplyCommentList/styles.d.ts.map +1 -1
  197. package/lib/typescript/social/features/feed/components/TopNavigation/TopNavigation.d.ts.map +1 -1
  198. package/lib/typescript/social/features/livestream/Player/Player.d.ts.map +1 -1
  199. package/lib/typescript/social/features/post/Detail/index.d.ts.map +1 -1
  200. package/lib/typescript/social/features/post/components/EngagementActions/Components/DetailStyle.d.ts.map +1 -1
  201. package/lib/typescript/social/features/post/components/EngagementActions/Components/FeedStyle.d.ts.map +1 -1
  202. package/lib/typescript/social/features/story/View/components/AmityViewStoryItem.d.ts.map +1 -1
  203. package/lib/typescript/social/features/user/Profile/components/Header/hooks/useHeader.d.ts +2 -0
  204. package/lib/typescript/social/features/user/Profile/components/Header/hooks/useHeader.d.ts.map +1 -1
  205. package/lib/typescript/social/features/user/Profile/components/Header/styles.d.ts +2 -0
  206. package/lib/typescript/social/features/user/Profile/components/Header/styles.d.ts.map +1 -1
  207. package/lib/typescript/social/features/user/Profile/elements/Menu/hooks/useMenu.d.ts.map +1 -1
  208. package/lib/typescript/social/features/visitor/UsageLimit/UsageLimit.d.ts +2 -0
  209. package/lib/typescript/social/features/visitor/UsageLimit/UsageLimit.d.ts.map +1 -0
  210. package/lib/typescript/social/features/visitor/UsageLimit/hooks/index.d.ts +2 -0
  211. package/lib/typescript/social/features/visitor/UsageLimit/hooks/index.d.ts.map +1 -0
  212. package/lib/typescript/social/features/visitor/UsageLimit/hooks/useUsageLimit.d.ts +40 -0
  213. package/lib/typescript/social/features/visitor/UsageLimit/hooks/useUsageLimit.d.ts.map +1 -0
  214. package/lib/typescript/social/features/visitor/UsageLimit/index.d.ts +2 -0
  215. package/lib/typescript/social/features/visitor/UsageLimit/index.d.ts.map +1 -0
  216. package/lib/typescript/social/features/visitor/UsageLimit/styles.d.ts +40 -0
  217. package/lib/typescript/social/features/visitor/UsageLimit/styles.d.ts.map +1 -0
  218. package/lib/typescript/social/hooks/index.d.ts +2 -0
  219. package/lib/typescript/social/hooks/index.d.ts.map +1 -1
  220. package/lib/typescript/social/hooks/useGlobalBehavior.d.ts +16 -0
  221. package/lib/typescript/social/hooks/useGlobalBehavior.d.ts.map +1 -0
  222. package/lib/typescript/social/hooks/useInteractionBehavior.d.ts +11 -0
  223. package/lib/typescript/social/hooks/useInteractionBehavior.d.ts.map +1 -0
  224. package/lib/typescript/social/hooks/usePostPermission.d.ts.map +1 -1
  225. package/lib/typescript/social/hooks/useStoryPermission.d.ts.map +1 -1
  226. package/lib/typescript/social/providers/BehaviourProvider.d.ts.map +1 -1
  227. package/lib/typescript/social/screens/CommunityProfile/components/Header/Header.d.ts.map +1 -1
  228. package/lib/typescript/social/screens/SocialHomePage/index.d.ts.map +1 -1
  229. package/lib/typescript/social/screens/VisitorUsageLimit/VisitorUsageLimit.d.ts +2 -0
  230. package/lib/typescript/social/screens/VisitorUsageLimit/VisitorUsageLimit.d.ts.map +1 -0
  231. package/lib/typescript/social/screens/VisitorUsageLimit/index.d.ts +2 -0
  232. package/lib/typescript/social/screens/VisitorUsageLimit/index.d.ts.map +1 -0
  233. package/package.json +3 -3
  234. package/src/core/assets/icons/index.ts +1 -0
  235. package/src/core/assets/icons/visitorLimit.tsx +19 -0
  236. package/src/core/constants/index.ts +15 -0
  237. package/src/core/hooks/useAuth.ts +4 -0
  238. package/src/core/providers/AmityUIKitProvider.tsx +28 -3
  239. package/src/core/providers/AuthProvider.tsx +34 -11
  240. package/src/core/routes/AmityUIKitNavigator.tsx +26 -1
  241. package/src/core/types/auth.ts +2 -0
  242. package/src/core/types/behaviour.ts +6 -0
  243. package/src/social/components/PollContent/PollOption.tsx +13 -19
  244. package/src/social/components/PostMenu/index.tsx +6 -3
  245. package/src/social/components/Social/CommentList/CommentList.tsx +4 -1
  246. package/src/social/components/Social/CommentListItem/CommentListItem.tsx +69 -55
  247. package/src/social/components/Social/CommentListItem/styles.ts +2 -1
  248. package/src/social/components/legacy/Social/ReplyCommentList/index.tsx +15 -5
  249. package/src/social/elements/CommunityCreatePostButton/CommunityCreatePostButton.tsx +7 -1
  250. package/src/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.tsx +10 -2
  251. package/src/social/features/comment/components/PostComment/CommentListItem/CommentListItem.tsx +17 -10
  252. package/src/social/features/comment/components/PostComment/ReplyCommentList/index.tsx +15 -5
  253. package/src/social/features/comment/components/PostComment/ReplyCommentList/styles.ts +8 -0
  254. package/src/social/features/feed/components/TopNavigation/TopNavigation.tsx +3 -1
  255. package/src/social/features/livestream/Player/Player.tsx +10 -7
  256. package/src/social/features/post/Detail/index.tsx +5 -2
  257. package/src/social/features/post/components/EngagementActions/Components/DetailStyle.tsx +19 -14
  258. package/src/social/features/post/components/EngagementActions/Components/FeedStyle.tsx +20 -12
  259. package/src/social/features/story/View/components/AmityViewStoryItem.tsx +21 -22
  260. package/src/social/features/user/Profile/components/Header/hooks/useHeader.ts +27 -20
  261. package/src/social/features/user/Profile/components/Header/styles.ts +2 -0
  262. package/src/social/features/user/Profile/elements/Menu/hooks/useMenu.ts +16 -4
  263. package/src/social/features/visitor/UsageLimit/UsageLimit.tsx +43 -0
  264. package/src/social/features/visitor/UsageLimit/hooks/index.ts +1 -0
  265. package/src/social/features/visitor/UsageLimit/hooks/useUsageLimit.ts +46 -0
  266. package/src/social/features/visitor/UsageLimit/index.ts +1 -0
  267. package/src/social/features/visitor/UsageLimit/styles.ts +45 -0
  268. package/src/social/hooks/index.ts +2 -0
  269. package/src/social/hooks/useGlobalBehavior.ts +33 -0
  270. package/src/social/hooks/useInteractionBehavior.ts +47 -0
  271. package/src/social/hooks/usePostPermission.ts +3 -1
  272. package/src/social/hooks/useStoryPermission.ts +8 -6
  273. package/src/social/providers/BehaviourProvider.tsx +1 -0
  274. package/src/social/screens/CommunityProfile/components/Header/Header.tsx +8 -2
  275. package/src/social/screens/SocialHomePage/index.tsx +45 -17
  276. package/src/social/screens/VisitorUsageLimit/VisitorUsageLimit.tsx +5 -0
  277. package/src/social/screens/VisitorUsageLimit/index.ts +1 -0
@@ -0,0 +1,45 @@
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
+ maxWidth: 252,
25
+ textAlign: 'center',
26
+ color: theme.colors.baseShade3,
27
+ },
28
+ subtitle: {
29
+ maxWidth: 252,
30
+ textAlign: 'center',
31
+ color: theme.colors.baseShade3,
32
+ },
33
+ signInButton: {
34
+ marginTop: 16,
35
+ borderRadius: 8,
36
+ paddingVertical: 10,
37
+ paddingHorizontal: 16,
38
+ },
39
+ signInText: {
40
+ color: theme.colors.primary,
41
+ },
42
+ });
43
+
44
+ return { styles, theme };
45
+ };
@@ -35,3 +35,5 @@ export * from './usePostSubscription';
35
35
  export * from './useRoomSubscription';
36
36
  export * from './queries/useFlagPost';
37
37
  export * from './queries/useClosePoll';
38
+ export * from './useGlobalBehavior';
39
+ export * from './useInteractionBehavior';
@@ -0,0 +1,33 @@
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 {
6
+ VISITOR_USER_ACTION_TOAST,
7
+ VISITOR_TOAST_DURATION,
8
+ } from '../../core/constants';
9
+
10
+ export const useGlobalBehavior = () => {
11
+ const { showToast } = useToast();
12
+ const { isVisitorOrBot } = useAuth();
13
+ const { AmityGlobalBehaviour } = useBehaviour();
14
+
15
+ const handleGlobalBehavior = useCallback(
16
+ ({ defaultBehavior }: { defaultBehavior?: () => void }) => {
17
+ if (isVisitorOrBot) {
18
+ if (AmityGlobalBehaviour?.handleVisitorUserAction) {
19
+ return AmityGlobalBehaviour.handleVisitorUserAction();
20
+ }
21
+ return showToast({
22
+ message: VISITOR_USER_ACTION_TOAST,
23
+ type: 'informative',
24
+ duration: VISITOR_TOAST_DURATION,
25
+ });
26
+ }
27
+ return defaultBehavior?.();
28
+ },
29
+ [isVisitorOrBot, AmityGlobalBehaviour, showToast]
30
+ );
31
+
32
+ return { handleGlobalBehavior, isVisitorOrBot };
33
+ };
@@ -0,0 +1,47 @@
1
+ import { useCallback } from 'react';
2
+ import { useBehaviour } from '../providers/BehaviourProvider';
3
+ import { useToast } from '../../core/stores/slices/toastSlice';
4
+ import { useGlobalBehavior } from './useGlobalBehavior';
5
+ import {
6
+ NON_MEMBER_ACTION_TOAST,
7
+ VISITOR_TOAST_DURATION,
8
+ } from '../../core/constants';
9
+
10
+ type HandleInteractionParams = {
11
+ defaultBehavior?: () => void;
12
+ allowNonMember?: boolean;
13
+ isJoined?: boolean;
14
+ };
15
+
16
+ export const useInteractionBehavior = () => {
17
+ const { showToast } = useToast();
18
+ const { AmityGlobalBehaviour } = useBehaviour();
19
+ const { handleGlobalBehavior, isVisitorOrBot } = useGlobalBehavior();
20
+
21
+ const handleInteraction = useCallback(
22
+ ({
23
+ defaultBehavior,
24
+ allowNonMember,
25
+ isJoined,
26
+ }: HandleInteractionParams) => {
27
+ handleGlobalBehavior({
28
+ defaultBehavior: () => {
29
+ if (allowNonMember || isJoined) {
30
+ return defaultBehavior?.();
31
+ }
32
+ if (AmityGlobalBehaviour?.handleNonMemberAction) {
33
+ return AmityGlobalBehaviour.handleNonMemberAction();
34
+ }
35
+ return showToast({
36
+ message: NON_MEMBER_ACTION_TOAST,
37
+ type: 'informative',
38
+ duration: VISITOR_TOAST_DURATION,
39
+ });
40
+ },
41
+ });
42
+ },
43
+ [handleGlobalBehavior, AmityGlobalBehaviour, showToast]
44
+ );
45
+
46
+ return { handleInteraction, isVisitorOrBot };
47
+ };
@@ -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 = !communityId
14
- ? socialSettings?.story?.allowAllUserToCreateStory
15
- : socialSettings?.story?.allowAllUserToCreateStory ||
16
- isGlobalAdmin ||
17
- checkStoryPermission(client, communityId);
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
  }
@@ -14,6 +14,7 @@ export const BehaviourProvider = ({
14
14
  }: IBehavioudProviderProps) => {
15
15
  const defaultBehaviour = useMemo(
16
16
  () => ({
17
+ AmityGlobalBehaviour: {},
17
18
  AmitySocialHomePageBehaviour: {},
18
19
  AmityGlobalFeedComponentBehavior: {},
19
20
  AmityPostContentComponentBehavior: {},
@@ -6,6 +6,7 @@ import {
6
6
  useCommunity,
7
7
  isModerator,
8
8
  useUser,
9
+ useGlobalBehavior,
9
10
  } from '../../../../hooks';
10
11
  import { useStyles } from './styles';
11
12
  import { CommunityCover } from '../../elements/CommunityCover/CommunityCover';
@@ -50,6 +51,7 @@ const AmityCommunityHeaderComponent: FC<AmityCommunityHeaderComponentProps> = ({
50
51
  const client = Client.getActiveClient();
51
52
  const navigation =
52
53
  useNavigation<NativeStackNavigationProp<RootStackParamList>>();
54
+ const { handleGlobalBehavior } = useGlobalBehavior();
53
55
  const componentId = ComponentID.community_header;
54
56
  const { community } = useCommunity(communityId);
55
57
  const { posts: pendingPosts } = usePosts({
@@ -153,8 +155,12 @@ const AmityCommunityHeaderComponent: FC<AmityCommunityHeaderComponentProps> = ({
153
155
  community={community}
154
156
  style={styles.infoWrap}
155
157
  onPress={() => {
156
- navigation.navigate('CommunityMembership', {
157
- community: community,
158
+ handleGlobalBehavior({
159
+ defaultBehavior: () => {
160
+ navigation.navigate('CommunityMembership', {
161
+ community: community,
162
+ });
163
+ },
158
164
  });
159
165
  }}
160
166
  />
@@ -1,8 +1,8 @@
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
- import { useUiKitConfig } from '../../hooks';
5
+ import { useAmityElement, useUiKitConfig } from '../../hooks';
6
6
  import { ComponentID, ElementID, PageID } from '../../enums/enumUIKitID';
7
7
  import { useTheme } from 'react-native-paper';
8
8
  import { useBehaviour } from '../../providers/BehaviourProvider';
@@ -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,9 +52,29 @@ const AmitySocialHomePage = () => {
52
52
  keys: ['text'],
53
53
  }) as string[];
54
54
 
55
+ const { isExcluded: isExploreExcluded } = useAmityElement({
56
+ pageId: PageID.social_home_page,
57
+ componentId: ComponentID.WildCardComponent,
58
+ elementId: ElementID.explore_button,
59
+ });
60
+
61
+ const allTabs = [newsFeedTab, exploreTab, myCommunitiesTab, PROFILE_TAB];
62
+
63
+ const visibleTabs = isExploreExcluded
64
+ ? allTabs.filter((t) => t !== exploreTab)
65
+ : allTabs;
66
+
55
67
  const [activeTab, setActiveTab] = useState<string>(newsFeedTab);
68
+
56
69
  const visitedTabs = useRef<Set<string>>(new Set([newsFeedTab]));
57
70
 
71
+ useEffect(() => {
72
+ if (isVisitorOrBot) {
73
+ visitedTabs.current.add(exploreTab);
74
+ setActiveTab(exploreTab);
75
+ }
76
+ }, [isVisitorOrBot, exploreTab]);
77
+
58
78
  const onTabChange = useCallback(
59
79
  (tabName: string) => {
60
80
  if (AmitySocialHomePageBehaviour?.onChooseTab)
@@ -74,6 +94,8 @@ const AmitySocialHomePage = () => {
74
94
  display: activeTab === tab ? ('flex' as const) : ('none' as const),
75
95
  });
76
96
 
97
+ const tabNames = isVisitorOrBot ? [exploreTab] : visibleTabs;
98
+
77
99
  return (
78
100
  <SafeAreaView
79
101
  testID="social_home_page"
@@ -82,24 +104,30 @@ const AmitySocialHomePage = () => {
82
104
  style={styles.container}
83
105
  >
84
106
  <AmitySocialHomeTopNavigationComponent activeTab={activeTab} />
85
- <CustomSocialTab
86
- activeTab={activeTab}
87
- onTabChange={onTabChange}
88
- tabNames={[newsFeedTab, exploreTab, myCommunitiesTab, PROFILE_TAB]}
89
- />
90
- <Divider />
91
- <View style={tabStyle(newsFeedTab)}>
92
- <AmityNewsFeedComponent
93
- pageId={PageID.social_home_page}
94
- onPressExploreCommunity={onPressExploreCommunity}
95
- />
96
- </View>
107
+ {tabNames.length > 1 && (
108
+ <>
109
+ <CustomSocialTab
110
+ activeTab={activeTab}
111
+ onTabChange={onTabChange}
112
+ tabNames={tabNames}
113
+ />
114
+ <Divider />
115
+ </>
116
+ )}
117
+ {!isVisitorOrBot && (
118
+ <View style={tabStyle(newsFeedTab)}>
119
+ <AmityNewsFeedComponent
120
+ pageId={PageID.social_home_page}
121
+ onPressExploreCommunity={onPressExploreCommunity}
122
+ />
123
+ </View>
124
+ )}
97
125
  {visitedTabs.current.has(exploreTab) && (
98
126
  <View style={tabStyle(exploreTab)}>
99
127
  <AmityExploreComponent pageId={PageID.social_home_page} />
100
128
  </View>
101
129
  )}
102
- {visitedTabs.current.has(myCommunitiesTab) && (
130
+ {!isVisitorOrBot && visitedTabs.current.has(myCommunitiesTab) && (
103
131
  <View style={tabStyle(myCommunitiesTab)}>
104
132
  <AmityMyCommunitiesComponent
105
133
  pageId={PageID.social_home_page}
@@ -107,7 +135,7 @@ const AmitySocialHomePage = () => {
107
135
  />
108
136
  </View>
109
137
  )}
110
- {visitedTabs.current.has(PROFILE_TAB) && (
138
+ {!isVisitorOrBot && visitedTabs.current.has(PROFILE_TAB) && (
111
139
  <View style={tabStyle(PROFILE_TAB)}>
112
140
  <UserProfile inline stickyTab={false} userId={client?.userId ?? ''} />
113
141
  </View>
@@ -0,0 +1,5 @@
1
+ import { UsageLimit } from '../../features/visitor/UsageLimit';
2
+
3
+ export function VisitorUsageLimit() {
4
+ return <UsageLimit />;
5
+ }
@@ -0,0 +1 @@
1
+ export { VisitorUsageLimit } from './VisitorUsageLimit';