@amityco/react-native-social-uikit 4.0.2-bfd939a.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 (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
@@ -27,6 +27,7 @@ import {
27
27
  import { Pressable } from 'react-native';
28
28
  import useAuth from '../../../../../../core/hooks/useAuth';
29
29
  import { useTimeDifference } from '../../../../../hooks/useTimeDifference';
30
+ import { useGlobalBehavior } from '../../../../../hooks/useGlobalBehavior';
30
31
  import {
31
32
  isReportTarget,
32
33
  reportTargetById,
@@ -144,6 +145,12 @@ const ReplyCommentList = ({
144
145
  await addCommentReaction(commentId, 'like');
145
146
  }
146
147
  };
148
+
149
+ const { handleGlobalBehavior } = useGlobalBehavior();
150
+
151
+ const onPressLike = () =>
152
+ handleGlobalBehavior({ defaultBehavior: addReactionToComment });
153
+
147
154
  const deleteReplyComment = () => {
148
155
  Alert.alert('Delete reply', 'This reply will be permanently deleted.', [
149
156
  {
@@ -292,10 +299,7 @@ const ReplyCommentList = ({
292
299
  )}
293
300
  </View>
294
301
 
295
- <TouchableOpacity
296
- onPress={() => addReactionToComment()}
297
- style={styles.likeBtn}
298
- >
302
+ <TouchableOpacity onPress={onPressLike} style={styles.likeBtn}>
299
303
  <Text style={isLike ? styles.likedText : styles.btnText}>
300
304
  {!isLike ? 'Like' : 'Liked'}
301
305
  </Text>
@@ -342,6 +346,7 @@ const ReplyCommentList = ({
342
346
  styles.twoOptions,
343
347
  ]}
344
348
  >
349
+ <View style={styles.handleBar} />
345
350
  {user?.userId === (client as Amity.Client).userId ? (
346
351
  <View>
347
352
  <TouchableOpacity
@@ -369,7 +374,12 @@ const ReplyCommentList = ({
369
374
  </View>
370
375
  ) : (
371
376
  <TouchableOpacity
372
- onPress={reportCommentObject}
377
+ onPress={() => {
378
+ closeModal();
379
+ handleGlobalBehavior({
380
+ defaultBehavior: reportCommentObject,
381
+ });
382
+ }}
373
383
  style={styles.modalRow}
374
384
  >
375
385
  <SvgXml
@@ -6,6 +6,14 @@ export const useStyles = () => {
6
6
  const theme = useTheme() as MyMD3Theme;
7
7
 
8
8
  const styles = StyleSheet.create({
9
+ handleBar: {
10
+ alignSelf: 'center',
11
+ width: 36,
12
+ backgroundColor: theme.colors.baseShade4,
13
+ height: 5,
14
+ marginVertical: 10,
15
+ borderRadius: 10,
16
+ },
9
17
  commentWrap: {
10
18
  backgroundColor: theme.colors.background,
11
19
  paddingHorizontal: 12,
@@ -15,6 +15,7 @@ import AmityCreatePostMenuComponent from '../CreatePostMenu';
15
15
  import TextKeyElement from '../../../../elements/TextKeyElement/TextKeyElement';
16
16
  import { usePopup } from '../../../../hooks/usePopup';
17
17
  import Popup from '../../../../components/PopupMenu/PopupMenu';
18
+ import useAuth from '../../../../../core/hooks/useAuth';
18
19
 
19
20
  type AmitySocialHomeTopNavigationComponentType = {
20
21
  activeTab: string;
@@ -29,6 +30,7 @@ const AmitySocialHomeTopNavigationComponent: FC<
29
30
  const theme = componentConfig.themeStyles;
30
31
  const { AmitySocialHomeTopNavigationComponentBehaviour } = useBehaviour();
31
32
  const { isOpen, setIsOpen, toggle } = usePopup();
33
+ const { isVisitorOrBot } = useAuth();
32
34
 
33
35
  const [myCommunitiesTab] = useUiKitConfig({
34
36
  page: PageID.social_home_page,
@@ -169,7 +171,7 @@ const AmitySocialHomeTopNavigationComponent: FC<
169
171
  >
170
172
  <Image source={searchIcon} style={styles.icon} />
171
173
  </TouchableOpacity>
172
- {activeTab !== exploreTab && (
174
+ {!isVisitorOrBot && activeTab !== exploreTab && (
173
175
  <TouchableOpacity
174
176
  style={styles.iconBtn}
175
177
  onPress={onPressCreate}
@@ -83,7 +83,7 @@ function AmityLiveStreamPlayerPage() {
83
83
  };
84
84
  useRoomSubscription({ room });
85
85
 
86
- const { client } = useAuth();
86
+ const { client, isVisitorOrBot } = useAuth();
87
87
  const videoRef = useRef<any>(null);
88
88
  const isStreamEnding = useRef(false);
89
89
 
@@ -127,7 +127,7 @@ function AmityLiveStreamPlayerPage() {
127
127
  }, []);
128
128
 
129
129
  useEffect(() => {
130
- if (!room?.status) return;
130
+ if (!room?.status || isVisitorOrBot) return;
131
131
 
132
132
  const shouldEnd =
133
133
  room.status === RoomStatus.ended ||
@@ -149,13 +149,14 @@ function AmityLiveStreamPlayerPage() {
149
149
  setVideoKey((prev) => prev + 1);
150
150
  }, 50);
151
151
  }
152
- }, [room?.status, wasLive]);
152
+ }, [room?.status, wasLive, isVisitorOrBot]);
153
153
 
154
154
  useEffect(() => {
155
+ if (isVisitorOrBot) return;
155
156
  if (room?.status === RoomStatus.terminated) {
156
157
  navigation.replace('LivestreamTerminated', { type: 'viewer' });
157
158
  }
158
- }, [room?.status, navigation]);
159
+ }, [room?.status, navigation, isVisitorOrBot]);
159
160
 
160
161
  const showControlsTemporarily = useCallback(() => {
161
162
  setShowControls(true);
@@ -171,9 +172,10 @@ function AmityLiveStreamPlayerPage() {
171
172
  }, [showControlsTemporarily]);
172
173
 
173
174
  const shouldShowEndThumbnail =
174
- room?.status === RoomStatus.ended ||
175
- (room?.status === RoomStatus.recorded && wasLive) ||
176
- (room as any)?.user?.isGlobalBan;
175
+ !isVisitorOrBot &&
176
+ (room?.status === RoomStatus.ended ||
177
+ (room?.status === RoomStatus.recorded && wasLive) ||
178
+ (room as any)?.user?.isGlobalBan);
177
179
 
178
180
  if (!room || error) {
179
181
  return (
@@ -246,6 +248,7 @@ function AmityLiveStreamPlayerPage() {
246
248
  setIsPaused(false);
247
249
  }
248
250
  }}
251
+ onEnd={() => setIsPaused(true)}
249
252
  />
250
253
  )}
251
254
 
@@ -43,6 +43,7 @@ import NetInfo from '@react-native-community/netinfo';
43
43
  import { useToast } from '../../../../core/stores/slices/toastSlice';
44
44
  import MyAvatar from '../../../components/MyAvatar/MyAvatar';
45
45
  import { MAX_MENTION_USERS } from '../../../../core/constants';
46
+ import useAuth from '../../../../core/hooks/useAuth';
46
47
 
47
48
  import { SafeAreaView } from 'react-native-safe-area-context';
48
49
  import ErrorComponent from '../../../components/ErrorComponent/ErrorComponent';
@@ -73,6 +74,8 @@ const AmityPostDetailPage: FC<AmityPostDetailPageType> = ({
73
74
  }) => {
74
75
  const pageId = PageID.post_detail_page;
75
76
  const componentId = ComponentID.WildCardComponent;
77
+
78
+ const { isVisitorOrBot } = useAuth();
76
79
  const disabledInteraction = false;
77
80
  const navigation =
78
81
  useNavigation<NativeStackNavigationProp<RootStackParamList>>();
@@ -285,7 +288,7 @@ const AmityPostDetailPage: FC<AmityPostDetailPageType> = ({
285
288
  </TouchableOpacity>
286
289
  </View>
287
290
  )}
288
- {!disabledInteraction && (
291
+ {!disabledInteraction && !isVisitorOrBot && (
289
292
  <View style={styles.InputWrap}>
290
293
  <MyAvatar style={styles.myAvatar} />
291
294
  <View style={styles.inputContainer}>
@@ -398,7 +401,7 @@ const AmityPostDetailPage: FC<AmityPostDetailPageType> = ({
398
401
  postData?.targetType === 'community' && postData?.targetId
399
402
  }
400
403
  postType="post"
401
- disabledInteraction={false}
404
+ disabledInteraction={disabledInteraction}
402
405
  ListHeaderComponent={
403
406
  postData && (
404
407
  <AmityPostContentComponent
@@ -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';