@amityco/react-native-social-uikit 4.0.0 → 4.0.1-00d805a4.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 (196) 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 -16
  11. package/lib/commonjs/core/providers/AuthProvider.js.map +1 -1
  12. package/lib/commonjs/core/routes/AmityUIKitNavigator.js +28 -1
  13. package/lib/commonjs/core/routes/AmityUIKitNavigator.js.map +1 -1
  14. package/lib/commonjs/index.js +6 -0
  15. package/lib/commonjs/index.js.map +1 -1
  16. package/lib/commonjs/social/components/Social/CommentList/CommentList.js +7 -1
  17. package/lib/commonjs/social/components/Social/CommentList/CommentList.js.map +1 -1
  18. package/lib/commonjs/social/components/Social/CommentListItem/CommentListItem.js +16 -3
  19. package/lib/commonjs/social/components/Social/CommentListItem/CommentListItem.js.map +1 -1
  20. package/lib/commonjs/social/components/legacy/Social/ReplyCommentList/index.js +12 -2
  21. package/lib/commonjs/social/components/legacy/Social/ReplyCommentList/index.js.map +1 -1
  22. package/lib/commonjs/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.js +6 -1
  23. package/lib/commonjs/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.js.map +1 -1
  24. package/lib/commonjs/social/features/comment/components/PostComment/CommentListItem/CommentListItem.js +15 -3
  25. package/lib/commonjs/social/features/comment/components/PostComment/CommentListItem/CommentListItem.js.map +1 -1
  26. package/lib/commonjs/social/features/comment/components/PostComment/ReplyCommentList/index.js +12 -2
  27. package/lib/commonjs/social/features/comment/components/PostComment/ReplyCommentList/index.js.map +1 -1
  28. package/lib/commonjs/social/features/feed/components/TopNavigation/TopNavigation.js +5 -1
  29. package/lib/commonjs/social/features/feed/components/TopNavigation/TopNavigation.js.map +1 -1
  30. package/lib/commonjs/social/features/post/Detail/index.js +8 -2
  31. package/lib/commonjs/social/features/post/Detail/index.js.map +1 -1
  32. package/lib/commonjs/social/features/post/components/Content/Content.js +5 -1
  33. package/lib/commonjs/social/features/post/components/Content/Content.js.map +1 -1
  34. package/lib/commonjs/social/features/post/components/EngagementActions/Components/DetailStyle.js +9 -1
  35. package/lib/commonjs/social/features/post/components/EngagementActions/Components/DetailStyle.js.map +1 -1
  36. package/lib/commonjs/social/features/post/components/EngagementActions/Components/FeedStyle.js +9 -1
  37. package/lib/commonjs/social/features/post/components/EngagementActions/Components/FeedStyle.js.map +1 -1
  38. package/lib/commonjs/social/features/user/Profile/components/Header/hooks/useHeader.js +6 -1
  39. package/lib/commonjs/social/features/user/Profile/components/Header/hooks/useHeader.js.map +1 -1
  40. package/lib/commonjs/social/hooks/index.js +11 -0
  41. package/lib/commonjs/social/hooks/index.js.map +1 -1
  42. package/lib/commonjs/social/hooks/useGlobalBehavior.js +53 -0
  43. package/lib/commonjs/social/hooks/useGlobalBehavior.js.map +1 -0
  44. package/lib/commonjs/social/hooks/usePostPermission.js +4 -2
  45. package/lib/commonjs/social/hooks/usePostPermission.js.map +1 -1
  46. package/lib/commonjs/social/hooks/useStoryPermission.js +3 -2
  47. package/lib/commonjs/social/hooks/useStoryPermission.js.map +1 -1
  48. package/lib/commonjs/social/index.js +7 -0
  49. package/lib/commonjs/social/index.js.map +1 -1
  50. package/lib/commonjs/social/providers/BehaviourProvider.js +1 -0
  51. package/lib/commonjs/social/providers/BehaviourProvider.js.map +1 -1
  52. package/lib/commonjs/social/screens/SocialHomePage/index.js +15 -5
  53. package/lib/commonjs/social/screens/SocialHomePage/index.js.map +1 -1
  54. package/lib/commonjs/social/screens/VisitorUsageLimit/VisitorUsageLimit.js +81 -0
  55. package/lib/commonjs/social/screens/VisitorUsageLimit/VisitorUsageLimit.js.map +1 -0
  56. package/lib/commonjs/social/screens/VisitorUsageLimit/index.js +13 -0
  57. package/lib/commonjs/social/screens/VisitorUsageLimit/index.js.map +1 -0
  58. package/lib/commonjs/social/screens/VisitorUsageLimit/styles.js +52 -0
  59. package/lib/commonjs/social/screens/VisitorUsageLimit/styles.js.map +1 -0
  60. package/lib/module/core/assets/icons/index.js +1 -0
  61. package/lib/module/core/assets/icons/index.js.map +1 -1
  62. package/lib/module/core/assets/icons/visitorLimit.js +19 -0
  63. package/lib/module/core/assets/icons/visitorLimit.js.map +1 -0
  64. package/lib/module/core/constants/index.js +10 -0
  65. package/lib/module/core/constants/index.js.map +1 -1
  66. package/lib/module/core/hooks/useAuth.js +6 -2
  67. package/lib/module/core/hooks/useAuth.js.map +1 -1
  68. package/lib/module/core/providers/AmityUIKitProvider.js.map +1 -1
  69. package/lib/module/core/providers/AuthProvider.js +44 -16
  70. package/lib/module/core/providers/AuthProvider.js.map +1 -1
  71. package/lib/module/core/routes/AmityUIKitNavigator.js +28 -1
  72. package/lib/module/core/routes/AmityUIKitNavigator.js.map +1 -1
  73. package/lib/module/index.js +2 -2
  74. package/lib/module/index.js.map +1 -1
  75. package/lib/module/social/components/Social/CommentList/CommentList.js +7 -1
  76. package/lib/module/social/components/Social/CommentList/CommentList.js.map +1 -1
  77. package/lib/module/social/components/Social/CommentListItem/CommentListItem.js +16 -3
  78. package/lib/module/social/components/Social/CommentListItem/CommentListItem.js.map +1 -1
  79. package/lib/module/social/components/legacy/Social/ReplyCommentList/index.js +12 -2
  80. package/lib/module/social/components/legacy/Social/ReplyCommentList/index.js.map +1 -1
  81. package/lib/module/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.js +7 -2
  82. package/lib/module/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.js.map +1 -1
  83. package/lib/module/social/features/comment/components/PostComment/CommentListItem/CommentListItem.js +16 -4
  84. package/lib/module/social/features/comment/components/PostComment/CommentListItem/CommentListItem.js.map +1 -1
  85. package/lib/module/social/features/comment/components/PostComment/ReplyCommentList/index.js +12 -2
  86. package/lib/module/social/features/comment/components/PostComment/ReplyCommentList/index.js.map +1 -1
  87. package/lib/module/social/features/feed/components/TopNavigation/TopNavigation.js +5 -1
  88. package/lib/module/social/features/feed/components/TopNavigation/TopNavigation.js.map +1 -1
  89. package/lib/module/social/features/post/Detail/index.js +8 -2
  90. package/lib/module/social/features/post/Detail/index.js.map +1 -1
  91. package/lib/module/social/features/post/components/Content/Content.js +5 -1
  92. package/lib/module/social/features/post/components/Content/Content.js.map +1 -1
  93. package/lib/module/social/features/post/components/EngagementActions/Components/DetailStyle.js +10 -2
  94. package/lib/module/social/features/post/components/EngagementActions/Components/DetailStyle.js.map +1 -1
  95. package/lib/module/social/features/post/components/EngagementActions/Components/FeedStyle.js +10 -2
  96. package/lib/module/social/features/post/components/EngagementActions/Components/FeedStyle.js.map +1 -1
  97. package/lib/module/social/features/user/Profile/components/Header/hooks/useHeader.js +7 -2
  98. package/lib/module/social/features/user/Profile/components/Header/hooks/useHeader.js.map +1 -1
  99. package/lib/module/social/hooks/index.js +1 -0
  100. package/lib/module/social/hooks/index.js.map +1 -1
  101. package/lib/module/social/hooks/useGlobalBehavior.js +45 -0
  102. package/lib/module/social/hooks/useGlobalBehavior.js.map +1 -0
  103. package/lib/module/social/hooks/usePostPermission.js +4 -2
  104. package/lib/module/social/hooks/usePostPermission.js.map +1 -1
  105. package/lib/module/social/hooks/useStoryPermission.js +3 -2
  106. package/lib/module/social/hooks/useStoryPermission.js.map +1 -1
  107. package/lib/module/social/index.js +1 -0
  108. package/lib/module/social/index.js.map +1 -1
  109. package/lib/module/social/providers/BehaviourProvider.js +1 -0
  110. package/lib/module/social/providers/BehaviourProvider.js.map +1 -1
  111. package/lib/module/social/screens/SocialHomePage/index.js +16 -6
  112. package/lib/module/social/screens/SocialHomePage/index.js.map +1 -1
  113. package/lib/module/social/screens/VisitorUsageLimit/VisitorUsageLimit.js +75 -0
  114. package/lib/module/social/screens/VisitorUsageLimit/VisitorUsageLimit.js.map +1 -0
  115. package/lib/module/social/screens/VisitorUsageLimit/index.js +2 -0
  116. package/lib/module/social/screens/VisitorUsageLimit/index.js.map +1 -0
  117. package/lib/module/social/screens/VisitorUsageLimit/styles.js +45 -0
  118. package/lib/module/social/screens/VisitorUsageLimit/styles.js.map +1 -0
  119. package/lib/typescript/core/assets/icons/index.d.ts +1 -0
  120. package/lib/typescript/core/assets/icons/index.d.ts.map +1 -1
  121. package/lib/typescript/core/assets/icons/visitorLimit.d.ts +3 -0
  122. package/lib/typescript/core/assets/icons/visitorLimit.d.ts.map +1 -0
  123. package/lib/typescript/core/constants/index.d.ts +8 -0
  124. package/lib/typescript/core/constants/index.d.ts.map +1 -1
  125. package/lib/typescript/core/hooks/useAuth.d.ts.map +1 -1
  126. package/lib/typescript/core/providers/AmityUIKitProvider.d.ts +2 -1
  127. package/lib/typescript/core/providers/AmityUIKitProvider.d.ts.map +1 -1
  128. package/lib/typescript/core/providers/AuthProvider.d.ts.map +1 -1
  129. package/lib/typescript/core/routes/AmityUIKitNavigator.d.ts.map +1 -1
  130. package/lib/typescript/core/types/auth.d.ts +2 -0
  131. package/lib/typescript/core/types/auth.d.ts.map +1 -1
  132. package/lib/typescript/core/types/behaviour.d.ts +18 -0
  133. package/lib/typescript/core/types/behaviour.d.ts.map +1 -1
  134. package/lib/typescript/index.d.ts +2 -2
  135. package/lib/typescript/index.d.ts.map +1 -1
  136. package/lib/typescript/social/components/Social/CommentList/CommentList.d.ts.map +1 -1
  137. package/lib/typescript/social/components/Social/CommentListItem/CommentListItem.d.ts.map +1 -1
  138. package/lib/typescript/social/components/legacy/Social/ReplyCommentList/index.d.ts.map +1 -1
  139. package/lib/typescript/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.d.ts.map +1 -1
  140. package/lib/typescript/social/features/comment/components/PostComment/CommentListItem/CommentListItem.d.ts.map +1 -1
  141. package/lib/typescript/social/features/comment/components/PostComment/ReplyCommentList/index.d.ts.map +1 -1
  142. package/lib/typescript/social/features/feed/components/TopNavigation/TopNavigation.d.ts.map +1 -1
  143. package/lib/typescript/social/features/post/Detail/index.d.ts.map +1 -1
  144. package/lib/typescript/social/features/post/components/Content/Content.d.ts.map +1 -1
  145. package/lib/typescript/social/features/post/components/EngagementActions/Components/DetailStyle.d.ts.map +1 -1
  146. package/lib/typescript/social/features/post/components/EngagementActions/Components/FeedStyle.d.ts.map +1 -1
  147. package/lib/typescript/social/features/user/Profile/components/Header/hooks/useHeader.d.ts.map +1 -1
  148. package/lib/typescript/social/hooks/index.d.ts +1 -0
  149. package/lib/typescript/social/hooks/index.d.ts.map +1 -1
  150. package/lib/typescript/social/hooks/useGlobalBehavior.d.ts +23 -0
  151. package/lib/typescript/social/hooks/useGlobalBehavior.d.ts.map +1 -0
  152. package/lib/typescript/social/hooks/usePostPermission.d.ts.map +1 -1
  153. package/lib/typescript/social/hooks/useStoryPermission.d.ts.map +1 -1
  154. package/lib/typescript/social/index.d.ts +1 -0
  155. package/lib/typescript/social/index.d.ts.map +1 -1
  156. package/lib/typescript/social/providers/BehaviourProvider.d.ts.map +1 -1
  157. package/lib/typescript/social/screens/SocialHomePage/index.d.ts.map +1 -1
  158. package/lib/typescript/social/screens/VisitorUsageLimit/VisitorUsageLimit.d.ts +2 -0
  159. package/lib/typescript/social/screens/VisitorUsageLimit/VisitorUsageLimit.d.ts.map +1 -0
  160. package/lib/typescript/social/screens/VisitorUsageLimit/index.d.ts +2 -0
  161. package/lib/typescript/social/screens/VisitorUsageLimit/index.d.ts.map +1 -0
  162. package/lib/typescript/social/screens/VisitorUsageLimit/styles.d.ts +40 -0
  163. package/lib/typescript/social/screens/VisitorUsageLimit/styles.d.ts.map +1 -0
  164. package/package.json +3 -3
  165. package/src/core/assets/icons/index.ts +1 -0
  166. package/src/core/assets/icons/visitorLimit.tsx +19 -0
  167. package/src/core/constants/index.ts +12 -0
  168. package/src/core/hooks/useAuth.ts +4 -0
  169. package/src/core/providers/AmityUIKitProvider.tsx +2 -1
  170. package/src/core/providers/AuthProvider.tsx +38 -12
  171. package/src/core/routes/AmityUIKitNavigator.tsx +28 -1
  172. package/src/core/types/auth.ts +2 -0
  173. package/src/core/types/behaviour.ts +18 -0
  174. package/src/index.tsx +2 -0
  175. package/src/social/components/Social/CommentList/CommentList.tsx +5 -1
  176. package/src/social/components/Social/CommentListItem/CommentListItem.tsx +19 -12
  177. package/src/social/components/legacy/Social/ReplyCommentList/index.tsx +17 -11
  178. package/src/social/elements/CommunityJoinButtonElement/CommunityJoinButtonElement.tsx +10 -2
  179. package/src/social/features/comment/components/PostComment/CommentListItem/CommentListItem.tsx +22 -16
  180. package/src/social/features/comment/components/PostComment/ReplyCommentList/index.tsx +17 -11
  181. package/src/social/features/feed/components/TopNavigation/TopNavigation.tsx +3 -1
  182. package/src/social/features/post/Detail/index.tsx +6 -2
  183. package/src/social/features/post/components/Content/Content.tsx +7 -4
  184. package/src/social/features/post/components/EngagementActions/Components/DetailStyle.tsx +7 -2
  185. package/src/social/features/post/components/EngagementActions/Components/FeedStyle.tsx +7 -2
  186. package/src/social/features/user/Profile/components/Header/hooks/useHeader.ts +5 -2
  187. package/src/social/hooks/index.ts +1 -0
  188. package/src/social/hooks/useGlobalBehavior.ts +39 -0
  189. package/src/social/hooks/usePostPermission.ts +3 -1
  190. package/src/social/hooks/useStoryPermission.ts +8 -6
  191. package/src/social/index.tsx +1 -0
  192. package/src/social/providers/BehaviourProvider.tsx +1 -0
  193. package/src/social/screens/SocialHomePage/index.tsx +26 -11
  194. package/src/social/screens/VisitorUsageLimit/VisitorUsageLimit.tsx +81 -0
  195. package/src/social/screens/VisitorUsageLimit/index.ts +1 -0
  196. package/src/social/screens/VisitorUsageLimit/styles.ts +45 -0
