@burdenoff/microfe-comradecircle 2026.525.1 → 2026.704.1

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 (97) hide show
  1. package/dist/comradecircle/ComradeCircleRoot.js +75 -95
  2. package/dist/comradecircle/ComradeCircleRoot.js.map +1 -1
  3. package/dist/comradecircle/ComradeCircleRoutes.js +58 -37
  4. package/dist/comradecircle/ComradeCircleRoutes.js.map +1 -1
  5. package/dist/comradecircle/components/Avatar.js +35 -0
  6. package/dist/comradecircle/components/Avatar.js.map +1 -0
  7. package/dist/comradecircle/components/CircleCard.js +117 -0
  8. package/dist/comradecircle/components/CircleCard.js.map +1 -0
  9. package/dist/comradecircle/components/CommentThread.js +105 -0
  10. package/dist/comradecircle/components/CommentThread.js.map +1 -0
  11. package/dist/comradecircle/components/CreateCircleDialog.js +148 -0
  12. package/dist/comradecircle/components/CreateCircleDialog.js.map +1 -0
  13. package/dist/comradecircle/components/CreateEventDialog.js +210 -0
  14. package/dist/comradecircle/components/CreateEventDialog.js.map +1 -0
  15. package/dist/comradecircle/components/EmptyState.js +35 -0
  16. package/dist/comradecircle/components/EmptyState.js.map +1 -0
  17. package/dist/comradecircle/components/EventCard.js +93 -0
  18. package/dist/comradecircle/components/EventCard.js.map +1 -0
  19. package/dist/comradecircle/components/FilterTabs.js +27 -0
  20. package/dist/comradecircle/components/FilterTabs.js.map +1 -0
  21. package/dist/comradecircle/components/MemberIdentity.js +43 -0
  22. package/dist/comradecircle/components/MemberIdentity.js.map +1 -0
  23. package/dist/comradecircle/components/MiniBar.js +22 -0
  24. package/dist/comradecircle/components/MiniBar.js.map +1 -0
  25. package/dist/comradecircle/components/PageLayout.js +38 -0
  26. package/dist/comradecircle/components/PageLayout.js.map +1 -0
  27. package/dist/comradecircle/components/Pagination.js +50 -0
  28. package/dist/comradecircle/components/Pagination.js.map +1 -0
  29. package/dist/comradecircle/components/PollCard.js +97 -0
  30. package/dist/comradecircle/components/PollCard.js.map +1 -0
  31. package/dist/comradecircle/components/PostCard.js +170 -0
  32. package/dist/comradecircle/components/PostCard.js.map +1 -0
  33. package/dist/comradecircle/components/PostComposer.js +77 -0
  34. package/dist/comradecircle/components/PostComposer.js.map +1 -0
  35. package/dist/comradecircle/components/ReactionBar.js +122 -0
  36. package/dist/comradecircle/components/ReactionBar.js.map +1 -0
  37. package/dist/comradecircle/components/StateViews.js +49 -0
  38. package/dist/comradecircle/components/StateViews.js.map +1 -0
  39. package/dist/comradecircle/components/StatusBadge.js +68 -0
  40. package/dist/comradecircle/components/StatusBadge.js.map +1 -0
  41. package/dist/comradecircle/components/Tabs.js +31 -0
  42. package/dist/comradecircle/components/Tabs.js.map +1 -0
  43. package/dist/comradecircle/components/TagInput.js +49 -0
  44. package/dist/comradecircle/components/TagInput.js.map +1 -0
  45. package/dist/comradecircle/context/ComradeCircleContext.js +85 -0
  46. package/dist/comradecircle/context/ComradeCircleContext.js.map +1 -0
  47. package/dist/comradecircle/context/index.js +1 -0
  48. package/dist/comradecircle/hooks/index.js +2 -0
  49. package/dist/comradecircle/hooks/useComradeCircleApi.js +416 -0
  50. package/dist/comradecircle/hooks/useComradeCircleApi.js.map +1 -0
  51. package/dist/comradecircle/hooks/useCursorPager.js +25 -0
  52. package/dist/comradecircle/hooks/useCursorPager.js.map +1 -0
  53. package/dist/comradecircle/index.js +5 -2
  54. package/dist/comradecircle/lib/toast.js +39 -0
  55. package/dist/comradecircle/lib/toast.js.map +1 -0
  56. package/dist/comradecircle/pages/FeedPage.js +65 -0
  57. package/dist/comradecircle/pages/FeedPage.js.map +1 -0
  58. package/dist/comradecircle/pages/circles/CircleDetailPage.js +650 -0
  59. package/dist/comradecircle/pages/circles/CircleDetailPage.js.map +1 -0
  60. package/dist/comradecircle/pages/circles/CirclesPage.js +129 -0
  61. package/dist/comradecircle/pages/circles/CirclesPage.js.map +1 -0
  62. package/dist/comradecircle/pages/events/EventDetailPage.js +276 -0
  63. package/dist/comradecircle/pages/events/EventDetailPage.js.map +1 -0
  64. package/dist/comradecircle/pages/events/EventsPage.js +102 -0
  65. package/dist/comradecircle/pages/events/EventsPage.js.map +1 -0
  66. package/dist/comradecircle/pages/members/MemberProfilePage.js +137 -0
  67. package/dist/comradecircle/pages/members/MemberProfilePage.js.map +1 -0
  68. package/dist/comradecircle/pages/members/MembersPage.js +152 -0
  69. package/dist/comradecircle/pages/members/MembersPage.js.map +1 -0
  70. package/dist/comradecircle/pages/profile/MyProfilePage.js +255 -0
  71. package/dist/comradecircle/pages/profile/MyProfilePage.js.map +1 -0
  72. package/dist/comradecircle/utils/cn.js +10 -0
  73. package/dist/comradecircle/utils/cn.js.map +1 -0
  74. package/dist/comradecircle/utils/formatters.js +51 -0
  75. package/dist/comradecircle/utils/formatters.js.map +1 -0
  76. package/dist/comradecircle/utils/navigation.js +2 -1
  77. package/dist/comradecircle/utils/navigation.js.map +1 -1
  78. package/dist/comradecircle/utils/slug.js +8 -0
  79. package/dist/comradecircle/utils/slug.js.map +1 -0
  80. package/dist/index.js +6 -4
  81. package/dist/node_modules/clsx/dist/clsx.js +18 -0
  82. package/dist/node_modules/clsx/dist/clsx.js.map +1 -0
  83. package/dist/node_modules/sonner/dist/index.js +163 -0
  84. package/dist/node_modules/sonner/dist/index.js.map +1 -0
  85. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +1716 -0
  86. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -0
  87. package/package.json +3 -2
  88. package/dist/comradecircle/pages/CommunitiesPage.js +0 -299
  89. package/dist/comradecircle/pages/CommunitiesPage.js.map +0 -1
  90. package/dist/comradecircle/pages/CreatorPage.js +0 -399
  91. package/dist/comradecircle/pages/CreatorPage.js.map +0 -1
  92. package/dist/comradecircle/pages/DashboardPage.js +0 -265
  93. package/dist/comradecircle/pages/DashboardPage.js.map +0 -1
  94. package/dist/comradecircle/providers/ComradeCircleProvider.js +0 -27
  95. package/dist/comradecircle/providers/ComradeCircleProvider.js.map +0 -1
  96. package/dist/comradecircle/store/comradecircleStore.js +0 -345
  97. package/dist/comradecircle/store/comradecircleStore.js.map +0 -1
