@amityco/react-native-social-uikit 4.0.2-f1fd1fbd.0 → 4.1.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 (269) 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.map +1 -1
  10. package/lib/commonjs/core/providers/AuthProvider.js +44 -21
  11. package/lib/commonjs/core/providers/AuthProvider.js.map +1 -1
  12. package/lib/commonjs/core/routes/AmityUIKitNavigator.js +23 -1
  13. package/lib/commonjs/core/routes/AmityUIKitNavigator.js.map +1 -1
  14. package/lib/commonjs/social/components/PollContent/PollOption.js +12 -12
  15. package/lib/commonjs/social/components/PollContent/PollOption.js.map +1 -1
  16. package/lib/commonjs/social/components/PostMenu/index.js +9 -2
  17. package/lib/commonjs/social/components/PostMenu/index.js.map +1 -1
  18. package/lib/commonjs/social/components/Social/CommentList/CommentList.js +6 -1
  19. package/lib/commonjs/social/components/Social/CommentList/CommentList.js.map +1 -1
  20. package/lib/commonjs/social/components/Social/CommentListItem/CommentListItem.js +24 -6
  21. package/lib/commonjs/social/components/Social/CommentListItem/CommentListItem.js.map +1 -1
  22. package/lib/commonjs/social/components/Social/CommentListItem/styles.js +3 -2
  23. package/lib/commonjs/social/components/Social/CommentListItem/styles.js.map +1 -1
  24. package/lib/commonjs/social/components/legacy/Social/ReplyCommentList/index.js +14 -2
  25. package/lib/commonjs/social/components/legacy/Social/ReplyCommentList/index.js.map +1 -1
  26. package/lib/commonjs/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.js +6 -1
  27. package/lib/commonjs/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.js.map +1 -1
  28. package/lib/commonjs/social/features/comment/components/PostComment/CommentListItem/CommentListItem.js +17 -3
  29. package/lib/commonjs/social/features/comment/components/PostComment/CommentListItem/CommentListItem.js.map +1 -1
  30. package/lib/commonjs/social/features/comment/components/PostComment/ReplyCommentList/index.js +17 -3
  31. package/lib/commonjs/social/features/comment/components/PostComment/ReplyCommentList/index.js.map +1 -1
  32. package/lib/commonjs/social/features/comment/components/PostComment/ReplyCommentList/styles.js +8 -0
  33. package/lib/commonjs/social/features/comment/components/PostComment/ReplyCommentList/styles.js.map +1 -1
  34. package/lib/commonjs/social/features/feed/components/TopNavigation/TopNavigation.js +5 -1
  35. package/lib/commonjs/social/features/feed/components/TopNavigation/TopNavigation.js.map +1 -1
  36. package/lib/commonjs/social/features/livestream/Player/Player.js +9 -6
  37. package/lib/commonjs/social/features/livestream/Player/Player.js.map +1 -1
  38. package/lib/commonjs/social/features/post/Detail/index.js +6 -2
  39. package/lib/commonjs/social/features/post/Detail/index.js.map +1 -1
  40. package/lib/commonjs/social/features/post/components/EngagementActions/Components/DetailStyle.js +16 -10
  41. package/lib/commonjs/social/features/post/components/EngagementActions/Components/DetailStyle.js.map +1 -1
  42. package/lib/commonjs/social/features/post/components/EngagementActions/Components/FeedStyle.js +17 -9
  43. package/lib/commonjs/social/features/post/components/EngagementActions/Components/FeedStyle.js.map +1 -1
  44. package/lib/commonjs/social/features/story/View/components/AmityViewStoryItem.js +19 -21
  45. package/lib/commonjs/social/features/story/View/components/AmityViewStoryItem.js.map +1 -1
  46. package/lib/commonjs/social/features/user/Profile/components/Header/hooks/useHeader.js +28 -19
  47. package/lib/commonjs/social/features/user/Profile/components/Header/hooks/useHeader.js.map +1 -1
  48. package/lib/commonjs/social/features/user/Profile/components/Header/styles.js +2 -0
  49. package/lib/commonjs/social/features/user/Profile/components/Header/styles.js.map +1 -1
  50. package/lib/commonjs/social/features/user/Profile/elements/Menu/hooks/useMenu.js +15 -4
  51. package/lib/commonjs/social/features/user/Profile/elements/Menu/hooks/useMenu.js.map +1 -1
  52. package/lib/commonjs/social/features/visitor/UsageLimit/UsageLimit.js +46 -0
  53. package/lib/commonjs/social/features/visitor/UsageLimit/UsageLimit.js.map +1 -0
  54. package/lib/commonjs/social/features/visitor/UsageLimit/hooks/index.js +13 -0
  55. package/lib/commonjs/social/features/visitor/UsageLimit/hooks/index.js.map +1 -0
  56. package/lib/commonjs/social/features/visitor/UsageLimit/hooks/useUsageLimit.js +54 -0
  57. package/lib/commonjs/social/features/visitor/UsageLimit/hooks/useUsageLimit.js.map +1 -0
  58. package/lib/commonjs/social/features/visitor/UsageLimit/index.js +13 -0
  59. package/lib/commonjs/social/features/visitor/UsageLimit/index.js.map +1 -0
  60. package/lib/commonjs/social/features/visitor/UsageLimit/styles.js +52 -0
  61. package/lib/commonjs/social/features/visitor/UsageLimit/styles.js.map +1 -0
  62. package/lib/commonjs/social/hooks/index.js +22 -0
  63. package/lib/commonjs/social/hooks/index.js.map +1 -1
  64. package/lib/commonjs/social/hooks/useGlobalBehavior.js +44 -0
  65. package/lib/commonjs/social/hooks/useGlobalBehavior.js.map +1 -0
  66. package/lib/commonjs/social/hooks/useInteractionBehavior.js +50 -0
  67. package/lib/commonjs/social/hooks/useInteractionBehavior.js.map +1 -0
  68. package/lib/commonjs/social/hooks/usePostPermission.js +4 -2
  69. package/lib/commonjs/social/hooks/usePostPermission.js.map +1 -1
  70. package/lib/commonjs/social/hooks/useStoryPermission.js +3 -2
  71. package/lib/commonjs/social/hooks/useStoryPermission.js.map +1 -1
  72. package/lib/commonjs/social/providers/BehaviourProvider.js +1 -0
  73. package/lib/commonjs/social/providers/BehaviourProvider.js.map +1 -1
  74. package/lib/commonjs/social/screens/CommunityProfile/components/Header/Header.js +9 -2
  75. package/lib/commonjs/social/screens/CommunityProfile/components/Header/Header.js.map +1 -1
  76. package/lib/commonjs/social/screens/SocialHomePage/index.js +14 -6
  77. package/lib/commonjs/social/screens/SocialHomePage/index.js.map +1 -1
  78. package/lib/commonjs/social/screens/VisitorUsageLimit/VisitorUsageLimit.js +11 -0
  79. package/lib/commonjs/social/screens/VisitorUsageLimit/VisitorUsageLimit.js.map +1 -0
  80. package/lib/commonjs/social/screens/VisitorUsageLimit/index.js +13 -0
  81. package/lib/commonjs/social/screens/VisitorUsageLimit/index.js.map +1 -0
  82. package/lib/module/core/assets/icons/index.js +1 -0
  83. package/lib/module/core/assets/icons/index.js.map +1 -1
  84. package/lib/module/core/assets/icons/visitorLimit.js +19 -0
  85. package/lib/module/core/assets/icons/visitorLimit.js.map +1 -0
  86. package/lib/module/core/constants/index.js +10 -0
  87. package/lib/module/core/constants/index.js.map +1 -1
  88. package/lib/module/core/hooks/useAuth.js +6 -2
  89. package/lib/module/core/hooks/useAuth.js.map +1 -1
  90. package/lib/module/core/providers/AmityUIKitProvider.js.map +1 -1
  91. package/lib/module/core/providers/AuthProvider.js +44 -21
  92. package/lib/module/core/providers/AuthProvider.js.map +1 -1
  93. package/lib/module/core/routes/AmityUIKitNavigator.js +23 -1
  94. package/lib/module/core/routes/AmityUIKitNavigator.js.map +1 -1
  95. package/lib/module/social/components/PollContent/PollOption.js +12 -12
  96. package/lib/module/social/components/PollContent/PollOption.js.map +1 -1
  97. package/lib/module/social/components/PostMenu/index.js +10 -3
  98. package/lib/module/social/components/PostMenu/index.js.map +1 -1
  99. package/lib/module/social/components/Social/CommentList/CommentList.js +6 -1
  100. package/lib/module/social/components/Social/CommentList/CommentList.js.map +1 -1
  101. package/lib/module/social/components/Social/CommentListItem/CommentListItem.js +24 -6
  102. package/lib/module/social/components/Social/CommentListItem/CommentListItem.js.map +1 -1
  103. package/lib/module/social/components/Social/CommentListItem/styles.js +3 -2
  104. package/lib/module/social/components/Social/CommentListItem/styles.js.map +1 -1
  105. package/lib/module/social/components/legacy/Social/ReplyCommentList/index.js +14 -2
  106. package/lib/module/social/components/legacy/Social/ReplyCommentList/index.js.map +1 -1
  107. package/lib/module/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.js +7 -2
  108. package/lib/module/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.js.map +1 -1
  109. package/lib/module/social/features/comment/components/PostComment/CommentListItem/CommentListItem.js +18 -4
  110. package/lib/module/social/features/comment/components/PostComment/CommentListItem/CommentListItem.js.map +1 -1
  111. package/lib/module/social/features/comment/components/PostComment/ReplyCommentList/index.js +17 -3
  112. package/lib/module/social/features/comment/components/PostComment/ReplyCommentList/index.js.map +1 -1
  113. package/lib/module/social/features/comment/components/PostComment/ReplyCommentList/styles.js +8 -0
  114. package/lib/module/social/features/comment/components/PostComment/ReplyCommentList/styles.js.map +1 -1
  115. package/lib/module/social/features/feed/components/TopNavigation/TopNavigation.js +5 -1
  116. package/lib/module/social/features/feed/components/TopNavigation/TopNavigation.js.map +1 -1
  117. package/lib/module/social/features/livestream/Player/Player.js +9 -6
  118. package/lib/module/social/features/livestream/Player/Player.js.map +1 -1
  119. package/lib/module/social/features/post/Detail/index.js +6 -2
  120. package/lib/module/social/features/post/Detail/index.js.map +1 -1
  121. package/lib/module/social/features/post/components/EngagementActions/Components/DetailStyle.js +17 -11
  122. package/lib/module/social/features/post/components/EngagementActions/Components/DetailStyle.js.map +1 -1
  123. package/lib/module/social/features/post/components/EngagementActions/Components/FeedStyle.js +18 -10
  124. package/lib/module/social/features/post/components/EngagementActions/Components/FeedStyle.js.map +1 -1
  125. package/lib/module/social/features/story/View/components/AmityViewStoryItem.js +20 -22
  126. package/lib/module/social/features/story/View/components/AmityViewStoryItem.js.map +1 -1
  127. package/lib/module/social/features/user/Profile/components/Header/hooks/useHeader.js +29 -20
  128. package/lib/module/social/features/user/Profile/components/Header/hooks/useHeader.js.map +1 -1
  129. package/lib/module/social/features/user/Profile/components/Header/styles.js +2 -0
  130. package/lib/module/social/features/user/Profile/components/Header/styles.js.map +1 -1
  131. package/lib/module/social/features/user/Profile/elements/Menu/hooks/useMenu.js +16 -4
  132. package/lib/module/social/features/user/Profile/elements/Menu/hooks/useMenu.js.map +1 -1
  133. package/lib/module/social/features/visitor/UsageLimit/UsageLimit.js +40 -0
  134. package/lib/module/social/features/visitor/UsageLimit/UsageLimit.js.map +1 -0
  135. package/lib/module/social/features/visitor/UsageLimit/hooks/index.js +2 -0
  136. package/lib/module/social/features/visitor/UsageLimit/hooks/index.js.map +1 -0
  137. package/lib/module/social/features/visitor/UsageLimit/hooks/useUsageLimit.js +47 -0
  138. package/lib/module/social/features/visitor/UsageLimit/hooks/useUsageLimit.js.map +1 -0
  139. package/lib/module/social/features/visitor/UsageLimit/index.js +2 -0
  140. package/lib/module/social/features/visitor/UsageLimit/index.js.map +1 -0
  141. package/lib/module/social/features/visitor/UsageLimit/styles.js +45 -0
  142. package/lib/module/social/features/visitor/UsageLimit/styles.js.map +1 -0
  143. package/lib/module/social/hooks/index.js +2 -0
  144. package/lib/module/social/hooks/index.js.map +1 -1
  145. package/lib/module/social/hooks/useGlobalBehavior.js +36 -0
  146. package/lib/module/social/hooks/useGlobalBehavior.js.map +1 -0
  147. package/lib/module/social/hooks/useInteractionBehavior.js +43 -0
  148. package/lib/module/social/hooks/useInteractionBehavior.js.map +1 -0
  149. package/lib/module/social/hooks/usePostPermission.js +4 -2
  150. package/lib/module/social/hooks/usePostPermission.js.map +1 -1
  151. package/lib/module/social/hooks/useStoryPermission.js +3 -2
  152. package/lib/module/social/hooks/useStoryPermission.js.map +1 -1
  153. package/lib/module/social/providers/BehaviourProvider.js +1 -0
  154. package/lib/module/social/providers/BehaviourProvider.js.map +1 -1
  155. package/lib/module/social/screens/CommunityProfile/components/Header/Header.js +10 -3
  156. package/lib/module/social/screens/CommunityProfile/components/Header/Header.js.map +1 -1
  157. package/lib/module/social/screens/SocialHomePage/index.js +15 -7
  158. package/lib/module/social/screens/SocialHomePage/index.js.map +1 -1
  159. package/lib/module/social/screens/VisitorUsageLimit/VisitorUsageLimit.js +5 -0
  160. package/lib/module/social/screens/VisitorUsageLimit/VisitorUsageLimit.js.map +1 -0
  161. package/lib/module/social/screens/VisitorUsageLimit/index.js +2 -0
  162. package/lib/module/social/screens/VisitorUsageLimit/index.js.map +1 -0
  163. package/lib/typescript/core/assets/icons/index.d.ts +1 -0
  164. package/lib/typescript/core/assets/icons/index.d.ts.map +1 -1
  165. package/lib/typescript/core/assets/icons/visitorLimit.d.ts +3 -0
  166. package/lib/typescript/core/assets/icons/visitorLimit.d.ts.map +1 -0
  167. package/lib/typescript/core/constants/index.d.ts +10 -0
  168. package/lib/typescript/core/constants/index.d.ts.map +1 -1
  169. package/lib/typescript/core/hooks/useAuth.d.ts.map +1 -1
  170. package/lib/typescript/core/providers/AmityUIKitProvider.d.ts +2 -1
  171. package/lib/typescript/core/providers/AmityUIKitProvider.d.ts.map +1 -1
  172. package/lib/typescript/core/providers/AuthProvider.d.ts.map +1 -1
  173. package/lib/typescript/core/routes/AmityUIKitNavigator.d.ts.map +1 -1
  174. package/lib/typescript/core/types/auth.d.ts +2 -0
  175. package/lib/typescript/core/types/auth.d.ts.map +1 -1
  176. package/lib/typescript/core/types/behaviour.d.ts +6 -0
  177. package/lib/typescript/core/types/behaviour.d.ts.map +1 -1
  178. package/lib/typescript/social/components/PollContent/PollOption.d.ts.map +1 -1
  179. package/lib/typescript/social/components/PostMenu/index.d.ts.map +1 -1
  180. package/lib/typescript/social/components/Social/CommentList/CommentList.d.ts.map +1 -1
  181. package/lib/typescript/social/components/Social/CommentListItem/CommentListItem.d.ts.map +1 -1
  182. package/lib/typescript/social/components/Social/CommentListItem/styles.d.ts +2 -1
  183. package/lib/typescript/social/components/Social/CommentListItem/styles.d.ts.map +1 -1
  184. package/lib/typescript/social/components/legacy/Social/ReplyCommentList/index.d.ts.map +1 -1
  185. package/lib/typescript/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.d.ts.map +1 -1
  186. package/lib/typescript/social/features/comment/components/PostComment/CommentListItem/CommentListItem.d.ts.map +1 -1
  187. package/lib/typescript/social/features/comment/components/PostComment/ReplyCommentList/index.d.ts.map +1 -1
  188. package/lib/typescript/social/features/comment/components/PostComment/ReplyCommentList/styles.d.ts +8 -0
  189. package/lib/typescript/social/features/comment/components/PostComment/ReplyCommentList/styles.d.ts.map +1 -1
  190. package/lib/typescript/social/features/feed/components/TopNavigation/TopNavigation.d.ts.map +1 -1
  191. package/lib/typescript/social/features/livestream/Player/Player.d.ts.map +1 -1
  192. package/lib/typescript/social/features/post/Detail/index.d.ts.map +1 -1
  193. package/lib/typescript/social/features/post/components/EngagementActions/Components/DetailStyle.d.ts.map +1 -1
  194. package/lib/typescript/social/features/post/components/EngagementActions/Components/FeedStyle.d.ts.map +1 -1
  195. package/lib/typescript/social/features/story/View/components/AmityViewStoryItem.d.ts.map +1 -1
  196. package/lib/typescript/social/features/user/Profile/components/Header/hooks/useHeader.d.ts +2 -0
  197. package/lib/typescript/social/features/user/Profile/components/Header/hooks/useHeader.d.ts.map +1 -1
  198. package/lib/typescript/social/features/user/Profile/components/Header/styles.d.ts +2 -0
  199. package/lib/typescript/social/features/user/Profile/components/Header/styles.d.ts.map +1 -1
  200. package/lib/typescript/social/features/user/Profile/elements/Menu/hooks/useMenu.d.ts.map +1 -1
  201. package/lib/typescript/social/features/visitor/UsageLimit/UsageLimit.d.ts +2 -0
  202. package/lib/typescript/social/features/visitor/UsageLimit/UsageLimit.d.ts.map +1 -0
  203. package/lib/typescript/social/features/visitor/UsageLimit/hooks/index.d.ts +2 -0
  204. package/lib/typescript/social/features/visitor/UsageLimit/hooks/index.d.ts.map +1 -0
  205. package/lib/typescript/social/features/visitor/UsageLimit/hooks/useUsageLimit.d.ts +40 -0
  206. package/lib/typescript/social/features/visitor/UsageLimit/hooks/useUsageLimit.d.ts.map +1 -0
  207. package/lib/typescript/social/features/visitor/UsageLimit/index.d.ts +2 -0
  208. package/lib/typescript/social/features/visitor/UsageLimit/index.d.ts.map +1 -0
  209. package/lib/typescript/social/features/visitor/UsageLimit/styles.d.ts +40 -0
  210. package/lib/typescript/social/features/visitor/UsageLimit/styles.d.ts.map +1 -0
  211. package/lib/typescript/social/hooks/index.d.ts +2 -0
  212. package/lib/typescript/social/hooks/index.d.ts.map +1 -1
  213. package/lib/typescript/social/hooks/useGlobalBehavior.d.ts +16 -0
  214. package/lib/typescript/social/hooks/useGlobalBehavior.d.ts.map +1 -0
  215. package/lib/typescript/social/hooks/useInteractionBehavior.d.ts +11 -0
  216. package/lib/typescript/social/hooks/useInteractionBehavior.d.ts.map +1 -0
  217. package/lib/typescript/social/hooks/usePostPermission.d.ts.map +1 -1
  218. package/lib/typescript/social/hooks/useStoryPermission.d.ts.map +1 -1
  219. package/lib/typescript/social/providers/BehaviourProvider.d.ts.map +1 -1
  220. package/lib/typescript/social/screens/CommunityProfile/components/Header/Header.d.ts.map +1 -1
  221. package/lib/typescript/social/screens/SocialHomePage/index.d.ts.map +1 -1
  222. package/lib/typescript/social/screens/VisitorUsageLimit/VisitorUsageLimit.d.ts +2 -0
  223. package/lib/typescript/social/screens/VisitorUsageLimit/VisitorUsageLimit.d.ts.map +1 -0
  224. package/lib/typescript/social/screens/VisitorUsageLimit/index.d.ts +2 -0
  225. package/lib/typescript/social/screens/VisitorUsageLimit/index.d.ts.map +1 -0
  226. package/package.json +3 -3
  227. package/src/core/assets/icons/index.ts +1 -0
  228. package/src/core/assets/icons/visitorLimit.tsx +19 -0
  229. package/src/core/constants/index.ts +15 -0
  230. package/src/core/hooks/useAuth.ts +4 -0
  231. package/src/core/providers/AmityUIKitProvider.tsx +2 -1
  232. package/src/core/providers/AuthProvider.tsx +35 -11
  233. package/src/core/routes/AmityUIKitNavigator.tsx +26 -1
  234. package/src/core/types/auth.ts +2 -0
  235. package/src/core/types/behaviour.ts +6 -0
  236. package/src/social/components/PollContent/PollOption.tsx +13 -19
  237. package/src/social/components/PostMenu/index.tsx +6 -3
  238. package/src/social/components/Social/CommentList/CommentList.tsx +4 -1
  239. package/src/social/components/Social/CommentListItem/CommentListItem.tsx +69 -55
  240. package/src/social/components/Social/CommentListItem/styles.ts +2 -1
  241. package/src/social/components/legacy/Social/ReplyCommentList/index.tsx +15 -5
  242. package/src/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.tsx +10 -2
  243. package/src/social/features/comment/components/PostComment/CommentListItem/CommentListItem.tsx +17 -10
  244. package/src/social/features/comment/components/PostComment/ReplyCommentList/index.tsx +15 -5
  245. package/src/social/features/comment/components/PostComment/ReplyCommentList/styles.ts +8 -0
  246. package/src/social/features/feed/components/TopNavigation/TopNavigation.tsx +3 -1
  247. package/src/social/features/livestream/Player/Player.tsx +10 -7
  248. package/src/social/features/post/Detail/index.tsx +5 -2
  249. package/src/social/features/post/components/EngagementActions/Components/DetailStyle.tsx +19 -14
  250. package/src/social/features/post/components/EngagementActions/Components/FeedStyle.tsx +20 -12
  251. package/src/social/features/story/View/components/AmityViewStoryItem.tsx +21 -22
  252. package/src/social/features/user/Profile/components/Header/hooks/useHeader.ts +27 -20
  253. package/src/social/features/user/Profile/components/Header/styles.ts +2 -0
  254. package/src/social/features/user/Profile/elements/Menu/hooks/useMenu.ts +16 -4
  255. package/src/social/features/visitor/UsageLimit/UsageLimit.tsx +43 -0
  256. package/src/social/features/visitor/UsageLimit/hooks/index.ts +1 -0
  257. package/src/social/features/visitor/UsageLimit/hooks/useUsageLimit.ts +46 -0
  258. package/src/social/features/visitor/UsageLimit/index.ts +1 -0
  259. package/src/social/features/visitor/UsageLimit/styles.ts +45 -0
  260. package/src/social/hooks/index.ts +2 -0
  261. package/src/social/hooks/useGlobalBehavior.ts +33 -0
  262. package/src/social/hooks/useInteractionBehavior.ts +47 -0
  263. package/src/social/hooks/usePostPermission.ts +3 -1
  264. package/src/social/hooks/useStoryPermission.ts +8 -6
  265. package/src/social/providers/BehaviourProvider.tsx +1 -0
  266. package/src/social/screens/CommunityProfile/components/Header/Header.tsx +8 -2
  267. package/src/social/screens/SocialHomePage/index.tsx +33 -16
  268. package/src/social/screens/VisitorUsageLimit/VisitorUsageLimit.tsx +5 -0
  269. package/src/social/screens/VisitorUsageLimit/index.ts +1 -0
