@stream-io/feeds-client 0.2.6 → 0.2.8

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 (342) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/index.js +408 -0
  3. package/dist/cjs/index.js.map +1 -0
  4. package/dist/cjs/react-bindings.js +1368 -0
  5. package/dist/cjs/react-bindings.js.map +1 -0
  6. package/dist/es/index.mjs +398 -0
  7. package/dist/es/index.mjs.map +1 -0
  8. package/dist/es/react-bindings.mjs +1368 -0
  9. package/dist/es/react-bindings.mjs.map +1 -0
  10. package/dist/index-Cfbt0DFY.js +6492 -0
  11. package/dist/index-Cfbt0DFY.js.map +1 -0
  12. package/dist/index-DLC5hiNd.mjs +6476 -0
  13. package/dist/index-DLC5hiNd.mjs.map +1 -0
  14. package/dist/tsconfig.tsbuildinfo +1 -1
  15. package/dist/types/bindings/index.d.ts +2 -0
  16. package/dist/types/bindings/index.d.ts.map +1 -0
  17. package/dist/{@react-bindings → types/bindings/react}/contexts/StreamFeedContext.d.ts +2 -1
  18. package/dist/types/bindings/react/contexts/StreamFeedContext.d.ts.map +1 -0
  19. package/dist/{@react-bindings → types/bindings/react}/contexts/StreamFeedsContext.d.ts +2 -1
  20. package/dist/types/bindings/react/contexts/StreamFeedsContext.d.ts.map +1 -0
  21. package/dist/{@react-bindings → types/bindings/react}/contexts/StreamSearchContext.d.ts +2 -1
  22. package/dist/types/bindings/react/contexts/StreamSearchContext.d.ts.map +1 -0
  23. package/dist/{@react-bindings → types/bindings/react}/contexts/StreamSearchResultsContext.d.ts +2 -1
  24. package/dist/types/bindings/react/contexts/StreamSearchResultsContext.d.ts.map +1 -0
  25. package/dist/{@react-bindings → types/bindings/react}/hooks/client-state-hooks/index.d.ts +1 -0
  26. package/dist/types/bindings/react/hooks/client-state-hooks/index.d.ts.map +1 -0
  27. package/dist/types/bindings/react/hooks/client-state-hooks/useClientConnectedUser.d.ts +5 -0
  28. package/dist/types/bindings/react/hooks/client-state-hooks/useClientConnectedUser.d.ts.map +1 -0
  29. package/dist/{@react-bindings → types/bindings/react}/hooks/client-state-hooks/useWsConnectionState.d.ts +1 -0
  30. package/dist/types/bindings/react/hooks/client-state-hooks/useWsConnectionState.d.ts.map +1 -0
  31. package/dist/{@react-bindings → types/bindings/react}/hooks/feed-state-hooks/index.d.ts +1 -0
  32. package/dist/types/bindings/react/hooks/feed-state-hooks/index.d.ts.map +1 -0
  33. package/dist/{@react-bindings → types/bindings/react}/hooks/feed-state-hooks/useAggregatedActivities.d.ts +3 -2
  34. package/dist/types/bindings/react/hooks/feed-state-hooks/useAggregatedActivities.d.ts.map +1 -0
  35. package/dist/{@react-bindings → types/bindings/react}/hooks/feed-state-hooks/useComments.d.ts +2 -3
  36. package/dist/types/bindings/react/hooks/feed-state-hooks/useComments.d.ts.map +1 -0
  37. package/dist/{@react-bindings → types/bindings/react}/hooks/feed-state-hooks/useFeedActivities.d.ts +3 -2
  38. package/dist/types/bindings/react/hooks/feed-state-hooks/useFeedActivities.d.ts.map +1 -0
  39. package/dist/{@react-bindings → types/bindings/react}/hooks/feed-state-hooks/useFeedMetadata.d.ts +3 -2
  40. package/dist/types/bindings/react/hooks/feed-state-hooks/useFeedMetadata.d.ts.map +1 -0
  41. package/dist/{@react-bindings → types/bindings/react}/hooks/feed-state-hooks/useFollowers.d.ts +5 -4
  42. package/dist/types/bindings/react/hooks/feed-state-hooks/useFollowers.d.ts.map +1 -0
  43. package/dist/{@react-bindings → types/bindings/react}/hooks/feed-state-hooks/useFollowing.d.ts +5 -4
  44. package/dist/types/bindings/react/hooks/feed-state-hooks/useFollowing.d.ts.map +1 -0
  45. package/dist/{@react-bindings → types/bindings/react}/hooks/feed-state-hooks/useIsAggregatedActivityRead.d.ts +2 -2
  46. package/dist/types/bindings/react/hooks/feed-state-hooks/useIsAggregatedActivityRead.d.ts.map +1 -0
  47. package/dist/{@react-bindings → types/bindings/react}/hooks/feed-state-hooks/useIsAggregatedActivitySeen.d.ts +2 -2
  48. package/dist/types/bindings/react/hooks/feed-state-hooks/useIsAggregatedActivitySeen.d.ts.map +1 -0
  49. package/dist/{@react-bindings → types/bindings/react}/hooks/feed-state-hooks/useNotificationStatus.d.ts +2 -1
  50. package/dist/types/bindings/react/hooks/feed-state-hooks/useNotificationStatus.d.ts.map +1 -0
  51. package/dist/{@react-bindings → types/bindings/react}/hooks/feed-state-hooks/useOwnCapabilities.d.ts +2 -1
  52. package/dist/types/bindings/react/hooks/feed-state-hooks/useOwnCapabilities.d.ts.map +1 -0
  53. package/dist/{@react-bindings → types/bindings/react}/hooks/feed-state-hooks/useOwnFollows.d.ts +3 -2
  54. package/dist/types/bindings/react/hooks/feed-state-hooks/useOwnFollows.d.ts.map +1 -0
  55. package/dist/{@react-bindings → types/bindings/react}/hooks/internal/index.d.ts +1 -0
  56. package/dist/types/bindings/react/hooks/internal/index.d.ts.map +1 -0
  57. package/dist/{@react-bindings → types/bindings/react}/hooks/internal/useStableCallback.d.ts +1 -0
  58. package/dist/types/bindings/react/hooks/internal/useStableCallback.d.ts.map +1 -0
  59. package/dist/{@react-bindings → types/bindings/react}/hooks/search-state-hooks/index.d.ts +1 -0
  60. package/dist/types/bindings/react/hooks/search-state-hooks/index.d.ts.map +1 -0
  61. package/dist/{@react-bindings → types/bindings/react}/hooks/search-state-hooks/useSearchQuery.d.ts +2 -1
  62. package/dist/types/bindings/react/hooks/search-state-hooks/useSearchQuery.d.ts.map +1 -0
  63. package/dist/{@react-bindings → types/bindings/react}/hooks/search-state-hooks/useSearchResult.d.ts +2 -1
  64. package/dist/types/bindings/react/hooks/search-state-hooks/useSearchResult.d.ts.map +1 -0
  65. package/dist/types/bindings/react/hooks/search-state-hooks/useSearchSources.d.ts +5 -0
  66. package/dist/types/bindings/react/hooks/search-state-hooks/useSearchSources.d.ts.map +1 -0
  67. package/dist/{@react-bindings → types/bindings/react}/hooks/useCreateFeedsClient.d.ts +2 -4
  68. package/dist/types/bindings/react/hooks/useCreateFeedsClient.d.ts.map +1 -0
  69. package/dist/{@react-bindings → types/bindings/react}/hooks/util/index.d.ts +1 -0
  70. package/dist/types/bindings/react/hooks/util/index.d.ts.map +1 -0
  71. package/dist/{@react-bindings → types/bindings/react}/hooks/util/useBookmarkActions.d.ts +2 -1
  72. package/dist/types/bindings/react/hooks/util/useBookmarkActions.d.ts.map +1 -0
  73. package/dist/{@react-bindings → types/bindings/react}/hooks/util/useReactionActions.d.ts +2 -1
  74. package/dist/types/bindings/react/hooks/util/useReactionActions.d.ts.map +1 -0
  75. package/dist/{@react-bindings → types/bindings/react}/index.d.ts +2 -1
  76. package/dist/types/bindings/react/index.d.ts.map +1 -0
  77. package/dist/{@react-bindings → types/bindings/react}/wrappers/StreamFeed.d.ts +2 -1
  78. package/dist/types/bindings/react/wrappers/StreamFeed.d.ts.map +1 -0
  79. package/dist/{@react-bindings → types/bindings/react}/wrappers/StreamFeeds.d.ts +1 -0
  80. package/dist/types/bindings/react/wrappers/StreamFeeds.d.ts.map +1 -0
  81. package/dist/{@react-bindings → types/bindings/react}/wrappers/StreamSearch.d.ts +2 -1
  82. package/dist/types/bindings/react/wrappers/StreamSearch.d.ts.map +1 -0
  83. package/dist/{@react-bindings → types/bindings/react}/wrappers/StreamSearchResults.d.ts +2 -1
  84. package/dist/types/bindings/react/wrappers/StreamSearchResults.d.ts.map +1 -0
  85. package/dist/{src → types}/common/ApiClient.d.ts +18 -0
  86. package/dist/types/common/ApiClient.d.ts.map +1 -0
  87. package/dist/{src → types}/common/ConnectionIdManager.d.ts +1 -0
  88. package/dist/types/common/ConnectionIdManager.d.ts.map +1 -0
  89. package/dist/{src → types}/common/EventDispatcher.d.ts +1 -0
  90. package/dist/types/common/EventDispatcher.d.ts.map +1 -0
  91. package/dist/{src → types}/common/Poll.d.ts +2 -1
  92. package/dist/types/common/Poll.d.ts.map +1 -0
  93. package/dist/{src → types}/common/TokenManager.d.ts +2 -0
  94. package/dist/types/common/TokenManager.d.ts.map +1 -0
  95. package/dist/{src → types}/common/gen-imports.d.ts +1 -0
  96. package/dist/types/common/gen-imports.d.ts.map +1 -0
  97. package/dist/{src → types}/common/rate-limit.d.ts +1 -0
  98. package/dist/types/common/rate-limit.d.ts.map +1 -0
  99. package/dist/{src → types}/common/real-time/StableWSConnection.d.ts +4 -4
  100. package/dist/types/common/real-time/StableWSConnection.d.ts.map +1 -0
  101. package/dist/{src → types}/common/real-time/event-models.d.ts +1 -0
  102. package/dist/types/common/real-time/event-models.d.ts.map +1 -0
  103. package/dist/{src → types}/common/search/ActivitySearchSource.d.ts +1 -0
  104. package/dist/types/common/search/ActivitySearchSource.d.ts.map +1 -0
  105. package/dist/{src → types}/common/search/BaseSearchSource.d.ts +2 -1
  106. package/dist/types/common/search/BaseSearchSource.d.ts.map +1 -0
  107. package/dist/{src → types}/common/search/FeedSearchSource.d.ts +1 -0
  108. package/dist/types/common/search/FeedSearchSource.d.ts.map +1 -0
  109. package/dist/{src → types}/common/search/SearchController.d.ts +2 -1
  110. package/dist/types/common/search/SearchController.d.ts.map +1 -0
  111. package/dist/{src → types}/common/search/UserSearchSource.d.ts +2 -1
  112. package/dist/types/common/search/UserSearchSource.d.ts.map +1 -0
  113. package/dist/{src → types}/common/search/index.d.ts +1 -0
  114. package/dist/types/common/search/index.d.ts.map +1 -0
  115. package/dist/{src → types}/common/search/types.d.ts +1 -0
  116. package/dist/types/common/search/types.d.ts.map +1 -0
  117. package/dist/{src → types}/common/types.d.ts +3 -1
  118. package/dist/types/common/types.d.ts.map +1 -0
  119. package/dist/{src → types}/common/utils.d.ts +1 -0
  120. package/dist/types/common/utils.d.ts.map +1 -0
  121. package/dist/{src → types}/feed/event-handlers/activity/handle-activity-added.d.ts +3 -2
  122. package/dist/types/feed/event-handlers/activity/handle-activity-added.d.ts.map +1 -0
  123. package/dist/{src → types}/feed/event-handlers/activity/handle-activity-deleted.d.ts +3 -2
  124. package/dist/types/feed/event-handlers/activity/handle-activity-deleted.d.ts.map +1 -0
  125. package/dist/{src → types}/feed/event-handlers/activity/handle-activity-marked.d.ts +1 -0
  126. package/dist/types/feed/event-handlers/activity/handle-activity-marked.d.ts.map +1 -0
  127. package/dist/{src → types}/feed/event-handlers/activity/handle-activity-pinned.d.ts +1 -0
  128. package/dist/types/feed/event-handlers/activity/handle-activity-pinned.d.ts.map +1 -0
  129. package/dist/types/feed/event-handlers/activity/handle-activity-reaction-added.d.ts +15 -0
  130. package/dist/types/feed/event-handlers/activity/handle-activity-reaction-added.d.ts.map +1 -0
  131. package/dist/types/feed/event-handlers/activity/handle-activity-reaction-deleted.d.ts +15 -0
  132. package/dist/types/feed/event-handlers/activity/handle-activity-reaction-deleted.d.ts.map +1 -0
  133. package/dist/{src → types}/feed/event-handlers/activity/handle-activity-removed-from-feed.d.ts +1 -0
  134. package/dist/types/feed/event-handlers/activity/handle-activity-removed-from-feed.d.ts.map +1 -0
  135. package/dist/{src → types}/feed/event-handlers/activity/handle-activity-unpinned.d.ts +1 -0
  136. package/dist/types/feed/event-handlers/activity/handle-activity-unpinned.d.ts.map +1 -0
  137. package/dist/{src → types}/feed/event-handlers/activity/handle-activity-updated.d.ts +1 -0
  138. package/dist/types/feed/event-handlers/activity/handle-activity-updated.d.ts.map +1 -0
  139. package/dist/{src → types}/feed/event-handlers/activity/index.d.ts +1 -0
  140. package/dist/types/feed/event-handlers/activity/index.d.ts.map +1 -0
  141. package/dist/{src → types}/feed/event-handlers/bookmark/handle-bookmark-added.d.ts +1 -0
  142. package/dist/types/feed/event-handlers/bookmark/handle-bookmark-added.d.ts.map +1 -0
  143. package/dist/{src → types}/feed/event-handlers/bookmark/handle-bookmark-deleted.d.ts +1 -0
  144. package/dist/types/feed/event-handlers/bookmark/handle-bookmark-deleted.d.ts.map +1 -0
  145. package/dist/{src → types}/feed/event-handlers/bookmark/handle-bookmark-updated.d.ts +1 -0
  146. package/dist/types/feed/event-handlers/bookmark/handle-bookmark-updated.d.ts.map +1 -0
  147. package/dist/{src → types}/feed/event-handlers/bookmark/index.d.ts +1 -0
  148. package/dist/types/feed/event-handlers/bookmark/index.d.ts.map +1 -0
  149. package/dist/{src → types}/feed/event-handlers/comment/handle-comment-added.d.ts +1 -0
  150. package/dist/types/feed/event-handlers/comment/handle-comment-added.d.ts.map +1 -0
  151. package/dist/{src → types}/feed/event-handlers/comment/handle-comment-deleted.d.ts +1 -0
  152. package/dist/types/feed/event-handlers/comment/handle-comment-deleted.d.ts.map +1 -0
  153. package/dist/{src → types}/feed/event-handlers/comment/handle-comment-reaction.d.ts +1 -0
  154. package/dist/types/feed/event-handlers/comment/handle-comment-reaction.d.ts.map +1 -0
  155. package/dist/{src → types}/feed/event-handlers/comment/handle-comment-updated.d.ts +1 -0
  156. package/dist/types/feed/event-handlers/comment/handle-comment-updated.d.ts.map +1 -0
  157. package/dist/{src → types}/feed/event-handlers/comment/index.d.ts +1 -0
  158. package/dist/types/feed/event-handlers/comment/index.d.ts.map +1 -0
  159. package/dist/{src → types}/feed/event-handlers/feed/handle-feed-updated.d.ts +1 -0
  160. package/dist/types/feed/event-handlers/feed/handle-feed-updated.d.ts.map +1 -0
  161. package/dist/{src → types}/feed/event-handlers/feed/index.d.ts +1 -0
  162. package/dist/types/feed/event-handlers/feed/index.d.ts.map +1 -0
  163. package/dist/{src → types}/feed/event-handlers/feed-member/handle-feed-member-added.d.ts +1 -0
  164. package/dist/types/feed/event-handlers/feed-member/handle-feed-member-added.d.ts.map +1 -0
  165. package/dist/{src → types}/feed/event-handlers/feed-member/handle-feed-member-removed.d.ts +1 -0
  166. package/dist/types/feed/event-handlers/feed-member/handle-feed-member-removed.d.ts.map +1 -0
  167. package/dist/{src → types}/feed/event-handlers/feed-member/handle-feed-member-updated.d.ts +1 -0
  168. package/dist/types/feed/event-handlers/feed-member/handle-feed-member-updated.d.ts.map +1 -0
  169. package/dist/{src → types}/feed/event-handlers/feed-member/index.d.ts +1 -0
  170. package/dist/types/feed/event-handlers/feed-member/index.d.ts.map +1 -0
  171. package/dist/{src → types}/feed/event-handlers/follow/handle-follow-created.d.ts +3 -2
  172. package/dist/types/feed/event-handlers/follow/handle-follow-created.d.ts.map +1 -0
  173. package/dist/{src → types}/feed/event-handlers/follow/handle-follow-deleted.d.ts +2 -1
  174. package/dist/types/feed/event-handlers/follow/handle-follow-deleted.d.ts.map +1 -0
  175. package/dist/{src → types}/feed/event-handlers/follow/handle-follow-updated.d.ts +3 -2
  176. package/dist/types/feed/event-handlers/follow/handle-follow-updated.d.ts.map +1 -0
  177. package/dist/{src → types}/feed/event-handlers/follow/index.d.ts +1 -0
  178. package/dist/types/feed/event-handlers/follow/index.d.ts.map +1 -0
  179. package/dist/{src → types}/feed/event-handlers/index.d.ts +1 -0
  180. package/dist/types/feed/event-handlers/index.d.ts.map +1 -0
  181. package/dist/{src → types}/feed/event-handlers/notification-feed/handle-notification-feed-updated.d.ts +1 -0
  182. package/dist/types/feed/event-handlers/notification-feed/handle-notification-feed-updated.d.ts.map +1 -0
  183. package/dist/{src → types}/feed/event-handlers/notification-feed/index.d.ts +1 -0
  184. package/dist/types/feed/event-handlers/notification-feed/index.d.ts.map +1 -0
  185. package/dist/{src → types}/feed/event-handlers/watch/handle-watch-started.d.ts +1 -0
  186. package/dist/types/feed/event-handlers/watch/handle-watch-started.d.ts.map +1 -0
  187. package/dist/{src → types}/feed/event-handlers/watch/handle-watch-stopped.d.ts +1 -0
  188. package/dist/types/feed/event-handlers/watch/handle-watch-stopped.d.ts.map +1 -0
  189. package/dist/{src → types}/feed/event-handlers/watch/index.d.ts +1 -0
  190. package/dist/types/feed/event-handlers/watch/index.d.ts.map +1 -0
  191. package/dist/{src → types}/feed/feed.d.ts +9 -6
  192. package/dist/types/feed/feed.d.ts.map +1 -0
  193. package/dist/{src → types}/feed/index.d.ts +1 -0
  194. package/dist/types/feed/index.d.ts.map +1 -0
  195. package/dist/{src → types}/feeds-client/event-handlers/index.d.ts +1 -0
  196. package/dist/types/feeds-client/event-handlers/index.d.ts.map +1 -0
  197. package/dist/{src → types}/feeds-client/event-handlers/user/handle-user-updated.d.ts +1 -0
  198. package/dist/types/feeds-client/event-handlers/user/handle-user-updated.d.ts.map +1 -0
  199. package/dist/{src → types}/feeds-client/feeds-client.d.ts +18 -10
  200. package/dist/types/feeds-client/feeds-client.d.ts.map +1 -0
  201. package/dist/{src → types}/feeds-client/index.d.ts +1 -0
  202. package/dist/types/feeds-client/index.d.ts.map +1 -0
  203. package/dist/{src → types}/gen/feeds/FeedApi.d.ts +1 -0
  204. package/dist/types/gen/feeds/FeedApi.d.ts.map +1 -0
  205. package/dist/{src → types}/gen/feeds/FeedsApi.d.ts +1 -0
  206. package/dist/types/gen/feeds/FeedsApi.d.ts.map +1 -0
  207. package/dist/{src → types}/gen/model-decoders/decoders.d.ts +1 -0
  208. package/dist/types/gen/model-decoders/decoders.d.ts.map +1 -0
  209. package/dist/{src → types}/gen/model-decoders/event-decoder-mapping.d.ts +1 -0
  210. package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts.map +1 -0
  211. package/dist/{src → types}/gen/models/index.d.ts +43 -1
  212. package/dist/types/gen/models/index.d.ts.map +1 -0
  213. package/dist/{src → types}/gen/moderation/ModerationApi.d.ts +1 -0
  214. package/dist/types/gen/moderation/ModerationApi.d.ts.map +1 -0
  215. package/dist/{src → types}/gen-imports.d.ts +1 -0
  216. package/dist/types/gen-imports.d.ts.map +1 -0
  217. package/dist/types/index.d.ts +10 -0
  218. package/dist/types/index.d.ts.map +1 -0
  219. package/dist/{src → types}/moderation-client.d.ts +1 -0
  220. package/dist/types/moderation-client.d.ts.map +1 -0
  221. package/dist/{src → types}/types-internal.d.ts +4 -0
  222. package/dist/types/types-internal.d.ts.map +1 -0
  223. package/dist/{src → types}/types.d.ts +1 -0
  224. package/dist/types/types.d.ts.map +1 -0
  225. package/dist/{src → types}/utils/check-has-another-page.d.ts +1 -0
  226. package/dist/types/utils/check-has-another-page.d.ts.map +1 -0
  227. package/dist/{src → types}/utils/constants.d.ts +1 -0
  228. package/dist/types/utils/constants.d.ts.map +1 -0
  229. package/dist/{src → types}/utils/index.d.ts +2 -0
  230. package/dist/types/utils/index.d.ts.map +1 -0
  231. package/dist/types/utils/is-react-native.d.ts +5 -0
  232. package/dist/types/utils/is-react-native.d.ts.map +1 -0
  233. package/dist/types/utils/logger.d.ts +61 -0
  234. package/dist/types/utils/logger.d.ts.map +1 -0
  235. package/dist/types/utils/state-update-queue.d.ts +83 -0
  236. package/dist/types/utils/state-update-queue.d.ts.map +1 -0
  237. package/dist/types/utils/type-assertions.d.ts +12 -0
  238. package/dist/types/utils/type-assertions.d.ts.map +1 -0
  239. package/dist/{src → types}/utils/unique-array-merge.d.ts +1 -0
  240. package/dist/types/utils/unique-array-merge.d.ts.map +1 -0
  241. package/dist/{src → types}/utils/update-entity-in-array.d.ts +1 -0
  242. package/dist/types/utils/update-entity-in-array.d.ts.map +1 -0
  243. package/package.json +21 -33
  244. package/src/bindings/index.ts +1 -0
  245. package/src/bindings/react/contexts/StreamFeedContext.tsx +18 -0
  246. package/src/bindings/react/contexts/StreamFeedsContext.tsx +21 -0
  247. package/src/bindings/react/contexts/StreamSearchContext.tsx +18 -0
  248. package/src/bindings/react/contexts/StreamSearchResultsContext.tsx +20 -0
  249. package/src/bindings/react/hooks/client-state-hooks/useClientConnectedUser.ts +18 -0
  250. package/src/bindings/react/hooks/client-state-hooks/useWsConnectionState.ts +18 -0
  251. package/src/bindings/react/hooks/feed-state-hooks/useAggregatedActivities.ts +25 -0
  252. package/src/bindings/react/hooks/feed-state-hooks/useComments.ts +91 -0
  253. package/src/bindings/react/hooks/feed-state-hooks/useFeedActivities.ts +36 -0
  254. package/src/bindings/react/hooks/feed-state-hooks/useFeedMetadata.ts +28 -0
  255. package/src/bindings/react/hooks/feed-state-hooks/useFollowers.ts +54 -0
  256. package/src/bindings/react/hooks/feed-state-hooks/useFollowing.ts +54 -0
  257. package/src/bindings/react/hooks/feed-state-hooks/useIsAggregatedActivityRead.ts +29 -0
  258. package/src/bindings/react/hooks/feed-state-hooks/useIsAggregatedActivitySeen.ts +28 -0
  259. package/src/bindings/react/hooks/feed-state-hooks/useNotificationStatus.ts +28 -0
  260. package/src/bindings/react/hooks/feed-state-hooks/useOwnCapabilities.ts +70 -0
  261. package/src/bindings/react/hooks/feed-state-hooks/useOwnFollows.ts +18 -0
  262. package/src/bindings/react/hooks/internal/useStableCallback.ts +37 -0
  263. package/src/bindings/react/hooks/search-state-hooks/useSearchQuery.ts +14 -0
  264. package/src/bindings/react/hooks/search-state-hooks/useSearchResult.ts +36 -0
  265. package/src/bindings/react/hooks/search-state-hooks/useSearchSources.ts +17 -0
  266. package/src/bindings/react/hooks/useCreateFeedsClient.ts +73 -0
  267. package/src/bindings/react/hooks/util/useBookmarkActions.ts +40 -0
  268. package/src/bindings/react/hooks/util/useReactionActions.ts +56 -0
  269. package/{@react-bindings → src/bindings/react}/index.ts +1 -1
  270. package/src/bindings/react/wrappers/StreamFeed.tsx +23 -0
  271. package/src/bindings/react/wrappers/StreamFeeds.tsx +13 -0
  272. package/src/bindings/react/wrappers/StreamSearch.tsx +23 -0
  273. package/src/bindings/react/wrappers/StreamSearchResults.tsx +23 -0
  274. package/src/common/ApiClient.ts +86 -33
  275. package/src/common/EventDispatcher.ts +3 -6
  276. package/src/common/Poll.ts +1 -1
  277. package/src/common/TokenManager.ts +4 -0
  278. package/src/common/real-time/StableWSConnection.ts +64 -60
  279. package/src/common/search/BaseSearchSource.ts +11 -4
  280. package/src/common/search/SearchController.ts +4 -2
  281. package/src/common/types.ts +3 -2
  282. package/src/feed/event-handlers/activity/activity-utils.test.ts +40 -9
  283. package/src/feed/event-handlers/activity/handle-activity-added.test.ts +1 -1
  284. package/src/feed/event-handlers/activity/handle-activity-added.ts +7 -7
  285. package/src/feed/event-handlers/activity/handle-activity-deleted.ts +15 -12
  286. package/src/feed/event-handlers/activity/handle-activity-reaction-added.test.ts +101 -1
  287. package/src/feed/event-handlers/activity/handle-activity-reaction-added.ts +55 -29
  288. package/src/feed/event-handlers/activity/handle-activity-reaction-deleted.test.ts +118 -1
  289. package/src/feed/event-handlers/activity/handle-activity-reaction-deleted.ts +59 -32
  290. package/src/feed/event-handlers/activity/handle-activity-removed-from-feed.ts +1 -1
  291. package/src/feed/event-handlers/follow/follow-state-update-queue.test.ts +219 -0
  292. package/src/feed/event-handlers/follow/handle-follow-created.ts +7 -2
  293. package/src/feed/event-handlers/follow/handle-follow-deleted.ts +5 -0
  294. package/src/feed/event-handlers/follow/handle-follow-updated.test.ts +0 -43
  295. package/src/feed/event-handlers/follow/handle-follow-updated.ts +7 -2
  296. package/src/feed/feed.test.ts +90 -0
  297. package/src/feed/feed.ts +25 -4
  298. package/src/feeds-client/feeds-client.ts +35 -4
  299. package/src/gen/feeds/FeedsApi.ts +2 -0
  300. package/src/gen/model-decoders/decoders.ts +22 -0
  301. package/src/gen/models/index.ts +71 -1
  302. package/src/index.ts +9 -0
  303. package/src/test-utils/response-generators.ts +12 -3
  304. package/src/types-internal.ts +4 -0
  305. package/src/utils/index.ts +1 -0
  306. package/src/utils/is-react-native.ts +7 -0
  307. package/src/utils/logger.ts +18 -0
  308. package/src/utils/state-update-queue.test.ts +85 -9
  309. package/src/utils/state-update-queue.ts +104 -11
  310. package/src/utils/type-assertions.ts +22 -1
  311. package/dist/@react-bindings/hooks/client-state-hooks/useClientConnectedUser.d.ts +0 -4
  312. package/dist/@react-bindings/hooks/search-state-hooks/useSearchSources.d.ts +0 -4
  313. package/dist/@react-bindings/hooks/useStateStore.d.ts +0 -3
  314. package/dist/index-react-bindings.browser.cjs +0 -6607
  315. package/dist/index-react-bindings.browser.cjs.map +0 -1
  316. package/dist/index-react-bindings.browser.js +0 -6574
  317. package/dist/index-react-bindings.browser.js.map +0 -1
  318. package/dist/index-react-bindings.node.cjs +0 -6607
  319. package/dist/index-react-bindings.node.cjs.map +0 -1
  320. package/dist/index-react-bindings.node.js +0 -6574
  321. package/dist/index-react-bindings.node.js.map +0 -1
  322. package/dist/index.browser.cjs +0 -6578
  323. package/dist/index.browser.cjs.map +0 -1
  324. package/dist/index.browser.js +0 -6551
  325. package/dist/index.browser.js.map +0 -1
  326. package/dist/index.d.ts +0 -9
  327. package/dist/index.node.cjs +0 -6578
  328. package/dist/index.node.cjs.map +0 -1
  329. package/dist/index.node.js +0 -6551
  330. package/dist/index.node.js.map +0 -1
  331. package/dist/src/common/StateStore.d.ts +0 -125
  332. package/dist/src/feed/event-handlers/activity/handle-activity-reaction-added.d.ts +0 -12
  333. package/dist/src/feed/event-handlers/activity/handle-activity-reaction-deleted.d.ts +0 -12
  334. package/dist/src/utils/state-update-queue.d.ts +0 -6
  335. package/dist/src/utils/type-assertions.d.ts +0 -7
  336. package/index.ts +0 -9
  337. package/src/common/StateStore.ts +0 -332
  338. /package/{@react-bindings → src/bindings/react}/hooks/client-state-hooks/index.ts +0 -0
  339. /package/{@react-bindings → src/bindings/react}/hooks/feed-state-hooks/index.ts +0 -0
  340. /package/{@react-bindings → src/bindings/react}/hooks/internal/index.ts +0 -0
  341. /package/{@react-bindings → src/bindings/react}/hooks/search-state-hooks/index.ts +0 -0
  342. /package/{@react-bindings → src/bindings/react}/hooks/util/index.ts +0 -0
