@burdenoff/microfe-comradecircle 2026.720.1 → 2026.720.2
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.
- package/dist/comradecircle/hooks/useComradeCircleApi.d.ts.map +1 -1
- package/dist/comradecircle/hooks/useComradeCircleApi.js +119 -100
- package/dist/comradecircle/hooks/useComradeCircleApi.js.map +1 -1
- package/dist/comradecircle/utils/pageContext.d.ts +29 -0
- package/dist/comradecircle/utils/pageContext.d.ts.map +1 -0
- package/dist/comradecircle/utils/pageContext.js +48 -0
- package/dist/comradecircle/utils/pageContext.js.map +1 -0
- package/dist/services/createSandboxAssistantTransport.d.ts.map +1 -1
- package/dist/services/createSandboxAssistantTransport.js +6 -4
- package/dist/services/createSandboxAssistantTransport.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useComradeCircleApi.d.ts","sourceRoot":"","sources":["../../../src/comradecircle/hooks/useComradeCircleApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,UAAU,EACV,OAAO,EACP,aAAa,EACb,OAAO,EACP,aAAa,EACb,aAAa,EACb,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,aAAa,EACb,UAAU,EACV,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,
|
|
1
|
+
{"version":3,"file":"useComradeCircleApi.d.ts","sourceRoot":"","sources":["../../../src/comradecircle/hooks/useComradeCircleApi.ts"],"names":[],"mappings":"AAAA;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C;IACxB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAED,eAAO,MAAM,YAAY,GAAI,UAAS,YAAiB,mFAqBtD,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,IAAI,MAAM,GAAG,SAAS,2EAmBjD,CAAC;AAEF,eAAO,MAAM,iBAAiB,wGAgB7B,CAAC;AAEF,eAAO,MAAM,iBAAiB;QAIK,MAAM;WAAS,mBAAmB;WAepE,CAAC;AAEF,eAAO,MAAM,qBAAqB;QAIC,MAAM;YAAU,cAAc;WAehE,CAAC;AAEF,eAAO,MAAM,eAAe;aAIY,MAAM;YAAU,aAAa;WAAS,MAAM,GAAG,IAAI;WAe1F,CAAC;AAMF,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,GAAG,SAAS,EAAE,SAAS,aAAa,qEAgB/E,CAAC;AAEF,eAAO,MAAM,gBAAgB,sGAgB5B,CAAC;AAEF,eAAO,MAAM,eAAe,0FAc3B,CAAC;AAEF,eAAO,MAAM,cAAc;YAIY,MAAM;cAAY,MAAM;eAAa,MAAM;WAejF,CAAC;AAMF,MAAM,WAAW,cAAc;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAED,eAAO,MAAM,cAAc,GAAI,UAAS,cAAmB,qFAkB1D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,UAAU,MAAM,GAAG,SAAS,6EAkBzD,CAAC;AAEF,eAAO,MAAM,mBAAmB,4GAmB/B,CAAC;AAGF,YAAY,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -72,59 +72,78 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
|
|
|
72
72
|
}, l = { limit: 50 }, u = (e) => {
|
|
73
73
|
let t = e ?? l, n = { limit: t.limit ?? l.limit };
|
|
74
74
|
return t.offset != null && (n.offset = t.offset), t.cursor != null && (n.cursor = t.cursor), n;
|
|
75
|
-
}, d = "\n id workspaceId circleId name slug description type visibility position isArchived\n createdAt updatedAt\n", f = "\n id workspaceId name slug description topic tags status visibility memberCount\n avatar { id } createdAt updatedAt\n", p = "id postId memberId type createdAt", m = "\n id workspaceId postId parentId authorId body isHidden createdAt updatedAt\n",
|
|
75
|
+
}, d = "\n id workspaceId circleId name slug description type visibility position isArchived\n createdAt updatedAt\n", f = "\n id workspaceId name slug description topic tags status visibility memberCount\n avatar { id } createdAt updatedAt\n", p = "id postId memberId type createdAt", m = (e) => `items { ${e} } pageInfo { cursor hasMore }`, h = "\n id workspaceId postId parentId authorId body isHidden createdAt updatedAt\n", g = `
|
|
76
76
|
id workspaceId channelId authorId body status tags attachmentFileIds isPinned
|
|
77
|
-
reactionCount commentCount reactions { ${p} } createdAt updatedAt
|
|
78
|
-
`,
|
|
77
|
+
reactionCount commentCount reactions { ${m(p)} } createdAt updatedAt
|
|
78
|
+
`, _ = "id workspaceId pollId label position voteCount createdAt", v = `
|
|
79
79
|
id workspaceId circleId question allowMultiple isAnonymous status closesAt
|
|
80
|
-
options { ${
|
|
81
|
-
`,
|
|
80
|
+
options { ${m(_)} } createdAt updatedAt
|
|
81
|
+
`, y = "\n id workspaceId eventId memberId status note createdAt updatedAt\n", b = "\n id workspaceId circleId hostId title description mode status location joinUrl\n capacity startsAt endsAt tags rsvpCount createdAt updatedAt\n", x = "\n id workspaceId memberId displayName headline bio avatar { id } interests skills\n presence discoverable createdAt updatedAt\n", S = "\n id workspaceId circleId memberId role status joinedAt createdAt updatedAt\n", C = "\n id workspaceId followerId targetId targetType muted createdAt updatedAt\n", w = (e) => e?.items ?? [], T = (e) => ({
|
|
82
|
+
...e,
|
|
83
|
+
channels: w(e.channels),
|
|
84
|
+
memberships: w(e.memberships)
|
|
85
|
+
}), E = (e) => ({
|
|
86
|
+
...e,
|
|
87
|
+
reactions: w(e.reactions),
|
|
88
|
+
comments: w(e.comments)
|
|
89
|
+
}), D = (e) => ({
|
|
90
|
+
...e,
|
|
91
|
+
options: w(e.options)
|
|
92
|
+
}), O = (e) => ({
|
|
93
|
+
...e,
|
|
94
|
+
rsvps: w(e.rsvps)
|
|
95
|
+
}), k = (e, t) => ({
|
|
96
|
+
items: (e.items ?? []).map(t),
|
|
97
|
+
pageInfo: e.pageInfo ?? { hasMore: !1 }
|
|
98
|
+
}), A = (t = {}) => {
|
|
82
99
|
let { apiGatewayUrl: n } = e();
|
|
83
100
|
return r({
|
|
84
101
|
queryKey: [...c.circles, t],
|
|
85
|
-
queryFn: async () => (await s(`query ComListCircles($status: ComCircleStatus, $visibility: ComCircleVisibility, $pagination: PaginationInput) {
|
|
102
|
+
queryFn: async () => k((await s(`query ComListCircles($status: ComCircleStatus, $visibility: ComCircleVisibility, $pagination: PaginationInput) {
|
|
86
103
|
comListCircles(status: $status, visibility: $visibility, pagination: $pagination) {
|
|
87
|
-
|
|
88
|
-
pageInfo { cursor hasMore }
|
|
104
|
+
${m(`${f} channels { ${m("id")} }`)}
|
|
89
105
|
}
|
|
90
106
|
}`, {
|
|
91
107
|
status: t.status,
|
|
92
108
|
visibility: t.visibility,
|
|
93
109
|
pagination: u(t.pagination)
|
|
94
|
-
}, n)).comListCircles
|
|
110
|
+
}, n)).comListCircles, T)
|
|
95
111
|
});
|
|
96
|
-
},
|
|
112
|
+
}, j = (t) => {
|
|
97
113
|
let { apiGatewayUrl: n } = e();
|
|
98
114
|
return r({
|
|
99
115
|
queryKey: c.circle(t ?? ""),
|
|
100
116
|
enabled: !!t,
|
|
101
|
-
queryFn: async () =>
|
|
117
|
+
queryFn: async () => {
|
|
118
|
+
let e = await s(`query ComCircle($id: ID!) {
|
|
102
119
|
comCircle(id: $id) {
|
|
103
120
|
${f}
|
|
104
|
-
channels { ${d} }
|
|
105
|
-
memberships { ${
|
|
121
|
+
channels { ${m(d)} }
|
|
122
|
+
memberships { ${m(S)} }
|
|
106
123
|
}
|
|
107
|
-
}`, { id: t }, n)
|
|
124
|
+
}`, { id: t }, n);
|
|
125
|
+
return e.comCircle ? T(e.comCircle) : null;
|
|
126
|
+
}
|
|
108
127
|
});
|
|
109
|
-
},
|
|
128
|
+
}, M = () => {
|
|
110
129
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
111
130
|
return n({
|
|
112
|
-
mutationFn: async (e) => (await s(`mutation ComCreateCircle($input: ComCreateCircleInput!) {
|
|
131
|
+
mutationFn: async (e) => T((await s(`mutation ComCreateCircle($input: ComCreateCircleInput!) {
|
|
113
132
|
comCreateCircle(input: $input) { ${f} }
|
|
114
|
-
}`, { input: e }, t)).comCreateCircle,
|
|
133
|
+
}`, { input: e }, t)).comCreateCircle),
|
|
115
134
|
onSuccess: () => r.invalidateQueries({ queryKey: c.circles })
|
|
116
135
|
});
|
|
117
|
-
},
|
|
136
|
+
}, N = () => {
|
|
118
137
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
119
138
|
return n({
|
|
120
139
|
mutationFn: async (e) => (await s(`mutation ComJoinCircle($circleId: ID!) {
|
|
121
|
-
comJoinCircle(circleId: $circleId) { ${
|
|
140
|
+
comJoinCircle(circleId: $circleId) { ${S} }
|
|
122
141
|
}`, { circleId: e }, t)).comJoinCircle,
|
|
123
142
|
onSuccess: (e) => {
|
|
124
143
|
r.invalidateQueries({ queryKey: c.circles }), r.invalidateQueries({ queryKey: c.circle(e.circleId) }), r.invalidateQueries({ queryKey: c.memberships });
|
|
125
144
|
}
|
|
126
145
|
});
|
|
127
|
-
},
|
|
146
|
+
}, P = () => {
|
|
128
147
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
129
148
|
return n({
|
|
130
149
|
mutationFn: async (e) => (await s("mutation ComLeaveCircle($circleId: ID!) { comLeaveCircle(circleId: $circleId) }", { circleId: e }, t)).comLeaveCircle,
|
|
@@ -132,11 +151,11 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
|
|
|
132
151
|
r.invalidateQueries({ queryKey: c.circles }), r.invalidateQueries({ queryKey: c.circle(t) }), r.invalidateQueries({ queryKey: c.memberships });
|
|
133
152
|
}
|
|
134
153
|
});
|
|
135
|
-
},
|
|
154
|
+
}, F = () => {
|
|
136
155
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
137
156
|
return n({
|
|
138
157
|
mutationFn: async (e) => (await s(`mutation ComSetMemberRole($membershipId: ID!, $role: ComMemberRole!) {
|
|
139
|
-
comSetMemberRole(membershipId: $membershipId, role: $role) { ${
|
|
158
|
+
comSetMemberRole(membershipId: $membershipId, role: $role) { ${S} }
|
|
140
159
|
}`, {
|
|
141
160
|
membershipId: e.membershipId,
|
|
142
161
|
role: e.role
|
|
@@ -145,13 +164,13 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
|
|
|
145
164
|
r.invalidateQueries({ queryKey: c.circle(e.circleId) }), r.invalidateQueries({ queryKey: c.memberships });
|
|
146
165
|
}
|
|
147
166
|
});
|
|
148
|
-
},
|
|
167
|
+
}, I = (t = {}) => {
|
|
149
168
|
let { apiGatewayUrl: n } = e();
|
|
150
169
|
return r({
|
|
151
170
|
queryKey: [...c.memberships, t],
|
|
152
171
|
queryFn: async () => (await s(`query ComListMemberships($circleId: ID, $status: ComMembershipStatus, $pagination: PaginationInput) {
|
|
153
172
|
comListMemberships(circleId: $circleId, status: $status, pagination: $pagination) {
|
|
154
|
-
items { ${
|
|
173
|
+
items { ${S} }
|
|
155
174
|
pageInfo { cursor hasMore }
|
|
156
175
|
}
|
|
157
176
|
}`, {
|
|
@@ -160,7 +179,7 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
|
|
|
160
179
|
pagination: u(t.pagination)
|
|
161
180
|
}, n)).comListMemberships
|
|
162
181
|
});
|
|
163
|
-
},
|
|
182
|
+
}, L = () => {
|
|
164
183
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
165
184
|
return n({
|
|
166
185
|
mutationFn: async (e) => (await s(`mutation ComCreateChannel($input: ComCreateChannelInput!) {
|
|
@@ -170,7 +189,7 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
|
|
|
170
189
|
r.invalidateQueries({ queryKey: c.channels(e.circleId) }), r.invalidateQueries({ queryKey: c.circle(e.circleId) });
|
|
171
190
|
}
|
|
172
191
|
});
|
|
173
|
-
},
|
|
192
|
+
}, R = (t = {}) => {
|
|
174
193
|
let { apiGatewayUrl: n } = e();
|
|
175
194
|
return r({
|
|
176
195
|
queryKey: [
|
|
@@ -179,49 +198,47 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
|
|
|
179
198
|
t.pagination
|
|
180
199
|
],
|
|
181
200
|
enabled: !!t.channelId,
|
|
182
|
-
queryFn: async () => (await s(`query ComListPosts($channelId: ID, $status: ComPostStatus, $pagination: PaginationInput) {
|
|
201
|
+
queryFn: async () => k((await s(`query ComListPosts($channelId: ID, $status: ComPostStatus, $pagination: PaginationInput) {
|
|
183
202
|
comListPosts(channelId: $channelId, status: $status, pagination: $pagination) {
|
|
184
|
-
|
|
185
|
-
pageInfo { cursor hasMore }
|
|
203
|
+
${m(g)}
|
|
186
204
|
}
|
|
187
205
|
}`, {
|
|
188
206
|
channelId: t.channelId,
|
|
189
207
|
status: t.status,
|
|
190
208
|
pagination: u(t.pagination)
|
|
191
|
-
}, n)).comListPosts
|
|
209
|
+
}, n)).comListPosts, E)
|
|
192
210
|
});
|
|
193
|
-
},
|
|
211
|
+
}, z = (t) => {
|
|
194
212
|
let { apiGatewayUrl: n } = e();
|
|
195
213
|
return r({
|
|
196
214
|
queryKey: [...c.feed, t],
|
|
197
|
-
queryFn: async () => (await s(`query ComMyFeed($pagination: PaginationInput) {
|
|
215
|
+
queryFn: async () => k((await s(`query ComMyFeed($pagination: PaginationInput) {
|
|
198
216
|
comMyFeed(pagination: $pagination) {
|
|
199
|
-
|
|
200
|
-
pageInfo { cursor hasMore }
|
|
217
|
+
${m(g)}
|
|
201
218
|
}
|
|
202
|
-
}`, { pagination: u(t) }, n)).comMyFeed
|
|
219
|
+
}`, { pagination: u(t) }, n)).comMyFeed, E)
|
|
203
220
|
});
|
|
204
|
-
},
|
|
221
|
+
}, B = () => {
|
|
205
222
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
206
223
|
return n({
|
|
207
|
-
mutationFn: async (e) => (await s(`mutation ComCreatePost($input: ComCreatePostInput!) {
|
|
208
|
-
comCreatePost(input: $input) { ${
|
|
209
|
-
}`, { input: e }, t)).comCreatePost,
|
|
224
|
+
mutationFn: async (e) => E((await s(`mutation ComCreatePost($input: ComCreatePostInput!) {
|
|
225
|
+
comCreatePost(input: $input) { ${g} }
|
|
226
|
+
}`, { input: e }, t)).comCreatePost),
|
|
210
227
|
onSuccess: (e) => {
|
|
211
228
|
r.invalidateQueries({ queryKey: c.posts(e.channelId) }), r.invalidateQueries({ queryKey: c.feed });
|
|
212
229
|
}
|
|
213
230
|
});
|
|
214
|
-
},
|
|
231
|
+
}, V = () => {
|
|
215
232
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
216
233
|
return n({
|
|
217
|
-
mutationFn: async (e) => (await s(`mutation ComUpdatePost($id: ID!, $input: ComUpdatePostInput!) {
|
|
218
|
-
comUpdatePost(id: $id, input: $input) { ${
|
|
219
|
-
}`, e, t)).comUpdatePost,
|
|
234
|
+
mutationFn: async (e) => E((await s(`mutation ComUpdatePost($id: ID!, $input: ComUpdatePostInput!) {
|
|
235
|
+
comUpdatePost(id: $id, input: $input) { ${g} }
|
|
236
|
+
}`, e, t)).comUpdatePost),
|
|
220
237
|
onSuccess: (e) => {
|
|
221
238
|
r.invalidateQueries({ queryKey: c.posts(e.channelId) }), r.invalidateQueries({ queryKey: c.post(e.id) }), r.invalidateQueries({ queryKey: c.feed });
|
|
222
239
|
}
|
|
223
240
|
});
|
|
224
|
-
},
|
|
241
|
+
}, H = () => {
|
|
225
242
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
226
243
|
return n({
|
|
227
244
|
mutationFn: async (e) => (await s("mutation ComRemovePost($id: ID!) { comRemovePost(id: $id) }", { id: e.id }, t)).comRemovePost,
|
|
@@ -229,54 +246,54 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
|
|
|
229
246
|
t.channelId && r.invalidateQueries({ queryKey: c.posts(t.channelId) }), r.invalidateQueries({ queryKey: c.feed });
|
|
230
247
|
}
|
|
231
248
|
});
|
|
232
|
-
},
|
|
249
|
+
}, U = () => {
|
|
233
250
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
234
251
|
return n({
|
|
235
|
-
mutationFn: async (e) => (await s(`mutation ComReactToPost($postId: ID!, $type: ComReactionType!) {
|
|
236
|
-
comReactToPost(postId: $postId, type: $type) { ${
|
|
237
|
-
}`, e, t)).comReactToPost,
|
|
252
|
+
mutationFn: async (e) => E((await s(`mutation ComReactToPost($postId: ID!, $type: ComReactionType!) {
|
|
253
|
+
comReactToPost(postId: $postId, type: $type) { ${g} }
|
|
254
|
+
}`, e, t)).comReactToPost),
|
|
238
255
|
onSuccess: (e) => {
|
|
239
256
|
r.invalidateQueries({ queryKey: c.posts(e.channelId) }), r.invalidateQueries({ queryKey: c.post(e.id) }), r.invalidateQueries({ queryKey: c.feed });
|
|
240
257
|
}
|
|
241
258
|
});
|
|
242
|
-
},
|
|
259
|
+
}, ee = (t) => {
|
|
243
260
|
let { apiGatewayUrl: n } = e();
|
|
244
261
|
return r({
|
|
245
262
|
queryKey: c.comments(t ?? ""),
|
|
246
263
|
enabled: !!t,
|
|
247
|
-
queryFn: async () => (await s(`query ComListComments($postId: ID!) {
|
|
248
|
-
comListComments(postId: $postId) { ${m} }
|
|
249
|
-
}`, { postId: t }, n)).comListComments
|
|
264
|
+
queryFn: async () => w((await s(`query ComListComments($postId: ID!) {
|
|
265
|
+
comListComments(postId: $postId) { ${m(h)} }
|
|
266
|
+
}`, { postId: t }, n)).comListComments)
|
|
250
267
|
});
|
|
251
|
-
},
|
|
268
|
+
}, W = () => {
|
|
252
269
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
253
270
|
return n({
|
|
254
271
|
mutationFn: async (e) => (await s(`mutation ComAddComment($input: ComCreateCommentInput!) {
|
|
255
|
-
comAddComment(input: $input) { ${
|
|
272
|
+
comAddComment(input: $input) { ${h} }
|
|
256
273
|
}`, { input: e }, t)).comAddComment,
|
|
257
274
|
onSuccess: (e) => {
|
|
258
275
|
r.invalidateQueries({ queryKey: c.comments(e.postId) }), r.invalidateQueries({ queryKey: c.post(e.postId) }), r.invalidateQueries({ queryKey: c.feed });
|
|
259
276
|
}
|
|
260
277
|
});
|
|
261
|
-
},
|
|
278
|
+
}, G = (t) => {
|
|
262
279
|
let { apiGatewayUrl: n } = e();
|
|
263
280
|
return r({
|
|
264
281
|
queryKey: [...c.follows, t ?? "all"],
|
|
265
|
-
queryFn: async () => (await s(`query ComMyFollows($targetType: ComFollowTargetType) {
|
|
266
|
-
comMyFollows(targetType: $targetType) { ${
|
|
267
|
-
}`, { targetType: t }, n)).comMyFollows
|
|
282
|
+
queryFn: async () => w((await s(`query ComMyFollows($targetType: ComFollowTargetType) {
|
|
283
|
+
comMyFollows(targetType: $targetType) { ${m(C)} }
|
|
284
|
+
}`, { targetType: t }, n)).comMyFollows)
|
|
268
285
|
});
|
|
269
|
-
},
|
|
286
|
+
}, K = () => {
|
|
270
287
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
271
288
|
return n({
|
|
272
289
|
mutationFn: async (e) => (await s(`mutation ComFollow($input: ComFollowInput!) {
|
|
273
|
-
comFollow(input: $input) { ${
|
|
290
|
+
comFollow(input: $input) { ${C} }
|
|
274
291
|
}`, { input: e }, t)).comFollow,
|
|
275
292
|
onSuccess: () => {
|
|
276
293
|
r.invalidateQueries({ queryKey: c.follows }), r.invalidateQueries({ queryKey: c.feed });
|
|
277
294
|
}
|
|
278
295
|
});
|
|
279
|
-
},
|
|
296
|
+
}, q = () => {
|
|
280
297
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
281
298
|
return n({
|
|
282
299
|
mutationFn: async (e) => (await s("mutation ComUnfollow($input: ComFollowInput!) { comUnfollow(input: $input) }", { input: e }, t)).comUnfollow,
|
|
@@ -284,92 +301,94 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
|
|
|
284
301
|
r.invalidateQueries({ queryKey: c.follows }), r.invalidateQueries({ queryKey: c.feed });
|
|
285
302
|
}
|
|
286
303
|
});
|
|
287
|
-
},
|
|
304
|
+
}, J = (t = {}) => {
|
|
288
305
|
let { apiGatewayUrl: n } = e();
|
|
289
306
|
return r({
|
|
290
307
|
queryKey: [...c.events, t],
|
|
291
|
-
queryFn: async () => (await s(`query ComListEvents($circleId: ID, $status: ComEventStatus, $pagination: PaginationInput) {
|
|
308
|
+
queryFn: async () => k((await s(`query ComListEvents($circleId: ID, $status: ComEventStatus, $pagination: PaginationInput) {
|
|
292
309
|
comListEvents(circleId: $circleId, status: $status, pagination: $pagination) {
|
|
293
|
-
|
|
294
|
-
pageInfo { cursor hasMore }
|
|
310
|
+
${m(b)}
|
|
295
311
|
}
|
|
296
312
|
}`, {
|
|
297
313
|
circleId: t.circleId,
|
|
298
314
|
status: t.status,
|
|
299
315
|
pagination: u(t.pagination)
|
|
300
|
-
}, n)).comListEvents
|
|
316
|
+
}, n)).comListEvents, O)
|
|
301
317
|
});
|
|
302
|
-
},
|
|
318
|
+
}, Y = (t) => {
|
|
303
319
|
let { apiGatewayUrl: n } = e();
|
|
304
320
|
return r({
|
|
305
321
|
queryKey: c.event(t ?? ""),
|
|
306
322
|
enabled: !!t,
|
|
307
|
-
queryFn: async () =>
|
|
323
|
+
queryFn: async () => {
|
|
324
|
+
let e = await s(`query ComEvent($id: ID!) {
|
|
308
325
|
comEvent(id: $id) {
|
|
309
|
-
${
|
|
310
|
-
rsvps { ${
|
|
326
|
+
${b}
|
|
327
|
+
rsvps { ${m(y)} }
|
|
311
328
|
}
|
|
312
|
-
}`, { id: t }, n)
|
|
329
|
+
}`, { id: t }, n);
|
|
330
|
+
return e.comEvent ? O(e.comEvent) : null;
|
|
331
|
+
}
|
|
313
332
|
});
|
|
314
|
-
},
|
|
333
|
+
}, X = () => {
|
|
315
334
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
316
335
|
return n({
|
|
317
|
-
mutationFn: async (e) => (await s(`mutation ComCreateEvent($input: ComCreateEventInput!) {
|
|
318
|
-
comCreateEvent(input: $input) { ${
|
|
319
|
-
}`, { input: e }, t)).comCreateEvent,
|
|
336
|
+
mutationFn: async (e) => O((await s(`mutation ComCreateEvent($input: ComCreateEventInput!) {
|
|
337
|
+
comCreateEvent(input: $input) { ${b} }
|
|
338
|
+
}`, { input: e }, t)).comCreateEvent),
|
|
320
339
|
onSuccess: () => r.invalidateQueries({ queryKey: c.events })
|
|
321
340
|
});
|
|
322
|
-
},
|
|
341
|
+
}, Z = () => {
|
|
323
342
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
324
343
|
return n({
|
|
325
|
-
mutationFn: async (e) => (await s(`mutation ComTransitionEvent($id: ID!, $status: ComEventStatus!) {
|
|
326
|
-
comTransitionEvent(id: $id, status: $status) { ${
|
|
327
|
-
}`, e, t)).comTransitionEvent,
|
|
344
|
+
mutationFn: async (e) => O((await s(`mutation ComTransitionEvent($id: ID!, $status: ComEventStatus!) {
|
|
345
|
+
comTransitionEvent(id: $id, status: $status) { ${b} }
|
|
346
|
+
}`, e, t)).comTransitionEvent),
|
|
328
347
|
onSuccess: (e) => {
|
|
329
348
|
r.invalidateQueries({ queryKey: c.events }), r.invalidateQueries({ queryKey: c.event(e.id) });
|
|
330
349
|
}
|
|
331
350
|
});
|
|
332
|
-
},
|
|
351
|
+
}, Q = () => {
|
|
333
352
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
334
353
|
return n({
|
|
335
354
|
mutationFn: async (e) => (await s(`mutation ComRsvpEvent($eventId: ID!, $status: ComRsvpStatus!, $note: String) {
|
|
336
|
-
comRsvpEvent(eventId: $eventId, status: $status, note: $note) { ${
|
|
355
|
+
comRsvpEvent(eventId: $eventId, status: $status, note: $note) { ${y} }
|
|
337
356
|
}`, e, t)).comRsvpEvent,
|
|
338
357
|
onSuccess: (e) => {
|
|
339
358
|
r.invalidateQueries({ queryKey: c.events }), r.invalidateQueries({ queryKey: c.event(e.eventId) });
|
|
340
359
|
}
|
|
341
360
|
});
|
|
342
|
-
},
|
|
361
|
+
}, $ = (t, n) => {
|
|
343
362
|
let { apiGatewayUrl: i } = e();
|
|
344
363
|
return r({
|
|
345
364
|
queryKey: [...c.polls(t ?? ""), n ?? "all"],
|
|
346
365
|
enabled: !!t,
|
|
347
|
-
queryFn: async () => (await s(`query ComListPolls($circleId: ID!, $status: ComPollStatus) {
|
|
348
|
-
comListPolls(circleId: $circleId, status: $status) { ${
|
|
366
|
+
queryFn: async () => w((await s(`query ComListPolls($circleId: ID!, $status: ComPollStatus) {
|
|
367
|
+
comListPolls(circleId: $circleId, status: $status) { ${m(v)} }
|
|
349
368
|
}`, {
|
|
350
369
|
circleId: t,
|
|
351
370
|
status: n
|
|
352
|
-
}, i)).comListPolls
|
|
371
|
+
}, i)).comListPolls).map(D)
|
|
353
372
|
});
|
|
354
|
-
},
|
|
373
|
+
}, te = () => {
|
|
355
374
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
356
375
|
return n({
|
|
357
|
-
mutationFn: async (e) => (await s(`mutation ComCreatePoll($input: ComCreatePollInput!) {
|
|
358
|
-
comCreatePoll(input: $input) { ${
|
|
359
|
-
}`, { input: e }, t)).comCreatePoll,
|
|
376
|
+
mutationFn: async (e) => D((await s(`mutation ComCreatePoll($input: ComCreatePollInput!) {
|
|
377
|
+
comCreatePoll(input: $input) { ${v} }
|
|
378
|
+
}`, { input: e }, t)).comCreatePoll),
|
|
360
379
|
onSuccess: (e) => r.invalidateQueries({ queryKey: c.polls(e.circleId) })
|
|
361
380
|
});
|
|
362
|
-
},
|
|
381
|
+
}, ne = () => {
|
|
363
382
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
364
383
|
return n({
|
|
365
|
-
mutationFn: async (e) => (await s(`mutation ComClosePoll($id: ID!) { comClosePoll(id: $id) { ${
|
|
384
|
+
mutationFn: async (e) => D((await s(`mutation ComClosePoll($id: ID!) { comClosePoll(id: $id) { ${v} } }`, { id: e }, t)).comClosePoll),
|
|
366
385
|
onSuccess: (e) => r.invalidateQueries({ queryKey: c.polls(e.circleId) })
|
|
367
386
|
});
|
|
368
|
-
},
|
|
387
|
+
}, re = () => {
|
|
369
388
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
370
389
|
return n({
|
|
371
390
|
mutationFn: async (e) => (await s(`mutation ComVotePoll($pollId: ID!, $optionId: ID!) {
|
|
372
|
-
comVotePoll(pollId: $pollId, optionId: $optionId) { ${
|
|
391
|
+
comVotePoll(pollId: $pollId, optionId: $optionId) { ${_} }
|
|
373
392
|
}`, {
|
|
374
393
|
pollId: e.pollId,
|
|
375
394
|
optionId: e.optionId
|
|
@@ -378,13 +397,13 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
|
|
|
378
397
|
t.circleId && r.invalidateQueries({ queryKey: c.polls(t.circleId) }), r.invalidateQueries({ queryKey: c.poll(t.pollId) });
|
|
379
398
|
}
|
|
380
399
|
});
|
|
381
|
-
},
|
|
400
|
+
}, ie = (t = {}) => {
|
|
382
401
|
let { apiGatewayUrl: n } = e();
|
|
383
402
|
return r({
|
|
384
403
|
queryKey: [...c.profiles, t],
|
|
385
404
|
queryFn: async () => (await s(`query ComListProfiles($discoverable: Boolean, $pagination: PaginationInput) {
|
|
386
405
|
comListProfiles(discoverable: $discoverable, pagination: $pagination) {
|
|
387
|
-
items { ${
|
|
406
|
+
items { ${x} }
|
|
388
407
|
pageInfo { cursor hasMore }
|
|
389
408
|
}
|
|
390
409
|
}`, {
|
|
@@ -392,21 +411,21 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
|
|
|
392
411
|
pagination: u(t.pagination)
|
|
393
412
|
}, n)).comListProfiles
|
|
394
413
|
});
|
|
395
|
-
},
|
|
414
|
+
}, ae = (t) => {
|
|
396
415
|
let { apiGatewayUrl: n } = e();
|
|
397
416
|
return r({
|
|
398
417
|
queryKey: c.profile(t ?? ""),
|
|
399
418
|
enabled: !!t,
|
|
400
419
|
staleTime: 600 * 1e3,
|
|
401
420
|
queryFn: async () => (await s(`query ComProfile($memberId: ID!) {
|
|
402
|
-
comProfile(memberId: $memberId) { ${
|
|
421
|
+
comProfile(memberId: $memberId) { ${x} }
|
|
403
422
|
}`, { memberId: t }, n)).comProfile
|
|
404
423
|
});
|
|
405
|
-
},
|
|
424
|
+
}, oe = () => {
|
|
406
425
|
let { apiGatewayUrl: t } = e(), r = i();
|
|
407
426
|
return n({
|
|
408
427
|
mutationFn: async (e) => (await s(`mutation ComUpsertProfile($input: ComUpsertProfileInput!) {
|
|
409
|
-
comUpsertProfile(input: $input) { ${
|
|
428
|
+
comUpsertProfile(input: $input) { ${x} }
|
|
410
429
|
}`, { input: e }, t)).comUpsertProfile,
|
|
411
430
|
onSuccess: (e) => {
|
|
412
431
|
r.invalidateQueries({ queryKey: c.profiles }), r.invalidateQueries({ queryKey: c.profile(e.memberId) });
|
|
@@ -414,6 +433,6 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
|
|
|
414
433
|
});
|
|
415
434
|
};
|
|
416
435
|
//#endregion
|
|
417
|
-
export {
|
|
436
|
+
export { W as useComAddComment, j as useComCircle, A as useComCircles, ne as useComClosePoll, ee as useComComments, L as useComCreateChannel, M as useComCreateCircle, X as useComCreateEvent, te as useComCreatePoll, B as useComCreatePost, Y as useComEvent, J as useComEvents, K as useComFollow, N as useComJoinCircle, P as useComLeaveCircle, I as useComMemberships, z as useComMyFeed, G as useComMyFollows, $ as useComPolls, R as useComPosts, ae as useComProfile, ie as useComProfiles, U as useComReactToPost, H as useComRemovePost, Q as useComRsvpEvent, F as useComSetMemberRole, Z as useComTransitionEvent, q as useComUnfollow, V as useComUpdatePost, oe as useComUpsertProfile, re as useComVotePoll };
|
|
418
437
|
|
|
419
438
|
//# sourceMappingURL=useComradeCircleApi.js.map
|
|
@@ -1 +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 { clearGraphqlResponseCache } from '../lib/graphql-cache';\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 isMutation = (query: string): boolean => /^\\s*mutation\\b/.test(query);\n\nconst comQuery = async <TData>(\n query: string,\n variables: Record<string, unknown>,\n baseUrl?: string\n): Promise<TData> => {\n // A mutation's own request must never be served from (or coalesced onto) the\n // read cache, and the resolved read cache must be dropped once it commits so\n // the React-Query refetch that follows sees the new state — not a stale\n // pre-write response held for up to 15s. Clear before AND after the write.\n const mutating = isMutation(query);\n if (mutating) clearGraphqlResponseCache();\n\n const response = await graphqlFetch<TData>({\n gateway: 'workspace',\n baseUrl,\n query,\n variables,\n workspaceToken: true,\n });\n\n if (mutating) clearGraphqlResponseCache();\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} channels { id } }\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":";;;;;;AAiEA,IAAM,KAAc,MAA2B,iBAAiB,KAAK,CAAK,GAEpE,IAAW,OACf,GACA,GACA,MACmB;CAKnB,IAAM,IAAW,EAAW,CAAK;CACjC,AAAI,KAAU,EAA0B;CAExC,IAAM,IAAW,MAAM,EAAoB;EACzC,SAAS;EACT;EACA;EACA;EACA,gBAAgB;CAClB,CAAC;CAID,IAFI,KAAU,EAA0B,GAEpC,EAAS,QAAQ,QACnB,MAAU,MAAM,EAAS,OAAO,IAAI,WAAW,wBAAwB;CAEzE,IAAI,CAAC,EAAS,MACZ,MAAU,MAAM,uCAAuC;CAEzD,OAAO,EAAS;AAClB,GAGM,IAAM;CACV,SAAS,CAAC,iBAAiB,SAAS;CACpC,SAAS,MAAe;EAAC;EAAiB;EAAU;CAAE;CACtD,WAAW,MAAqB;EAAC;EAAiB;EAAY;CAAQ;CACtE,QAAQ,MAAsB;EAAC;EAAiB;EAAS;CAAS;CAClE,OAAO,MAAe;EAAC;EAAiB;EAAQ;CAAE;CAClD,WAAW,MAAmB;EAAC;EAAiB;EAAY;CAAM;CAClE,MAAM,CAAC,iBAAiB,MAAM;CAC9B,SAAS,CAAC,iBAAiB,SAAS;CACpC,QAAQ,CAAC,iBAAiB,QAAQ;CAClC,QAAQ,MAAe;EAAC;EAAiB;EAAS;CAAE;CACpD,QAAQ,MAAqB;EAAC;EAAiB;EAAS;CAAQ;CAChE,OAAO,MAAe;EAAC;EAAiB;EAAQ;CAAE;CAClD,UAAU,CAAC,iBAAiB,UAAU;CACtC,UAAU,MAAqB;EAAC;EAAiB;EAAW;CAAQ;CACpE,aAAa,CAAC,iBAAiB,aAAa;AAC9C,GAEM,IAAgC,EAAE,OAAO,GAAG,GAG5C,KAAQ,MAAyC;CACrD,IAAM,IAA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E,UAAU,EAAI,QAAQ,EAAK,QAAQ,EAAE,CAAC;EAC/D;CACF,CAAC;AACH"}
|
|
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 { clearGraphqlResponseCache } from '../lib/graphql-cache';\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 ComPageInfo,\n PaginationInput,\n} from '../types';\n\n// ============================================================================\n// Transport\n// ============================================================================\n\nconst isMutation = (query: string): boolean => /^\\s*mutation\\b/.test(query);\n\nconst comQuery = async <TData>(\n query: string,\n variables: Record<string, unknown>,\n baseUrl?: string\n): Promise<TData> => {\n // A mutation's own request must never be served from (or coalesced onto) the\n // read cache, and the resolved read cache must be dropped once it commits so\n // the React-Query refetch that follows sees the new state — not a stale\n // pre-write response held for up to 15s. Clear before AND after the write.\n const mutating = isMutation(query);\n if (mutating) clearGraphqlResponseCache();\n\n const response = await graphqlFetch<TData>({\n gateway: 'workspace',\n baseUrl,\n query,\n variables,\n workspaceToken: true,\n });\n\n if (mutating) clearGraphqlResponseCache();\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\n/**\n * Every collection on the svc schema — root list fields AND nested fields such\n * as `ComPost.reactions` / `ComPoll.options` — returns a `Com*Connection`\n * (`{ items, pageInfo }`), never a bare list. Selecting scalars directly on a\n * connection is a hard `GRAPHQL_VALIDATION_FAILED` at the gateway, so every\n * collection selection is built through this helper.\n */\nconst conn = (fields: string): string => `items { ${fields} } pageInfo { cursor hasMore }`;\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 { ${conn(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 { ${conn(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// Wire -> domain normalisation\n// ----------------------------------------------------------------------------\n// The transport shape (`Com*Connection`) and the shape components consume (flat\n// arrays) differ deliberately: pagination belongs to the transport, not to the\n// render tree. Every hook therefore unwraps connections here, once, so no\n// component ever has to know about `items`/`pageInfo`.\n// ============================================================================\n\n/** A `Com*Connection` as it arrives over the wire. */\ninterface WireConnection<T> {\n items: T[];\n pageInfo?: ComPageInfo;\n}\n\n/** Nested connections are optional on the wire: a selection may omit them. */\ntype WireNested<T> = WireConnection<T> | null | undefined;\n\nconst unwrap = <T>(value: WireNested<T>): T[] => value?.items ?? [];\n\ntype ComCircleWire = Omit<ComCircle, 'channels' | 'memberships'> & {\n channels?: WireNested<ComChannel>;\n memberships?: WireNested<ComMembership>;\n};\n\ntype ComPostWire = Omit<ComPost, 'reactions' | 'comments'> & {\n reactions?: WireNested<ComReaction>;\n comments?: WireNested<ComComment>;\n};\n\ntype ComPollWire = Omit<ComPoll, 'options'> & { options?: WireNested<ComPollOption> };\n\ntype ComEventWire = Omit<ComEvent, 'rsvps'> & { rsvps?: WireNested<ComEventRsvp> };\n\nconst toCircle = (wire: ComCircleWire): ComCircle => ({\n ...wire,\n channels: unwrap(wire.channels),\n memberships: unwrap(wire.memberships),\n});\n\nconst toPost = (wire: ComPostWire): ComPost => ({\n ...wire,\n reactions: unwrap(wire.reactions),\n comments: unwrap(wire.comments),\n});\n\nconst toPoll = (wire: ComPollWire): ComPoll => ({ ...wire, options: unwrap(wire.options) });\n\nconst toEvent = (wire: ComEventWire): ComEvent => ({ ...wire, rsvps: unwrap(wire.rsvps) });\n\n/** Map a wire connection onto the domain connection components consume. */\nconst toConnection = <TWire, TDomain>(\n wire: WireConnection<TWire>,\n map: (item: TWire) => TDomain\n): ComConnection<TDomain> => ({\n items: (wire.items ?? []).map(map),\n pageInfo: wire.pageInfo ?? { hasMore: false },\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: WireConnection<ComCircleWire> }>(\n `query ComListCircles($status: ComCircleStatus, $visibility: ComCircleVisibility, $pagination: PaginationInput) {\n comListCircles(status: $status, visibility: $visibility, pagination: $pagination) {\n ${conn(`${CIRCLE_FIELDS} channels { ${conn('id')} }`)}\n }\n }`,\n {\n status: filters.status,\n visibility: filters.visibility,\n pagination: page(filters.pagination),\n },\n apiGatewayUrl\n );\n return toConnection(result.comListCircles, toCircle);\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: ComCircleWire | null }>(\n `query ComCircle($id: ID!) {\n comCircle(id: $id) {\n ${CIRCLE_FIELDS}\n channels { ${conn(CHANNEL_FIELDS)} }\n memberships { ${conn(MEMBERSHIP_FIELDS)} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.comCircle ? toCircle(result.comCircle) : null;\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: ComCircleWire }>(\n `mutation ComCreateCircle($input: ComCreateCircleInput!) {\n comCreateCircle(input: $input) { ${CIRCLE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return toCircle(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: ComCircleWire }>(\n `mutation ComUpdateCircle($id: ID!, $input: ComUpdateCircleInput!) {\n comUpdateCircle(id: $id, input: $input) { ${CIRCLE_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return toCircle(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: WireConnection<ComChannel> }>(\n `query ComListChannels($circleId: ID!) {\n comListChannels(circleId: $circleId) { ${conn(CHANNEL_FIELDS)} }\n }`,\n { circleId },\n apiGatewayUrl\n );\n return unwrap(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: WireConnection<ComPostWire> }>(\n `query ComListPosts($channelId: ID, $status: ComPostStatus, $pagination: PaginationInput) {\n comListPosts(channelId: $channelId, status: $status, pagination: $pagination) {\n ${conn(POST_FIELDS)}\n }\n }`,\n {\n channelId: filters.channelId,\n status: filters.status,\n pagination: page(filters.pagination),\n },\n apiGatewayUrl\n );\n return toConnection(result.comListPosts, toPost);\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: ComPostWire | null }>(\n `query ComPost($id: ID!) {\n comPost(id: $id) {\n ${POST_FIELDS}\n comments { ${conn(COMMENT_FIELDS)} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.comPost ? toPost(result.comPost) : null;\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: WireConnection<ComPostWire> }>(\n `query ComMyFeed($pagination: PaginationInput) {\n comMyFeed(pagination: $pagination) {\n ${conn(POST_FIELDS)}\n }\n }`,\n { pagination: page(pagination) },\n apiGatewayUrl\n );\n return toConnection(result.comMyFeed, toPost);\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: ComPostWire }>(\n `mutation ComCreatePost($input: ComCreatePostInput!) {\n comCreatePost(input: $input) { ${POST_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return toPost(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: ComPostWire }>(\n `mutation ComUpdatePost($id: ID!, $input: ComUpdatePostInput!) {\n comUpdatePost(id: $id, input: $input) { ${POST_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return toPost(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: ComPostWire }>(\n `mutation ComReactToPost($postId: ID!, $type: ComReactionType!) {\n comReactToPost(postId: $postId, type: $type) { ${POST_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return toPost(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: WireConnection<ComComment> }>(\n `query ComListComments($postId: ID!) {\n comListComments(postId: $postId) { ${conn(COMMENT_FIELDS)} }\n }`,\n { postId },\n apiGatewayUrl\n );\n return unwrap(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: WireConnection<ComFeedFollow> }>(\n `query ComMyFollows($targetType: ComFollowTargetType) {\n comMyFollows(targetType: $targetType) { ${conn(FOLLOW_FIELDS)} }\n }`,\n { targetType },\n apiGatewayUrl\n );\n return unwrap(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: WireConnection<ComEventWire> }>(\n `query ComListEvents($circleId: ID, $status: ComEventStatus, $pagination: PaginationInput) {\n comListEvents(circleId: $circleId, status: $status, pagination: $pagination) {\n ${conn(EVENT_FIELDS)}\n }\n }`,\n {\n circleId: filters.circleId,\n status: filters.status,\n pagination: page(filters.pagination),\n },\n apiGatewayUrl\n );\n return toConnection(result.comListEvents, toEvent);\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: ComEventWire | null }>(\n `query ComEvent($id: ID!) {\n comEvent(id: $id) {\n ${EVENT_FIELDS}\n rsvps { ${conn(RSVP_FIELDS)} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.comEvent ? toEvent(result.comEvent) : null;\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: ComEventWire }>(\n `mutation ComCreateEvent($input: ComCreateEventInput!) {\n comCreateEvent(input: $input) { ${EVENT_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return toEvent(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: ComEventWire }>(\n `mutation ComUpdateEvent($id: ID!, $input: ComUpdateEventInput!) {\n comUpdateEvent(id: $id, input: $input) { ${EVENT_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return toEvent(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: ComEventWire }>(\n `mutation ComTransitionEvent($id: ID!, $status: ComEventStatus!) {\n comTransitionEvent(id: $id, status: $status) { ${EVENT_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return toEvent(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: WireConnection<ComPollWire> }>(\n `query ComListPolls($circleId: ID!, $status: ComPollStatus) {\n comListPolls(circleId: $circleId, status: $status) { ${conn(POLL_FIELDS)} }\n }`,\n { circleId, status },\n apiGatewayUrl\n );\n return unwrap(result.comListPolls).map(toPoll);\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: ComPollWire }>(\n `mutation ComCreatePoll($input: ComCreatePollInput!) {\n comCreatePoll(input: $input) { ${POLL_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return toPoll(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: ComPollWire }>(\n `mutation ComClosePoll($id: ID!) { comClosePoll(id: $id) { ${POLL_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return toPoll(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":";;;;;;AAkEA,IAAM,KAAc,MAA2B,iBAAiB,KAAK,CAAK,GAEpE,IAAW,OACf,GACA,GACA,MACmB;CAKnB,IAAM,IAAW,EAAW,CAAK;CACjC,AAAI,KAAU,EAA0B;CAExC,IAAM,IAAW,MAAM,EAAoB;EACzC,SAAS;EACT;EACA;EACA;EACA,gBAAgB;CAClB,CAAC;CAID,IAFI,KAAU,EAA0B,GAEpC,EAAS,QAAQ,QACnB,MAAU,MAAM,EAAS,OAAO,IAAI,WAAW,wBAAwB;CAEzE,IAAI,CAAC,EAAS,MACZ,MAAU,MAAM,uCAAuC;CAEzD,OAAO,EAAS;AAClB,GAGM,IAAM;CACV,SAAS,CAAC,iBAAiB,SAAS;CACpC,SAAS,MAAe;EAAC;EAAiB;EAAU;CAAE;CACtD,WAAW,MAAqB;EAAC;EAAiB;EAAY;CAAQ;CACtE,QAAQ,MAAsB;EAAC;EAAiB;EAAS;CAAS;CAClE,OAAO,MAAe;EAAC;EAAiB;EAAQ;CAAE;CAClD,WA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Ae;YAErD,EAAE,YAAS,GACX,CACF,GACc;CAElB,CAAC;AACH,GAEa,WAA4B;CACvC,IAAM,EAAE,qBAAkB,EAAiB,GACrC,IAAK,EAAe;CAC1B,OAAO,EAAY;EACjB,YAAY,OAAO,OAQV,MAPc,EACnB;8CACsC,EAAe;YAErD,EAAE,SAAM,GACR,CACF,GACc;EAEhB,YAAY,MAAS;GAEnB,AADA,EAAG,kBAAkB,EAAE,UAAU,EAAI,SAAS,CAAC,GAC/C,EAAG,kBAAkB,EAAE,UAAU,EAAI,QAAQ,EAAK,QAAQ,EAAE,CAAC;EAC/D;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Page context gathering — captures the user's current browser context to be
|
|
3
|
+
* sent alongside every assistant prompt for better AI awareness (BOFF-3707).
|
|
4
|
+
*
|
|
5
|
+
* Modeled on microfe-vibecontrols/src/utils/pageContext.ts.
|
|
6
|
+
*/
|
|
7
|
+
interface ConversationContextShape {
|
|
8
|
+
entityType?: string;
|
|
9
|
+
entityId?: string;
|
|
10
|
+
activeTab?: string;
|
|
11
|
+
metadata?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export interface PageContext {
|
|
14
|
+
currentUrl: string;
|
|
15
|
+
currentPage: string;
|
|
16
|
+
entityType?: string;
|
|
17
|
+
entityId?: string;
|
|
18
|
+
platform: string;
|
|
19
|
+
version: string;
|
|
20
|
+
viewportSize: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function gatherPageContext(): PageContext;
|
|
23
|
+
/**
|
|
24
|
+
* Route -> entity table. `/comradecircle/*` is the app-shell mount point;
|
|
25
|
+
* paths below are relative to it (see ComradeCircleRoutes.tsx).
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveComradeCircleConversationContext(pathname: string, search: string): ConversationContextShape;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=pageContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageContext.d.ts","sourceRoot":"","sources":["../../../src/comradecircle/utils/pageContext.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,UAAU,wBAAwB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,WAAW;IAG1B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IAGpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,iBAAiB,IAAI,WAAW,CAkB/C;AAMD;;;GAGG;AACH,wBAAgB,uCAAuC,CACrD,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,wBAAwB,CAgD1B"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region src/comradecircle/utils/pageContext.ts
|
|
2
|
+
function e() {
|
|
3
|
+
let e = window.location.href, t = window.location.pathname.split("/").filter(Boolean).slice(0, 3).join("/") || "home", r = n(window.location.pathname, window.location.search);
|
|
4
|
+
return {
|
|
5
|
+
currentUrl: e,
|
|
6
|
+
currentPage: t,
|
|
7
|
+
entityType: r.entityType,
|
|
8
|
+
entityId: r.entityId,
|
|
9
|
+
platform: "comradecircle",
|
|
10
|
+
version: "2026.720.1",
|
|
11
|
+
viewportSize: `${window.innerWidth}x${window.innerHeight}`
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function t(e, t) {
|
|
15
|
+
return t.match(e);
|
|
16
|
+
}
|
|
17
|
+
function n(e, n) {
|
|
18
|
+
let r = new URLSearchParams(n);
|
|
19
|
+
for (let [n, r] of [
|
|
20
|
+
[/^\/comradecircle\/circles\/([^/]+)$/, "COMRADECIRCLE_CIRCLE"],
|
|
21
|
+
[/^\/comradecircle\/events\/([^/]+)$/, "COMRADECIRCLE_EVENT"],
|
|
22
|
+
[/^\/comradecircle\/members\/([^/]+)$/, "COMRADECIRCLE_MEMBER"]
|
|
23
|
+
]) {
|
|
24
|
+
let i = t(n, e);
|
|
25
|
+
if (i) return {
|
|
26
|
+
entityType: r,
|
|
27
|
+
entityId: i[1],
|
|
28
|
+
metadata: { routePattern: n.source }
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if (/^\/comradecircle\/circles$/.test(e)) return { entityType: "COMRADECIRCLE_CIRCLE_LIST" };
|
|
32
|
+
if (/^\/comradecircle\/events$/.test(e)) return { entityType: "COMRADECIRCLE_EVENT_LIST" };
|
|
33
|
+
if (/^\/comradecircle\/members$/.test(e)) return { entityType: "COMRADECIRCLE_MEMBER_LIST" };
|
|
34
|
+
if (/^\/comradecircle\/profile$/.test(e)) return { entityType: "COMRADECIRCLE_MY_PROFILE" };
|
|
35
|
+
if (/^\/comradecircle\/?$/.test(e)) return { entityType: "COMRADECIRCLE_FEED" };
|
|
36
|
+
let i = r.get("tab") ?? (() => {
|
|
37
|
+
let t = e.split("/").filter(Boolean);
|
|
38
|
+
return t.length > 2 ? t[t.length - 1] : void 0;
|
|
39
|
+
})();
|
|
40
|
+
return {
|
|
41
|
+
activeTab: i ?? void 0,
|
|
42
|
+
metadata: i ? { activeTab: i } : void 0
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { e as gatherPageContext };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=pageContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageContext.js","names":[],"sources":["../../../src/comradecircle/utils/pageContext.ts"],"sourcesContent":["/**\n * Page context gathering — captures the user's current browser context to be\n * sent alongside every assistant prompt for better AI awareness (BOFF-3707).\n *\n * Modeled on microfe-vibecontrols/src/utils/pageContext.ts.\n */\n\ninterface ConversationContextShape {\n entityType?: string;\n entityId?: string;\n activeTab?: string;\n metadata?: Record<string, unknown>;\n}\n\nexport interface PageContext {\n // `currentUrl` (NOT `activeUrl`) — must match the agent's allowed-context-key\n // contract, otherwise the agent filters it out.\n currentUrl: string;\n currentPage: string;\n // The entity the user is currently looking at, resolved from the route. Lets\n // the assistant act on \"this / current / here\" without asking for an id.\n entityType?: string;\n entityId?: string;\n platform: string;\n version: string;\n viewportSize: string;\n}\n\nexport function gatherPageContext(): PageContext {\n const url = window.location.href;\n const pathSegments = window.location.pathname.split('/').filter(Boolean);\n const currentPage = pathSegments.slice(0, 3).join('/') || 'home';\n const entity = resolveComradeCircleConversationContext(\n window.location.pathname,\n window.location.search\n );\n\n return {\n currentUrl: url,\n currentPage,\n entityType: entity.entityType,\n entityId: entity.entityId,\n platform: 'comradecircle',\n version: import.meta.env.VITE_APP_VERSION ?? '2026.720.1',\n viewportSize: `${window.innerWidth}x${window.innerHeight}`,\n };\n}\n\nfunction matchPath(pattern: RegExp, pathname: string): RegExpMatchArray | null {\n return pathname.match(pattern);\n}\n\n/**\n * Route -> entity table. `/comradecircle/*` is the app-shell mount point;\n * paths below are relative to it (see ComradeCircleRoutes.tsx).\n */\nexport function resolveComradeCircleConversationContext(\n pathname: string,\n search: string\n): ConversationContextShape {\n const params = new URLSearchParams(search);\n const directMatches: Array<[RegExp, string]> = [\n [/^\\/comradecircle\\/circles\\/([^/]+)$/, 'COMRADECIRCLE_CIRCLE'],\n [/^\\/comradecircle\\/events\\/([^/]+)$/, 'COMRADECIRCLE_EVENT'],\n [/^\\/comradecircle\\/members\\/([^/]+)$/, 'COMRADECIRCLE_MEMBER'],\n ];\n\n for (const [pattern, entityType] of directMatches) {\n const match = matchPath(pattern, pathname);\n if (match) {\n return {\n entityType,\n entityId: match[1],\n metadata: {\n routePattern: pattern.source,\n },\n };\n }\n }\n\n if (/^\\/comradecircle\\/circles$/.test(pathname)) {\n return { entityType: 'COMRADECIRCLE_CIRCLE_LIST' };\n }\n if (/^\\/comradecircle\\/events$/.test(pathname)) {\n return { entityType: 'COMRADECIRCLE_EVENT_LIST' };\n }\n if (/^\\/comradecircle\\/members$/.test(pathname)) {\n return { entityType: 'COMRADECIRCLE_MEMBER_LIST' };\n }\n if (/^\\/comradecircle\\/profile$/.test(pathname)) {\n return { entityType: 'COMRADECIRCLE_MY_PROFILE' };\n }\n if (/^\\/comradecircle\\/?$/.test(pathname)) {\n return { entityType: 'COMRADECIRCLE_FEED' };\n }\n\n const activeTab =\n params.get('tab') ??\n (() => {\n const segments = pathname.split('/').filter(Boolean);\n return segments.length > 2 ? segments[segments.length - 1] : undefined;\n })();\n\n return {\n activeTab: activeTab ?? undefined,\n metadata: activeTab ? { activeTab } : undefined,\n };\n}\n"],"mappings":";AA4BA,SAAgB,IAAiC;CAC/C,IAAM,IAAM,OAAO,SAAS,MAEtB,IADe,OAAO,SAAS,SAAS,MAAM,GAAG,EAAE,OAAO,OAC5C,EAAa,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,QACpD,IAAS,EACb,OAAO,SAAS,UAChB,OAAO,SAAS,MAClB;CAEA,OAAO;EACL,YAAY;EACZ;EACA,YAAY,EAAO;EACnB,UAAU,EAAO;EACjB,UAAU;EACV,SAA6C;EAC7C,cAAc,GAAG,OAAO,WAAW,GAAG,OAAO;CAC/C;AACF;AAEA,SAAS,EAAU,GAAiB,GAA2C;CAC7E,OAAO,EAAS,MAAM,CAAO;AAC/B;AAMA,SAAgB,EACd,GACA,GAC0B;CAC1B,IAAM,IAAS,IAAI,gBAAgB,CAAM;CAOzC,KAAK,IAAM,CAAC,GAAS,MAAe;EALlC,CAAC,uCAAuC,sBAAsB;EAC9D,CAAC,sCAAsC,qBAAqB;EAC5D,CAAC,uCAAuC,sBAAsB;CAG5B,GAAe;EACjD,IAAM,IAAQ,EAAU,GAAS,CAAQ;EACzC,IAAI,GACF,OAAO;GACL;GACA,UAAU,EAAM;GAChB,UAAU,EACR,cAAc,EAAQ,OACxB;EACF;CAEJ;CAEA,IAAI,6BAA6B,KAAK,CAAQ,GAC5C,OAAO,EAAE,YAAY,4BAA4B;CAEnD,IAAI,4BAA4B,KAAK,CAAQ,GAC3C,OAAO,EAAE,YAAY,2BAA2B;CAElD,IAAI,6BAA6B,KAAK,CAAQ,GAC5C,OAAO,EAAE,YAAY,4BAA4B;CAEnD,IAAI,6BAA6B,KAAK,CAAQ,GAC5C,OAAO,EAAE,YAAY,2BAA2B;CAElD,IAAI,uBAAuB,KAAK,CAAQ,GACtC,OAAO,EAAE,YAAY,qBAAqB;CAG5C,IAAM,IACJ,EAAO,IAAI,KAAK,YACT;EACL,IAAM,IAAW,EAAS,MAAM,GAAG,EAAE,OAAO,OAAO;EACnD,OAAO,EAAS,SAAS,IAAI,EAAS,EAAS,SAAS,KAAK,KAAA;CAC/D,GAAG;CAEL,OAAO;EACL,WAAW,KAAa,KAAA;EACxB,UAAU,IAAY,EAAE,aAAU,IAAI,KAAA;CACxC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSandboxAssistantTransport.d.ts","sourceRoot":"","sources":["../../src/services/createSandboxAssistantTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"createSandboxAssistantTransport.d.ts","sourceRoot":"","sources":["../../src/services/createSandboxAssistantTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnE,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,4BAA4B,IAAI,kBAAkB,CAMjE"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { gatherPageContext as e } from "../comradecircle/utils/pageContext.js";
|
|
2
|
+
import { useSandboxAssistantTransport as t } from "@burdenoff/fe-libs/shared/assistant";
|
|
2
3
|
//#region src/services/createSandboxAssistantTransport.ts
|
|
3
|
-
function
|
|
4
|
-
return
|
|
4
|
+
function n() {
|
|
5
|
+
return t({
|
|
5
6
|
product: "comradecircle",
|
|
7
|
+
gatherPageContext: e,
|
|
6
8
|
enableCredits: !0
|
|
7
9
|
});
|
|
8
10
|
}
|
|
9
11
|
//#endregion
|
|
10
|
-
export {
|
|
12
|
+
export { n as useSandboxAssistantTransport };
|
|
11
13
|
|
|
12
14
|
//# sourceMappingURL=createSandboxAssistantTransport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSandboxAssistantTransport.js","names":[],"sources":["../../src/services/createSandboxAssistantTransport.ts"],"sourcesContent":["/**\n * comradecircle adapter for the shared fe-libs AssistantWidget transport.\n *\n * The sandbox lifecycle + poll/stream loop now lives in\n * `@burdenoff/fe-libs/shared/assistant` (one implementation for all products);\n * this is a thin wrapper. The exported name/shape are unchanged so app-shell\n * imports don't move. The public return type is a LOCALLY-declared structural\n * mirror — never re-export fe-libs types (vite-plugin-dts path rewriting).\n */\n\nimport { useSandboxAssistantTransport as useSharedTransport } from '@burdenoff/fe-libs/shared/assistant';\n\ninterface AssistantSendArgs {\n prompt: string;\n onProgress: (partialText: string) => void;\n signal: AbortSignal;\n}\n\nexport interface AssistantTransport {\n sendPrompt: (args: AssistantSendArgs) => Promise<{ text: string }>;\n prewarm?: (level?: 'probe' | 'full') => void;\n suspend?: () => void;\n}\n\nexport function useSandboxAssistantTransport(): AssistantTransport {\n return useSharedTransport({\n product: 'comradecircle',\n
|
|
1
|
+
{"version":3,"file":"createSandboxAssistantTransport.js","names":[],"sources":["../../src/services/createSandboxAssistantTransport.ts"],"sourcesContent":["/**\n * comradecircle adapter for the shared fe-libs AssistantWidget transport.\n *\n * The sandbox lifecycle + poll/stream loop now lives in\n * `@burdenoff/fe-libs/shared/assistant` (one implementation for all products);\n * this is a thin wrapper. The exported name/shape are unchanged so app-shell\n * imports don't move. The public return type is a LOCALLY-declared structural\n * mirror — never re-export fe-libs types (vite-plugin-dts path rewriting).\n */\n\nimport { useSandboxAssistantTransport as useSharedTransport } from '@burdenoff/fe-libs/shared/assistant';\n\nimport { gatherPageContext } from '../comradecircle/utils/pageContext.js';\n\ninterface AssistantSendArgs {\n prompt: string;\n onProgress: (partialText: string) => void;\n signal: AbortSignal;\n}\n\nexport interface AssistantTransport {\n sendPrompt: (args: AssistantSendArgs) => Promise<{ text: string }>;\n prewarm?: (level?: 'probe' | 'full') => void;\n suspend?: () => void;\n}\n\nexport function useSandboxAssistantTransport(): AssistantTransport {\n return useSharedTransport({\n product: 'comradecircle',\n gatherPageContext,\n enableCredits: true,\n });\n}\n"],"mappings":";;;AA0BA,SAAgB,IAAmD;CACjE,OAAO,EAAmB;EACxB,SAAS;EACT;EACA,eAAe;CACjB,CAAC;AACH"}
|