@@ -0,0 +1,416 @@
1
+ import { useComradeCircle as e } from "../context/ComradeCircleContext.js";
2
+ import "../context/index.js";
3
+ import { useMutation as t, useQuery as n, useQueryClient as r } from "@tanstack/react-query";
4
+ import { graphqlFetch as i } from "@burdenoff/fe-libs/shared/graphql";
5
+ //#region src/comradecircle/hooks/useComradeCircleApi.ts
6
+ var a = async (e, t, n) => {
7
+ let r = await i({
8
+ gateway: "workspace",
9
+ baseUrl: n,
10
+ query: e,
11
+ variables: t,
12
+ workspaceToken: !0
13
+ });
14
+ if (r.errors?.length) throw Error(r.errors[0]?.message ?? "GraphQL request failed");
15
+ if (!r.data) throw Error("GraphQL response did not include data");
16
+ return r.data;
17
+ }, o = {
18
+ circles: ["comradecircle", "circles"],
19
+ circle: (e) => [
20
+ "comradecircle",
21
+ "circle",
22
+ e
23
+ ],
24
+ channels: (e) => [
25
+ "comradecircle",
26
+ "channels",
27
+ e
28
+ ],
29
+ posts: (e) => [
30
+ "comradecircle",
31
+ "posts",
32
+ e
33
+ ],
34
+ post: (e) => [
35
+ "comradecircle",
36
+ "post",
37
+ e
38
+ ],
39
+ comments: (e) => [
40
+ "comradecircle",
41
+ "comments",
42
+ e
43
+ ],
44
+ feed: ["comradecircle", "feed"],
45
+ follows: ["comradecircle", "follows"],
46
+ events: ["comradecircle", "events"],
47
+ event: (e) => [
48
+ "comradecircle",
49
+ "event",
50
+ e
51
+ ],
52
+ polls: (e) => [
53
+ "comradecircle",
54
+ "polls",
55
+ e
56
+ ],
57
+ poll: (e) => [
58
+ "comradecircle",
59
+ "poll",
60
+ e
61
+ ],
62
+ profiles: ["comradecircle", "profiles"],
63
+ profile: (e) => [
64
+ "comradecircle",
65
+ "profile",
66
+ e
67
+ ],
68
+ memberships: ["comradecircle", "memberships"]
69
+ }, s = { limit: 50 }, c = (e) => {
70
+ let t = e ?? s, n = { limit: t.limit ?? s.limit };
71
+ return t.offset != null && (n.offset = t.offset), t.cursor != null && (n.cursor = t.cursor), n;
72
+ }, l = "\n id workspaceId circleId name slug description type visibility position isArchived\n createdAt updatedAt\n", u = "\n id workspaceId name slug description topic tags status visibility memberCount\n avatar { id } createdAt updatedAt\n", d = "id postId memberId type createdAt", f = "\n id workspaceId postId parentId authorId body isHidden createdAt updatedAt\n", p = `
73
+ id workspaceId channelId authorId body status tags attachmentFileIds isPinned
74
+ reactionCount commentCount reactions { ${d} } createdAt updatedAt
75
+ `, m = "id workspaceId pollId label position voteCount createdAt", h = `
76
+ id workspaceId circleId question allowMultiple isAnonymous status closesAt
77
+ options { ${m} } createdAt updatedAt
78
+ `, g = "\n id workspaceId eventId memberId status note createdAt updatedAt\n", _ = "\n id workspaceId circleId hostId title description mode status location joinUrl\n capacity startsAt endsAt tags rsvpCount createdAt updatedAt\n", v = "\n id workspaceId memberId displayName headline bio avatar { id } interests skills\n presence discoverable createdAt updatedAt\n", y = "\n id workspaceId circleId memberId role status joinedAt createdAt updatedAt\n", b = "\n id workspaceId followerId targetId targetType muted createdAt updatedAt\n", x = (t = {}) => {
79
+ let { apiGatewayUrl: r } = e();
80
+ return n({
81
+ queryKey: [...o.circles, t],
82
+ queryFn: async () => (await a(`query ComListCircles($status: ComCircleStatus, $visibility: ComCircleVisibility, $pagination: PaginationInput) {
83
+ comListCircles(status: $status, visibility: $visibility, pagination: $pagination) {
84
+ items { ${u} }
85
+ pageInfo { cursor hasMore }
86
+ }
87
+ }`, {
88
+ status: t.status,
89
+ visibility: t.visibility,
90
+ pagination: c(t.pagination)
91
+ }, r)).comListCircles
92
+ });
93
+ }, S = (t) => {
94
+ let { apiGatewayUrl: r } = e();
95
+ return n({
96
+ queryKey: o.circle(t ?? ""),
97
+ enabled: !!t,
98
+ queryFn: async () => (await a(`query ComCircle($id: ID!) {
99
+ comCircle(id: $id) {
100
+ ${u}
101
+ channels { ${l} }
102
+ memberships { ${y} }
103
+ }
104
+ }`, { id: t }, r)).comCircle
105
+ });
106
+ }, C = () => {
107
+ let { apiGatewayUrl: n } = e(), i = r();
108
+ return t({
109
+ mutationFn: async (e) => (await a(`mutation ComCreateCircle($input: ComCreateCircleInput!) {
110
+ comCreateCircle(input: $input) { ${u} }
111
+ }`, { input: e }, n)).comCreateCircle,
112
+ onSuccess: () => i.invalidateQueries({ queryKey: o.circles })
113
+ });
114
+ }, w = () => {
115
+ let { apiGatewayUrl: n } = e(), i = r();
116
+ return t({
117
+ mutationFn: async (e) => (await a(`mutation ComJoinCircle($circleId: ID!) {
118
+ comJoinCircle(circleId: $circleId) { ${y} }
119
+ }`, { circleId: e }, n)).comJoinCircle,
120
+ onSuccess: (e) => {
121
+ i.invalidateQueries({ queryKey: o.circles }), i.invalidateQueries({ queryKey: o.circle(e.circleId) }), i.invalidateQueries({ queryKey: o.memberships });
122
+ }
123
+ });
124
+ }, T = () => {
125
+ let { apiGatewayUrl: n } = e(), i = r();
126
+ return t({
127
+ mutationFn: async (e) => (await a("mutation ComLeaveCircle($circleId: ID!) { comLeaveCircle(circleId: $circleId) }", { circleId: e }, n)).comLeaveCircle,
128
+ onSuccess: (e, t) => {
129
+ i.invalidateQueries({ queryKey: o.circles }), i.invalidateQueries({ queryKey: o.circle(t) }), i.invalidateQueries({ queryKey: o.memberships });
130
+ }
131
+ });
132
+ }, E = () => {
133
+ let { apiGatewayUrl: n } = e(), i = r();
134
+ return t({
135
+ mutationFn: async (e) => (await a(`mutation ComSetMemberRole($membershipId: ID!, $role: ComMemberRole!) {
136
+ comSetMemberRole(membershipId: $membershipId, role: $role) { ${y} }
137
+ }`, {
138
+ membershipId: e.membershipId,
139
+ role: e.role
140
+ }, n)).comSetMemberRole,
141
+ onSuccess: (e) => {
142
+ i.invalidateQueries({ queryKey: o.circle(e.circleId) }), i.invalidateQueries({ queryKey: o.memberships });
143
+ }
144
+ });
145
+ }, D = (t = {}) => {
146
+ let { apiGatewayUrl: r } = e();
147
+ return n({
148
+ queryKey: [...o.memberships, t],
149
+ queryFn: async () => (await a(`query ComListMemberships($circleId: ID, $status: ComMembershipStatus, $pagination: PaginationInput) {
150
+ comListMemberships(circleId: $circleId, status: $status, pagination: $pagination) {
151
+ items { ${y} }
152
+ pageInfo { cursor hasMore }
153
+ }
154
+ }`, {
155
+ circleId: t.circleId,
156
+ status: t.status,
157
+ pagination: c(t.pagination)
158
+ }, r)).comListMemberships
159
+ });
160
+ }, O = () => {
161
+ let { apiGatewayUrl: n } = e(), i = r();
162
+ return t({
163
+ mutationFn: async (e) => (await a(`mutation ComCreateChannel($input: ComCreateChannelInput!) {
164
+ comCreateChannel(input: $input) { ${l} }
165
+ }`, { input: e }, n)).comCreateChannel,
166
+ onSuccess: (e) => {
167
+ i.invalidateQueries({ queryKey: o.channels(e.circleId) }), i.invalidateQueries({ queryKey: o.circle(e.circleId) });
168
+ }
169
+ });
170
+ }, k = (t = {}) => {
171
+ let { apiGatewayUrl: r } = e();
172
+ return n({
173
+ queryKey: [
174
+ ...o.posts(t.channelId ?? "all"),
175
+ t.status,
176
+ t.pagination
177
+ ],
178
+ enabled: !!t.channelId,
179
+ queryFn: async () => (await a(`query ComListPosts($channelId: ID, $status: ComPostStatus, $pagination: PaginationInput) {
180
+ comListPosts(channelId: $channelId, status: $status, pagination: $pagination) {
181
+ items { ${p} }
182
+ pageInfo { cursor hasMore }
183
+ }
184
+ }`, {
185
+ channelId: t.channelId,
186
+ status: t.status,
187
+ pagination: c(t.pagination)
188
+ }, r)).comListPosts
189
+ });
190
+ }, A = (t) => {
191
+ let { apiGatewayUrl: r } = e();
192
+ return n({
193
+ queryKey: [...o.feed, t],
194
+ queryFn: async () => (await a(`query ComMyFeed($pagination: PaginationInput) {
195
+ comMyFeed(pagination: $pagination) {
196
+ items { ${p} }
197
+ pageInfo { cursor hasMore }
198
+ }
199
+ }`, { pagination: c(t) }, r)).comMyFeed
200
+ });
201
+ }, j = () => {
202
+ let { apiGatewayUrl: n } = e(), i = r();
203
+ return t({
204
+ mutationFn: async (e) => (await a(`mutation ComCreatePost($input: ComCreatePostInput!) {
205
+ comCreatePost(input: $input) { ${p} }
206
+ }`, { input: e }, n)).comCreatePost,
207
+ onSuccess: (e) => {
208
+ i.invalidateQueries({ queryKey: o.posts(e.channelId) }), i.invalidateQueries({ queryKey: o.feed });
209
+ }
210
+ });
211
+ }, M = () => {
212
+ let { apiGatewayUrl: n } = e(), i = r();
213
+ return t({
214
+ mutationFn: async (e) => (await a(`mutation ComUpdatePost($id: ID!, $input: ComUpdatePostInput!) {
215
+ comUpdatePost(id: $id, input: $input) { ${p} }
216
+ }`, e, n)).comUpdatePost,
217
+ onSuccess: (e) => {
218
+ i.invalidateQueries({ queryKey: o.posts(e.channelId) }), i.invalidateQueries({ queryKey: o.post(e.id) }), i.invalidateQueries({ queryKey: o.feed });
219
+ }
220
+ });
221
+ }, N = () => {
222
+ let { apiGatewayUrl: n } = e(), i = r();
223
+ return t({
224
+ mutationFn: async (e) => (await a("mutation ComRemovePost($id: ID!) { comRemovePost(id: $id) }", { id: e.id }, n)).comRemovePost,
225
+ onSuccess: (e, t) => {
226
+ t.channelId && i.invalidateQueries({ queryKey: o.posts(t.channelId) }), i.invalidateQueries({ queryKey: o.feed });
227
+ }
228
+ });
229
+ }, P = () => {
230
+ let { apiGatewayUrl: n } = e(), i = r();
231
+ return t({
232
+ mutationFn: async (e) => (await a(`mutation ComReactToPost($postId: ID!, $type: ComReactionType!) {
233
+ comReactToPost(postId: $postId, type: $type) { ${p} }
234
+ }`, e, n)).comReactToPost,
235
+ onSuccess: (e) => {
236
+ i.invalidateQueries({ queryKey: o.posts(e.channelId) }), i.invalidateQueries({ queryKey: o.post(e.id) }), i.invalidateQueries({ queryKey: o.feed });
237
+ }
238
+ });
239
+ }, F = (t) => {
240
+ let { apiGatewayUrl: r } = e();
241
+ return n({
242
+ queryKey: o.comments(t ?? ""),
243
+ enabled: !!t,
244
+ queryFn: async () => (await a(`query ComListComments($postId: ID!) {
245
+ comListComments(postId: $postId) { ${f} }
246
+ }`, { postId: t }, r)).comListComments
247
+ });
248
+ }, I = () => {
249
+ let { apiGatewayUrl: n } = e(), i = r();
250
+ return t({
251
+ mutationFn: async (e) => (await a(`mutation ComAddComment($input: ComCreateCommentInput!) {
252
+ comAddComment(input: $input) { ${f} }
253
+ }`, { input: e }, n)).comAddComment,
254
+ onSuccess: (e) => {
255
+ i.invalidateQueries({ queryKey: o.comments(e.postId) }), i.invalidateQueries({ queryKey: o.post(e.postId) }), i.invalidateQueries({ queryKey: o.feed });
256
+ }
257
+ });
258
+ }, L = (t) => {
259
+ let { apiGatewayUrl: r } = e();
260
+ return n({
261
+ queryKey: [...o.follows, t ?? "all"],
262
+ queryFn: async () => (await a(`query ComMyFollows($targetType: ComFollowTargetType) {
263
+ comMyFollows(targetType: $targetType) { ${b} }
264
+ }`, { targetType: t }, r)).comMyFollows
265
+ });
266
+ }, R = () => {
267
+ let { apiGatewayUrl: n } = e(), i = r();
268
+ return t({
269
+ mutationFn: async (e) => (await a(`mutation ComFollow($input: ComFollowInput!) {
270
+ comFollow(input: $input) { ${b} }
271
+ }`, { input: e }, n)).comFollow,
272
+ onSuccess: () => {
273
+ i.invalidateQueries({ queryKey: o.follows }), i.invalidateQueries({ queryKey: o.feed });
274
+ }
275
+ });
276
+ }, z = () => {
277
+ let { apiGatewayUrl: n } = e(), i = r();
278
+ return t({
279
+ mutationFn: async (e) => (await a("mutation ComUnfollow($input: ComFollowInput!) { comUnfollow(input: $input) }", { input: e }, n)).comUnfollow,
280
+ onSuccess: () => {
281
+ i.invalidateQueries({ queryKey: o.follows }), i.invalidateQueries({ queryKey: o.feed });
282
+ }
283
+ });
284
+ }, B = (t = {}) => {
285
+ let { apiGatewayUrl: r } = e();
286
+ return n({
287
+ queryKey: [...o.events, t],
288
+ queryFn: async () => (await a(`query ComListEvents($circleId: ID, $status: ComEventStatus, $pagination: PaginationInput) {
289
+ comListEvents(circleId: $circleId, status: $status, pagination: $pagination) {
290
+ items { ${_} }
291
+ pageInfo { cursor hasMore }
292
+ }
293
+ }`, {
294
+ circleId: t.circleId,
295
+ status: t.status,
296
+ pagination: c(t.pagination)
297
+ }, r)).comListEvents
298
+ });
299
+ }, V = (t) => {
300
+ let { apiGatewayUrl: r } = e();
301
+ return n({
302
+ queryKey: o.event(t ?? ""),
303
+ enabled: !!t,
304
+ queryFn: async () => (await a(`query ComEvent($id: ID!) {
305
+ comEvent(id: $id) {
306
+ ${_}
307
+ rsvps { ${g} }
308
+ }
309
+ }`, { id: t }, r)).comEvent
310
+ });
311
+ }, H = () => {
312
+ let { apiGatewayUrl: n } = e(), i = r();
313
+ return t({
314
+ mutationFn: async (e) => (await a(`mutation ComCreateEvent($input: ComCreateEventInput!) {
315
+ comCreateEvent(input: $input) { ${_} }
316
+ }`, { input: e }, n)).comCreateEvent,
317
+ onSuccess: () => i.invalidateQueries({ queryKey: o.events })
318
+ });
319
+ }, U = () => {
320
+ let { apiGatewayUrl: n } = e(), i = r();
321
+ return t({
322
+ mutationFn: async (e) => (await a(`mutation ComTransitionEvent($id: ID!, $status: ComEventStatus!) {
323
+ comTransitionEvent(id: $id, status: $status) { ${_} }
324
+ }`, e, n)).comTransitionEvent,
325
+ onSuccess: (e) => {
326
+ i.invalidateQueries({ queryKey: o.events }), i.invalidateQueries({ queryKey: o.event(e.id) });
327
+ }
328
+ });
329
+ }, W = () => {
330
+ let { apiGatewayUrl: n } = e(), i = r();
331
+ return t({
332
+ mutationFn: async (e) => (await a(`mutation ComRsvpEvent($eventId: ID!, $status: ComRsvpStatus!, $note: String) {
333
+ comRsvpEvent(eventId: $eventId, status: $status, note: $note) { ${g} }
334
+ }`, e, n)).comRsvpEvent,
335
+ onSuccess: (e) => {
336
+ i.invalidateQueries({ queryKey: o.events }), i.invalidateQueries({ queryKey: o.event(e.eventId) });
337
+ }
338
+ });
339
+ }, G = (t, r) => {
340
+ let { apiGatewayUrl: i } = e();
341
+ return n({
342
+ queryKey: [...o.polls(t ?? ""), r ?? "all"],
343
+ enabled: !!t,
344
+ queryFn: async () => (await a(`query ComListPolls($circleId: ID!, $status: ComPollStatus) {
345
+ comListPolls(circleId: $circleId, status: $status) { ${h} }
346
+ }`, {
347
+ circleId: t,
348
+ status: r
349
+ }, i)).comListPolls
350
+ });
351
+ }, K = () => {
352
+ let { apiGatewayUrl: n } = e(), i = r();
353
+ return t({
354
+ mutationFn: async (e) => (await a(`mutation ComCreatePoll($input: ComCreatePollInput!) {
355
+ comCreatePoll(input: $input) { ${h} }
356
+ }`, { input: e }, n)).comCreatePoll,
357
+ onSuccess: (e) => i.invalidateQueries({ queryKey: o.polls(e.circleId) })
358
+ });
359
+ }, q = () => {
360
+ let { apiGatewayUrl: n } = e(), i = r();
361
+ return t({
362
+ mutationFn: async (e) => (await a(`mutation ComClosePoll($id: ID!) { comClosePoll(id: $id) { ${h} } }`, { id: e }, n)).comClosePoll,
363
+ onSuccess: (e) => i.invalidateQueries({ queryKey: o.polls(e.circleId) })
364
+ });
365
+ }, J = () => {
366
+ let { apiGatewayUrl: n } = e(), i = r();
367
+ return t({
368
+ mutationFn: async (e) => (await a(`mutation ComVotePoll($pollId: ID!, $optionId: ID!) {
369
+ comVotePoll(pollId: $pollId, optionId: $optionId) { ${m} }
370
+ }`, {
371
+ pollId: e.pollId,
372
+ optionId: e.optionId
373
+ }, n)).comVotePoll,
374
+ onSuccess: (e, t) => {
375
+ t.circleId && i.invalidateQueries({ queryKey: o.polls(t.circleId) }), i.invalidateQueries({ queryKey: o.poll(t.pollId) });
376
+ }
377
+ });
378
+ }, Y = (t = {}) => {
379
+ let { apiGatewayUrl: r } = e();
380
+ return n({
381
+ queryKey: [...o.profiles, t],
382
+ queryFn: async () => (await a(`query ComListProfiles($discoverable: Boolean, $pagination: PaginationInput) {
383
+ comListProfiles(discoverable: $discoverable, pagination: $pagination) {
384
+ items { ${v} }
385
+ pageInfo { cursor hasMore }
386
+ }
387
+ }`, {
388
+ discoverable: t.discoverable,
389
+ pagination: c(t.pagination)
390
+ }, r)).comListProfiles
391
+ });
392
+ }, X = (t) => {
393
+ let { apiGatewayUrl: r } = e();
394
+ return n({
395
+ queryKey: o.profile(t ?? ""),
396
+ enabled: !!t,
397
+ staleTime: 600 * 1e3,
398
+ queryFn: async () => (await a(`query ComProfile($memberId: ID!) {
399
+ comProfile(memberId: $memberId) { ${v} }
400
+ }`, { memberId: t }, r)).comProfile
401
+ });
402
+ }, Z = () => {
403
+ let { apiGatewayUrl: n } = e(), i = r();
404
+ return t({
405
+ mutationFn: async (e) => (await a(`mutation ComUpsertProfile($input: ComUpsertProfileInput!) {
406
+ comUpsertProfile(input: $input) { ${v} }
407
+ }`, { input: e }, n)).comUpsertProfile,
408
+ onSuccess: (e) => {
409
+ i.invalidateQueries({ queryKey: o.profiles }), i.invalidateQueries({ queryKey: o.profile(e.memberId) });
410
+ }
411
+ });
412
+ };
413
+ //#endregion
414
+ export { I as useComAddComment, S as useComCircle, x as useComCircles, q as useComClosePoll, F as useComComments, O as useComCreateChannel, C as useComCreateCircle, H as useComCreateEvent, K as useComCreatePoll, j as useComCreatePost, V as useComEvent, B as useComEvents, R as useComFollow, w as useComJoinCircle, T as useComLeaveCircle, D as useComMemberships, A as useComMyFeed, L as useComMyFollows, G as useComPolls, k as useComPosts, X as useComProfile, Y as useComProfiles, P as useComReactToPost, N as useComRemovePost, W as useComRsvpEvent, E as useComSetMemberRole, U as useComTransitionEvent, z as useComUnfollow, M as useComUpdatePost, Z as useComUpsertProfile, J as useComVotePoll };
415
+
416
+ //# sourceMappingURL=useComradeCircleApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useComradeCircleApi.js","names":[],"sources":["../../../src/comradecircle/hooks/useComradeCircleApi.ts"],"sourcesContent":["/**\n * ComradeCircle API hooks\n * @module comradecircle/hooks\n *\n * React-Query hooks wired DIRECTLY to the real `wspace-comradecircle-svc`\n * federated GraphQL contract (the `com*` operations). Every query/mutation\n * below uses an inline gql string whose fields match the svc\n * `.hive-schema.graphql` exactly. No mock data.\n *\n * Transport: `graphqlFetch({ gateway: 'workspace', workspaceToken: true })` —\n * the host shell supplies the gateway base URL + a workspace-scoped token.\n *\n * IMPORTANT: `User`/`File` are id-only federation stubs in this subgraph. We\n * never select `author { firstName }` or `avatar { url }`. Display identity is\n * resolved through `ComProfile` (see `useComProfile`).\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { useComradeCircle } from '../context';\nimport type {\n ComConnection,\n ComCircle,\n ComCircleStatus,\n ComCircleVisibility,\n ComChannel,\n ComComment,\n ComPost,\n ComPostStatus,\n ComPoll,\n ComPollStatus,\n ComPollOption,\n ComEvent,\n ComEventStatus,\n ComEventRsvp,\n ComRsvpStatus,\n ComProfile,\n ComMembership,\n ComMembershipStatus,\n ComMemberRole,\n ComFeedFollow,\n ComFollowTargetType,\n ComReaction,\n ComReactionType,\n ComCreateCircleInput,\n ComUpdateCircleInput,\n ComCreateChannelInput,\n ComUpdateChannelInput,\n ComCreatePostInput,\n ComUpdatePostInput,\n ComCreateCommentInput,\n ComCreateEventInput,\n ComUpdateEventInput,\n ComCreatePollInput,\n ComFollowInput,\n ComUpsertProfileInput,\n PaginationInput,\n} from '../types';\n\n// ============================================================================\n// Transport\n// ============================================================================\n\nconst comQuery = async <TData>(\n query: string,\n variables: Record<string, unknown>,\n baseUrl?: string\n): Promise<TData> => {\n const response = await graphqlFetch<TData>({\n gateway: 'workspace',\n baseUrl,\n query,\n variables,\n workspaceToken: true,\n });\n\n if (response.errors?.length) {\n throw new Error(response.errors[0]?.message ?? 'GraphQL request failed');\n }\n if (!response.data) {\n throw new Error('GraphQL response did not include data');\n }\n return response.data;\n};\n\n// React-Query key roots (one namespace per domain entity).\nconst KEY = {\n circles: ['comradecircle', 'circles'] as const,\n circle: (id: string) => ['comradecircle', 'circle', id] as const,\n channels: (circleId: string) => ['comradecircle', 'channels', circleId] as const,\n posts: (channelId: string) => ['comradecircle', 'posts', channelId] as const,\n post: (id: string) => ['comradecircle', 'post', id] as const,\n comments: (postId: string) => ['comradecircle', 'comments', postId] as const,\n feed: ['comradecircle', 'feed'] as const,\n follows: ['comradecircle', 'follows'] as const,\n events: ['comradecircle', 'events'] as const,\n event: (id: string) => ['comradecircle', 'event', id] as const,\n polls: (circleId: string) => ['comradecircle', 'polls', circleId] as const,\n poll: (id: string) => ['comradecircle', 'poll', id] as const,\n profiles: ['comradecircle', 'profiles'] as const,\n profile: (memberId: string) => ['comradecircle', 'profile', memberId] as const,\n memberships: ['comradecircle', 'memberships'] as const,\n};\n\nconst DEFAULT_PAGE: PaginationInput = { limit: 50 };\n\n/** Drop `cursor` when it is nullish so the svc never sees an explicit null. */\nconst page = (p?: PaginationInput): PaginationInput => {\n const base = p ?? DEFAULT_PAGE;\n const result: PaginationInput = { limit: base.limit ?? DEFAULT_PAGE.limit };\n if (base.offset != null) result.offset = base.offset;\n if (base.cursor != null) result.cursor = base.cursor;\n return result;\n};\n\n// ============================================================================\n// Reusable gql field selections (codegen-free strictness)\n// ============================================================================\n\nconst CHANNEL_FIELDS = `\n id workspaceId circleId name slug description type visibility position isArchived\n createdAt updatedAt\n`;\n\nconst CIRCLE_FIELDS = `\n id workspaceId name slug description topic tags status visibility memberCount\n avatar { id } createdAt updatedAt\n`;\n\nconst REACTION_FIELDS = `id postId memberId type createdAt`;\n\nconst COMMENT_FIELDS = `\n id workspaceId postId parentId authorId body isHidden createdAt updatedAt\n`;\n\nconst POST_FIELDS = `\n id workspaceId channelId authorId body status tags attachmentFileIds isPinned\n reactionCount commentCount reactions { ${REACTION_FIELDS} } createdAt updatedAt\n`;\n\nconst POLL_OPTION_FIELDS = `id workspaceId pollId label position voteCount createdAt`;\n\nconst POLL_FIELDS = `\n id workspaceId circleId question allowMultiple isAnonymous status closesAt\n options { ${POLL_OPTION_FIELDS} } createdAt updatedAt\n`;\n\nconst RSVP_FIELDS = `\n id workspaceId eventId memberId status note createdAt updatedAt\n`;\n\nconst EVENT_FIELDS = `\n id workspaceId circleId hostId title description mode status location joinUrl\n capacity startsAt endsAt tags rsvpCount createdAt updatedAt\n`;\n\nconst PROFILE_FIELDS = `\n id workspaceId memberId displayName headline bio avatar { id } interests skills\n presence discoverable createdAt updatedAt\n`;\n\nconst MEMBERSHIP_FIELDS = `\n id workspaceId circleId memberId role status joinedAt createdAt updatedAt\n`;\n\nconst FOLLOW_FIELDS = `\n id workspaceId followerId targetId targetType muted createdAt updatedAt\n`;\n\n// ============================================================================\n// Circles\n// ============================================================================\n\nexport interface CircleFilters {\n status?: ComCircleStatus;\n visibility?: ComCircleVisibility;\n pagination?: PaginationInput;\n}\n\nexport const useComCircles = (filters: CircleFilters = {}) => {\n const { apiGatewayUrl } = useComradeCircle();\n return useQuery({\n queryKey: [...KEY.circles, filters],\n queryFn: async () => {\n const result = await comQuery<{ comListCircles: ComConnection<ComCircle> }>(\n `query ComListCircles($status: ComCircleStatus, $visibility: ComCircleVisibility, $pagination: PaginationInput) {\n comListCircles(status: $status, visibility: $visibility, pagination: $pagination) {\n items { ${CIRCLE_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n status: filters.status,\n visibility: filters.visibility,\n pagination: page(filters.pagination),\n },\n apiGatewayUrl\n );\n return result.comListCircles;\n },\n });\n};\n\nexport const useComCircle = (id: string | undefined) => {\n const { apiGatewayUrl } = useComradeCircle();\n return useQuery({\n queryKey: KEY.circle(id ?? ''),\n enabled: Boolean(id),\n queryFn: async () => {\n const result = await comQuery<{ comCircle: ComCircle | null }>(\n `query ComCircle($id: ID!) {\n comCircle(id: $id) {\n ${CIRCLE_FIELDS}\n channels { ${CHANNEL_FIELDS} }\n memberships { ${MEMBERSHIP_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.comCircle;\n },\n });\n};\n\nexport const useComCreateCircle = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: ComCreateCircleInput) => {\n const result = await comQuery<{ comCreateCircle: ComCircle }>(\n `mutation ComCreateCircle($input: ComCreateCircleInput!) {\n comCreateCircle(input: $input) { ${CIRCLE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.comCreateCircle;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.circles }),\n });\n};\n\nexport const useComUpdateCircle = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; input: ComUpdateCircleInput }) => {\n const result = await comQuery<{ comUpdateCircle: ComCircle }>(\n `mutation ComUpdateCircle($id: ID!, $input: ComUpdateCircleInput!) {\n comUpdateCircle(id: $id, input: $input) { ${CIRCLE_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.comUpdateCircle;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.circles });\n qc.invalidateQueries({ queryKey: KEY.circle(data.id) });\n },\n });\n};\n\nexport const useComArchiveCircle = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (id: string) => {\n const result = await comQuery<{ comArchiveCircle: boolean }>(\n `mutation ComArchiveCircle($id: ID!) { comArchiveCircle(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return result.comArchiveCircle;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.circles }),\n });\n};\n\nexport const useComJoinCircle = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (circleId: string) => {\n const result = await comQuery<{ comJoinCircle: ComMembership }>(\n `mutation ComJoinCircle($circleId: ID!) {\n comJoinCircle(circleId: $circleId) { ${MEMBERSHIP_FIELDS} }\n }`,\n { circleId },\n apiGatewayUrl\n );\n return result.comJoinCircle;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.circles });\n qc.invalidateQueries({ queryKey: KEY.circle(data.circleId) });\n qc.invalidateQueries({ queryKey: KEY.memberships });\n },\n });\n};\n\nexport const useComLeaveCircle = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (circleId: string) => {\n const result = await comQuery<{ comLeaveCircle: boolean }>(\n `mutation ComLeaveCircle($circleId: ID!) { comLeaveCircle(circleId: $circleId) }`,\n { circleId },\n apiGatewayUrl\n );\n return result.comLeaveCircle;\n },\n onSuccess: (_data, circleId) => {\n qc.invalidateQueries({ queryKey: KEY.circles });\n qc.invalidateQueries({ queryKey: KEY.circle(circleId) });\n qc.invalidateQueries({ queryKey: KEY.memberships });\n },\n });\n};\n\nexport const useComSetMemberRole = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { membershipId: string; role: ComMemberRole; circleId?: string }) => {\n const result = await comQuery<{ comSetMemberRole: ComMembership }>(\n `mutation ComSetMemberRole($membershipId: ID!, $role: ComMemberRole!) {\n comSetMemberRole(membershipId: $membershipId, role: $role) { ${MEMBERSHIP_FIELDS} }\n }`,\n { membershipId: vars.membershipId, role: vars.role },\n apiGatewayUrl\n );\n return result.comSetMemberRole;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.circle(data.circleId) });\n qc.invalidateQueries({ queryKey: KEY.memberships });\n },\n });\n};\n\nexport interface MembershipFilters {\n circleId?: string;\n status?: ComMembershipStatus;\n pagination?: PaginationInput;\n}\n\nexport const useComMemberships = (filters: MembershipFilters = {}) => {\n const { apiGatewayUrl } = useComradeCircle();\n return useQuery({\n queryKey: [...KEY.memberships, filters],\n queryFn: async () => {\n const result = await comQuery<{ comListMemberships: ComConnection<ComMembership> }>(\n `query ComListMemberships($circleId: ID, $status: ComMembershipStatus, $pagination: PaginationInput) {\n comListMemberships(circleId: $circleId, status: $status, pagination: $pagination) {\n items { ${MEMBERSHIP_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n circleId: filters.circleId,\n status: filters.status,\n pagination: page(filters.pagination),\n },\n apiGatewayUrl\n );\n return result.comListMemberships;\n },\n });\n};\n\n// ============================================================================\n// Channels\n// ============================================================================\n\nexport const useComChannels = (circleId: string | undefined) => {\n const { apiGatewayUrl } = useComradeCircle();\n return useQuery({\n queryKey: KEY.channels(circleId ?? ''),\n enabled: Boolean(circleId),\n queryFn: async () => {\n const result = await comQuery<{ comListChannels: ComChannel[] }>(\n `query ComListChannels($circleId: ID!) {\n comListChannels(circleId: $circleId) { ${CHANNEL_FIELDS} }\n }`,\n { circleId },\n apiGatewayUrl\n );\n return result.comListChannels;\n },\n });\n};\n\nexport const useComCreateChannel = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: ComCreateChannelInput) => {\n const result = await comQuery<{ comCreateChannel: ComChannel }>(\n `mutation ComCreateChannel($input: ComCreateChannelInput!) {\n comCreateChannel(input: $input) { ${CHANNEL_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.comCreateChannel;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.channels(data.circleId) });\n qc.invalidateQueries({ queryKey: KEY.circle(data.circleId) });\n },\n });\n};\n\nexport const useComUpdateChannel = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; input: ComUpdateChannelInput; circleId: string }) => {\n const result = await comQuery<{ comUpdateChannel: ComChannel }>(\n `mutation ComUpdateChannel($id: ID!, $input: ComUpdateChannelInput!) {\n comUpdateChannel(id: $id, input: $input) { ${CHANNEL_FIELDS} }\n }`,\n { id: vars.id, input: vars.input },\n apiGatewayUrl\n );\n return result.comUpdateChannel;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.channels(data.circleId) });\n qc.invalidateQueries({ queryKey: KEY.circle(data.circleId) });\n },\n });\n};\n\n// ============================================================================\n// Posts / Reactions / Comments\n// ============================================================================\n\nexport interface PostFilters {\n channelId?: string;\n status?: ComPostStatus;\n pagination?: PaginationInput;\n}\n\nexport const useComPosts = (filters: PostFilters = {}) => {\n const { apiGatewayUrl } = useComradeCircle();\n return useQuery({\n queryKey: [...KEY.posts(filters.channelId ?? 'all'), filters.status, filters.pagination],\n enabled: Boolean(filters.channelId),\n queryFn: async () => {\n const result = await comQuery<{ comListPosts: ComConnection<ComPost> }>(\n `query ComListPosts($channelId: ID, $status: ComPostStatus, $pagination: PaginationInput) {\n comListPosts(channelId: $channelId, status: $status, pagination: $pagination) {\n items { ${POST_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n channelId: filters.channelId,\n status: filters.status,\n pagination: page(filters.pagination),\n },\n apiGatewayUrl\n );\n return result.comListPosts;\n },\n });\n};\n\nexport const useComPost = (id: string | undefined) => {\n const { apiGatewayUrl } = useComradeCircle();\n return useQuery({\n queryKey: KEY.post(id ?? ''),\n enabled: Boolean(id),\n queryFn: async () => {\n const result = await comQuery<{ comPost: ComPost | null }>(\n `query ComPost($id: ID!) {\n comPost(id: $id) {\n ${POST_FIELDS}\n comments { ${COMMENT_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.comPost;\n },\n });\n};\n\nexport const useComMyFeed = (pagination?: PaginationInput) => {\n const { apiGatewayUrl } = useComradeCircle();\n return useQuery({\n queryKey: [...KEY.feed, pagination],\n queryFn: async () => {\n const result = await comQuery<{ comMyFeed: ComConnection<ComPost> }>(\n `query ComMyFeed($pagination: PaginationInput) {\n comMyFeed(pagination: $pagination) {\n items { ${POST_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n { pagination: page(pagination) },\n apiGatewayUrl\n );\n return result.comMyFeed;\n },\n });\n};\n\nexport const useComCreatePost = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: ComCreatePostInput) => {\n const result = await comQuery<{ comCreatePost: ComPost }>(\n `mutation ComCreatePost($input: ComCreatePostInput!) {\n comCreatePost(input: $input) { ${POST_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.comCreatePost;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.posts(data.channelId) });\n qc.invalidateQueries({ queryKey: KEY.feed });\n },\n });\n};\n\nexport const useComUpdatePost = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; input: ComUpdatePostInput }) => {\n const result = await comQuery<{ comUpdatePost: ComPost }>(\n `mutation ComUpdatePost($id: ID!, $input: ComUpdatePostInput!) {\n comUpdatePost(id: $id, input: $input) { ${POST_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.comUpdatePost;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.posts(data.channelId) });\n qc.invalidateQueries({ queryKey: KEY.post(data.id) });\n qc.invalidateQueries({ queryKey: KEY.feed });\n },\n });\n};\n\nexport const useComRemovePost = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; channelId?: string }) => {\n const result = await comQuery<{ comRemovePost: boolean }>(\n `mutation ComRemovePost($id: ID!) { comRemovePost(id: $id) }`,\n { id: vars.id },\n apiGatewayUrl\n );\n return result.comRemovePost;\n },\n onSuccess: (_d, vars) => {\n if (vars.channelId) qc.invalidateQueries({ queryKey: KEY.posts(vars.channelId) });\n qc.invalidateQueries({ queryKey: KEY.feed });\n },\n });\n};\n\nexport const useComReactToPost = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { postId: string; type: ComReactionType }) => {\n const result = await comQuery<{ comReactToPost: ComPost }>(\n `mutation ComReactToPost($postId: ID!, $type: ComReactionType!) {\n comReactToPost(postId: $postId, type: $type) { ${POST_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.comReactToPost;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.posts(data.channelId) });\n qc.invalidateQueries({ queryKey: KEY.post(data.id) });\n qc.invalidateQueries({ queryKey: KEY.feed });\n },\n });\n};\n\nexport const useComComments = (postId: string | undefined) => {\n const { apiGatewayUrl } = useComradeCircle();\n return useQuery({\n queryKey: KEY.comments(postId ?? ''),\n enabled: Boolean(postId),\n queryFn: async () => {\n const result = await comQuery<{ comListComments: ComComment[] }>(\n `query ComListComments($postId: ID!) {\n comListComments(postId: $postId) { ${COMMENT_FIELDS} }\n }`,\n { postId },\n apiGatewayUrl\n );\n return result.comListComments;\n },\n });\n};\n\nexport const useComAddComment = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: ComCreateCommentInput) => {\n const result = await comQuery<{ comAddComment: ComComment }>(\n `mutation ComAddComment($input: ComCreateCommentInput!) {\n comAddComment(input: $input) { ${COMMENT_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.comAddComment;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.comments(data.postId) });\n qc.invalidateQueries({ queryKey: KEY.post(data.postId) });\n qc.invalidateQueries({ queryKey: KEY.feed });\n },\n });\n};\n\n// ============================================================================\n// Feed follows\n// ============================================================================\n\nexport const useComMyFollows = (targetType?: ComFollowTargetType) => {\n const { apiGatewayUrl } = useComradeCircle();\n return useQuery({\n queryKey: [...KEY.follows, targetType ?? 'all'],\n queryFn: async () => {\n const result = await comQuery<{ comMyFollows: ComFeedFollow[] }>(\n `query ComMyFollows($targetType: ComFollowTargetType) {\n comMyFollows(targetType: $targetType) { ${FOLLOW_FIELDS} }\n }`,\n { targetType },\n apiGatewayUrl\n );\n return result.comMyFollows;\n },\n });\n};\n\nexport const useComFollow = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: ComFollowInput) => {\n const result = await comQuery<{ comFollow: ComFeedFollow }>(\n `mutation ComFollow($input: ComFollowInput!) {\n comFollow(input: $input) { ${FOLLOW_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.comFollow;\n },\n onSuccess: () => {\n qc.invalidateQueries({ queryKey: KEY.follows });\n qc.invalidateQueries({ queryKey: KEY.feed });\n },\n });\n};\n\nexport const useComUnfollow = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: ComFollowInput) => {\n const result = await comQuery<{ comUnfollow: boolean }>(\n `mutation ComUnfollow($input: ComFollowInput!) { comUnfollow(input: $input) }`,\n { input },\n apiGatewayUrl\n );\n return result.comUnfollow;\n },\n onSuccess: () => {\n qc.invalidateQueries({ queryKey: KEY.follows });\n qc.invalidateQueries({ queryKey: KEY.feed });\n },\n });\n};\n\nexport const useComMuteFollow = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; muted: boolean }) => {\n const result = await comQuery<{ comMuteFollow: ComFeedFollow }>(\n `mutation ComMuteFollow($id: ID!, $muted: Boolean!) {\n comMuteFollow(id: $id, muted: $muted) { ${FOLLOW_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.comMuteFollow;\n },\n onSuccess: () => {\n qc.invalidateQueries({ queryKey: KEY.follows });\n qc.invalidateQueries({ queryKey: KEY.feed });\n },\n });\n};\n\n// ============================================================================\n// Events / RSVPs\n// ============================================================================\n\nexport interface EventFilters {\n circleId?: string;\n status?: ComEventStatus;\n pagination?: PaginationInput;\n}\n\nexport const useComEvents = (filters: EventFilters = {}) => {\n const { apiGatewayUrl } = useComradeCircle();\n return useQuery({\n queryKey: [...KEY.events, filters],\n queryFn: async () => {\n const result = await comQuery<{ comListEvents: ComConnection<ComEvent> }>(\n `query ComListEvents($circleId: ID, $status: ComEventStatus, $pagination: PaginationInput) {\n comListEvents(circleId: $circleId, status: $status, pagination: $pagination) {\n items { ${EVENT_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n circleId: filters.circleId,\n status: filters.status,\n pagination: page(filters.pagination),\n },\n apiGatewayUrl\n );\n return result.comListEvents;\n },\n });\n};\n\nexport const useComEvent = (id: string | undefined) => {\n const { apiGatewayUrl } = useComradeCircle();\n return useQuery({\n queryKey: KEY.event(id ?? ''),\n enabled: Boolean(id),\n queryFn: async () => {\n const result = await comQuery<{ comEvent: ComEvent | null }>(\n `query ComEvent($id: ID!) {\n comEvent(id: $id) {\n ${EVENT_FIELDS}\n rsvps { ${RSVP_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.comEvent;\n },\n });\n};\n\nexport const useComCreateEvent = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: ComCreateEventInput) => {\n const result = await comQuery<{ comCreateEvent: ComEvent }>(\n `mutation ComCreateEvent($input: ComCreateEventInput!) {\n comCreateEvent(input: $input) { ${EVENT_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.comCreateEvent;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.events }),\n });\n};\n\nexport const useComUpdateEvent = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; input: ComUpdateEventInput }) => {\n const result = await comQuery<{ comUpdateEvent: ComEvent }>(\n `mutation ComUpdateEvent($id: ID!, $input: ComUpdateEventInput!) {\n comUpdateEvent(id: $id, input: $input) { ${EVENT_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.comUpdateEvent;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.events });\n qc.invalidateQueries({ queryKey: KEY.event(data.id) });\n },\n });\n};\n\nexport const useComTransitionEvent = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; status: ComEventStatus }) => {\n const result = await comQuery<{ comTransitionEvent: ComEvent }>(\n `mutation ComTransitionEvent($id: ID!, $status: ComEventStatus!) {\n comTransitionEvent(id: $id, status: $status) { ${EVENT_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.comTransitionEvent;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.events });\n qc.invalidateQueries({ queryKey: KEY.event(data.id) });\n },\n });\n};\n\nexport const useComRsvpEvent = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { eventId: string; status: ComRsvpStatus; note?: string | null }) => {\n const result = await comQuery<{ comRsvpEvent: ComEventRsvp }>(\n `mutation ComRsvpEvent($eventId: ID!, $status: ComRsvpStatus!, $note: String) {\n comRsvpEvent(eventId: $eventId, status: $status, note: $note) { ${RSVP_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.comRsvpEvent;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.events });\n qc.invalidateQueries({ queryKey: KEY.event(data.eventId) });\n },\n });\n};\n\n// ============================================================================\n// Polls / Votes\n// ============================================================================\n\nexport const useComPolls = (circleId: string | undefined, status?: ComPollStatus) => {\n const { apiGatewayUrl } = useComradeCircle();\n return useQuery({\n queryKey: [...KEY.polls(circleId ?? ''), status ?? 'all'],\n enabled: Boolean(circleId),\n queryFn: async () => {\n const result = await comQuery<{ comListPolls: ComPoll[] }>(\n `query ComListPolls($circleId: ID!, $status: ComPollStatus) {\n comListPolls(circleId: $circleId, status: $status) { ${POLL_FIELDS} }\n }`,\n { circleId, status },\n apiGatewayUrl\n );\n return result.comListPolls;\n },\n });\n};\n\nexport const useComCreatePoll = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: ComCreatePollInput) => {\n const result = await comQuery<{ comCreatePoll: ComPoll }>(\n `mutation ComCreatePoll($input: ComCreatePollInput!) {\n comCreatePoll(input: $input) { ${POLL_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.comCreatePoll;\n },\n onSuccess: (data) => qc.invalidateQueries({ queryKey: KEY.polls(data.circleId) }),\n });\n};\n\nexport const useComClosePoll = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (id: string) => {\n const result = await comQuery<{ comClosePoll: ComPoll }>(\n `mutation ComClosePoll($id: ID!) { comClosePoll(id: $id) { ${POLL_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return result.comClosePoll;\n },\n onSuccess: (data) => qc.invalidateQueries({ queryKey: KEY.polls(data.circleId) }),\n });\n};\n\nexport const useComVotePoll = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { pollId: string; optionId: string; circleId?: string }) => {\n const result = await comQuery<{ comVotePoll: ComPollOption }>(\n `mutation ComVotePoll($pollId: ID!, $optionId: ID!) {\n comVotePoll(pollId: $pollId, optionId: $optionId) { ${POLL_OPTION_FIELDS} }\n }`,\n { pollId: vars.pollId, optionId: vars.optionId },\n apiGatewayUrl\n );\n return result.comVotePoll;\n },\n onSuccess: (_data, vars) => {\n if (vars.circleId) qc.invalidateQueries({ queryKey: KEY.polls(vars.circleId) });\n qc.invalidateQueries({ queryKey: KEY.poll(vars.pollId) });\n },\n });\n};\n\n// ============================================================================\n// Profiles (social identity layer)\n// ============================================================================\n\nexport interface ProfileFilters {\n discoverable?: boolean;\n pagination?: PaginationInput;\n}\n\nexport const useComProfiles = (filters: ProfileFilters = {}) => {\n const { apiGatewayUrl } = useComradeCircle();\n return useQuery({\n queryKey: [...KEY.profiles, filters],\n queryFn: async () => {\n const result = await comQuery<{ comListProfiles: ComConnection<ComProfile> }>(\n `query ComListProfiles($discoverable: Boolean, $pagination: PaginationInput) {\n comListProfiles(discoverable: $discoverable, pagination: $pagination) {\n items { ${PROFILE_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n { discoverable: filters.discoverable, pagination: page(filters.pagination) },\n apiGatewayUrl\n );\n return result.comListProfiles;\n },\n });\n};\n\nexport const useComProfile = (memberId: string | undefined) => {\n const { apiGatewayUrl } = useComradeCircle();\n return useQuery({\n queryKey: KEY.profile(memberId ?? ''),\n enabled: Boolean(memberId),\n // Profiles change rarely; cache aggressively so feed identity lookups are cheap.\n staleTime: 10 * 60 * 1000,\n queryFn: async () => {\n const result = await comQuery<{ comProfile: ComProfile | null }>(\n `query ComProfile($memberId: ID!) {\n comProfile(memberId: $memberId) { ${PROFILE_FIELDS} }\n }`,\n { memberId },\n apiGatewayUrl\n );\n return result.comProfile;\n },\n });\n};\n\nexport const useComUpsertProfile = () => {\n const { apiGatewayUrl } = useComradeCircle();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: ComUpsertProfileInput) => {\n const result = await comQuery<{ comUpsertProfile: ComProfile }>(\n `mutation ComUpsertProfile($input: ComUpsertProfileInput!) {\n comUpsertProfile(input: $input) { ${PROFILE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.comUpsertProfile;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.profiles });\n qc.invalidateQueries({ queryKey: KEY.profile(data.memberId) });\n },\n });\n};\n\n// Re-export commonly used reaction type for convenience.\nexport type { ComReaction };\n"],"mappings":";;;;;AAgEA,IAAM,IAAW,OACf,GACA,GACA,MACmB;CACnB,IAAM,IAAW,MAAM,EAAoB;EACzC,SAAS;EACT;EACA;EACA;EACA,gBAAgB;EACjB,CAAC;AAEF,KAAI,EAAS,QAAQ,OACnB,OAAU,MAAM,EAAS,OAAO,IAAI,WAAW,yBAAyB;AAE1E,KAAI,CAAC,EAAS,KACZ,OAAU,MAAM,wCAAwC;AAE1D,QAAO,EAAS;GAIZ,IAAM;CACV,SAAS,CAAC,iBAAiB,UAAU;CACrC,SAAS,MAAe;EAAC;EAAiB;EAAU;EAAG;CACvD,WAAW,MAAqB;EAAC;EAAiB;EAAY;EAAS;CACvE,QAAQ,MAAsB;EA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,SAAS,aACQ,MAAM,EACnB;8CACsC,EAAe;YAErD,EAAE,aAAU,EACZ,EACD,EACa;EAEjB,CAAC;GAGS,UAA4B;CACvC,IAAM,EAAE,qBAAkB,GAAkB,EACtC,IAAK,GAAgB;AAC3B,QAAO,EAAY;EACjB,YAAY,OAAO,OACF,MAAM,EACnB;8CACsC,EAAe;YAErD,EAAE,UAAO,EACT,EACD,EACa;EAEhB,YAAY,MAAS;AAEnB,GADA,EAAG,kBAAkB,EAAE,UAAU,EAAI,UAAU,CAAC,EAChD,EAAG,kBAAkB,EAAE,UAAU,EAAI,QAAQ,EAAK,SAAS,EAAE,CAAC;;EAEjE,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { useCallback as e, useState as t } from "react";
2
+ //#region src/comradecircle/hooks/useCursorPager.ts
3
+ function n() {
4
+ let [n, r] = t([null]), i = n.length - 1;
5
+ return {
6
+ page: i,
7
+ cursor: n[i] ?? void 0,
8
+ next: e((e) => {
9
+ e && r((t) => [...t, e]);
10
+ }, []),
11
+ prev: e(() => {
12
+ r((e) => e.length > 1 ? e.slice(0, -1) : e);
13
+ }, []),
14
+ reset: e(() => {
15
+ r([null]);
16
+ }, []),
17
+ onPageChange: e((e, t) => {
18
+ r((n) => e > n.length - 1 ? t ? [...n, t] : n : n.length > 1 ? n.slice(0, -1) : n);
19
+ }, [])
20
+ };
21
+ }
22
+ //#endregion
23
+ export { n as useCursorPager };
24
+
25
+ //# sourceMappingURL=useCursorPager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCursorPager.js","names":[],"sources":["../../../src/comradecircle/hooks/useCursorPager.ts"],"sourcesContent":["/**\n * useCursorPager — forward/back cursor pagination for Com* list connections.\n * @module comradecircle/hooks\n *\n * The svc paginates by cursor only (`PaginationInput.offset` is a no-op — the\n * resolver never sets Prisma `skip` from it). So a page must send\n * `pagination.cursor = the previous page's pageInfo.cursor` to advance. This\n * hook keeps a stack of the cursors that opened each visited page so Prev/Next\n * are exact, and exposes a 0-indexed `page` for display.\n */\n\nimport { useCallback, useState } from 'react';\n\nexport interface CursorPager {\n /** 0-indexed page number for display. */\n page: number;\n /**\n * Cursor that opens the current page — `undefined` on the first page so it is\n * OMITTED from the GraphQL variables (the svc rejects an explicit `cursor: null`;\n * a first page must send no cursor at all, per cursor-pagination convention).\n */\n cursor: string | undefined;\n /** Advance to the next page using the current page's end cursor. No-op if null. */\n next: (endCursor: string | null | undefined) => void;\n /** Go back one page. No-op on the first page. */\n prev: () => void;\n /** Reset to the first page (call when filters change). */\n reset: () => void;\n /**\n * Adapter for `<Pagination onPageChange>` — compares the requested page to the\n * current one and calls next()/prev() accordingly.\n */\n onPageChange: (targetPage: number, endCursor: string | null | undefined) => void;\n}\n\nexport function useCursorPager(): CursorPager {\n const [stack, setStack] = useState<(string | null)[]>([null]);\n const page = stack.length - 1;\n const cursor = stack[page] ?? undefined;\n\n const next = useCallback((endCursor: string | null | undefined) => {\n if (endCursor) setStack((s) => [...s, endCursor]);\n }, []);\n\n const prev = useCallback(() => {\n setStack((s) => (s.length > 1 ? s.slice(0, -1) : s));\n }, []);\n\n const reset = useCallback(() => {\n setStack([null]);\n }, []);\n\n const onPageChange = useCallback((targetPage: number, endCursor: string | null | undefined) => {\n setStack((s) => {\n const current = s.length - 1;\n if (targetPage > current) {\n return endCursor ? [...s, endCursor] : s;\n }\n return s.length > 1 ? s.slice(0, -1) : s;\n });\n }, []);\n\n return { page, cursor, next, prev, reset, onPageChange };\n}\n"],"mappings":";;AAmCA,SAAgB,IAA8B;CAC5C,IAAM,CAAC,GAAO,KAAY,EAA4B,CAAC,KAAK,CAAC,EACvD,IAAO,EAAM,SAAS;AAyB5B,QAAO;EAAE;EAAM,QAxBA,EAAM,MAAS,KAAA;EAwBP,MAtBV,GAAa,MAAyC;AACjE,GAAI,KAAW,GAAU,MAAM,CAAC,GAAG,GAAG,EAAU,CAAC;KAChD,EAAE,CAAC;EAoBuB,MAlBhB,QAAkB;AAC7B,MAAU,MAAO,EAAE,SAAS,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,EAAG;KACnD,EAAE,CAAC;EAgB6B,OAdrB,QAAkB;AAC9B,KAAS,CAAC,KAAK,CAAC;KACf,EAAE,CAAC;EAYoC,cAVrB,GAAa,GAAoB,MAAyC;AAC7F,MAAU,MAEJ,IADY,EAAE,SAAS,IAElB,IAAY,CAAC,GAAG,GAAG,EAAU,GAAG,IAElC,EAAE,SAAS,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,EACvC;KACD,EAAE,CAAC;EAEkD"}
@@ -1,3 +1,6 @@
1
- import "./providers/ComradeCircleProvider.js";
2
- import "./store/comradecircleStore.js";
1
+ import "./utils/navigation.js";
2
+ import "./context/ComradeCircleContext.js";
3
+ import "./utils/cn.js";
4
+ import "./context/index.js";
5
+ import "./utils/formatters.js";
3
6
  import "./ComradeCircleRoot.js";