@@ -0,0 +1,2 @@
1
+ export declare function VisitorUsageLimit(): import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=VisitorUsageLimit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VisitorUsageLimit.d.ts","sourceRoot":"","sources":["../../../../../src/social/screens/VisitorUsageLimit/VisitorUsageLimit.tsx"],"names":[],"mappings":"AAaA,wBAAgB,iBAAiB,4CAmEhC"}
@@ -0,0 +1,2 @@
1
+ export { VisitorUsageLimit } from './VisitorUsageLimit';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/social/screens/VisitorUsageLimit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { MyMD3Theme } from '../../../core/providers/AmityUIKitProvider';
2
+ export declare const useStyles: () => {
3
+ styles: {
4
+ container: {
5
+ flex: number;
6
+ backgroundColor: string;
7
+ };
8
+ contentContainer: {
9
+ flex: number;
10
+ alignItems: "center";
11
+ paddingHorizontal: number;
12
+ flexDirection: "column";
13
+ justifyContent: "center";
14
+ };
15
+ icon: {
16
+ marginBottom: number;
17
+ };
18
+ title: {
19
+ maxWidth: number;
20
+ textAlign: "center";
21
+ color: string;
22
+ };
23
+ subtitle: {
24
+ maxWidth: number;
25
+ textAlign: "center";
26
+ color: string;
27
+ };
28
+ signInButton: {
29
+ marginTop: number;
30
+ borderRadius: number;
31
+ paddingVertical: number;
32
+ paddingHorizontal: number;
33
+ };
34
+ signInText: {
35
+ color: string;
36
+ };
37
+ };
38
+ theme: MyMD3Theme;
39
+ };
40
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/social/screens/VisitorUsageLimit/styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAE7E,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/react-native-social-uikit",
3
- "version": "4.0.0",
3
+ "version": "4.0.1-00d805a4.0",
4
4
  "description": "Social UIKit",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -57,7 +57,7 @@