@@ -8,7 +8,10 @@ import {
8
8
  } from '@amityco/ts-sdk-react-native';
9
9
  import { AmityPostEngagementActionsSubComponentType } from './type';
10
10
  import { useStyles } from './styles';
11
- import { useAmityComponent } from '../../../../../hooks';
11
+ import {
12
+ useAmityComponent,
13
+ useInteractionBehavior,
14
+ } from '../../../../../hooks';
12
15
  import { PageID, ComponentID } from '../../../../../enums';
13
16
  import { SvgXml } from 'react-native-svg';
14
17
  import { likeReaction } from '../../../../../../core/assets/icons/xml';
@@ -34,6 +37,7 @@ const DetailStyle: FC<AmityPostEngagementActionsSubComponentType> = ({
34
37
  componentId: ComponentID.post_content,
35
38
  });
36
39
  const styles = useStyles(themeStyles);
40
+ const { handleInteraction } = useInteractionBehavior();
37
41
  const [postData, setPostData] = useState<Amity.Post>(null);
38
42
 
39
43
  const { shareLink, handleSharePress } = usePostShareAction({
@@ -95,19 +99,20 @@ const DetailStyle: FC<AmityPostEngagementActionsSubComponentType> = ({
95
99
  }
96
100
  }, [isLike, postId]);
97
101
 
98
- const onClickReactions = useCallback(() => {
99
- setIsReactionListVisible(true);
100
- }, []);
102
+ const onPressReaction = useCallback(() => {
103
+ handleInteraction({
104
+ defaultBehavior: addReactionToPost,
105
+ isJoined: community ? community.isJoined : true,
106
+ });
107
+ }, [addReactionToPost, handleInteraction, community]);
101
108
 
102
- if (community && community.isJoined === false) {
103
- return (
104
- <View style={styles.actionSection}>
105
- <Text style={styles.btnText}>
106
- Join community to interact with all posts
107
- </Text>
108
- </View>
109
- );
110
- }
109
+ const onClickReactions = useCallback(() => {
110
+ handleInteraction({
111
+ defaultBehavior: () => setIsReactionListVisible(true),
112
+ allowNonMember: true,
113
+ isJoined: community?.isJoined,
114
+ });
115
+ }, [handleInteraction, community]);
111
116
 
112
117
  return (
113
118
  <>
@@ -136,7 +141,7 @@ const DetailStyle: FC<AmityPostEngagementActionsSubComponentType> = ({
136
141
  </View>
137
142
  <View style={[styles.actionSection, styles.detailActionSection]}>
138
143
  <View style={styles.row}>
139
- <TouchableOpacity onPress={addReactionToPost} style={styles.likeBtn}>
144
+ <TouchableOpacity onPress={onPressReaction} style={styles.likeBtn}>
140
145
  {isLike ? (
141
146
  <SvgXml
142
147
  xml={likeReaction(themeStyles.colors.background)}
@@ -8,7 +8,10 @@ import {
8
8
  subscribeTopic,
9
9
  } from '@amityco/ts-sdk-react-native';
10
10
  import { useStyles } from './styles';
11
- import { useAmityComponent } from '../../../../../hooks';
11
+ import {
12
+ useAmityComponent,
13
+ useInteractionBehavior,
14
+ } from '../../../../../hooks';
12
15
  import { PageID, ComponentID } from '../../../../../enums';
13
16
  import { SvgXml } from 'react-native-svg';
14
17
  import { likeReaction } from '../../../../../../core/assets/icons/xml';
@@ -38,6 +41,7 @@ const FeedStyle: FC<AmityPostEngagementActionsSubComponentType> = ({
38
41
  });
39
42
  const styles = useStyles(themeStyles);
40
43
  const { AmityGlobalFeedComponentBehavior } = useBehaviour();
44
+ const { handleInteraction } = useInteractionBehavior();
41
45
  const navigation =
42
46
  useNavigation<NativeStackNavigationProp<RootStackParamList>>();
43
47
  const [postData, setPostData] = useState<Amity.Post>(null);
@@ -81,7 +85,14 @@ const FeedStyle: FC<AmityPostEngagementActionsSubComponentType> = ({
81
85
  }
82
86
  }, [isLike, postData, postId]);
83
87
 
84
- const onPressComment = useCallback(() => {
88
+ const onPressReaction = useCallback(() => {
89
+ handleInteraction({
90
+ defaultBehavior: addReactionToPost,
91
+ isJoined: community ? community.isJoined : true,
92
+ });
93
+ }, [addReactionToPost, handleInteraction, community]);
94
+
95
+ const goToPostDetail = useCallback(() => {
85
96
  if (AmityGlobalFeedComponentBehavior.goToPostDetailPage) {
86
97
  return AmityGlobalFeedComponentBehavior.goToPostDetailPage();
87
98
  }
@@ -90,20 +101,17 @@ const FeedStyle: FC<AmityPostEngagementActionsSubComponentType> = ({
90
101
  });
91
102
  }, [AmityGlobalFeedComponentBehavior, navigation, postId]);
92
103
 
93
- if (community && community.isJoined === false) {
94
- return (
95
- <View style={styles.actionSection}>
96
- <Text style={styles.btnText}>
97
- Join community to interact with all posts
98
- </Text>
99
- </View>
100
- );
101
- }
104
+ const onPressComment = useCallback(() => {
105
+ handleInteraction({
106
+ defaultBehavior: goToPostDetail,
107
+ isJoined: community ? community.isJoined : true,
108
+ });
109
+ }, [goToPostDetail, handleInteraction, community]);
102
110
 
103
111
  return (
104
112
  <Pressable onPress={onPressComment} style={styles.actionSection}>
105
113
  <View style={styles.row}>
106
- <TouchableOpacity onPress={addReactionToPost} style={styles.likeBtn}>
114
+ <TouchableOpacity onPress={onPressReaction} style={styles.likeBtn}>
107
115
  {isLike ? (
108
116
  <SvgXml
109
117
  xml={likeReaction(themeStyles.colors.background)}
@@ -13,7 +13,11 @@ import {
13
13
  } from 'react-native';
14
14
  import LinearGradient from 'react-native-linear-gradient';
15
15
  import { FC, memo, useCallback, useRef, useState } from 'react';
16
- import { useConfigImageUri, useStory } from '../../../../hooks';
16
+ import {
17
+ useConfigImageUri,
18
+ useInteractionBehavior,
19
+ useStory,
20
+ } from '../../../../hooks';
17
21
  import { useStyles } from '../styles';
18
22
  import Video, { OnLoadData } from 'react-native-video';
19
23
  import {
@@ -40,6 +44,7 @@ import GestureRecognizer from 'react-native-swipe-gestures';
40
44
  import uiSlice from '../../../../../core/stores/slices/uiSlice';
41
45
  import { LoadingOverlay } from '../../../../components/legacy/LoadingOverlay';
42
46
  import Toast from '../../../../components/legacy/Toast/Toast';
47
+ import GlobalToast from '../../../../components/Toast';
43
48
  import { Typography } from '../../../../../core/components/Typography/Typography';
44
49
  import { useTheme } from 'react-native-paper';
45
50
  import { MyMD3Theme } from '../../../../../core/providers/AmityUIKitProvider';
@@ -87,6 +92,7 @@ const AmityViewStoryItem: FC<IAmityViewStoryItem> = ({
87
92
  const progress = useRef(new Animated.Value(0)).current;
88
93
  const sheetRef = useRef<BottomSheetMethods>(null);
89
94
  const { handleReaction } = useStory();
95
+ const { handleInteraction } = useInteractionBehavior();
90
96
  const currentStory = storyData[current];
91
97
  const storyHyperLink = currentStory?.items[0]?.data || undefined;
92
98
  const timeDifference = useTimeDifference(currentStory?.createdAt, true);
@@ -204,33 +210,24 @@ const AmityViewStoryItem: FC<IAmityViewStoryItem> = ({
204
210
  }, [progress]);
205
211
 
206
212
  const onPressReaction = useCallback(() => {
207
- if (communityData?.isJoined) {
208
- handleReaction({
209
- targetId: currentStory?.storyId,
210
- reactionName: 'like',
211
- isLiked,
212
- });
213
- setTotalReaction((prev) => (isLiked ? prev - 1 : prev + 1));
214
- setIsLiked((prev) => !prev);
215
- return;
216
- }
217
- progress.stopAnimation(() => setPressed(true));
218
- Alert.alert('Join community to interact with all stories', null, [
219
- {
220
- text: 'OK',
221
- onPress: () => {
222
- startAnimation();
223
- setPressed(false);
224
- },
213
+ handleInteraction({
214
+ defaultBehavior: () => {
215
+ handleReaction({
216
+ targetId: currentStory?.storyId,
217
+ reactionName: 'like',
218
+ isLiked,
219
+ });
220
+ setTotalReaction((prev) => (isLiked ? prev - 1 : prev + 1));
221
+ setIsLiked((prev) => !prev);
225
222
  },
226
- ]);
223
+ isJoined: communityData?.isJoined,
224
+ });
227
225
  }, [
228
226
  communityData?.isJoined,
229
227
  currentStory?.storyId,
228
+ handleInteraction,
230
229
  handleReaction,
231
230
  isLiked,
232
- progress,
233
- startAnimation,
234
231
  ]);
235
232
 
236
233
  const onCloseBottomSheet = useCallback(() => {
@@ -652,6 +649,7 @@ const AmityViewStoryItem: FC<IAmityViewStoryItem> = ({
652
649
  withAvatar={true}
653
650
  />
654
651
  </KeyboardAvoidingView>
652
+ <GlobalToast />
655
653
  </Modal>
656
654
  )}
657
655
  <BottomSheet
@@ -675,6 +673,7 @@ const AmityViewStoryItem: FC<IAmityViewStoryItem> = ({
675
673
  </BottomSheet>
676
674
  <LoadingOverlay isLoading={loading} />
677
675
  <Toast />
676
+ <GlobalToast />
678
677
  </View>
679
678
  );
680
679
  };
@@ -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
- followUser(user.userId);
60
+ handleGlobalBehavior({
61
+ defaultBehavior: () => followUser(user.userId),
62
+ });
60
63
  };
61
64
 
62
65
  const handleUnfollow = () => {
@@ -109,24 +112,28 @@ export function useHeader(user?: Amity.User) {
109
112
 
110
113
  const navigateToRelationship = (tab: UserRelationshipTab) => {
111
114
  if (!user?.userId) return;
112
- if (!isMyProfile && isPrivateNetwork && !isFollowing) {
113
- showToast({
114
- type: 'informative',
115
- message: TOAST.USER.RELATIONSHIP.FOLLOW_TO_INTERACT,
116
- });
117
- return;
118
- }
119
- if (AmityUserProfileHeaderComponentBehavior?.goToUserRelationshipPage) {
120
- AmityUserProfileHeaderComponentBehavior.goToUserRelationshipPage({
121
- userId: user.userId,
122
- selectedTab: tab,
123
- });
124
- } else {
125
- navigation.push('UserRelationship', {
126
- userId: user.userId,
127
- selectedTab: tab,
128
- });
129
- }
115
+ handleGlobalBehavior({
116
+ defaultBehavior: () => {
117
+ if (!isMyProfile && isPrivateNetwork && !isFollowing) {
118
+ showToast({
119
+ type: 'informative',
120
+ message: TOAST.USER.RELATIONSHIP.FOLLOW_TO_INTERACT,
121
+ });
122
+ return;
123
+ }
124
+ if (AmityUserProfileHeaderComponentBehavior?.goToUserRelationshipPage) {
125
+ AmityUserProfileHeaderComponentBehavior.goToUserRelationshipPage({
126
+ userId: user.userId,
127
+ selectedTab: tab,
128
+ });
129
+ } else {
130
+ navigation.push('UserRelationship', {
131
+ userId: user.userId,
132
+ selectedTab: tab,
133
+ });
134
+ }
135
+ },
136
+ });
130
137
  };
131
138
 
132
139
  return {
@@ -51,6 +51,8 @@ export const useStyles = (
51
51
  },
52
52
  hiddenText: {
53
53
  position: 'absolute',
54
+ left: 0,
55
+ right: 0,
54
56
  opacity: 0,
55
57
  },
56
58
  seeMore: {
@@ -17,6 +17,7 @@ import { useUserFlaggedByMeQuery } from '../../../../../../hooks/queries/useFlag
17
17
  import { useBlockUser } from '../../../../../../hooks/queries/useBlockUser';
18
18
  import { useFollowInfo } from '../../../../../../hooks/objects';
19
19
  import { useBehaviour } from '../../../../../../providers/BehaviourProvider';
20
+ import { useGlobalBehavior } from '../../../../../../hooks';
20
21
 
21
22
  type UseMenuParams = {
22
23
  userId?: string;
@@ -28,6 +29,7 @@ export function useMenu({ userId, displayName }: UseMenuParams) {
28
29
 
29
30
  const { client } = useAuth();
30
31
  const { getShareLink } = useShareableLink();
32
+ const { handleGlobalBehavior } = useGlobalBehavior();
31
33
  const { AmityUserProfilePageBehavior } = useBehaviour();
32
34
  const { accessibilityId: menuButtonId } = useAmityElement({
33
35
  pageId,
@@ -97,8 +99,10 @@ export function useMenu({ userId, displayName }: UseMenuParams) {
97
99
  testID: 'report-user-button',
98
100
  accessibilityLabel: 'Report user',
99
101
  onPress: () => {
100
- if (userId) reportUser(userId);
101
102
  closeBottomSheet();
103
+ handleGlobalBehavior({
104
+ defaultBehavior: () => userId && reportUser(userId),
105
+ });
102
106
  },
103
107
  },
104
108
  {
@@ -108,8 +112,10 @@ export function useMenu({ userId, displayName }: UseMenuParams) {
108
112
  testID: 'unreport-user-button',
109
113
  accessibilityLabel: 'Unreport user',
110
114
  onPress: () => {
111
- if (userId) unreportUser(userId);
112
115
  closeBottomSheet();
116
+ handleGlobalBehavior({
117
+ defaultBehavior: () => userId && unreportUser(userId),
118
+ });
113
119
  },
114
120
  },
115
121
  {
@@ -120,7 +126,10 @@ export function useMenu({ userId, displayName }: UseMenuParams) {
120
126
  accessibilityLabel: 'Block user',
121
127
  onPress: () => {
122
128
  closeBottomSheet();
123
- if (userId) blockUser(userId, displayName ?? userId);
129
+ handleGlobalBehavior({
130
+ defaultBehavior: () =>
131
+ userId && blockUser(userId, displayName ?? userId),
132
+ });
124
133
  },
125
134
  },
126
135
  {
@@ -131,7 +140,10 @@ export function useMenu({ userId, displayName }: UseMenuParams) {
131
140
  accessibilityLabel: 'Unblock user',
132
141
  onPress: () => {
133
142
  closeBottomSheet();
134
- if (userId) unBlockUser(userId, displayName ?? userId);
143
+ handleGlobalBehavior({
144
+ defaultBehavior: () =>
145
+ userId && unBlockUser(userId, displayName ?? userId),
146
+ });
135
147
  },
136
148
  },
137
149
  ].filter((action) => action.visible);
@@ -0,0 +1,43 @@
1
+ import { TouchableOpacity, View } from 'react-native';
2
+ import { SafeAreaView } from 'react-native-safe-area-context';
3
+ import { SvgXml } from 'react-native-svg';
4
+ import { Typography } from '../../../../core/components/Typography/Typography';
5
+ import { visitorLimit } from '../../../../core/assets/icons';
6
+ import { VISITOR_USAGE_LIMIT_MESSAGE } from '../../../../core/constants';
7
+ import { useUsageLimit } from './hooks';
8
+
9
+ export function UsageLimit() {
10
+ const { styles, theme, onPressSignIn } = useUsageLimit();
11
+
12
+ return (
13
+ <SafeAreaView style={styles.container} edges={['top', 'left']}>
14
+ <View style={styles.contentContainer}>
15
+ <SvgXml
16
+ accessible
17
+ accessibilityLabel="Usage limit reached"
18
+ width={60}
19
+ height={40}
20
+ style={styles.icon}
21
+ xml={visitorLimit()}
22
+ color={theme.colors.secondaryShade4}
23
+ />
24
+ <Typography.TitleBold style={styles.title}>
25
+ {VISITOR_USAGE_LIMIT_MESSAGE.TITLE}
26
+ </Typography.TitleBold>
27
+ <Typography.Caption style={styles.subtitle}>
28
+ {VISITOR_USAGE_LIMIT_MESSAGE.SUBTITLE}
29
+ </Typography.Caption>
30
+ <TouchableOpacity
31
+ style={styles.signInButton}
32
+ onPress={onPressSignIn}
33
+ accessibilityRole="button"
34
+ accessibilityLabel={VISITOR_USAGE_LIMIT_MESSAGE.SIGN_IN}
35
+ >
36
+ <Typography.BodyBold style={styles.signInText}>
37
+ {VISITOR_USAGE_LIMIT_MESSAGE.SIGN_IN}
38
+ </Typography.BodyBold>
39
+ </TouchableOpacity>
40
+ </View>
41
+ </SafeAreaView>
42
+ );
43
+ }
@@ -0,0 +1 @@
1
+ export { useUsageLimit } from './useUsageLimit';
@@ -0,0 +1,46 @@
1
+ import { useCallback, useEffect } from 'react';
2
+ import { BackHandler } from 'react-native';
3
+ import { useStyles } from '../styles';
4
+ import { useToast } from '../../../../../core/stores/slices/toastSlice';
5
+ import { useBehaviour } from '../../../../providers/BehaviourProvider';
6
+ import {
7
+ VISITOR_USAGE_LIMIT_MESSAGE,
8
+ VISITOR_TOAST_DURATION,
9
+ } from '../../../../../core/constants';
10
+
11
+ export const useUsageLimit = () => {
12
+ const { styles, theme } = useStyles();
13
+ const { showToast } = useToast();
14
+ const { AmityGlobalBehaviour } = useBehaviour();
15
+
16
+ const showSignInToast = useCallback(() => {
17
+ showToast({
18
+ message: VISITOR_USAGE_LIMIT_MESSAGE.TOAST,
19
+ type: 'informative',
20
+ duration: VISITOR_TOAST_DURATION,
21
+ });
22
+ }, []);
23
+
24
+ useEffect(() => {
25
+ showSignInToast();
26
+ }, [showSignInToast]);
27
+
28
+ // Dead-end page: swallow the Android hardware back press so the user
29
+ // cannot navigate away from the error state.
30
+ useEffect(() => {
31
+ const subscription = BackHandler.addEventListener(
32
+ 'hardwareBackPress',
33
+ () => true
34
+ );
35
+ return () => subscription.remove();
36
+ }, []);
37
+
38
+ const onPressSignIn = useCallback(() => {
39
+ if (AmityGlobalBehaviour?.handleVisitorUsageLimitSignIn) {
40
+ return AmityGlobalBehaviour.handleVisitorUsageLimitSignIn();
41
+ }
42
+ showSignInToast();
43
+ }, [AmityGlobalBehaviour, showSignInToast]);
44
+
45
+ return { styles, theme, onPressSignIn };
46
+ };
@@ -0,0 +1 @@
1
+ export { UsageLimit } from './UsageLimit';
@@ -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: {},