@kendew-agency/react-feedback-layer 0.4.0-rc.0 → 0.4.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -41,10 +41,9 @@ __export(src_exports, {
41
41
  ResolveSession: () => ResolveSession,
42
42
  StartResolving: () => StartResolving,
43
43
  ToggleOverlayButton: () => ToggleOverlayButton,
44
- UserProvider: () => UserProvider,
44
+ commentReducer: () => commentReducer,
45
45
  useCommentScope: () => useCommentScope,
46
46
  useComments: () => useComments,
47
- useCurrentUser: () => useCurrentUser,
48
47
  useFeedbackSession: () => useFeedbackSession
49
48
  });
50
49
  module.exports = __toCommonJS(src_exports);
@@ -186,28 +185,80 @@ var useCommentEvents = () => {
186
185
 
187
186
  // src/utils/select-visible-comments.ts
188
187
  var normalizeDraftVisibility = (value) => value === "hidden" ? "hidden" : "visible";
188
+ var isLocated = (comment) => typeof comment.locationId === "string" && comment.locationId.length > 0;
189
+ var normalizeLocationId = (value) => typeof value === "string" && value.length > 0 ? value : void 0;
190
+ var applyDraftFilter = (comments, session, draftVisibility, currentUserId) => {
191
+ if (session.status !== "draft" || normalizeDraftVisibility(draftVisibility) !== "hidden") {
192
+ return comments;
193
+ }
194
+ return comments.filter((comment) => {
195
+ if (comment.status === "draft") {
196
+ return true;
197
+ }
198
+ const authorId = comment.user?.id;
199
+ return authorId === void 0 || authorId === currentUserId;
200
+ });
201
+ };
202
+ var selectCommentsByLocation = ({
203
+ comments,
204
+ locationId
205
+ }) => {
206
+ const location = normalizeLocationId(locationId);
207
+ if (location === void 0) {
208
+ return [];
209
+ }
210
+ return comments.filter(
211
+ (comment) => isLocated(comment) && comment.locationId === location
212
+ );
213
+ };
189
214
  var selectVisibleComments = ({
190
215
  comments,
191
216
  session,
217
+ locationId,
192
218
  draftVisibility = "visible",
193
219
  currentUserId
194
220
  }) => {
195
221
  if (session === null) {
196
222
  return [];
197
223
  }
198
- const inSession = comments.filter(
224
+ const inSession = selectCommentsByLocation({ comments, locationId }).filter(
199
225
  (comment) => comment.sessionId === session.id
200
226
  );
201
- if (session.status !== "draft" || normalizeDraftVisibility(draftVisibility) !== "hidden") {
202
- return inSession;
227
+ return applyDraftFilter(inSession, session, draftVisibility, currentUserId);
228
+ };
229
+ var selectCommentsBySession = ({
230
+ comments,
231
+ locationId,
232
+ session,
233
+ draftVisibility = "visible",
234
+ currentUserId
235
+ }) => {
236
+ const grouped = {};
237
+ for (const comment of selectCommentsByLocation({ comments, locationId })) {
238
+ const list = grouped[comment.sessionId];
239
+ if (list) {
240
+ list.push(comment);
241
+ } else {
242
+ grouped[comment.sessionId] = [comment];
243
+ }
203
244
  }
204
- return inSession.filter((comment) => {
205
- if (comment.status === "draft") {
206
- return true;
245
+ if (session !== null) {
246
+ const active = grouped[session.id];
247
+ if (active) {
248
+ const filtered = applyDraftFilter(
249
+ active,
250
+ session,
251
+ draftVisibility,
252
+ currentUserId
253
+ );
254
+ if (filtered.length === 0) {
255
+ delete grouped[session.id];
256
+ } else {
257
+ grouped[session.id] = filtered;
258
+ }
207
259
  }
208
- const authorId = comment.user?.id;
209
- return authorId === void 0 || authorId === currentUserId;
210
- });
260
+ }
261
+ return grouped;
211
262
  };
212
263
 
213
264
  // src/contexts/feedback-session-context.tsx
@@ -248,6 +299,45 @@ var useSessionEvents = () => {
248
299
  return { events, emit };
249
300
  };
250
301
 
302
+ // src/utils/session-type.ts
303
+ var SESSION_TYPES = ["feedback"];
304
+ var isSessionType = (value) => SESSION_TYPES.includes(value);
305
+ var SESSION_STATUSES = [
306
+ "draft",
307
+ "confirmed",
308
+ "resolving",
309
+ "resolved"
310
+ ];
311
+ var parseInitialSession = (value) => {
312
+ if (value === null || typeof value !== "object") return null;
313
+ const status = value.status;
314
+ if (!SESSION_STATUSES.includes(status)) return null;
315
+ const session = value;
316
+ return {
317
+ ...value,
318
+ comments: session.comments ?? []
319
+ };
320
+ };
321
+
322
+ // src/utils/session-guards.ts
323
+ var locatedComments = (session) => session.comments.filter(isLocated);
324
+ var confirmRefusal = (session, localDrafts) => {
325
+ if (!session || session.status !== "draft") return "session is not a draft";
326
+ if (localDrafts > 0) return "a local draft comment exists";
327
+ if (locatedComments(session).length === 0) return "session has no comments";
328
+ if (!isSessionType(session.type)) return "unknown session type";
329
+ return null;
330
+ };
331
+ var resolveRefusal = (session) => {
332
+ if (session?.status !== "resolving") return "session is not resolving";
333
+ return locatedComments(session).some((c) => c.status === "published") ? "a comment is still published" : null;
334
+ };
335
+ var sumCounts = (counts) => {
336
+ let total = 0;
337
+ for (const count of counts.values()) total += count;
338
+ return total;
339
+ };
340
+
251
341
  // src/utils/session-reducer.ts
252
342
  var initialSessionReducerState = {
253
343
  session: null,
@@ -340,53 +430,8 @@ var sessionReducer = (state, action) => {
340
430
  }
341
431
  };
342
432
 
343
- // src/utils/session-type.ts
344
- var SESSION_TYPES = ["feedback"];
345
- var isSessionType = (value) => SESSION_TYPES.includes(value);
346
- var SESSION_STATUSES = [
347
- "draft",
348
- "confirmed",
349
- "resolving",
350
- "resolved"
351
- ];
352
- var parseInitialSession = (value) => {
353
- if (value === null || typeof value !== "object") return null;
354
- const status = value.status;
355
- if (!SESSION_STATUSES.includes(status)) return null;
356
- const session = value;
357
- return {
358
- ...value,
359
- comments: session.comments ?? []
360
- };
361
- };
362
-
363
- // src/contexts/user-context.tsx
364
- var React = __toESM(require("react"), 1);
365
- var import_jsx_runtime = require("react/jsx-runtime");
366
- var UserContext = React.createContext(
367
- void 0
368
- );
369
- var UserProvider = ({ user, children }) => {
370
- const value = React.useMemo(
371
- () => ({ currentUser: user }),
372
- [user]
373
- );
374
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserContext.Provider, { value, children });
375
- };
376
- var useCurrentUser = () => {
377
- const ctx = React.useContext(UserContext);
378
- if (!ctx) {
379
- throw new Error("useCurrentUser must be used within <UserProvider />");
380
- }
381
- return ctx.currentUser;
382
- };
383
- var useOptionalCurrentUser = () => {
384
- const ctx = React.useContext(UserContext);
385
- return ctx ? ctx.currentUser : void 0;
386
- };
387
-
388
433
  // src/contexts/feedback-session-context.tsx
389
- var import_jsx_runtime2 = require("react/jsx-runtime");
434
+ var import_jsx_runtime = require("react/jsx-runtime");
390
435
  var FeedbackSessionContext = (0, import_react3.createContext)(
391
436
  null
392
437
  );
@@ -394,7 +439,8 @@ var SessionBridgeContext = (0, import_react3.createContext)(null);
394
439
  var MAX_PROJECT_ID_LENGTH = 128;
395
440
  var isValidProjectId = (projectId) => projectId === void 0 || typeof projectId === "string" && projectId.length >= 1 && projectId.length <= MAX_PROJECT_ID_LENGTH;
396
441
  var pick = (value, fallback) => value !== void 0 ? value : fallback;
397
- var createRefusal = (type, projectId, inFlight, session, hasCallback) => {
442
+ var createRefusal = (type, projectId, inFlight, session, hasCallback, user) => {
443
+ if (!user) return "user is required";
398
444
  if (!isSessionType(type)) return "unknown session type";
399
445
  if (!isValidProjectId(projectId)) {
400
446
  return "projectId must be 1 to 128 characters";
@@ -404,18 +450,6 @@ var createRefusal = (type, projectId, inFlight, session, hasCallback) => {
404
450
  if (!hasCallback) return "onCreateSession is not provided";
405
451
  return null;
406
452
  };
407
- var confirmRefusal = (session, localDrafts) => {
408
- if (!session || session.status !== "draft") return "session is not a draft";
409
- if (localDrafts > 0) return "a local draft comment exists";
410
- if (session.comments.length === 0) return "session has no comments";
411
- if (!isSessionType(session.type)) return "unknown session type";
412
- return null;
413
- };
414
- var sumCounts = (counts) => {
415
- let total = 0;
416
- for (const count of counts.values()) total += count;
417
- return total;
418
- };
419
453
  var FeedbackSessionProvider = ({
420
454
  children,
421
455
  initialSession,
@@ -427,7 +461,6 @@ var FeedbackSessionProvider = ({
427
461
  onResolveSession,
428
462
  onError
429
463
  }) => {
430
- const contextUser = useOptionalCurrentUser();
431
464
  const initialParsedRef = (0, import_react3.useRef)(
432
465
  void 0
433
466
  );
@@ -468,14 +501,15 @@ var FeedbackSessionProvider = ({
468
501
  const createSession = (0, import_react3.useCallback)(
469
502
  async (options) => {
470
503
  const type = options?.type ?? "feedback";
471
- const user = pick(options?.user, contextUser);
504
+ const user = options?.user;
472
505
  const sessionProjectId = pick(options?.projectId, projectId);
473
506
  const refusal = createRefusal(
474
507
  type,
475
508
  sessionProjectId,
476
509
  inFlightRef.current,
477
510
  stateRef.current.session,
478
- onCreateSession !== void 0
511
+ onCreateSession !== void 0,
512
+ user
479
513
  );
480
514
  if (refusal !== null || !onCreateSession) {
481
515
  const error = new SessionCreateError(refusal ?? void 0);
@@ -487,7 +521,7 @@ var FeedbackSessionProvider = ({
487
521
  try {
488
522
  const input = {
489
523
  type,
490
- user: user ?? null,
524
+ user,
491
525
  projectId: sessionProjectId
492
526
  };
493
527
  const { data, error } = await tx.executeAsync(
@@ -510,7 +544,7 @@ var FeedbackSessionProvider = ({
510
544
  apply({ type: "SET_OPERATION_STATE", to: "idle" });
511
545
  }
512
546
  },
513
- [apply, contextUser, emit, onCreateSession, projectId, report]
547
+ [apply, emit, onCreateSession, projectId, report]
514
548
  );
515
549
  const confirmSession = (0, import_react3.useCallback)(async () => {
516
550
  if (inFlightRef.current === "confirming") return { error: null };
@@ -596,11 +630,7 @@ var FeedbackSessionProvider = ({
596
630
  const resolveSession = (0, import_react3.useCallback)(
597
631
  () => runTransition({
598
632
  pending: "completingResolution",
599
- guard: (session) => {
600
- if (session?.status !== "resolving")
601
- return "session is not resolving";
602
- return session.comments.some((c) => c.status === "published") ? "a comment is still published" : null;
603
- },
633
+ guard: resolveRefusal,
604
634
  call: onResolveSession,
605
635
  failure: SessionResolveError,
606
636
  commit: () => {
@@ -658,7 +688,7 @@ var FeedbackSessionProvider = ({
658
688
  resolveSession,
659
689
  events
660
690
  };
661
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FeedbackSessionContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SessionBridgeContext.Provider, { value: bridge, children }) });
691
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FeedbackSessionContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SessionBridgeContext.Provider, { value: bridge, children }) });
662
692
  };
663
693
  var useFeedbackSession = () => {
664
694
  const context = (0, import_react3.useContext)(FeedbackSessionContext);
@@ -680,7 +710,7 @@ var useSessionBridge = () => {
680
710
  };
681
711
 
682
712
  // src/contexts/comment-context.tsx
683
- var import_jsx_runtime3 = require("react/jsx-runtime");
713
+ var import_jsx_runtime2 = require("react/jsx-runtime");
684
714
  var CommentContext = (0, import_react4.createContext)(null);
685
715
  var commentReducer = (state, action) => {
686
716
  switch (action.type) {
@@ -695,6 +725,7 @@ var commentReducer = (state, action) => {
695
725
  {
696
726
  id: newId,
697
727
  sessionId: action.sessionId,
728
+ locationId: action.locationId,
698
729
  projectId: state.projectId,
699
730
  user: state.currentUser,
700
731
  position: {
@@ -804,6 +835,7 @@ var CommentContextProvider = ({
804
835
  }
805
836
  },
806
837
  projectId,
838
+ locationId: locationIdProp,
807
839
  onError,
808
840
  onAdd,
809
841
  onEdit,
@@ -811,6 +843,9 @@ var CommentContextProvider = ({
811
843
  onResolve,
812
844
  onReopen
813
845
  }) => {
846
+ const locationId = normalizeLocationId(locationIdProp);
847
+ const locationIdRef = (0, import_react4.useRef)(locationId);
848
+ locationIdRef.current = locationId;
814
849
  const hostRef = (0, import_react4.useRef)({ onAdd, onEdit, onDelete, onResolve, onReopen });
815
850
  hostRef.current = { onAdd, onEdit, onDelete, onResolve, onReopen };
816
851
  const bridge = useSessionBridge();
@@ -818,8 +853,7 @@ var CommentContextProvider = ({
818
853
  bridgeRef.current = bridge;
819
854
  const canResolveRef = (0, import_react4.useRef)(bridge.canResolve);
820
855
  canResolveRef.current = bridge.canResolve;
821
- const contextUser = useOptionalCurrentUser();
822
- const currentUser = contextUser !== void 0 ? contextUser : currentUserProp ?? null;
856
+ const currentUser = currentUserProp ?? null;
823
857
  const currentUserRef = (0, import_react4.useRef)(currentUser);
824
858
  currentUserRef.current = currentUser;
825
859
  const [state, dispatch] = (0, import_react4.useReducer)(
@@ -863,9 +897,15 @@ var CommentContextProvider = ({
863
897
  onError?.(new SessionStateError());
864
898
  return;
865
899
  }
900
+ const currentLocationId = locationIdRef.current;
901
+ if (currentLocationId === void 0) {
902
+ onError?.(new AddError("locationId is missing"));
903
+ return;
904
+ }
866
905
  dispatch({
867
906
  type: "REGISTER",
868
907
  sessionId: session.id,
908
+ locationId: currentLocationId,
869
909
  position,
870
910
  indicatorPosition: indicatorPosition || null
871
911
  });
@@ -1039,9 +1079,18 @@ var CommentContextProvider = ({
1039
1079
  const toggleOverlay = () => {
1040
1080
  dispatch({ type: "TOGGLE_OVERLAY" });
1041
1081
  };
1082
+ const activeSession = bridge.session ? { id: bridge.session.id, status: bridge.session.status } : null;
1042
1083
  const visibleComments = selectVisibleComments({
1043
1084
  comments: state.comments,
1044
- session: bridge.session ? { id: bridge.session.id, status: bridge.session.status } : null,
1085
+ session: activeSession,
1086
+ locationId,
1087
+ draftVisibility: state.config?.draftVisibility,
1088
+ currentUserId: currentUser?.id
1089
+ });
1090
+ const commentsBySession = selectCommentsBySession({
1091
+ comments: state.comments,
1092
+ locationId,
1093
+ session: activeSession,
1045
1094
  draftVisibility: state.config?.draftVisibility,
1046
1095
  currentUserId: currentUser?.id
1047
1096
  });
@@ -1056,7 +1105,7 @@ var CommentContextProvider = ({
1056
1105
  onError(error);
1057
1106
  }
1058
1107
  };
1059
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1108
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1060
1109
  CommentContext.Provider,
1061
1110
  {
1062
1111
  value: {
@@ -1064,6 +1113,7 @@ var CommentContextProvider = ({
1064
1113
  comments: visibleComments.filter(hasStatus("published")),
1065
1114
  resolvedComments: visibleComments.filter(hasStatus("resolved")),
1066
1115
  allComments: visibleComments,
1116
+ commentsBySession,
1067
1117
  config: state.config,
1068
1118
  changeOverlayState,
1069
1119
  overlayState: state.overlayState,
@@ -1108,7 +1158,7 @@ var normalizeRect = (a, b) => {
1108
1158
  };
1109
1159
 
1110
1160
  // src/components/comment-overlay.tsx
1111
- var import_jsx_runtime4 = require("react/jsx-runtime");
1161
+ var import_jsx_runtime3 = require("react/jsx-runtime");
1112
1162
  var DRAG_THRESHOLD = 4;
1113
1163
  var CommentOverlay = ({ children, ...rest }) => {
1114
1164
  const {
@@ -1183,8 +1233,8 @@ var CommentOverlay = ({ children, ...rest }) => {
1183
1233
  setPreview(null);
1184
1234
  };
1185
1235
  if (overlayState === "inactive") return children;
1186
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { "data-overlay": true, style: { position: "relative", ...rest.style }, ...rest, children: [
1187
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1236
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { "data-overlay": true, style: { position: "relative", ...rest.style }, ...rest, children: [
1237
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1188
1238
  "div",
1189
1239
  {
1190
1240
  ref: overlayRef,
@@ -1198,7 +1248,7 @@ var CommentOverlay = ({ children, ...rest }) => {
1198
1248
  }
1199
1249
  ),
1200
1250
  getActiveComment() && // biome-ignore lint: This element should only handle clicks as a guard
1201
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1251
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1202
1252
  "div",
1203
1253
  {
1204
1254
  "data-comment-guard": true,
@@ -1224,7 +1274,7 @@ var CommentOverlay = ({ children, ...rest }) => {
1224
1274
  }
1225
1275
  }
1226
1276
  ),
1227
- preview && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1277
+ preview && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1228
1278
  "div",
1229
1279
  {
1230
1280
  style: {
@@ -1256,41 +1306,35 @@ var EDITING_STYLES = {
1256
1306
  };
1257
1307
 
1258
1308
  // src/components/comment-renderer.tsx
1259
- var import_jsx_runtime5 = require("react/jsx-runtime");
1309
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1260
1310
  var CommentRenderer = ({
1261
1311
  Comment: Comment2,
1262
1312
  DraftComment,
1263
1313
  ResolvedComment
1264
1314
  }) => {
1265
- const {
1266
- comments,
1267
- draftComments,
1268
- overlayState,
1269
- resolvedComments,
1270
- config
1271
- } = useComments();
1315
+ const { comments, draftComments, overlayState, resolvedComments, config } = useComments();
1272
1316
  if (overlayState === "inactive") return null;
1273
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1317
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1274
1318
  draftComments.map((comment) => {
1275
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DraftComment, { comment }, comment.id);
1319
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DraftComment, { comment }, comment.id);
1276
1320
  }),
1277
1321
  comments.map((comment) => {
1278
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Comment2, { comment }, comment.id);
1322
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Comment2, { comment }, comment.id);
1279
1323
  }),
1280
1324
  resolvedComments.map((comment) => {
1281
1325
  if (config?.commentVisibility?.hideResolved) return null;
1282
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ResolvedComment, { comment }, comment.id);
1326
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ResolvedComment, { comment }, comment.id);
1283
1327
  })
1284
1328
  ] });
1285
1329
  };
1286
1330
 
1287
1331
  // src/components/comment-actions.tsx
1288
1332
  var import_react_slot = require("@radix-ui/react-slot");
1289
- var import_jsx_runtime6 = require("react/jsx-runtime");
1333
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1290
1334
  var ToggleOverlayButton = ({ asChild, ...rest }) => {
1291
1335
  const { toggleOverlay, overlayState } = useComments();
1292
1336
  const Comp = asChild ? import_react_slot.Slot : "button";
1293
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1337
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1294
1338
  Comp,
1295
1339
  {
1296
1340
  "data-active": overlayState !== "inactive",
@@ -1308,12 +1352,12 @@ var import_react6 = require("react");
1308
1352
  var import_react_slot2 = require("@radix-ui/react-slot");
1309
1353
 
1310
1354
  // src/contexts/scoped-comment.tsx
1311
- var React2 = __toESM(require("react"), 1);
1312
- var CommentScopeContext = React2.createContext(
1355
+ var React = __toESM(require("react"), 1);
1356
+ var CommentScopeContext = React.createContext(
1313
1357
  null
1314
1358
  );
1315
1359
  function useCommentScope() {
1316
- const ctx = React2.useContext(CommentScopeContext);
1360
+ const ctx = React.useContext(CommentScopeContext);
1317
1361
  if (!ctx) {
1318
1362
  throw new Error("Comment.* must be used within <Comment.Root />");
1319
1363
  }
@@ -1321,7 +1365,7 @@ function useCommentScope() {
1321
1365
  }
1322
1366
 
1323
1367
  // src/components/comment.tsx
1324
- var import_jsx_runtime7 = require("react/jsx-runtime");
1368
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1325
1369
  var CommentRoot = ({
1326
1370
  comment,
1327
1371
  defaultDraft,
@@ -1337,11 +1381,11 @@ var CommentRoot = ({
1337
1381
  top: comment.position.y,
1338
1382
  left: comment.position.x
1339
1383
  };
1340
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1384
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1341
1385
  CommentScopeContext.Provider,
1342
1386
  {
1343
1387
  value: { comment, isActive, draft, setDraft },
1344
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1388
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1345
1389
  "div",
1346
1390
  {
1347
1391
  ...rest,
@@ -1363,7 +1407,7 @@ var CommentIndicator = ({ ...rest }) => {
1363
1407
  const { config } = useComments();
1364
1408
  if (!comment.indicator) return null;
1365
1409
  if (config?.indicatorVisibility === "active" && !isActive) return null;
1366
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1410
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1367
1411
  "div",
1368
1412
  {
1369
1413
  ...rest,
@@ -1385,12 +1429,12 @@ var CommentIndicator = ({ ...rest }) => {
1385
1429
  var CommentContent = ({ asChild, ...rest }) => {
1386
1430
  const { draft } = useCommentScope();
1387
1431
  const Comp = asChild ? import_react_slot2.Slot : "p";
1388
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Comp, { ...rest, children: draft });
1432
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Comp, { ...rest, children: draft });
1389
1433
  };
1390
1434
  var CommentEdit = ({ asChild, ...rest }) => {
1391
1435
  const { draft, setDraft } = useCommentScope();
1392
1436
  const Comp = asChild ? import_react_slot2.Slot : "textarea";
1393
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1437
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1394
1438
  Comp,
1395
1439
  {
1396
1440
  ...rest,
@@ -1408,7 +1452,7 @@ var CommentConfirm = ({ asChild, ...rest }) => {
1408
1452
  const { updateComment } = useComments();
1409
1453
  const { comment, draft } = useCommentScope();
1410
1454
  const Comp = asChild ? import_react_slot2.Slot : "button";
1411
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1455
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1412
1456
  Comp,
1413
1457
  {
1414
1458
  ...rest,
@@ -1424,7 +1468,7 @@ var CommentDelete = ({ asChild, ...rest }) => {
1424
1468
  const { deleteComment } = useComments();
1425
1469
  const { comment } = useCommentScope();
1426
1470
  const Comp = asChild ? import_react_slot2.Slot : "button";
1427
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1471
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1428
1472
  Comp,
1429
1473
  {
1430
1474
  ...rest,
@@ -1451,7 +1495,7 @@ var CommentResolve = ({ asChild, ...rest }) => {
1451
1495
  );
1452
1496
  return null;
1453
1497
  }
1454
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1498
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1455
1499
  Comp,
1456
1500
  {
1457
1501
  ...rest,
@@ -1478,7 +1522,7 @@ var CommentReopen = ({ asChild, ...rest }) => {
1478
1522
  );
1479
1523
  return null;
1480
1524
  }
1481
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1525
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1482
1526
  Comp,
1483
1527
  {
1484
1528
  ...rest,
@@ -1558,16 +1602,16 @@ var Comment = {
1558
1602
 
1559
1603
  // src/components/session-actions.tsx
1560
1604
  var import_react_slot3 = require("@radix-ui/react-slot");
1561
- var import_jsx_runtime8 = require("react/jsx-runtime");
1562
- var CreateSession = ({ asChild, ...rest }) => {
1605
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1606
+ var CreateSession = ({ asChild, user, ...rest }) => {
1563
1607
  const { createSession } = useFeedbackSession();
1564
1608
  const Comp = asChild ? import_react_slot3.Slot : "button";
1565
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1609
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1566
1610
  Comp,
1567
1611
  {
1568
1612
  ...rest,
1569
1613
  onClick: (e) => {
1570
- void createSession();
1614
+ void createSession({ user });
1571
1615
  rest.onClick?.(e);
1572
1616
  }
1573
1617
  }
@@ -1576,7 +1620,7 @@ var CreateSession = ({ asChild, ...rest }) => {
1576
1620
  var ConfirmSession = ({ asChild, ...rest }) => {
1577
1621
  const { confirmSession } = useFeedbackSession();
1578
1622
  const Comp = asChild ? import_react_slot3.Slot : "button";
1579
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1623
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1580
1624
  Comp,
1581
1625
  {
1582
1626
  ...rest,
@@ -1590,7 +1634,7 @@ var ConfirmSession = ({ asChild, ...rest }) => {
1590
1634
  var StartResolving = ({ asChild, ...rest }) => {
1591
1635
  const { startResolving } = useFeedbackSession();
1592
1636
  const Comp = asChild ? import_react_slot3.Slot : "button";
1593
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1637
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1594
1638
  Comp,
1595
1639
  {
1596
1640
  ...rest,
@@ -1604,7 +1648,7 @@ var StartResolving = ({ asChild, ...rest }) => {
1604
1648
  var ResolveSession = ({ asChild, ...rest }) => {
1605
1649
  const { resolveSession } = useFeedbackSession();
1606
1650
  const Comp = asChild ? import_react_slot3.Slot : "button";
1607
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1651
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1608
1652
  Comp,
1609
1653
  {
1610
1654
  ...rest,
@@ -1628,9 +1672,8 @@ var ResolveSession = ({ asChild, ...rest }) => {
1628
1672
  ResolveSession,
1629
1673
  StartResolving,
1630
1674
  ToggleOverlayButton,
1631
- UserProvider,
1675
+ commentReducer,
1632
1676
  useCommentScope,
1633
1677
  useComments,
1634
- useCurrentUser,
1635
1678
  useFeedbackSession
1636
1679
  });