@@ -0,0 +1,1368 @@
1
+ import require$$0, { useCallback, useMemo, useState, useEffect, createContext, useContext, useRef } from "react";
2
+ import "@stream-io/state-store";
3
+ import { F as FeedsClient, j as isCommentResponse, e as checkHasAnotherPage, b as FeedOwnCapability } from "../index-DLC5hiNd.mjs";
4
+ import "@stream-io/logger";
5
+ import "axios";
6
+ var shim = { exports: {} };
7
+ var useSyncExternalStoreShim_production = {};
8
+ /**
9
+ * @license React
10
+ * use-sync-external-store-shim.production.js
11
+ *
12
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
17
+ var hasRequiredUseSyncExternalStoreShim_production;
18
+ function requireUseSyncExternalStoreShim_production() {
19
+ if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
20
+ hasRequiredUseSyncExternalStoreShim_production = 1;
21
+ var React = require$$0;
22
+ function is(x, y) {
23
+ return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
24
+ }
25
+ var objectIs = "function" === typeof Object.is ? Object.is : is, useState2 = React.useState, useEffect2 = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue;
26
+ function useSyncExternalStore$2(subscribe, getSnapshot) {
27
+ var value = getSnapshot(), _useState = useState2({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
28
+ useLayoutEffect(
29
+ function() {
30
+ inst.value = value;
31
+ inst.getSnapshot = getSnapshot;
32
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
33
+ },
34
+ [subscribe, value, getSnapshot]
35
+ );
36
+ useEffect2(
37
+ function() {
38
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
39
+ return subscribe(function() {
40
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
41
+ });
42
+ },
43
+ [subscribe]
44
+ );
45
+ useDebugValue(value);
46
+ return value;
47
+ }
48
+ function checkIfSnapshotChanged(inst) {
49
+ var latestGetSnapshot = inst.getSnapshot;
50
+ inst = inst.value;
51
+ try {
52
+ var nextValue = latestGetSnapshot();
53
+ return !objectIs(inst, nextValue);
54
+ } catch (error) {
55
+ return true;
56
+ }
57
+ }
58
+ function useSyncExternalStore$1(subscribe, getSnapshot) {
59
+ return getSnapshot();
60
+ }
61
+ var shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
62
+ useSyncExternalStoreShim_production.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim2;
63
+ return useSyncExternalStoreShim_production;
64
+ }
65
+ var useSyncExternalStoreShim_development = {};
66
+ /**
67
+ * @license React
68
+ * use-sync-external-store-shim.development.js
69
+ *
70
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
71
+ *
72
+ * This source code is licensed under the MIT license found in the
73
+ * LICENSE file in the root directory of this source tree.
74
+ */
75
+ var hasRequiredUseSyncExternalStoreShim_development;
76
+ function requireUseSyncExternalStoreShim_development() {
77
+ if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
78
+ hasRequiredUseSyncExternalStoreShim_development = 1;
79
+ "production" !== process.env.NODE_ENV && function() {
80
+ function is(x, y) {
81
+ return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
82
+ }
83
+ function useSyncExternalStore$2(subscribe, getSnapshot) {
84
+ didWarnOld18Alpha || void 0 === React.startTransition || (didWarnOld18Alpha = true, console.error(
85
+ "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
86
+ ));
87
+ var value = getSnapshot();
88
+ if (!didWarnUncachedGetSnapshot) {
89
+ var cachedValue = getSnapshot();
90
+ objectIs(value, cachedValue) || (console.error(
91
+ "The result of getSnapshot should be cached to avoid an infinite loop"
92
+ ), didWarnUncachedGetSnapshot = true);
93
+ }
94
+ cachedValue = useState2({
95
+ inst: { value, getSnapshot }
96
+ });
97
+ var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
98
+ useLayoutEffect(
99
+ function() {
100
+ inst.value = value;
101
+ inst.getSnapshot = getSnapshot;
102
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
103
+ },
104
+ [subscribe, value, getSnapshot]
105
+ );
106
+ useEffect2(
107
+ function() {
108
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
109
+ return subscribe(function() {
110
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
111
+ });
112
+ },
113
+ [subscribe]
114
+ );
115
+ useDebugValue(value);
116
+ return value;
117
+ }
118
+ function checkIfSnapshotChanged(inst) {
119
+ var latestGetSnapshot = inst.getSnapshot;
120
+ inst = inst.value;
121
+ try {
122
+ var nextValue = latestGetSnapshot();
123
+ return !objectIs(inst, nextValue);
124
+ } catch (error) {
125
+ return true;
126
+ }
127
+ }
128
+ function useSyncExternalStore$1(subscribe, getSnapshot) {
129
+ return getSnapshot();
130
+ }
131
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
132
+ var React = require$$0, objectIs = "function" === typeof Object.is ? Object.is : is, useState2 = React.useState, useEffect2 = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
133
+ useSyncExternalStoreShim_development.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim2;
134
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
135
+ }();
136
+ return useSyncExternalStoreShim_development;
137
+ }
138
+ var hasRequiredShim;
139
+ function requireShim() {
140
+ if (hasRequiredShim) return shim.exports;
141
+ hasRequiredShim = 1;
142
+ if (process.env.NODE_ENV === "production") {
143
+ shim.exports = requireUseSyncExternalStoreShim_production();
144
+ } else {
145
+ shim.exports = requireUseSyncExternalStoreShim_development();
146
+ }
147
+ return shim.exports;
148
+ }
149
+ var shimExports = requireShim();
150
+ const isPatch = (value) => typeof value === "function";
151
+ const noop$1 = () => {
152
+ };
153
+ class StateStore {
154
+ constructor(value) {
155
+ this.value = value;
156
+ this.handlers = /* @__PURE__ */ new Set();
157
+ this.preprocessors = /* @__PURE__ */ new Set();
158
+ this.partialNext = (partial) => this.next((current) => ({ ...current, ...partial }));
159
+ this.subscribeWithSelector = (selector2, handler) => {
160
+ let previouslySelectedValues;
161
+ const wrappedHandler = (nextValue) => {
162
+ const newlySelectedValues = selector2(nextValue);
163
+ const selectionsAreEqual = StateStore.doSelectionsEqual(previouslySelectedValues, newlySelectedValues);
164
+ if (selectionsAreEqual)
165
+ return;
166
+ const previouslySelectedValuesCopy = previouslySelectedValues;
167
+ previouslySelectedValues = newlySelectedValues;
168
+ handler(newlySelectedValues, previouslySelectedValuesCopy);
169
+ };
170
+ return this.subscribe(wrappedHandler);
171
+ };
172
+ }
173
+ /**
174
+ * Allows merging two stores only if their keys differ otherwise there's no way to ensure the data type stability.
175
+ * @experimental
176
+ * This method is experimental and may change in future versions.
177
+ */
178
+ merge(stateStore) {
179
+ return new MergedStateStore({
180
+ original: this,
181
+ merged: stateStore
182
+ });
183
+ }
184
+ next(newValueOrPatch) {
185
+ const newValue = isPatch(newValueOrPatch) ? newValueOrPatch(this.value) : newValueOrPatch;
186
+ if (Object.is(newValue, this.value))
187
+ return;
188
+ this.preprocessors.forEach((preprocessor) => preprocessor(newValue, this.value));
189
+ const oldValue = this.value;
190
+ this.value = newValue;
191
+ this.handlers.forEach((handler) => handler(this.value, oldValue));
192
+ }
193
+ getLatestValue() {
194
+ return this.value;
195
+ }
196
+ subscribe(handler) {
197
+ handler(this.value, void 0);
198
+ this.handlers.add(handler);
199
+ return () => {
200
+ this.handlers.delete(handler);
201
+ };
202
+ }
203
+ static doSelectionsEqual(previouslySelectedValues, newlySelectedValues) {
204
+ let selectionsAreEqual;
205
+ if (selectionsAreEqual = typeof previouslySelectedValues !== "undefined") {
206
+ for (const key in newlySelectedValues) {
207
+ if (Object.is(previouslySelectedValues[key], newlySelectedValues[key])) {
208
+ continue;
209
+ }
210
+ selectionsAreEqual = false;
211
+ break;
212
+ }
213
+ }
214
+ return selectionsAreEqual;
215
+ }
216
+ /**
217
+ * Registers a preprocessor function that will be called before the state is updated.
218
+ *
219
+ * Preprocessors are invoked with the new and previous values whenever `next` or `partialNext` methods
220
+ * are called, allowing you to mutate or react to the new value before it is set. Preprocessors run in the
221
+ * order they were registered.
222
+ *
223
+ * @example
224
+ * ```ts
225
+ * const store = new StateStore<{ count: number; isMaxValue: bool; }>({ count: 0, isMaxValue: false });
226
+ *
227
+ * store.addPreprocessor((nextValue, prevValue) => {
228
+ * if (nextValue.count > 10) {
229
+ * nextValue.count = 10; // Clamp the value to a maximum of 10
230
+ * }
231
+ *
232
+ * if (nextValue.count === 10) {
233
+ * nextValue.isMaxValue = true; // Set isMaxValue to true if count is 10
234
+ * } else {
235
+ * nextValue.isMaxValue = false; // Reset isMaxValue otherwise
236
+ * }
237
+ * });
238
+ *
239
+ * store.partialNext({ count: 15 });
240
+ *
241
+ * store.getLatestValue(); // { count: 10, isMaxValue: true }
242
+ *
243
+ * store.partialNext({ count: 5 });
244
+ *
245
+ * store.getLatestValue(); // { count: 5, isMaxValue: false }
246
+ * ```
247
+ *
248
+ * @param preprocessor - The function to be called with the next and previous values before the state is updated.
249
+ * @returns A `RemovePreprocessor` function that removes the preprocessor when called.
250
+ */
251
+ addPreprocessor(preprocessor) {
252
+ this.preprocessors.add(preprocessor);
253
+ return () => {
254
+ this.preprocessors.delete(preprocessor);
255
+ };
256
+ }
257
+ }
258
+ class MergedStateStore extends StateStore {
259
+ constructor({ original, merged }) {
260
+ const originalValue = original.getLatestValue();
261
+ const mergedValue = merged.getLatestValue();
262
+ super({
263
+ ...originalValue,
264
+ ...mergedValue
265
+ });
266
+ this.next = () => {
267
+ console.warn(`${MergedStateStore.name}.next is disabled, call original.next or merged.next instead`);
268
+ };
269
+ this.partialNext = () => {
270
+ console.warn(`${MergedStateStore.name}.partialNext is disabled, call original.partialNext or merged.partialNext instead`);
271
+ };
272
+ this.cachedOriginalValue = originalValue;
273
+ this.cachedMergedValue = mergedValue;
274
+ this.original = original;
275
+ this.merged = merged;
276
+ }
277
+ /**
278
+ * Subscribes to changes in the merged state store.
279
+ *
280
+ * This method extends the base subscribe functionality to handle the merged nature of this store:
281
+ * 1. The first subscriber triggers registration of helper subscribers that listen to both source stores
282
+ * 2. Changes from either source store are propagated to this merged store
283
+ * 3. Source store values are cached to prevent unnecessary updates
284
+ *
285
+ * When the first subscriber is added, the method sets up listeners on both original and merged stores.
286
+ * These listeners update the combined store value whenever either source store changes.
287
+ * All subscriptions (helpers and the actual handler) are tracked so they can be properly cleaned up.
288
+ *
289
+ * @param handler - The callback function that will be executed when the state changes
290
+ * @returns An unsubscribe function that, when called, removes the subscription and any helper subscriptions
291
+ */
292
+ subscribe(handler) {
293
+ const unsubscribeFunctions = [];
294
+ if (!this.handlers.size) {
295
+ const base = (nextValue) => {
296
+ super.next((currentValue) => ({
297
+ ...currentValue,
298
+ ...nextValue
299
+ }));
300
+ };
301
+ unsubscribeFunctions.push(this.original.subscribe((nextValue) => {
302
+ if (nextValue === this.cachedOriginalValue)
303
+ return;
304
+ this.cachedOriginalValue = nextValue;
305
+ base(nextValue);
306
+ }), this.merged.subscribe((nextValue) => {
307
+ if (nextValue === this.cachedMergedValue)
308
+ return;
309
+ this.cachedMergedValue = nextValue;
310
+ base(nextValue);
311
+ }));
312
+ }
313
+ unsubscribeFunctions.push(super.subscribe(handler));
314
+ return () => {
315
+ unsubscribeFunctions.forEach((unsubscribe) => unsubscribe());
316
+ };
317
+ }
318
+ /**
319
+ * Retrieves the latest combined state from both original and merged stores.
320
+ *
321
+ * This method extends the base getLatestValue functionality to ensure the merged store
322
+ * remains in sync with its source stores even when there are no active subscribers.
323
+ *
324
+ * When there are no handlers registered, the method:
325
+ * 1. Fetches the latest values from both source stores
326
+ * 2. Compares them with the cached values to detect changes
327
+ * 3. If changes are detected, updates the internal value and caches
328
+ * the new source values to maintain consistency
329
+ *
330
+ * This approach ensures that calling getLatestValue() always returns the most
331
+ * up-to-date combined state, even if the merged store hasn't been actively
332
+ * receiving updates through subscriptions.
333
+ *
334
+ * @returns The latest combined state from both original and merged stores
335
+ */
336
+ getLatestValue() {
337
+ if (!this.handlers.size) {
338
+ const originalValue = this.original.getLatestValue();
339
+ const mergedValue = this.merged.getLatestValue();
340
+ if (originalValue !== this.cachedOriginalValue || mergedValue !== this.cachedMergedValue) {
341
+ this.value = {
342
+ ...originalValue,
343
+ ...mergedValue
344
+ };
345
+ this.cachedMergedValue = mergedValue;
346
+ this.cachedOriginalValue = originalValue;
347
+ }
348
+ }
349
+ return super.getLatestValue();
350
+ }
351
+ addPreprocessor() {
352
+ console.warn(`${MergedStateStore.name}.addPreprocessor is disabled, call original.addPreprocessor or merged.addPreprocessor instead`);
353
+ return noop$1;
354
+ }
355
+ }
356
+ const noop = () => {
357
+ };
358
+ function useStateStore(store, selector2) {
359
+ const wrappedSubscription = useCallback((onStoreChange) => {
360
+ const unsubscribe = store?.subscribeWithSelector(selector2, onStoreChange);
361
+ return unsubscribe ?? noop;
362
+ }, [store, selector2]);
363
+ const wrappedSnapshot = useMemo(() => {
364
+ let cachedTuple;
365
+ return () => {
366
+ const currentValue = store?.getLatestValue();
367
+ if (!currentValue)
368
+ return void 0;
369
+ if (cachedTuple && Object.is(cachedTuple[0], currentValue)) {
370
+ return cachedTuple[1];
371
+ }
372
+ const newlySelected = selector2(currentValue);
373
+ const selectionsAreEqual = StateStore.doSelectionsEqual(cachedTuple?.[1], newlySelected);
374
+ if (selectionsAreEqual)
375
+ return cachedTuple[1];
376
+ cachedTuple = [currentValue, newlySelected];
377
+ return cachedTuple[1];
378
+ };
379
+ }, [store, selector2]);
380
+ const state = shimExports.useSyncExternalStore(wrappedSubscription, wrappedSnapshot);
381
+ return state;
382
+ }
383
+ const useCreateFeedsClient = ({
384
+ apiKey,
385
+ tokenOrProvider,
386
+ userData,
387
+ options
388
+ }) => {
389
+ const [client, setClient] = useState(
390
+ () => new FeedsClient(apiKey, options)
391
+ );
392
+ const [error, setError] = useState(null);
393
+ const [cachedUserData, setCachedUserData] = useState(userData);
394
+ const [cachedOptions] = useState(options);
395
+ if (error) {
396
+ throw error;
397
+ }
398
+ if (userData.id !== cachedUserData.id) {
399
+ setCachedUserData(userData);
400
+ }
401
+ useEffect(() => {
402
+ const _client = new FeedsClient(apiKey, cachedOptions);
403
+ const connectionPromise = _client.connectUser(cachedUserData, tokenOrProvider).then(() => {
404
+ setError(null);
405
+ console.log("Successfully connected user: ", cachedUserData.id);
406
+ }).catch((err) => {
407
+ setError(err);
408
+ });
409
+ setClient(_client);
410
+ return () => {
411
+ setClient(null);
412
+ connectionPromise.then(() => {
413
+ setError(null);
414
+ return _client.disconnectUser();
415
+ }).catch((err) => {
416
+ setError(err);
417
+ }).then(() => {
418
+ console.log(
419
+ `Connection for user "${cachedUserData.id}" has been closed`
420
+ );
421
+ });
422
+ };
423
+ }, [apiKey, cachedUserData, cachedOptions, tokenOrProvider]);
424
+ return client;
425
+ };
426
+ const StreamFeedsContext = createContext(void 0);
427
+ const useFeedsClient = () => {
428
+ return useContext(StreamFeedsContext);
429
+ };
430
+ const useClientConnectedUser = () => {
431
+ const client = useFeedsClient();
432
+ const { user } = useStateStore(client?.state, selector$c) ?? {};
433
+ return user;
434
+ };
435
+ const selector$c = (nextState) => ({
436
+ user: nextState.connected_user
437
+ });
438
+ const useWsConnectionState = () => {
439
+ const client = useFeedsClient();
440
+ const { is_healthy } = useStateStore(client?.state, selector$b) ?? {};
441
+ return { is_healthy };
442
+ };
443
+ const selector$b = (nextState) => ({
444
+ is_healthy: nextState.is_ws_connection_healthy
445
+ });
446
+ const StreamFeedContext = createContext(void 0);
447
+ const useFeedContext = () => {
448
+ return useContext(StreamFeedContext);
449
+ };
450
+ const useStableCallback = (callback) => {
451
+ const ref = useRef(callback);
452
+ ref.current = callback;
453
+ return useCallback((...args) => {
454
+ return ref.current(...args);
455
+ }, []);
456
+ };
457
+ const useFeedActivities = (feedFromProps) => {
458
+ const feedFromContext = useFeedContext();
459
+ const feed = feedFromProps ?? feedFromContext;
460
+ const data = useStateStore(feed?.state, selector$a);
461
+ const loadNextPage = useStableCallback(async () => {
462
+ if (!feed || !data?.has_next_page || data?.is_loading) {
463
+ return;
464
+ }
465
+ await feed.getNextPage();
466
+ });
467
+ return useMemo(() => ({ ...data, loadNextPage }), [data, loadNextPage]);
468
+ };
469
+ const selector$a = ({
470
+ is_loading_activities,
471
+ next,
472
+ activities = []
473
+ }) => ({
474
+ is_loading: is_loading_activities,
475
+ has_next_page: typeof next !== "undefined",
476
+ activities
477
+ });
478
+ function useComments({
479
+ feed: feedFromProps,
480
+ parent
481
+ }) {
482
+ const feedFromContext = useFeedContext();
483
+ const feed = feedFromProps ?? feedFromContext;
484
+ const selector2 = useCallback(
485
+ (state) => ({
486
+ comments: state.comments_by_entity_id?.[parent.id]?.comments,
487
+ comments_pagination: state.comments_by_entity_id?.[parent.id]?.pagination
488
+ }),
489
+ [parent.id]
490
+ );
491
+ const data = useStateStore(feed?.state, selector2);
492
+ const loadNextPage = useMemo(() => {
493
+ if (!feed) return void 0;
494
+ return (request) => {
495
+ if (isCommentResponse(parent)) {
496
+ return feed.loadNextPageCommentReplies(parent, request);
497
+ } else {
498
+ return feed.loadNextPageActivityComments(parent, request);
499
+ }
500
+ };
501
+ }, [feed, parent]);
502
+ return useMemo(() => {
503
+ if (!data) {
504
+ return void 0;
505
+ }
506
+ return {
507
+ ...data,
508
+ has_next_page: checkHasAnotherPage(
509
+ data.comments,
510
+ data.comments_pagination?.next
511
+ ),
512
+ is_loading_next_page: data?.comments_pagination?.loading_next_page ?? false,
513
+ loadNextPage
514
+ };
515
+ }, [data, loadNextPage]);
516
+ }
517
+ const stableEmptyArray = [];
518
+ const selector$9 = (currentState) => ({
519
+ oc: currentState.own_capabilities ?? stableEmptyArray
520
+ });
521
+ const useOwnCapabilities = (feedFromProps) => {
522
+ const feedFromContext = useFeedContext();
523
+ const feed = feedFromProps ?? feedFromContext;
524
+ const { oc = stableEmptyArray } = useStateStore(feed?.state, selector$9) ?? {};
525
+ return useMemo(
526
+ () => ({
527
+ can_add_activity: oc.indexOf(FeedOwnCapability.ADD_ACTIVITY) > -1,
528
+ can_add_activity_reaction: oc.indexOf(FeedOwnCapability.ADD_ACTIVITY_REACTION) > -1,
529
+ can_add_comment: oc.indexOf(FeedOwnCapability.ADD_COMMENT) > -1,
530
+ can_add_comment_reaction: oc.indexOf(FeedOwnCapability.ADD_COMMENT_REACTION) > -1,
531
+ can_bookmark_activity: oc.indexOf(FeedOwnCapability.BOOKMARK_ACTIVITY) > -1,
532
+ can_create_feed: oc.indexOf(FeedOwnCapability.CREATE_FEED) > -1,
533
+ can_delete_bookmark: oc.indexOf(FeedOwnCapability.DELETE_BOOKMARK) > -1,
534
+ can_delete_comment: oc.indexOf(FeedOwnCapability.DELETE_COMMENT) > -1,
535
+ can_delete_feed: oc.indexOf(FeedOwnCapability.DELETE_FEED) > -1,
536
+ can_edit_bookmark: oc.indexOf(FeedOwnCapability.EDIT_BOOKMARK) > -1,
537
+ can_follow: oc.indexOf(FeedOwnCapability.FOLLOW) > -1,
538
+ can_remove_activity: oc.indexOf(FeedOwnCapability.REMOVE_ACTIVITY) > -1,
539
+ can_remove_activity_reaction: oc.indexOf(FeedOwnCapability.REMOVE_ACTIVITY_REACTION) > -1,
540
+ can_remove_comment_reaction: oc.indexOf(FeedOwnCapability.REMOVE_COMMENT_REACTION) > -1,
541
+ can_unfollow: oc.indexOf(FeedOwnCapability.UNFOLLOW) > -1,
542
+ can_update_feed: oc.indexOf(FeedOwnCapability.UPDATE_FEED) > -1,
543
+ can_invite_feed: oc.indexOf(FeedOwnCapability.INVITE_FEED) > -1,
544
+ can_join_feed: oc.indexOf(FeedOwnCapability.JOIN_FEED) > -1,
545
+ can_leave_feed: oc.indexOf(FeedOwnCapability.LEAVE_FEED) > -1,
546
+ can_manage_feed_group: oc.indexOf(FeedOwnCapability.MANAGE_FEED_GROUP) > -1,
547
+ can_mark_activity: oc.indexOf(FeedOwnCapability.MARK_ACTIVITY) > -1,
548
+ can_pin_activity: oc.indexOf(FeedOwnCapability.PIN_ACTIVITY) > -1,
549
+ can_query_feed_members: oc.indexOf(FeedOwnCapability.QUERY_FEED_MEMBERS) > -1,
550
+ can_query_follows: oc.indexOf(FeedOwnCapability.QUERY_FOLLOWS) > -1,
551
+ can_read_activities: oc.indexOf(FeedOwnCapability.READ_ACTIVITIES) > -1,
552
+ can_read_feed: oc.indexOf(FeedOwnCapability.READ_FEED) > -1,
553
+ can_update_activity: oc.indexOf(FeedOwnCapability.UPDATE_ACTIVITY) > -1,
554
+ can_update_comment: oc.indexOf(FeedOwnCapability.UPDATE_COMMENT) > -1,
555
+ can_update_feed_followers: oc.indexOf(FeedOwnCapability.UPDATE_FEED_FOLLOWERS) > -1,
556
+ can_update_feed_members: oc.indexOf(FeedOwnCapability.UPDATE_FEED_MEMBERS) > -1
557
+ }),
558
+ [oc]
559
+ );
560
+ };
561
+ const selector$8 = ({
562
+ follower_count,
563
+ followers,
564
+ followers_pagination
565
+ }) => ({
566
+ follower_count,
567
+ followers,
568
+ followers_pagination
569
+ });
570
+ function useFollowers(feedFromProps) {
571
+ const feedFromContext = useFeedContext();
572
+ const feed = feedFromProps ?? feedFromContext;
573
+ const data = useStateStore(feed?.state, selector$8);
574
+ const loadNextPage = useCallback(
575
+ (...options) => feed?.loadNextPageFollowers(...options),
576
+ [feed]
577
+ );
578
+ return useMemo(() => {
579
+ if (!data) {
580
+ return void 0;
581
+ }
582
+ return {
583
+ ...data,
584
+ is_loading_next_page: data.followers_pagination?.loading_next_page ?? false,
585
+ has_next_page: checkHasAnotherPage(
586
+ data.followers,
587
+ data.followers_pagination?.next
588
+ ),
589
+ loadNextPage
590
+ };
591
+ }, [data, loadNextPage]);
592
+ }
593
+ const selector$7 = ({
594
+ following_count,
595
+ following,
596
+ following_pagination
597
+ }) => ({
598
+ following_count,
599
+ following,
600
+ following_pagination
601
+ });
602
+ function useFollowing(feedFromProps) {
603
+ const feedFromContext = useFeedContext();
604
+ const feed = feedFromProps ?? feedFromContext;
605
+ const data = useStateStore(feed?.state, selector$7);
606
+ const loadNextPage = useCallback(
607
+ (...options) => feed?.loadNextPageFollowing(...options),
608
+ [feed]
609
+ );
610
+ return useMemo(() => {
611
+ if (!data) {
612
+ return void 0;
613
+ }
614
+ return {
615
+ ...data,
616
+ is_loading_next_page: data.following_pagination?.loading_next_page ?? false,
617
+ has_next_page: checkHasAnotherPage(
618
+ data.following,
619
+ data.following_pagination?.next
620
+ ),
621
+ loadNextPage
622
+ };
623
+ }, [data, loadNextPage]);
624
+ }
625
+ const useFeedMetadata = (feedFromProps) => {
626
+ const feedFromContext = useFeedContext();
627
+ const feed = feedFromProps ?? feedFromContext;
628
+ return useStateStore(feed?.state, selector$6);
629
+ };
630
+ const selector$6 = ({
631
+ follower_count = 0,
632
+ following_count = 0,
633
+ created_by,
634
+ created_at,
635
+ updated_at
636
+ }) => ({
637
+ created_by,
638
+ follower_count,
639
+ following_count,
640
+ created_at,
641
+ updated_at
642
+ });
643
+ const useOwnFollows = (feedFromProps) => {
644
+ const feedFromContext = useFeedContext();
645
+ const feed = feedFromProps ?? feedFromContext;
646
+ return useStateStore(feed?.state, selector$5);
647
+ };
648
+ const selector$5 = ({ own_follows }) => ({
649
+ own_follows
650
+ });
651
+ const selector$4 = ({ notification_status }) => ({
652
+ unread: notification_status?.unread ?? 0,
653
+ unseen: notification_status?.unseen ?? 0,
654
+ last_read_at: notification_status?.last_read_at,
655
+ last_seen_at: notification_status?.last_seen_at,
656
+ read_activities: notification_status?.read_activities,
657
+ seen_activities: notification_status?.seen_activities
658
+ });
659
+ function useNotificationStatus(feedFromProps) {
660
+ const feedFromContext = useFeedContext();
661
+ const feed = feedFromProps ?? feedFromContext;
662
+ return useStateStore(feed?.state, selector$4);
663
+ }
664
+ const selector$3 = ({ aggregated_activities }) => ({
665
+ aggregated_activities
666
+ });
667
+ function useAggregatedActivities(feedFromProps) {
668
+ const feedFromContext = useFeedContext();
669
+ const feed = feedFromProps ?? feedFromContext;
670
+ return useStateStore(feed?.state, selector$3);
671
+ }
672
+ const useIsAggregatedActivityRead = ({
673
+ feed: feedFromProps,
674
+ aggregatedActivity
675
+ }) => {
676
+ const feedFromContext = useFeedContext();
677
+ const feed = feedFromProps ?? feedFromContext;
678
+ const {
679
+ read_activities: readActivities
680
+ /* last_read_at: lastReadAt */
681
+ } = useNotificationStatus(feed) ?? {};
682
+ const group = aggregatedActivity.group;
683
+ return useMemo(
684
+ () => (
685
+ // FIXME: This part of the condition does not work as marking individual groups as read also updates the last_read_at. Should be uncommented once it's fixed on the backend.
686
+ // (lastReadAt &&
687
+ // aggregatedActivity.updated_at.getTime() <= lastReadAt.getTime()) ||
688
+ (readActivities ?? []).includes(group)
689
+ ),
690
+ [readActivities, group]
691
+ );
692
+ };
693
+ const useIsAggregatedActivitySeen = ({
694
+ feed: feedFromProps,
695
+ aggregatedActivity
696
+ }) => {
697
+ const feedFromContext = useFeedContext();
698
+ const feed = feedFromProps ?? feedFromContext;
699
+ const { seen_activities: seenActivities, last_seen_at: lastSeenAt } = useNotificationStatus(feed) ?? {};
700
+ const group = aggregatedActivity.group;
701
+ return useMemo(
702
+ () => lastSeenAt && aggregatedActivity.updated_at.getTime() < lastSeenAt.getTime() || (seenActivities ?? []).includes(group),
703
+ [lastSeenAt, aggregatedActivity.updated_at, seenActivities, group]
704
+ );
705
+ };
706
+ const StreamSearchResultsContext = createContext(void 0);
707
+ const useSearchResultsContext = () => {
708
+ return useContext(StreamSearchResultsContext);
709
+ };
710
+ const useSearchResult = (sourceFromProps) => {
711
+ const sourceFromContext = useSearchResultsContext();
712
+ const source = sourceFromProps ?? sourceFromContext;
713
+ const { items, error, isLoading, hasNext } = useStateStore(source?.state, selector$2) ?? {};
714
+ const loadMore = useStableCallback(async () => {
715
+ if (hasNext) {
716
+ source?.search();
717
+ }
718
+ });
719
+ return useMemo(
720
+ () => ({ items, error, isLoading, hasNext, loadMore }),
721
+ [error, hasNext, isLoading, items, loadMore]
722
+ );
723
+ };
724
+ const selector$2 = ({
725
+ items,
726
+ isLoading,
727
+ hasNext,
728
+ lastQueryError
729
+ }) => ({
730
+ items,
731
+ isLoading,
732
+ hasNext,
733
+ error: lastQueryError
734
+ });
735
+ const StreamSearchContext = createContext(void 0);
736
+ const useSearchContext = () => {
737
+ return useContext(StreamSearchContext);
738
+ };
739
+ const useSearchQuery = (controllerFromProps) => {
740
+ const controllerFromState = useSearchContext();
741
+ const controller = controllerFromProps ?? controllerFromState;
742
+ return useStateStore(controller?.state, selector$1);
743
+ };
744
+ const selector$1 = ({ searchQuery }) => ({
745
+ searchQuery
746
+ });
747
+ const useSearchSources = (controllerFromProps) => {
748
+ const controllerFromState = useSearchContext();
749
+ const controller = controllerFromProps ?? controllerFromState;
750
+ return useStateStore(controller?.state, selector);
751
+ };
752
+ const selector = ({ sources }) => ({
753
+ sources
754
+ });
755
+ const useReactionActions = ({
756
+ entity,
757
+ type
758
+ }) => {
759
+ const client = useFeedsClient();
760
+ const isComment = isCommentResponse(entity);
761
+ const hasOwnReaction = useMemo(
762
+ () => !!entity.own_reactions?.find((r) => r.type === type),
763
+ [entity.own_reactions, type]
764
+ );
765
+ const addReaction = useStableCallback(async () => {
766
+ await (isComment ? client?.addCommentReaction({ id: entity.id, type }) : client?.addReaction({ activity_id: entity.id, type }));
767
+ });
768
+ const removeReaction = useStableCallback(async () => {
769
+ await (isComment ? client?.deleteCommentReaction({ id: entity.id, type }) : client?.deleteActivityReaction({
770
+ activity_id: entity.id,
771
+ type
772
+ }));
773
+ });
774
+ const toggleReaction = useStableCallback(async () => {
775
+ if (hasOwnReaction) {
776
+ await removeReaction();
777
+ } else {
778
+ await addReaction();
779
+ }
780
+ });
781
+ return useMemo(
782
+ () => ({ addReaction, removeReaction, toggleReaction }),
783
+ [addReaction, removeReaction, toggleReaction]
784
+ );
785
+ };
786
+ const useBookmarkActions = ({
787
+ entity
788
+ }) => {
789
+ const client = useFeedsClient();
790
+ const hasOwnBookmark = entity.own_bookmarks?.length > 0;
791
+ const addBookmark = useStableCallback(async () => {
792
+ await client?.addBookmark({ activity_id: entity.id });
793
+ });
794
+ const removeBookmark = useStableCallback(async () => {
795
+ await client?.deleteBookmark({ activity_id: entity.id });
796
+ });
797
+ const toggleBookmark = useStableCallback(async () => {
798
+ if (hasOwnBookmark) {
799
+ await removeBookmark();
800
+ } else {
801
+ await addBookmark();
802
+ }
803
+ });
804
+ return useMemo(
805
+ () => ({ addBookmark, removeBookmark, toggleBookmark }),
806
+ [addBookmark, removeBookmark, toggleBookmark]
807
+ );
808
+ };
809
+ var jsxRuntime = { exports: {} };
810
+ var reactJsxRuntime_production = {};
811
+ /**
812
+ * @license React
813
+ * react-jsx-runtime.production.js
814
+ *
815
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
816
+ *
817
+ * This source code is licensed under the MIT license found in the
818
+ * LICENSE file in the root directory of this source tree.
819
+ */
820
+ var hasRequiredReactJsxRuntime_production;
821
+ function requireReactJsxRuntime_production() {
822
+ if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
823
+ hasRequiredReactJsxRuntime_production = 1;
824
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
825
+ function jsxProd(type, config, maybeKey) {
826
+ var key = null;
827
+ void 0 !== maybeKey && (key = "" + maybeKey);
828
+ void 0 !== config.key && (key = "" + config.key);
829
+ if ("key" in config) {
830
+ maybeKey = {};
831
+ for (var propName in config)
832
+ "key" !== propName && (maybeKey[propName] = config[propName]);
833
+ } else maybeKey = config;
834
+ config = maybeKey.ref;
835
+ return {
836
+ $$typeof: REACT_ELEMENT_TYPE,
837
+ type,
838
+ key,
839
+ ref: void 0 !== config ? config : null,
840
+ props: maybeKey
841
+ };
842
+ }
843
+ reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
844
+ reactJsxRuntime_production.jsx = jsxProd;
845
+ reactJsxRuntime_production.jsxs = jsxProd;
846
+ return reactJsxRuntime_production;
847
+ }
848
+ var reactJsxRuntime_development = {};
849
+ /**
850
+ * @license React
851
+ * react-jsx-runtime.development.js
852
+ *
853
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
854
+ *
855
+ * This source code is licensed under the MIT license found in the
856
+ * LICENSE file in the root directory of this source tree.
857
+ */
858
+ var hasRequiredReactJsxRuntime_development;
859
+ function requireReactJsxRuntime_development() {
860
+ if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
861
+ hasRequiredReactJsxRuntime_development = 1;
862
+ "production" !== process.env.NODE_ENV && function() {
863
+ function getComponentNameFromType(type) {
864
+ if (null == type) return null;
865
+ if ("function" === typeof type)
866
+ return type.$$typeof === REACT_CLIENT_REFERENCE$2 ? null : type.displayName || type.name || null;
867
+ if ("string" === typeof type) return type;
868
+ switch (type) {
869
+ case REACT_FRAGMENT_TYPE:
870
+ return "Fragment";
871
+ case REACT_PORTAL_TYPE:
872
+ return "Portal";
873
+ case REACT_PROFILER_TYPE:
874
+ return "Profiler";
875
+ case REACT_STRICT_MODE_TYPE:
876
+ return "StrictMode";
877
+ case REACT_SUSPENSE_TYPE:
878
+ return "Suspense";
879
+ case REACT_SUSPENSE_LIST_TYPE:
880
+ return "SuspenseList";
881
+ }
882
+ if ("object" === typeof type)
883
+ switch ("number" === typeof type.tag && console.error(
884
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
885
+ ), type.$$typeof) {
886
+ case REACT_CONTEXT_TYPE:
887
+ return (type.displayName || "Context") + ".Provider";
888
+ case REACT_CONSUMER_TYPE:
889
+ return (type._context.displayName || "Context") + ".Consumer";
890
+ case REACT_FORWARD_REF_TYPE:
891
+ var innerType = type.render;
892
+ type = type.displayName;
893
+ type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
894
+ return type;
895
+ case REACT_MEMO_TYPE:
896
+ return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
897
+ case REACT_LAZY_TYPE:
898
+ innerType = type._payload;
899
+ type = type._init;
900
+ try {
901
+ return getComponentNameFromType(type(innerType));
902
+ } catch (x) {
903
+ }
904
+ }
905
+ return null;
906
+ }
907
+ function testStringCoercion(value) {
908
+ return "" + value;
909
+ }
910
+ function checkKeyStringCoercion(value) {
911
+ try {
912
+ testStringCoercion(value);
913
+ var JSCompiler_inline_result = false;
914
+ } catch (e) {
915
+ JSCompiler_inline_result = true;
916
+ }
917
+ if (JSCompiler_inline_result) {
918
+ JSCompiler_inline_result = console;
919
+ var JSCompiler_temp_const = JSCompiler_inline_result.error;
920
+ var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
921
+ JSCompiler_temp_const.call(
922
+ JSCompiler_inline_result,
923
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
924
+ JSCompiler_inline_result$jscomp$0
925
+ );
926
+ return testStringCoercion(value);
927
+ }
928
+ }
929
+ function disabledLog() {
930
+ }
931
+ function disableLogs() {
932
+ if (0 === disabledDepth) {
933
+ prevLog = console.log;
934
+ prevInfo = console.info;
935
+ prevWarn = console.warn;
936
+ prevError = console.error;
937
+ prevGroup = console.group;
938
+ prevGroupCollapsed = console.groupCollapsed;
939
+ prevGroupEnd = console.groupEnd;
940
+ var props = {
941
+ configurable: true,
942
+ enumerable: true,
943
+ value: disabledLog,
944
+ writable: true
945
+ };
946
+ Object.defineProperties(console, {
947
+ info: props,
948
+ log: props,
949
+ warn: props,
950
+ error: props,
951
+ group: props,
952
+ groupCollapsed: props,
953
+ groupEnd: props
954
+ });
955
+ }
956
+ disabledDepth++;
957
+ }
958
+ function reenableLogs() {
959
+ disabledDepth--;
960
+ if (0 === disabledDepth) {
961
+ var props = { configurable: true, enumerable: true, writable: true };
962
+ Object.defineProperties(console, {
963
+ log: assign({}, props, { value: prevLog }),
964
+ info: assign({}, props, { value: prevInfo }),
965
+ warn: assign({}, props, { value: prevWarn }),
966
+ error: assign({}, props, { value: prevError }),
967
+ group: assign({}, props, { value: prevGroup }),
968
+ groupCollapsed: assign({}, props, { value: prevGroupCollapsed }),
969
+ groupEnd: assign({}, props, { value: prevGroupEnd })
970
+ });
971
+ }
972
+ 0 > disabledDepth && console.error(
973
+ "disabledDepth fell below zero. This is a bug in React. Please file an issue."
974
+ );
975
+ }
976
+ function describeBuiltInComponentFrame(name) {
977
+ if (void 0 === prefix)
978
+ try {
979
+ throw Error();
980
+ } catch (x) {
981
+ var match = x.stack.trim().match(/\n( *(at )?)/);
982
+ prefix = match && match[1] || "";
983
+ suffix = -1 < x.stack.indexOf("\n at") ? " (<anonymous>)" : -1 < x.stack.indexOf("@") ? "@unknown:0:0" : "";
984
+ }
985
+ return "\n" + prefix + name + suffix;
986
+ }
987
+ function describeNativeComponentFrame(fn, construct) {
988
+ if (!fn || reentry) return "";
989
+ var frame = componentFrameCache.get(fn);
990
+ if (void 0 !== frame) return frame;
991
+ reentry = true;
992
+ frame = Error.prepareStackTrace;
993
+ Error.prepareStackTrace = void 0;
994
+ var previousDispatcher = null;
995
+ previousDispatcher = ReactSharedInternals.H;
996
+ ReactSharedInternals.H = null;
997
+ disableLogs();
998
+ try {
999
+ var RunInRootFrame = {
1000
+ DetermineComponentFrameRoot: function() {
1001
+ try {
1002
+ if (construct) {
1003
+ var Fake = function() {
1004
+ throw Error();
1005
+ };
1006
+ Object.defineProperty(Fake.prototype, "props", {
1007
+ set: function() {
1008
+ throw Error();
1009
+ }
1010
+ });
1011
+ if ("object" === typeof Reflect && Reflect.construct) {
1012
+ try {
1013
+ Reflect.construct(Fake, []);
1014
+ } catch (x) {
1015
+ var control = x;
1016
+ }
1017
+ Reflect.construct(fn, [], Fake);
1018
+ } else {
1019
+ try {
1020
+ Fake.call();
1021
+ } catch (x$0) {
1022
+ control = x$0;
1023
+ }
1024
+ fn.call(Fake.prototype);
1025
+ }
1026
+ } else {
1027
+ try {
1028
+ throw Error();
1029
+ } catch (x$1) {
1030
+ control = x$1;
1031
+ }
1032
+ (Fake = fn()) && "function" === typeof Fake.catch && Fake.catch(function() {
1033
+ });
1034
+ }
1035
+ } catch (sample) {
1036
+ if (sample && control && "string" === typeof sample.stack)
1037
+ return [sample.stack, control.stack];
1038
+ }
1039
+ return [null, null];
1040
+ }
1041
+ };
1042
+ RunInRootFrame.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
1043
+ var namePropDescriptor = Object.getOwnPropertyDescriptor(
1044
+ RunInRootFrame.DetermineComponentFrameRoot,
1045
+ "name"
1046
+ );
1047
+ namePropDescriptor && namePropDescriptor.configurable && Object.defineProperty(
1048
+ RunInRootFrame.DetermineComponentFrameRoot,
1049
+ "name",
1050
+ { value: "DetermineComponentFrameRoot" }
1051
+ );
1052
+ var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), sampleStack = _RunInRootFrame$Deter[0], controlStack = _RunInRootFrame$Deter[1];
1053
+ if (sampleStack && controlStack) {
1054
+ var sampleLines = sampleStack.split("\n"), controlLines = controlStack.split("\n");
1055
+ for (_RunInRootFrame$Deter = namePropDescriptor = 0; namePropDescriptor < sampleLines.length && !sampleLines[namePropDescriptor].includes(
1056
+ "DetermineComponentFrameRoot"
1057
+ ); )
1058
+ namePropDescriptor++;
1059
+ for (; _RunInRootFrame$Deter < controlLines.length && !controlLines[_RunInRootFrame$Deter].includes(
1060
+ "DetermineComponentFrameRoot"
1061
+ ); )
1062
+ _RunInRootFrame$Deter++;
1063
+ if (namePropDescriptor === sampleLines.length || _RunInRootFrame$Deter === controlLines.length)
1064
+ for (namePropDescriptor = sampleLines.length - 1, _RunInRootFrame$Deter = controlLines.length - 1; 1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter && sampleLines[namePropDescriptor] !== controlLines[_RunInRootFrame$Deter]; )
1065
+ _RunInRootFrame$Deter--;
1066
+ for (; 1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter; namePropDescriptor--, _RunInRootFrame$Deter--)
1067
+ if (sampleLines[namePropDescriptor] !== controlLines[_RunInRootFrame$Deter]) {
1068
+ if (1 !== namePropDescriptor || 1 !== _RunInRootFrame$Deter) {
1069
+ do
1070
+ if (namePropDescriptor--, _RunInRootFrame$Deter--, 0 > _RunInRootFrame$Deter || sampleLines[namePropDescriptor] !== controlLines[_RunInRootFrame$Deter]) {
1071
+ var _frame = "\n" + sampleLines[namePropDescriptor].replace(
1072
+ " at new ",
1073
+ " at "
1074
+ );
1075
+ fn.displayName && _frame.includes("<anonymous>") && (_frame = _frame.replace("<anonymous>", fn.displayName));
1076
+ "function" === typeof fn && componentFrameCache.set(fn, _frame);
1077
+ return _frame;
1078
+ }
1079
+ while (1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter);
1080
+ }
1081
+ break;
1082
+ }
1083
+ }
1084
+ } finally {
1085
+ reentry = false, ReactSharedInternals.H = previousDispatcher, reenableLogs(), Error.prepareStackTrace = frame;
1086
+ }
1087
+ sampleLines = (sampleLines = fn ? fn.displayName || fn.name : "") ? describeBuiltInComponentFrame(sampleLines) : "";
1088
+ "function" === typeof fn && componentFrameCache.set(fn, sampleLines);
1089
+ return sampleLines;
1090
+ }
1091
+ function describeUnknownElementTypeFrameInDEV(type) {
1092
+ if (null == type) return "";
1093
+ if ("function" === typeof type) {
1094
+ var prototype = type.prototype;
1095
+ return describeNativeComponentFrame(
1096
+ type,
1097
+ !(!prototype || !prototype.isReactComponent)
1098
+ );
1099
+ }
1100
+ if ("string" === typeof type) return describeBuiltInComponentFrame(type);
1101
+ switch (type) {
1102
+ case REACT_SUSPENSE_TYPE:
1103
+ return describeBuiltInComponentFrame("Suspense");
1104
+ case REACT_SUSPENSE_LIST_TYPE:
1105
+ return describeBuiltInComponentFrame("SuspenseList");
1106
+ }
1107
+ if ("object" === typeof type)
1108
+ switch (type.$$typeof) {
1109
+ case REACT_FORWARD_REF_TYPE:
1110
+ return type = describeNativeComponentFrame(type.render, false), type;
1111
+ case REACT_MEMO_TYPE:
1112
+ return describeUnknownElementTypeFrameInDEV(type.type);
1113
+ case REACT_LAZY_TYPE:
1114
+ prototype = type._payload;
1115
+ type = type._init;
1116
+ try {
1117
+ return describeUnknownElementTypeFrameInDEV(type(prototype));
1118
+ } catch (x) {
1119
+ }
1120
+ }
1121
+ return "";
1122
+ }
1123
+ function getOwner() {
1124
+ var dispatcher = ReactSharedInternals.A;
1125
+ return null === dispatcher ? null : dispatcher.getOwner();
1126
+ }
1127
+ function hasValidKey(config) {
1128
+ if (hasOwnProperty.call(config, "key")) {
1129
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
1130
+ if (getter && getter.isReactWarning) return false;
1131
+ }
1132
+ return void 0 !== config.key;
1133
+ }
1134
+ function defineKeyPropWarningGetter(props, displayName) {
1135
+ function warnAboutAccessingKey() {
1136
+ specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
1137
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
1138
+ displayName
1139
+ ));
1140
+ }
1141
+ warnAboutAccessingKey.isReactWarning = true;
1142
+ Object.defineProperty(props, "key", {
1143
+ get: warnAboutAccessingKey,
1144
+ configurable: true
1145
+ });
1146
+ }
1147
+ function elementRefGetterWithDeprecationWarning() {
1148
+ var componentName = getComponentNameFromType(this.type);
1149
+ didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
1150
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
1151
+ ));
1152
+ componentName = this.props.ref;
1153
+ return void 0 !== componentName ? componentName : null;
1154
+ }
1155
+ function ReactElement(type, key, self, source, owner, props) {
1156
+ self = props.ref;
1157
+ type = {
1158
+ $$typeof: REACT_ELEMENT_TYPE,
1159
+ type,
1160
+ key,
1161
+ props,
1162
+ _owner: owner
1163
+ };
1164
+ null !== (void 0 !== self ? self : null) ? Object.defineProperty(type, "ref", {
1165
+ enumerable: false,
1166
+ get: elementRefGetterWithDeprecationWarning
1167
+ }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
1168
+ type._store = {};
1169
+ Object.defineProperty(type._store, "validated", {
1170
+ configurable: false,
1171
+ enumerable: false,
1172
+ writable: true,
1173
+ value: 0
1174
+ });
1175
+ Object.defineProperty(type, "_debugInfo", {
1176
+ configurable: false,
1177
+ enumerable: false,
1178
+ writable: true,
1179
+ value: null
1180
+ });
1181
+ Object.freeze && (Object.freeze(type.props), Object.freeze(type));
1182
+ return type;
1183
+ }
1184
+ function jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self) {
1185
+ if ("string" === typeof type || "function" === typeof type || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_OFFSCREEN_TYPE || "object" === typeof type && null !== type && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_CLIENT_REFERENCE$1 || void 0 !== type.getModuleId)) {
1186
+ var children = config.children;
1187
+ if (void 0 !== children)
1188
+ if (isStaticChildren)
1189
+ if (isArrayImpl(children)) {
1190
+ for (isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++)
1191
+ validateChildKeys(children[isStaticChildren], type);
1192
+ Object.freeze && Object.freeze(children);
1193
+ } else
1194
+ console.error(
1195
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
1196
+ );
1197
+ else validateChildKeys(children, type);
1198
+ } else {
1199
+ children = "";
1200
+ if (void 0 === type || "object" === typeof type && null !== type && 0 === Object.keys(type).length)
1201
+ children += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
1202
+ null === type ? isStaticChildren = "null" : isArrayImpl(type) ? isStaticChildren = "array" : void 0 !== type && type.$$typeof === REACT_ELEMENT_TYPE ? (isStaticChildren = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />", children = " Did you accidentally export a JSX literal instead of a component?") : isStaticChildren = typeof type;
1203
+ console.error(
1204
+ "React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",
1205
+ isStaticChildren,
1206
+ children
1207
+ );
1208
+ }
1209
+ if (hasOwnProperty.call(config, "key")) {
1210
+ children = getComponentNameFromType(type);
1211
+ var keys = Object.keys(config).filter(function(k) {
1212
+ return "key" !== k;
1213
+ });
1214
+ isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
1215
+ didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error(
1216
+ 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
1217
+ isStaticChildren,
1218
+ children,
1219
+ keys,
1220
+ children
1221
+ ), didWarnAboutKeySpread[children + isStaticChildren] = true);
1222
+ }
1223
+ children = null;
1224
+ void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
1225
+ hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
1226
+ if ("key" in config) {
1227
+ maybeKey = {};
1228
+ for (var propName in config)
1229
+ "key" !== propName && (maybeKey[propName] = config[propName]);
1230
+ } else maybeKey = config;
1231
+ children && defineKeyPropWarningGetter(
1232
+ maybeKey,
1233
+ "function" === typeof type ? type.displayName || type.name || "Unknown" : type
1234
+ );
1235
+ return ReactElement(type, children, self, source, getOwner(), maybeKey);
1236
+ }
1237
+ function validateChildKeys(node, parentType) {
1238
+ if ("object" === typeof node && node && node.$$typeof !== REACT_CLIENT_REFERENCE) {
1239
+ if (isArrayImpl(node))
1240
+ for (var i = 0; i < node.length; i++) {
1241
+ var child = node[i];
1242
+ isValidElement(child) && validateExplicitKey(child, parentType);
1243
+ }
1244
+ else if (isValidElement(node))
1245
+ node._store && (node._store.validated = 1);
1246
+ else if (null === node || "object" !== typeof node ? i = null : (i = MAYBE_ITERATOR_SYMBOL && node[MAYBE_ITERATOR_SYMBOL] || node["@@iterator"], i = "function" === typeof i ? i : null), "function" === typeof i && i !== node.entries && (i = i.call(node), i !== node))
1247
+ for (; !(node = i.next()).done; )
1248
+ isValidElement(node.value) && validateExplicitKey(node.value, parentType);
1249
+ }
1250
+ }
1251
+ function isValidElement(object) {
1252
+ return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
1253
+ }
1254
+ function validateExplicitKey(element, parentType) {
1255
+ if (element._store && !element._store.validated && null == element.key && (element._store.validated = 1, parentType = getCurrentComponentErrorInfo(parentType), !ownerHasKeyUseWarning[parentType])) {
1256
+ ownerHasKeyUseWarning[parentType] = true;
1257
+ var childOwner = "";
1258
+ element && null != element._owner && element._owner !== getOwner() && (childOwner = null, "number" === typeof element._owner.tag ? childOwner = getComponentNameFromType(element._owner.type) : "string" === typeof element._owner.name && (childOwner = element._owner.name), childOwner = " It was passed a child from " + childOwner + ".");
1259
+ var prevGetCurrentStack = ReactSharedInternals.getCurrentStack;
1260
+ ReactSharedInternals.getCurrentStack = function() {
1261
+ var stack = describeUnknownElementTypeFrameInDEV(element.type);
1262
+ prevGetCurrentStack && (stack += prevGetCurrentStack() || "");
1263
+ return stack;
1264
+ };
1265
+ console.error(
1266
+ 'Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',
1267
+ parentType,
1268
+ childOwner
1269
+ );
1270
+ ReactSharedInternals.getCurrentStack = prevGetCurrentStack;
1271
+ }
1272
+ }
1273
+ function getCurrentComponentErrorInfo(parentType) {
1274
+ var info = "", owner = getOwner();
1275
+ owner && (owner = getComponentNameFromType(owner.type)) && (info = "\n\nCheck the render method of `" + owner + "`.");
1276
+ info || (parentType = getComponentNameFromType(parentType)) && (info = "\n\nCheck the top-level render call using <" + parentType + ">.");
1277
+ return info;
1278
+ }
1279
+ var React = require$$0, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler");
1280
+ var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE$2 = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, assign = Object.assign, REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, disabledDepth = 0, prevLog, prevInfo, prevWarn, prevError, prevGroup, prevGroupCollapsed, prevGroupEnd;
1281
+ disabledLog.__reactDisabledLog = true;
1282
+ var prefix, suffix, reentry = false;
1283
+ var componentFrameCache = new ("function" === typeof WeakMap ? WeakMap : Map)();
1284
+ var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), specialPropKeyWarningShown;
1285
+ var didWarnAboutElementRef = {};
1286
+ var didWarnAboutKeySpread = {}, ownerHasKeyUseWarning = {};
1287
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
1288
+ reactJsxRuntime_development.jsx = function(type, config, maybeKey, source, self) {
1289
+ return jsxDEVImpl(type, config, maybeKey, false, source, self);
1290
+ };
1291
+ reactJsxRuntime_development.jsxs = function(type, config, maybeKey, source, self) {
1292
+ return jsxDEVImpl(type, config, maybeKey, true, source, self);
1293
+ };
1294
+ }();
1295
+ return reactJsxRuntime_development;
1296
+ }
1297
+ var hasRequiredJsxRuntime;
1298
+ function requireJsxRuntime() {
1299
+ if (hasRequiredJsxRuntime) return jsxRuntime.exports;
1300
+ hasRequiredJsxRuntime = 1;
1301
+ if (process.env.NODE_ENV === "production") {
1302
+ jsxRuntime.exports = requireReactJsxRuntime_production();
1303
+ } else {
1304
+ jsxRuntime.exports = requireReactJsxRuntime_development();
1305
+ }
1306
+ return jsxRuntime.exports;
1307
+ }
1308
+ var jsxRuntimeExports = requireJsxRuntime();
1309
+ const StreamFeeds = ({ client, children }) => {
1310
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(StreamFeedsContext.Provider, { value: client, children });
1311
+ };
1312
+ StreamFeeds.displayName = "StreamFeeds";
1313
+ const StreamFeed = ({
1314
+ feed,
1315
+ children
1316
+ }) => {
1317
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(StreamFeedContext.Provider, { value: feed, children });
1318
+ };
1319
+ StreamFeed.displayName = "StreamFeed";
1320
+ const StreamSearch = ({
1321
+ searchController,
1322
+ children
1323
+ }) => {
1324
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(StreamSearchContext.Provider, { value: searchController, children });
1325
+ };
1326
+ StreamSearch.displayName = "StreamSearch";
1327
+ const StreamSearchResults = ({
1328
+ source,
1329
+ children
1330
+ }) => {
1331
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(StreamSearchResultsContext.Provider, { value: source, children });
1332
+ };
1333
+ StreamSearchResults.displayName = "StreamSearchResults";
1334
+ export {
1335
+ StreamFeed,
1336
+ StreamFeedContext,
1337
+ StreamFeeds,
1338
+ StreamFeedsContext,
1339
+ StreamSearch,
1340
+ StreamSearchContext,
1341
+ StreamSearchResults,
1342
+ StreamSearchResultsContext,
1343
+ useAggregatedActivities,
1344
+ useBookmarkActions,
1345
+ useClientConnectedUser,
1346
+ useComments,
1347
+ useCreateFeedsClient,
1348
+ useFeedActivities,
1349
+ useFeedContext,
1350
+ useFeedMetadata,
1351
+ useFeedsClient,
1352
+ useFollowers,
1353
+ useFollowing,
1354
+ useIsAggregatedActivityRead,
1355
+ useIsAggregatedActivitySeen,
1356
+ useNotificationStatus,
1357
+ useOwnCapabilities,
1358
+ useOwnFollows,
1359
+ useReactionActions,
1360
+ useSearchContext,
1361
+ useSearchQuery,
1362
+ useSearchResult,
1363
+ useSearchResultsContext,
1364
+ useSearchSources,
1365
+ useStateStore,
1366
+ useWsConnectionState
1367
+ };
1368
+ //# sourceMappingURL=react-bindings.mjs.map