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