@@ -0,0 +1,39 @@
1
+ import { toast as e } from "../../node_modules/sonner/dist/index.js";
2
+ //#region src/comradecircle/lib/toast.ts
3
+ var t = {
4
+ success(t, n) {
5
+ e.success(t, {
6
+ description: n,
7
+ duration: 4e3
8
+ });
9
+ },
10
+ info(t, n) {
11
+ e.info(t, {
12
+ description: n,
13
+ duration: 4e3
14
+ });
15
+ },
16
+ warning(t, n) {
17
+ e.warning(t, {
18
+ description: n,
19
+ duration: 8e3
20
+ });
21
+ },
22
+ error(t, n) {
23
+ e.error(t, {
24
+ description: n,
25
+ duration: Infinity,
26
+ closeButton: !0
27
+ });
28
+ },
29
+ dismiss(t) {
30
+ e.dismiss(t);
31
+ }
32
+ };
33
+ function n(e) {
34
+ return e instanceof Error ? e.message : typeof e == "string" ? e : "Something went wrong. Please try again.";
35
+ }
36
+ //#endregion
37
+ export { n as describeError, t as notify };
38
+
39
+ //# sourceMappingURL=toast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toast.js","names":[],"sources":["../../../src/comradecircle/lib/toast.ts"],"sourcesContent":["import { toast } from 'sonner';\n\n/**\n * Module-wide toast API. sonner is a global singleton; the matching <Toaster>\n * is owned by the HOST app shell. Every page/component surfaces feedback through\n * these helpers instead of hand-rolling fixed-position toast markup, so\n * success/error notifications stay consistent with the rest of the platform.\n *\n * Durations follow the notification spec: success/info auto-dismiss, errors stay\n * until the user dismisses them (sonner renders a close button and announces via\n * aria-live).\n */\nexport const notify = {\n success(message: string, description?: string): void {\n toast.success(message, { description, duration: 4000 });\n },\n info(message: string, description?: string): void {\n toast.info(message, { description, duration: 4000 });\n },\n warning(message: string, description?: string): void {\n toast.warning(message, { description, duration: 8000 });\n },\n error(message: string, description?: string): void {\n toast.error(message, { description, duration: Infinity, closeButton: true });\n },\n dismiss(id?: string | number): void {\n toast.dismiss(id);\n },\n};\n\n/** Normalize an unknown thrown value into a human-readable message. */\nexport function describeError(error: unknown): string {\n if (error instanceof Error) return error.message;\n if (typeof error === 'string') return error;\n return 'Something went wrong. Please try again.';\n}\n\nexport { toast };\n"],"mappings":";;AAYA,IAAa,IAAS;CACpB,QAAQ,GAAiB,GAA4B;AACnD,IAAM,QAAQ,GAAS;GAAE;GAAa,UAAU;GAAM,CAAC;;CAEzD,KAAK,GAAiB,GAA4B;AAChD,IAAM,KAAK,GAAS;GAAE;GAAa,UAAU;GAAM,CAAC;;CAEtD,QAAQ,GAAiB,GAA4B;AACnD,IAAM,QAAQ,GAAS;GAAE;GAAa,UAAU;GAAM,CAAC;;CAEzD,MAAM,GAAiB,GAA4B;AACjD,IAAM,MAAM,GAAS;GAAE;GAAa,UAAU;GAAU,aAAa;GAAM,CAAC;;CAE9E,QAAQ,GAA4B;AAClC,IAAM,QAAQ,EAAG;;CAEpB;AAGD,SAAgB,EAAc,GAAwB;AAGpD,QAFI,aAAiB,QAAc,EAAM,UACrC,OAAO,KAAU,WAAiB,IAC/B"}