@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.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { HTMLProps, ReactNode, ElementType, ButtonHTMLAttributes } from 'react';
4
- import { C as CommentType, a as CommentOverlayProps$1, b as CommentContext, I as InitialFeedbackSession, c as CreateSessionInput, F as FeedbackSession, S as SessionType, K as KnownError, A as ActiveFeedbackSession, d as SessionOperationState, U as User, e as SessionEvents, f as UserProviderProps } from './use-session-events-DFksOgVA.cjs';
4
+ import { CommentType, CommentState, CommentAction, CommentOverlayProps as CommentOverlayProps$1, CommentContext, User, InitialFeedbackSession, CreateSessionInput, FeedbackSession, SessionType, KnownError, ActiveFeedbackSession, SessionOperationState, SessionEvents } from './types.cjs';
5
5
 
6
6
  interface CommentOverlayProps extends HTMLProps<HTMLDivElement> {
7
7
  children: ReactNode;
@@ -131,12 +131,13 @@ declare const Comment: {
131
131
  Reopen: ({ asChild, ...rest }: CommentReopenProps) => react_jsx_runtime.JSX.Element | null;
132
132
  };
133
133
 
134
+ declare const commentReducer: (state: CommentState, action: CommentAction) => CommentState;
134
135
  /**
135
136
  * Comment context provider to provide the comments to the children components
136
137
  *
137
138
  * @param initialComments as the initial comments from the document
138
139
  */
139
- declare const CommentContextProvider: ({ children, initialComments, initialOverlayState, currentUser: currentUserProp, subscription, config, projectId, onError, onAdd, onEdit, onDelete, onResolve, onReopen, }: CommentOverlayProps$1) => react_jsx_runtime.JSX.Element;
140
+ declare const CommentContextProvider: ({ children, initialComments, initialOverlayState, currentUser: currentUserProp, subscription, config, projectId, locationId: locationIdProp, onError, onAdd, onEdit, onDelete, onResolve, onReopen, }: CommentOverlayProps$1) => react_jsx_runtime.JSX.Element;
140
141
  declare const useComments: () => CommentContext;
141
142
 
142
143
  type CommentScope = {
@@ -151,7 +152,11 @@ declare function useCommentScope(): CommentScope;
151
152
  interface SessionButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
152
153
  asChild?: boolean;
153
154
  }
154
- declare const CreateSession: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
155
+ interface CreateSessionProps extends SessionButtonProps {
156
+ /** The user creating the session */
157
+ user: User;
158
+ }
159
+ declare const CreateSession: ({ asChild, user, ...rest }: CreateSessionProps) => react_jsx_runtime.JSX.Element;
155
160
  declare const ConfirmSession: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
156
161
  declare const StartResolving: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
157
162
  declare const ResolveSession: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
@@ -182,9 +187,10 @@ type FeedbackSessionContextType = {
182
187
  sessionState: SessionOperationState;
183
188
  /** Mirrors the canResolveSession prop */
184
189
  canResolve: boolean;
185
- createSession: (options?: {
190
+ createSession: (options: {
191
+ /** The user creating the session. Required, a missing user is refused */
192
+ user: User;
186
193
  type?: SessionType;
187
- user?: User | null;
188
194
  projectId?: string;
189
195
  }) => Promise<ActionResult>;
190
196
  confirmSession: () => Promise<ActionResult>;
@@ -195,11 +201,4 @@ type FeedbackSessionContextType = {
195
201
  declare const FeedbackSessionProvider: ({ children, initialSession, projectId, canResolveSession, onCreateSession, onConfirmSession, onStartResolving, onResolveSession, onError, }: FeedbackSessionProviderProps) => react_jsx_runtime.JSX.Element;
196
202
  declare const useFeedbackSession: () => FeedbackSessionContextType;
197
203
 
198
- declare const UserProvider: ({ user, children }: UserProviderProps) => react_jsx_runtime.JSX.Element;
199
- /**
200
- * Returns the current user, or null when nobody is signed in.
201
- * Throws when used outside <UserProvider />.
202
- */
203
- declare const useCurrentUser: () => User | null;
204
-
205
- export { Comment, CommentContextProvider, CommentOverlay, CommentRenderer, CommentScopeContext, ConfirmSession, CreateSession, type FeedbackSessionContextType, FeedbackSessionProvider, type FeedbackSessionProviderProps, ResolveSession, StartResolving, ToggleOverlayButton, UserProvider, useCommentScope, useComments, useCurrentUser, useFeedbackSession };
204
+ export { Comment, CommentContextProvider, CommentOverlay, CommentRenderer, CommentScopeContext, ConfirmSession, CreateSession, type FeedbackSessionContextType, FeedbackSessionProvider, type FeedbackSessionProviderProps, ResolveSession, StartResolving, ToggleOverlayButton, commentReducer, useCommentScope, useComments, useFeedbackSession };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { HTMLProps, ReactNode, ElementType, ButtonHTMLAttributes } from 'react';
4
- import { C as CommentType, a as CommentOverlayProps$1, b as CommentContext, I as InitialFeedbackSession, c as CreateSessionInput, F as FeedbackSession, S as SessionType, K as KnownError, A as ActiveFeedbackSession, d as SessionOperationState, U as User, e as SessionEvents, f as UserProviderProps } from './use-session-events-DFksOgVA.js';
4
+ import { CommentType, CommentState, CommentAction, CommentOverlayProps as CommentOverlayProps$1, CommentContext, User, InitialFeedbackSession, CreateSessionInput, FeedbackSession, SessionType, KnownError, ActiveFeedbackSession, SessionOperationState, SessionEvents } from './types.js';
5
5
 
6
6
  interface CommentOverlayProps extends HTMLProps<HTMLDivElement> {
7
7
  children: ReactNode;
@@ -131,12 +131,13 @@ declare const Comment: {
131
131
  Reopen: ({ asChild, ...rest }: CommentReopenProps) => react_jsx_runtime.JSX.Element | null;
132
132
  };
133
133
 
134
+ declare const commentReducer: (state: CommentState, action: CommentAction) => CommentState;
134
135
  /**
135
136
  * Comment context provider to provide the comments to the children components
136
137
  *
137
138
  * @param initialComments as the initial comments from the document
138
139
  */
139
- declare const CommentContextProvider: ({ children, initialComments, initialOverlayState, currentUser: currentUserProp, subscription, config, projectId, onError, onAdd, onEdit, onDelete, onResolve, onReopen, }: CommentOverlayProps$1) => react_jsx_runtime.JSX.Element;
140
+ declare const CommentContextProvider: ({ children, initialComments, initialOverlayState, currentUser: currentUserProp, subscription, config, projectId, locationId: locationIdProp, onError, onAdd, onEdit, onDelete, onResolve, onReopen, }: CommentOverlayProps$1) => react_jsx_runtime.JSX.Element;
140
141
  declare const useComments: () => CommentContext;
141
142
 
142
143
  type CommentScope = {
@@ -151,7 +152,11 @@ declare function useCommentScope(): CommentScope;
151
152
  interface SessionButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
152
153
  asChild?: boolean;
153
154
  }
154
- declare const CreateSession: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
155
+ interface CreateSessionProps extends SessionButtonProps {
156
+ /** The user creating the session */
157
+ user: User;
158
+ }
159
+ declare const CreateSession: ({ asChild, user, ...rest }: CreateSessionProps) => react_jsx_runtime.JSX.Element;
155
160
  declare const ConfirmSession: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
156
161
  declare const StartResolving: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
157
162
  declare const ResolveSession: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
@@ -182,9 +187,10 @@ type FeedbackSessionContextType = {
182
187
  sessionState: SessionOperationState;
183
188
  /** Mirrors the canResolveSession prop */
184
189
  canResolve: boolean;
185
- createSession: (options?: {
190
+ createSession: (options: {
191
+ /** The user creating the session. Required, a missing user is refused */
192
+ user: User;
186
193
  type?: SessionType;
187
- user?: User | null;
188
194
  projectId?: string;
189
195
  }) => Promise<ActionResult>;
190
196
  confirmSession: () => Promise<ActionResult>;
@@ -195,11 +201,4 @@ type FeedbackSessionContextType = {
195
201
  declare const FeedbackSessionProvider: ({ children, initialSession, projectId, canResolveSession, onCreateSession, onConfirmSession, onStartResolving, onResolveSession, onError, }: FeedbackSessionProviderProps) => react_jsx_runtime.JSX.Element;
196
202
  declare const useFeedbackSession: () => FeedbackSessionContextType;
197
203
 
198
- declare const UserProvider: ({ user, children }: UserProviderProps) => react_jsx_runtime.JSX.Element;
199
- /**
200
- * Returns the current user, or null when nobody is signed in.
201
- * Throws when used outside <UserProvider />.
202
- */
203
- declare const useCurrentUser: () => User | null;
204
-
205
- export { Comment, CommentContextProvider, CommentOverlay, CommentRenderer, CommentScopeContext, ConfirmSession, CreateSession, type FeedbackSessionContextType, FeedbackSessionProvider, type FeedbackSessionProviderProps, ResolveSession, StartResolving, ToggleOverlayButton, UserProvider, useCommentScope, useComments, useCurrentUser, useFeedbackSession };
204
+ export { Comment, CommentContextProvider, CommentOverlay, CommentRenderer, CommentScopeContext, ConfirmSession, CreateSession, type FeedbackSessionContextType, FeedbackSessionProvider, type FeedbackSessionProviderProps, ResolveSession, StartResolving, ToggleOverlayButton, commentReducer, useCommentScope, useComments, useFeedbackSession };