57
57
  "registry": "https://registry.npmjs.org/"
58
58
  },
59
59
  "devDependencies": {
60
- "@amityco/ts-sdk-react-native": "7.18.1-72bd324a.0",
60
+ "@amityco/ts-sdk-react-native": "7.22.1-f15e84ea.0",
61
61
  "@babel/plugin-transform-export-namespace-from": "^7.27.1",
62
62
  "@commitlint/config-conventional": "^17.0.2",
63
63
  "@evilmartians/lefthook": "^1.2.2",
@@ -119,7 +119,7 @@
119
119
  "@types/react": "^19.1.0"
120
120
  },
121
121
  "peerDependencies": {
122
- "@amityco/ts-sdk-react-native": "7.18.1-72bd324a.0",
122
+ "@amityco/ts-sdk-react-native": "7.22.1-f15e84ea.0",
123
123
  "@livekit/react-native": "^2.9.6",
124
124
  "@livekit/react-native-webrtc": "^137.0.2",
125
125
  "@react-native-async-storage/async-storage": "^1.19.3",
@@ -34,6 +34,7 @@ export { default as pause } from './pause';
34
34
  export { default as resume } from './resume';
35
35
  export { default as terminated } from './terminated';
36
36
  export { default as warning } from './warning';
37
+ export { default as visitorLimit } from './visitorLimit';
37
38
  export { default as ban } from './ban';
38
39
  export { default as arrowLeft } from './arrowLeft';
39
40
  export { default as poll } from './poll';
@@ -0,0 +1,19 @@
1
+ export const icon = () => `<svg
2
+ width="100%"
3
+ height="100%"
4
+ viewBox="0 0 60 40"
5
+ fill="none"
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ >
8
+ <path
9
+ d="M57.5 0C58.8542 0 60 1.14583 60 2.5V37.5C60 38.9583 58.8542 40 57.5 40H5C2.1875 40 0 37.8125 0 35V5.83333C0 4.47917 1.04167 3.33333 2.5 3.33333H6.66667V2.5C6.66667 1.14583 7.70833 0 9.16667 0H57.5ZM3.33333 35C3.33333 35.9375 4.0625 36.6667 5 36.6667C5.83333 36.6667 6.66667 35.9375 6.66667 35V6.66667H3.33333V35ZM56.6667 36.6667V3.33333H10V35V35.1042C10 35.5208 9.79167 36.25 9.6875 36.6667H56.6667Z"
10
+ fill="currentColor"
11
+ />
12
+ <path
13
+ d="M36.0494 25.4322C36.0494 26.8211 34.9383 27.9013 33.5803 27.9013C32.1914 27.9013 31.1111 26.8211 31.1111 25.4322C31.1111 24.0742 32.1914 22.9631 33.5803 22.9631C34.9383 22.9631 36.0494 24.0742 36.0494 25.4322ZM31.3889 12.9013C31.358 12.4692 31.6975 12.0989 32.1296 12.0989H35C35.4321 12.0989 35.7716 12.4692 35.7407 12.9013L35.3395 21.2964C35.3086 21.6668 34.9691 21.9754 34.5988 21.9754H32.5309C32.1605 21.9754 31.821 21.6668 31.7901 21.2964L31.3889 12.9013Z"
14
+ fill="currentColor"
15
+ />
16
+ </svg>
17
+ `;
18
+
19
+ export default icon;
@@ -88,11 +88,23 @@ export const ERROR_CODE = {
88
88
  ONLY_ONE_MODERATOR: '400317',
89
89
  ONLY_ONE_MEMBER: '400318',
90
90
  GLOBAL_BAN: '400312',
91
+ VISITOR_USAGE_LIMIT_EXCEEDED: '400323',
91
92
  INVALID_IMAGE:
92
93
  'Amity SDK (500000): Image uploading failed: Request has invalid image format',
93
94
  DISPLAY_NAME_UPDATE: '400301',
94
95
  };
95
96
 
97
+ export const VISITOR_USAGE_LIMIT_MESSAGE = {
98
+ TITLE: "You've reached your daily limit.",
99
+ SUBTITLE: 'Create an account or sign in to keep exploring the community.',
100
+ SIGN_IN: 'Sign in',
101
+ TOAST: 'Create an account or sign in to continue.',
102
+ };
103
+
104
+ // Web parity: amity_social_label_create_account_or_sign_in
105
+ export const VISITOR_USER_ACTION_TOAST =
106
+ 'Create an account or sign in to continue.';
107
+
96
108
  export const COMMENT_ERROR_MESSAGE = {
97
109
  BLOCKED_WORD:
98
110
  'Your comment contains inappropriate word. Please review and delete it.',
@@ -14,6 +14,8 @@ const useAuth = (): AuthContextInterface => {
14
14
  sessionState,
15
15
  apiRegion,
16
16
  isGlobalBan,
17
+ isVisitorUsageLimitReached,
18
+ isVisitorOrBot,
17
19
  } = useContext(AuthContext);
18
20
 
19
21
  return {
@@ -26,6 +28,8 @@ const useAuth = (): AuthContextInterface => {
26
28
  sessionState,
27
29
  apiRegion,
28
30
  isGlobalBan,
31
+ isVisitorUsageLimitReached,
32
+ isVisitorOrBot,
29
33
  };
30
34
  };
31
35
 
@@ -21,7 +21,8 @@ import { ErrorBoundary } from '../components/ErrorBoundary';
21
21
 
22
22
  export type CusTomTheme = typeof DefaultTheme;
23
23
  export interface IAmityUIkitProvider {
24
- userId: string;
24
+ /** Omit to connect as a visitor (read-only session). */
25
+ userId?: string;
25
26
  displayName?: string;
26
27
  apiKey: string;
27
28
  apiRegion?: string;
@@ -24,6 +24,8 @@ export const AuthContext = createContext<AuthContextInterface>({
24
24
  authToken: '',
25
25
  fcmToken: undefined,
26
26
  isGlobalBan: false,
27
+ isVisitorUsageLimitReached: false,
28
+ isVisitorOrBot: false,
27
29
  });
28
30
 
29
31
  export const AuthContextProvider: FC<IAmityUIkitProvider> = ({
@@ -44,6 +46,9 @@ export const AuthContextProvider: FC<IAmityUIkitProvider> = ({
44
46
  apiEndpoint: { http: apiEndpoint },
45
47
  });
46
48
  const [isGlobalBan, setIsGlobalBan] = useState(false);
49
+ const [isVisitorUsageLimitReached, setIsVisitorUsageLimitReached] =
50
+ useState(false);
51
+ const [isVisitorOrBot, setIsVisitorOrBot] = useState(false);
47
52
 
48
53
  const sessionHandler: Amity.SessionHandler = {
49
54
  sessionWillRenewAccessToken(renewal) {
@@ -64,29 +69,47 @@ export const AuthContextProvider: FC<IAmityUIkitProvider> = ({
64
69
  if (sessionState === 'established') {
65
70
  setIsConnected(true);
66
71
  onSdkReady();
72
+ // Same check as the Web UIKit's isVisitorOrBot in SDKProvider
73
+ setIsVisitorOrBot(Client.getCurrentUserType() !== 'signed-in');
67
74
  }
68
75
  }, [sessionState]);
69
76
 
70
- const handleConnect = useCallback(async () => {
71
- let loginParam;
77
+ useEffect(() => {
78
+ // SDK emits this (throttled, 2s window) when a visitor/bot session gets
79
+ // error 400323 — daily usage limit exceeded. The session stays alive, so
80
+ // this is tracked separately from isGlobalBan. In-memory only: the flag
81
+ // resets when the provider remounts or the user signs in with a userId.
82
+ return Client.onVisitorUsageLimitReached(() => {
83
+ setIsVisitorUsageLimitReached(true);
84
+ });
85
+ }, []);
72
86
 
73
- loginParam = {
74
- userId: userId,
75
- displayName: displayName,
76
- };
77
- if (authToken?.length > 0) {
78
- loginParam = { ...loginParam, authToken: authToken };
79
- }
87
+ const handleConnect = useCallback(async () => {
80
88
  try {
81
- const response = await Client.login(loginParam, sessionHandler);
82
- if (!response) return;
89
+ if (userId) {
90
+ let loginParam: Amity.ConnectClientParams = {
91
+ userId: userId,
92
+ displayName: displayName,
93
+ };
94
+ if (authToken?.length > 0) {
95
+ loginParam = { ...loginParam, authToken: authToken };
96
+ }
97
+ const response = await Client.login(loginParam, sessionHandler);
98
+ if (!response) return;
99
+ } else {
100
+ // No userId — connect as a visitor (read-only session, same
101
+ // convention as the Web UIKit's registerDevice without userId)
102
+ const response = await Client.loginAsVisitor({ sessionHandler });
103
+ if (!response) return;
104
+ }
83
105
  } catch (err) {
84
106
  if (err?.message?.includes(ERROR_CODE.GLOBAL_BAN)) {
85
107
  setIsGlobalBan(true);
86
108
  }
87
109
  }
88
110
 
89
- if (fcmToken) {
111
+ // Visitors/bots are GET-only with no MQTT — skip push registration for them.
112
+ if (fcmToken && userId) {
90
113
  try {
91
114
  await Client.registerPushNotification(fcmToken);
92
115
  } catch (err) {
@@ -111,6 +134,7 @@ export const AuthContextProvider: FC<IAmityUIkitProvider> = ({
111
134
  }
112
135
  };
113
136
  useEffect(() => {
137
+ setIsVisitorUsageLimitReached(false);
114
138
  login();
115
139
  }, [userId]);
116
140
 
@@ -138,6 +162,8 @@ export const AuthContextProvider: FC<IAmityUIkitProvider> = ({
138
162
  sessionState,
139
163
  apiRegion: apiRegion.toLowerCase(),
140
164
  isGlobalBan,
165
+ isVisitorUsageLimitReached,
166
+ isVisitorOrBot,
141
167
  }}
142
168
  >
143
169
  {children}
@@ -1,3 +1,4 @@
1
+ import { useEffect, useRef } from 'react';
1
2
  import {
2
3
  NavigationContainer,
3
4
  NavigationIndependentTree,
@@ -43,6 +44,8 @@ import { CommunityStoriesNotificationSettingScreen } from '../../social/screens/
43
44
  import { CommunityLivestreamsNotificationSettingScreen } from '../../social/screens/CommunityLivestreamsNotificationSetting';
44
45
  import CommunityPendingRequest from '../../social/screens/CommunityPendingRequest';
45
46
  import { GlobalBan } from '../../social/screens/GlobalBan';
47
+ import { VisitorUsageLimit } from '../../social/screens/VisitorUsageLimit';
48
+ import { useBehaviour } from '../../social/providers/BehaviourProvider';
46
49
  import {
47
50
  ImageViewerScreen,
48
51
  VideoPlayerScreen,
@@ -60,10 +63,34 @@ const Stack = createNativeStackNavigator<
60
63
 
61
64
  export default function AmitySocialUIKitV4Navigator() {
62
65
  const theme = useTheme<MyMD3Theme>();
63
- const { isGlobalBan } = useAuth();
66
+ const { isGlobalBan, isVisitorUsageLimitReached } = useAuth();
67
+ const { AmityGlobalBehaviour } = useBehaviour();
68
+
69
+ const handleVisitorUsageLimitReached =
70
+ AmityGlobalBehaviour?.handleVisitorUsageLimitReached;
71
+ const hasHandledUsageLimit = useRef(false);
72
+
73
+ useEffect(() => {
74
+ if (!isVisitorUsageLimitReached) {
75
+ hasHandledUsageLimit.current = false;
76
+ return;
77
+ }
78
+ // Customer override replaces the default full-page swap; guard so rapid
79
+ // repeat events trigger a single navigation.
80
+ if (handleVisitorUsageLimitReached && !hasHandledUsageLimit.current) {
81
+ hasHandledUsageLimit.current = true;
82
+ handleVisitorUsageLimitReached();
83
+ }
84
+ }, [isVisitorUsageLimitReached, handleVisitorUsageLimitReached]);
64
85
 
65
86
  if (isGlobalBan) return <GlobalBan />;
66
87
 
88
+ // Default usage-limit handling: replace the whole navigation tree with the
89
+ // dead-end error page so back-navigation cannot escape it.
90
+ if (isVisitorUsageLimitReached && !handleVisitorUsageLimitReached) {
91
+ return <VisitorUsageLimit />;
92
+ }
93
+
67
94
  return (
68
95
  <NavigationIndependentTree>
69
96
  <NavigationContainer ref={navigationRef} onReady={onNavigationReady}>
@@ -10,4 +10,6 @@ export type AuthContextInterface = {
10
10
  authToken?: string;
11
11
  fcmToken?: string;
12
12
  isGlobalBan: boolean;
13
+ isVisitorUsageLimitReached: boolean;
14
+ isVisitorOrBot: boolean;
13
15
  };
@@ -17,6 +17,24 @@ export type CommunitySettingPageContext = {
17
17
  };
18
18
 
19
19
  export interface IBehaviour {
20
+ AmityGlobalBehaviour?: {
21
+ /**
22
+ * Called when a visitor attempts a restricted action (comment, react,
23
+ * follow, join…). Default shows a toast; override to open a sign-in flow.
24
+ */
25
+ handleVisitorUserAction?: () => void;
26
+ /**
27
+ * Called when a visitor session exceeds its daily usage limit (error
28
+ * 400323). Providing this skips the default full-page
29
+ * <VisitorUsageLimit /> swap so a custom error page can be shown instead.
30
+ */
31
+ handleVisitorUsageLimitReached?: () => void;
32
+ /**
33
+ * Called when "Sign in" is pressed on the usage-limit error page.
34
+ * Default shows a toast; override to navigate to a sign-in flow.
35
+ */
36
+ handleVisitorUsageLimitSignIn?: () => void;
37
+ };
20
38
  AmitySocialHomePageBehaviour?: {
21
39
  onChooseTab?: (arg?: string) => void;
22
40
  };
package/src/index.tsx CHANGED
@@ -75,6 +75,7 @@ import {
75
75
  AmityEditUserProfilePage,
76
76
  AmityUserRelationshipPage,
77
77
  AmityBlockedUsersPage,
78
+ VisitorUsageLimit,
78
79
  } from './social';
79
80
 
80
81
  // Polyfill for BackHandler compatibility with older libraries like react-native-modalbox
@@ -106,6 +107,7 @@ export {
106
107
  AmityUiKitProvider,
107
108
  ErrorBoundary,
108
109
  AmityUiKitSocial,
110
+ VisitorUsageLimit,
109
111
  AmityStoryTabComponent,
110
112
  AmityStoryTabComponentEnum,
111
113
  AmityCreateStoryPage,
@@ -31,6 +31,7 @@ import { useToast } from '../../../../core/stores/slices/toastSlice';
31
31
  import { lock } from '../../../../core/assets/icons';
32
32
  import { Typography } from '../../../../core/components/Typography/Typography';
33
33
  import { MAX_MENTION_USERS } from '../../../../core/constants';
34
+ import useAuth from '../../../../core/hooks/useAuth';
34
35
 
35
36
  interface ICommentListProp {
36
37
  postId: string;
@@ -68,6 +69,9 @@ const CommentList: FC<ICommentListProp> = ({
68
69
  withAvatar,
69
70
  disabledComment,
70
71
  }) => {
72
+ // Web parity: visitors never see the comment composer
73
+ const { isVisitorOrBot } = useAuth();
74
+ const hideComposer = disabledInteraction || isVisitorOrBot;
71
75
  const styles = useStyles();
72
76
  const theme = useTheme() as MyMD3Theme;
73
77
  const onNextPageRef = useRef<() => void | null>(null);
@@ -284,7 +288,7 @@ const CommentList: FC<ICommentListProp> = ({
284
288
  </TouchableOpacity>
285
289
  </View>
286
290
  )}
287
- {!disabledInteraction &&
291
+ {!hideComposer &&
288
292
  (disabledComment ? (
289
293
  <View style={styles.disabledCommentWrap}>
290
294
  <SvgXml
@@ -44,6 +44,7 @@ import ReplyCommentList from '../../legacy/Social/ReplyCommentList';
44
44
  import AmityReactionListComponent from '../../../features/reaction/components/List';
45
45
  import { CommentRepository } from '@amityco/ts-sdk-react-native';
46
46
  import { useTimeDifference } from '../../../hooks/useTimeDifference';
47
+ import { useGlobalBehavior } from '../../../hooks/useGlobalBehavior';
47
48
  import { LinkPreview } from '../../PreviewLink';
48
49
  import { Typography } from '../../../../core/components/Typography/Typography';
49
50
  import { pen, report, trash, unreport } from '../../../../core/assets/icons';
@@ -290,6 +291,13 @@ const CommentListItem = ({
290
291
  onClickReply && onClickReply(user, commentId);
291
292
  };
292
293
 
294
+ // Web parity: visitors see Like/Reply but taps show the sign-in toast
295
+ const { handleGlobalBehavior, isVisitorOrBot } = useGlobalBehavior();
296
+ const onPressLike = () =>
297
+ handleGlobalBehavior({ defaultBehavior: addReactionToComment });
298
+ const onPressReply = () =>
299
+ handleGlobalBehavior({ defaultBehavior: onHandleReply });
300
+
293
301
  const onPressCommentReaction = () => {
294
302
  setIsReactionListVisible(true);
295
303
  };
@@ -348,10 +356,7 @@ const CommentListItem = ({
348
356
  </Typography.Caption>
349
357
  )}
350
358
  </View>
351
- <TouchableOpacity
352
- onPress={() => addReactionToComment()}
353
- style={styles.likeBtn}
354
- >
359
+ <TouchableOpacity onPress={onPressLike} style={styles.likeBtn}>
355
360
  <Typography.CaptionBold
356
361
  style={isLike ? styles.likedText : styles.btnText}
357
362
  >
@@ -359,20 +364,22 @@ const CommentListItem = ({
359
364
  </Typography.CaptionBold>
360
365
  </TouchableOpacity>
361
366
  <TouchableOpacity
362
- onPress={disabledComment ? undefined : onHandleReply}
367
+ onPress={disabledComment ? undefined : onPressReply}
363
368
  style={styles.likeBtn}
364
369
  >
365
370
  <Typography.CaptionBold style={styles.btnText}>
366
371
  Reply
367
372
  </Typography.CaptionBold>
368
373
  </TouchableOpacity>
369
- <TouchableOpacity onPress={openModal}>
370
- <SvgXml
371
- xml={threeDots(theme.colors.baseShade2)}
372
- width="20"
373
- height="20"
374
- />
375
- </TouchableOpacity>
374
+ {!isVisitorOrBot && (
375
+ <TouchableOpacity onPress={openModal}>
376
+ <SvgXml
377
+ xml={threeDots(theme.colors.baseShade2)}
378
+ width="20"
379
+ height="20"
380
+ />
381
+ </TouchableOpacity>
382
+ )}
376
383
  </View>
377
384
 
378
385
  {likeReaction > 0 && (
@@ -44,6 +44,7 @@ import { useNavigation } from '@react-navigation/native';
44
44
  import { NativeStackNavigationProp } from '@react-navigation/native-stack';
45
45
  import { RootStackParamList } from '../../../../../core/routes/RouteParamList';
46
46
  import { useTimeDifference } from '../../../../hooks';
47
+ import { useGlobalBehavior } from '../../../../hooks/useGlobalBehavior';
47
48
  import { useToast } from '../../../../../core/stores/slices/toastSlice';
48
49
  import AmityReactionListComponent from '../../../../features/reaction/components/List';
49
50
 
@@ -155,6 +156,12 @@ export default function ReplyCommentList({
155
156
  await addCommentReaction(commentId, 'like');
156
157
  }
157
158
  };
159
+
160
+ // Web parity: visitors see Like but taps show the sign-in toast
161
+ const { handleGlobalBehavior, isVisitorOrBot } = useGlobalBehavior();
162
+ const onPressLike = () =>
163
+ handleGlobalBehavior({ defaultBehavior: addReactionToComment });
164
+
158
165
  const deletePostObject = () => {
159
166
  Alert.alert('Delete reply', `This reply will be permanently deleted.`, [
160
167
  {
@@ -267,10 +274,7 @@ export default function ReplyCommentList({
267
274
  </Typography.Caption>
268
275
  )}
269
276
  </View>
270
- <TouchableOpacity
271
- onPress={() => addReactionToComment()}
272
- style={styles.likeBtn}
273
- >
277
+ <TouchableOpacity onPress={onPressLike} style={styles.likeBtn}>
274
278
  <Typography.CaptionBold
275
279
  style={isLike ? styles.likedText : styles.btnText}
276
280
  >
@@ -278,13 +282,15 @@ export default function ReplyCommentList({
278
282
  </Typography.CaptionBold>
279
283
  </TouchableOpacity>
280
284
 
281
- <TouchableOpacity onPress={openModal} style={styles.threeDots}>
282
- <SvgXml
283
- xml={threeDots(theme.colors.base)}
284
- width="20"
285
- height="16"
286
- />
287
- </TouchableOpacity>
285
+ {!isVisitorOrBot && (
286
+ <TouchableOpacity onPress={openModal} style={styles.threeDots}>
287
+ <SvgXml
288
+ xml={threeDots(theme.colors.base)}
289
+ width="20"
290
+ height="16"
291
+ />
292
+ </TouchableOpacity>
293
+ )}
288
294
  </View>
289
295
  {likeReaction > 0 && (
290
296
  <TouchableOpacity
@@ -1,7 +1,11 @@
1
1
  import { FC, memo } from 'react';
2
2
  import { TouchableOpacityProps } from 'react-native';
3
3
  import { ComponentID, ElementID, PageID } from '../../enums/enumUIKitID';
4
- import { useAmityElement, useJoinCommunity } from '../../hooks';
4
+ import {
5
+ useAmityElement,
6
+ useGlobalBehavior,
7
+ useJoinCommunity,
8
+ } from '../../hooks';
5
9
  import { Button, BUTTON_SIZE } from '../../components/Button/Button';
6
10
  import { plus } from '../../../core/assets/icons';
7
11
  import { useCustomRankingGlobalFeed } from '../../hooks/useCustomRankingGlobalFeed';
@@ -36,9 +40,13 @@ const CommunityJoinButton: FC<CommunityJoinButtonType> = ({
36
40
  },
37
41
  });
38
42
 
43
+ const { handleGlobalBehavior } = useGlobalBehavior();
44
+
39
45
  const handleJoinCommunity = () => {
40
46
  if (!communityId) return;
41
- joinCommunity(communityId);
47
+ handleGlobalBehavior({
48
+ defaultBehavior: () => joinCommunity(communityId),
49
+ });
42
50
  };
43
51
 
44
52
  if (isExcluded) return null;
@@ -43,7 +43,7 @@ import { useTheme } from 'react-native-paper';
43
43
  import type { MyMD3Theme } from '../../../../../../core/providers/AmityUIKitProvider';
44
44
  import ReplyCommentList from '../ReplyCommentList/index';
45
45
  import { CommentRepository } from '@amityco/ts-sdk-react-native';
46
- import { useTimeDifference } from '../../../../../hooks';
46
+ import { useGlobalBehavior, useTimeDifference } from '../../../../../hooks';
47
47
  import ModeratorBadgeElement from '../../../../../elements/ModeratorBadgeElement/ModeratorBadgeElement';
48
48
  import { BrandBadge } from '../../../../../elements/BrandBadge';
49
49
  import { ComponentID, PageID } from '../../../../../enums';
@@ -315,6 +315,13 @@ const CommentListItem = ({
315
315
  onClickReply && onClickReply(user, commentId);
316
316
  };
317
317
 
318
+ // Web parity: visitors see Like/Reply but taps show the sign-in toast
319
+ const { handleGlobalBehavior, isVisitorOrBot } = useGlobalBehavior();
320
+ const onPressLike = () =>
321
+ handleGlobalBehavior({ defaultBehavior: addReactionToComment });
322
+ const onPressReply = () =>
323
+ handleGlobalBehavior({ defaultBehavior: onHandleReply });
324
+
318
325
  const onPressCommentReaction = () => {
319
326
  onNavigate && onNavigate();
320
327
  setIsReactionListVisible(true);
@@ -399,27 +406,26 @@ const CommentListItem = ({
399
406
  )}
400
407
  </View>
401
408
 
402
- <TouchableOpacity
403
- onPress={() => addReactionToComment()}
404
- style={styles.likeBtn}
405
- >
409
+ <TouchableOpacity onPress={onPressLike} style={styles.likeBtn}>
406
410
  <Text style={isLike ? styles.likedText : styles.btnText}>
407
411
  {!isLike ? 'Like' : 'Liked'}
408
412
  </Text>
409
413
  </TouchableOpacity>
410
- <TouchableOpacity
411
- onPress={onHandleReply}
412
- style={styles.likeBtn}
413
- >
414
+ <TouchableOpacity onPress={onPressReply} style={styles.likeBtn}>
414
415
  <Text style={styles.btnText}>Reply</Text>
415
416
  </TouchableOpacity>
416
- <TouchableOpacity onPress={openModal} style={styles.threeDots}>
417
- <SvgXml
418
- xml={threeDots(theme.colors.base)}
419
- width="20"
420
- height="16"
421
- />
422
- </TouchableOpacity>
417
+ {!isVisitorOrBot && (
418
+ <TouchableOpacity
419
+ onPress={openModal}
420
+ style={styles.threeDots}
421
+ >
422
+ <SvgXml
423
+ xml={threeDots(theme.colors.base)}
424
+ width="20"
425
+ height="16"
426
+ />
427
+ </TouchableOpacity>
428
+ )}
423
429
  </View>
424
430
 
425
431
  {likeReaction > 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
+ // Web parity: visitors see Like but taps show the sign-in toast
150
+ const { handleGlobalBehavior, isVisitorOrBot } = useGlobalBehavior();
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,21 +299,20 @@ 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>
302
306
  </TouchableOpacity>
303
- <TouchableOpacity onPress={openModal} style={styles.threeDots}>
304
- <SvgXml
305
- xml={threeDots(theme.colors.base)}
306
- width="20"
307
- height="16"
308
- />
309
- </TouchableOpacity>
307
+ {!isVisitorOrBot && (
308
+ <TouchableOpacity onPress={openModal} style={styles.threeDots}>
309
+ <SvgXml
310
+ xml={threeDots(theme.colors.base)}
311
+ width="20"
312
+ height="16"
313
+ />
314
+ </TouchableOpacity>
315
+ )}
310
316
  </View>
311
317
 
312
318
  {likeReaction > 0 && (