@kendew-agency/react-feedback-layer 0.3.1 → 0.4.0-rc.0
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/README.md +713 -454
- package/dist/index.cjs +982 -222
- package/dist/index.d.cts +130 -13
- package/dist/index.d.ts +130 -13
- package/dist/index.js +981 -218
- package/dist/types.d.cts +6 -5
- package/dist/types.d.ts +6 -5
- package/dist/{comment.types-C0m3sQ_Q.d.cts → use-session-events-DFksOgVA.d.cts} +177 -35
- package/dist/{comment.types-C0m3sQ_Q.d.ts → use-session-events-DFksOgVA.d.ts} +177 -35
- package/package.json +8 -3
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 } from './
|
|
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';
|
|
5
5
|
|
|
6
6
|
interface CommentOverlayProps extends HTMLProps<HTMLDivElement> {
|
|
7
7
|
children: ReactNode;
|
|
@@ -15,31 +15,42 @@ type CommentRendererProps = {
|
|
|
15
15
|
DraftComment: ElementType<{
|
|
16
16
|
comment: CommentType;
|
|
17
17
|
}>;
|
|
18
|
-
ResolvingComment: ElementType<{
|
|
19
|
-
comment: CommentType;
|
|
20
|
-
}>;
|
|
21
18
|
ResolvedComment: ElementType<{
|
|
22
19
|
comment: CommentType;
|
|
23
20
|
}>;
|
|
24
21
|
};
|
|
25
22
|
/**
|
|
23
|
+
* Comment rendering component
|
|
24
|
+
* @remarks
|
|
25
|
+
* This component is used to render all comments based on their state.
|
|
26
|
+
* This component is optional and the samen could be built using the `useComments()` hook
|
|
26
27
|
*
|
|
27
|
-
* @param
|
|
28
|
-
* @
|
|
28
|
+
* @param Comment - Component for all open comments
|
|
29
|
+
* @param DraftComment - Component for all draft comments
|
|
30
|
+
* @param ResolvedComment - Component for all resolved comments
|
|
31
|
+
* @returns mapped arrays of all comment types
|
|
32
|
+
* @description This component is used to render all comments based on their type
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <CommentRenderer
|
|
36
|
+
* Comment={MyCommentComponent}
|
|
37
|
+
* DraftComment={MyDraftCommentComponent}
|
|
38
|
+
* ResolvedComment={MyResolvedCommentComponent}
|
|
39
|
+
* />
|
|
40
|
+
* ```
|
|
29
41
|
*/
|
|
30
|
-
declare const CommentRenderer: ({ Comment, DraftComment,
|
|
42
|
+
declare const CommentRenderer: ({ Comment, DraftComment, ResolvedComment, }: CommentRendererProps) => react_jsx_runtime.JSX.Element | null;
|
|
31
43
|
|
|
32
44
|
interface CommentButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
33
45
|
asChild?: boolean;
|
|
34
46
|
}
|
|
35
47
|
declare const ToggleOverlayButton: ({ asChild, ...rest }: CommentButtonProps) => react_jsx_runtime.JSX.Element;
|
|
36
|
-
declare const ConfirmComments: ({ asChild, ...rest }: CommentButtonProps) => react_jsx_runtime.JSX.Element;
|
|
37
|
-
declare const ResolveComments: ({ asChild, ...rest }: CommentButtonProps) => react_jsx_runtime.JSX.Element;
|
|
38
48
|
|
|
39
49
|
interface CommentRootProps extends HTMLProps<HTMLDivElement> {
|
|
40
50
|
comment: CommentType;
|
|
41
|
-
children?: ReactNode;
|
|
42
51
|
defaultDraft?: string;
|
|
52
|
+
withPosition?: boolean;
|
|
53
|
+
children?: ReactNode;
|
|
43
54
|
}
|
|
44
55
|
interface CommentIndicatorProps extends HTMLProps<HTMLDivElement> {
|
|
45
56
|
}
|
|
@@ -58,14 +69,66 @@ interface CommentDeleteProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
58
69
|
interface CommentResolveProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
59
70
|
asChild?: boolean;
|
|
60
71
|
}
|
|
72
|
+
interface CommentReopenProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
73
|
+
asChild?: boolean;
|
|
74
|
+
}
|
|
61
75
|
declare const Comment: {
|
|
62
|
-
|
|
76
|
+
/**
|
|
77
|
+
* The root component for a comment, must be used to wrap all other comment components.
|
|
78
|
+
*
|
|
79
|
+
* @param comment as the current comment from the comments array
|
|
80
|
+
* @param defaultDraft as the optional initial value for the comment edit state
|
|
81
|
+
* @param withPosition as whether to inject positioning styles from the comment's position. Disable if you want to display the comment in a list. Defaults to true
|
|
82
|
+
*/
|
|
83
|
+
Root: ({ comment, defaultDraft, withPosition, children, ...rest }: CommentRootProps) => react_jsx_runtime.JSX.Element;
|
|
84
|
+
/**
|
|
85
|
+
* The comment indicator
|
|
86
|
+
*
|
|
87
|
+
* @description Shows a dashed line that indicates a section this comment relates to
|
|
88
|
+
*/
|
|
63
89
|
Indicator: ({ ...rest }: CommentIndicatorProps) => react_jsx_runtime.JSX.Element | null;
|
|
90
|
+
/**
|
|
91
|
+
* The comment's static safed content
|
|
92
|
+
*
|
|
93
|
+
* @description Displays the comment's content as a `<p>` tag
|
|
94
|
+
* @param asChild as whether to use the child as the base element instead of the default `<p>` tag. This allows for more flexibility
|
|
95
|
+
*/
|
|
64
96
|
Content: ({ asChild, ...rest }: CommentContentProps) => react_jsx_runtime.JSX.Element;
|
|
97
|
+
/**
|
|
98
|
+
* The comment's editable content
|
|
99
|
+
*
|
|
100
|
+
* @description A textarea to edit the comment's content
|
|
101
|
+
* @param asChild as whether to use the child as the base element instead of the default `<textarea>` tag. This allows for more flexibility
|
|
102
|
+
*/
|
|
65
103
|
Edit: ({ asChild, ...rest }: CommentEditProps) => react_jsx_runtime.JSX.Element;
|
|
104
|
+
/**
|
|
105
|
+
* Confirms the changes made to a comment
|
|
106
|
+
*
|
|
107
|
+
* @description Updates the comment's content with the current draft
|
|
108
|
+
* @param asChild as whether to use the child as the base element instead of the default `<button>` tag. This allows for more flexibility
|
|
109
|
+
*/
|
|
66
110
|
Confirm: ({ asChild, ...rest }: CommentConfirmProps) => react_jsx_runtime.JSX.Element;
|
|
111
|
+
/**
|
|
112
|
+
* Deletes a comment
|
|
113
|
+
*
|
|
114
|
+
* @description Removes the comment from the comment list
|
|
115
|
+
* @param asChild as whether to use the child as the base element instead of the default `<button>` tag. This allows for more flexibility
|
|
116
|
+
*/
|
|
67
117
|
Delete: ({ asChild, ...rest }: CommentDeleteProps) => react_jsx_runtime.JSX.Element;
|
|
118
|
+
/**
|
|
119
|
+
* Resolves a comment
|
|
120
|
+
*
|
|
121
|
+
* @description Calls `resolveComment` for this comment. Renders nothing (and logs an error) for draft and resolved comments
|
|
122
|
+
* @param asChild as whether to use the child as the base element instead of the default `<button>` tag. This allows for more flexibility
|
|
123
|
+
*/
|
|
68
124
|
Resolve: ({ asChild, ...rest }: CommentResolveProps) => react_jsx_runtime.JSX.Element | null;
|
|
125
|
+
/**
|
|
126
|
+
* Reopens a resolved comment
|
|
127
|
+
*
|
|
128
|
+
* @description Calls `reopenComment` for this comment. Renders nothing (and logs an error) for draft and published comments
|
|
129
|
+
* @param asChild as whether to use the child as the base element instead of the default `<button>` tag. This allows for more flexibility
|
|
130
|
+
*/
|
|
131
|
+
Reopen: ({ asChild, ...rest }: CommentReopenProps) => react_jsx_runtime.JSX.Element | null;
|
|
69
132
|
};
|
|
70
133
|
|
|
71
134
|
/**
|
|
@@ -73,7 +136,7 @@ declare const Comment: {
|
|
|
73
136
|
*
|
|
74
137
|
* @param initialComments as the initial comments from the document
|
|
75
138
|
*/
|
|
76
|
-
declare const CommentContextProvider: ({ children, initialComments, initialOverlayState,
|
|
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;
|
|
77
140
|
declare const useComments: () => CommentContext;
|
|
78
141
|
|
|
79
142
|
type CommentScope = {
|
|
@@ -85,4 +148,58 @@ type CommentScope = {
|
|
|
85
148
|
declare const CommentScopeContext: React.Context<CommentScope | null>;
|
|
86
149
|
declare function useCommentScope(): CommentScope;
|
|
87
150
|
|
|
88
|
-
|
|
151
|
+
interface SessionButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
152
|
+
asChild?: boolean;
|
|
153
|
+
}
|
|
154
|
+
declare const CreateSession: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
155
|
+
declare const ConfirmSession: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
156
|
+
declare const StartResolving: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
157
|
+
declare const ResolveSession: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
158
|
+
|
|
159
|
+
type FeedbackSessionProviderProps = {
|
|
160
|
+
children: ReactNode;
|
|
161
|
+
/** Resume a session, for example after a reload */
|
|
162
|
+
initialSession?: InitialFeedbackSession;
|
|
163
|
+
/** Default project id sent to onCreateSession */
|
|
164
|
+
projectId?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Whether the current user may start the resolution of a session, resolve a
|
|
167
|
+
* session, and resolve and reopen comments.
|
|
168
|
+
* @default false
|
|
169
|
+
*/
|
|
170
|
+
canResolveSession?: boolean;
|
|
171
|
+
onCreateSession?: (input: CreateSessionInput) => Promise<FeedbackSession>;
|
|
172
|
+
onConfirmSession?: (sessionId: string, type: SessionType) => Promise<void>;
|
|
173
|
+
onStartResolving?: (sessionId: string) => Promise<void>;
|
|
174
|
+
onResolveSession?: (sessionId: string) => Promise<void>;
|
|
175
|
+
onError?: (error: KnownError) => void;
|
|
176
|
+
};
|
|
177
|
+
type ActionResult = {
|
|
178
|
+
error: KnownError | null;
|
|
179
|
+
};
|
|
180
|
+
type FeedbackSessionContextType = {
|
|
181
|
+
session: ActiveFeedbackSession | null;
|
|
182
|
+
sessionState: SessionOperationState;
|
|
183
|
+
/** Mirrors the canResolveSession prop */
|
|
184
|
+
canResolve: boolean;
|
|
185
|
+
createSession: (options?: {
|
|
186
|
+
type?: SessionType;
|
|
187
|
+
user?: User | null;
|
|
188
|
+
projectId?: string;
|
|
189
|
+
}) => Promise<ActionResult>;
|
|
190
|
+
confirmSession: () => Promise<ActionResult>;
|
|
191
|
+
startResolving: () => Promise<ActionResult>;
|
|
192
|
+
resolveSession: () => Promise<ActionResult>;
|
|
193
|
+
events: SessionEvents;
|
|
194
|
+
};
|
|
195
|
+
declare const FeedbackSessionProvider: ({ children, initialSession, projectId, canResolveSession, onCreateSession, onConfirmSession, onStartResolving, onResolveSession, onError, }: FeedbackSessionProviderProps) => react_jsx_runtime.JSX.Element;
|
|
196
|
+
declare const useFeedbackSession: () => FeedbackSessionContextType;
|
|
197
|
+
|
|
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 };
|
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 } from './
|
|
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';
|
|
5
5
|
|
|
6
6
|
interface CommentOverlayProps extends HTMLProps<HTMLDivElement> {
|
|
7
7
|
children: ReactNode;
|
|
@@ -15,31 +15,42 @@ type CommentRendererProps = {
|
|
|
15
15
|
DraftComment: ElementType<{
|
|
16
16
|
comment: CommentType;
|
|
17
17
|
}>;
|
|
18
|
-
ResolvingComment: ElementType<{
|
|
19
|
-
comment: CommentType;
|
|
20
|
-
}>;
|
|
21
18
|
ResolvedComment: ElementType<{
|
|
22
19
|
comment: CommentType;
|
|
23
20
|
}>;
|
|
24
21
|
};
|
|
25
22
|
/**
|
|
23
|
+
* Comment rendering component
|
|
24
|
+
* @remarks
|
|
25
|
+
* This component is used to render all comments based on their state.
|
|
26
|
+
* This component is optional and the samen could be built using the `useComments()` hook
|
|
26
27
|
*
|
|
27
|
-
* @param
|
|
28
|
-
* @
|
|
28
|
+
* @param Comment - Component for all open comments
|
|
29
|
+
* @param DraftComment - Component for all draft comments
|
|
30
|
+
* @param ResolvedComment - Component for all resolved comments
|
|
31
|
+
* @returns mapped arrays of all comment types
|
|
32
|
+
* @description This component is used to render all comments based on their type
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <CommentRenderer
|
|
36
|
+
* Comment={MyCommentComponent}
|
|
37
|
+
* DraftComment={MyDraftCommentComponent}
|
|
38
|
+
* ResolvedComment={MyResolvedCommentComponent}
|
|
39
|
+
* />
|
|
40
|
+
* ```
|
|
29
41
|
*/
|
|
30
|
-
declare const CommentRenderer: ({ Comment, DraftComment,
|
|
42
|
+
declare const CommentRenderer: ({ Comment, DraftComment, ResolvedComment, }: CommentRendererProps) => react_jsx_runtime.JSX.Element | null;
|
|
31
43
|
|
|
32
44
|
interface CommentButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
33
45
|
asChild?: boolean;
|
|
34
46
|
}
|
|
35
47
|
declare const ToggleOverlayButton: ({ asChild, ...rest }: CommentButtonProps) => react_jsx_runtime.JSX.Element;
|
|
36
|
-
declare const ConfirmComments: ({ asChild, ...rest }: CommentButtonProps) => react_jsx_runtime.JSX.Element;
|
|
37
|
-
declare const ResolveComments: ({ asChild, ...rest }: CommentButtonProps) => react_jsx_runtime.JSX.Element;
|
|
38
48
|
|
|
39
49
|
interface CommentRootProps extends HTMLProps<HTMLDivElement> {
|
|
40
50
|
comment: CommentType;
|
|
41
|
-
children?: ReactNode;
|
|
42
51
|
defaultDraft?: string;
|
|
52
|
+
withPosition?: boolean;
|
|
53
|
+
children?: ReactNode;
|
|
43
54
|
}
|
|
44
55
|
interface CommentIndicatorProps extends HTMLProps<HTMLDivElement> {
|
|
45
56
|
}
|
|
@@ -58,14 +69,66 @@ interface CommentDeleteProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
58
69
|
interface CommentResolveProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
59
70
|
asChild?: boolean;
|
|
60
71
|
}
|
|
72
|
+
interface CommentReopenProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
73
|
+
asChild?: boolean;
|
|
74
|
+
}
|
|
61
75
|
declare const Comment: {
|
|
62
|
-
|
|
76
|
+
/**
|
|
77
|
+
* The root component for a comment, must be used to wrap all other comment components.
|
|
78
|
+
*
|
|
79
|
+
* @param comment as the current comment from the comments array
|
|
80
|
+
* @param defaultDraft as the optional initial value for the comment edit state
|
|
81
|
+
* @param withPosition as whether to inject positioning styles from the comment's position. Disable if you want to display the comment in a list. Defaults to true
|
|
82
|
+
*/
|
|
83
|
+
Root: ({ comment, defaultDraft, withPosition, children, ...rest }: CommentRootProps) => react_jsx_runtime.JSX.Element;
|
|
84
|
+
/**
|
|
85
|
+
* The comment indicator
|
|
86
|
+
*
|
|
87
|
+
* @description Shows a dashed line that indicates a section this comment relates to
|
|
88
|
+
*/
|
|
63
89
|
Indicator: ({ ...rest }: CommentIndicatorProps) => react_jsx_runtime.JSX.Element | null;
|
|
90
|
+
/**
|
|
91
|
+
* The comment's static safed content
|
|
92
|
+
*
|
|
93
|
+
* @description Displays the comment's content as a `<p>` tag
|
|
94
|
+
* @param asChild as whether to use the child as the base element instead of the default `<p>` tag. This allows for more flexibility
|
|
95
|
+
*/
|
|
64
96
|
Content: ({ asChild, ...rest }: CommentContentProps) => react_jsx_runtime.JSX.Element;
|
|
97
|
+
/**
|
|
98
|
+
* The comment's editable content
|
|
99
|
+
*
|
|
100
|
+
* @description A textarea to edit the comment's content
|
|
101
|
+
* @param asChild as whether to use the child as the base element instead of the default `<textarea>` tag. This allows for more flexibility
|
|
102
|
+
*/
|
|
65
103
|
Edit: ({ asChild, ...rest }: CommentEditProps) => react_jsx_runtime.JSX.Element;
|
|
104
|
+
/**
|
|
105
|
+
* Confirms the changes made to a comment
|
|
106
|
+
*
|
|
107
|
+
* @description Updates the comment's content with the current draft
|
|
108
|
+
* @param asChild as whether to use the child as the base element instead of the default `<button>` tag. This allows for more flexibility
|
|
109
|
+
*/
|
|
66
110
|
Confirm: ({ asChild, ...rest }: CommentConfirmProps) => react_jsx_runtime.JSX.Element;
|
|
111
|
+
/**
|
|
112
|
+
* Deletes a comment
|
|
113
|
+
*
|
|
114
|
+
* @description Removes the comment from the comment list
|
|
115
|
+
* @param asChild as whether to use the child as the base element instead of the default `<button>` tag. This allows for more flexibility
|
|
116
|
+
*/
|
|
67
117
|
Delete: ({ asChild, ...rest }: CommentDeleteProps) => react_jsx_runtime.JSX.Element;
|
|
118
|
+
/**
|
|
119
|
+
* Resolves a comment
|
|
120
|
+
*
|
|
121
|
+
* @description Calls `resolveComment` for this comment. Renders nothing (and logs an error) for draft and resolved comments
|
|
122
|
+
* @param asChild as whether to use the child as the base element instead of the default `<button>` tag. This allows for more flexibility
|
|
123
|
+
*/
|
|
68
124
|
Resolve: ({ asChild, ...rest }: CommentResolveProps) => react_jsx_runtime.JSX.Element | null;
|
|
125
|
+
/**
|
|
126
|
+
* Reopens a resolved comment
|
|
127
|
+
*
|
|
128
|
+
* @description Calls `reopenComment` for this comment. Renders nothing (and logs an error) for draft and published comments
|
|
129
|
+
* @param asChild as whether to use the child as the base element instead of the default `<button>` tag. This allows for more flexibility
|
|
130
|
+
*/
|
|
131
|
+
Reopen: ({ asChild, ...rest }: CommentReopenProps) => react_jsx_runtime.JSX.Element | null;
|
|
69
132
|
};
|
|
70
133
|
|
|
71
134
|
/**
|
|
@@ -73,7 +136,7 @@ declare const Comment: {
|
|
|
73
136
|
*
|
|
74
137
|
* @param initialComments as the initial comments from the document
|
|
75
138
|
*/
|
|
76
|
-
declare const CommentContextProvider: ({ children, initialComments, initialOverlayState,
|
|
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;
|
|
77
140
|
declare const useComments: () => CommentContext;
|
|
78
141
|
|
|
79
142
|
type CommentScope = {
|
|
@@ -85,4 +148,58 @@ type CommentScope = {
|
|
|
85
148
|
declare const CommentScopeContext: React.Context<CommentScope | null>;
|
|
86
149
|
declare function useCommentScope(): CommentScope;
|
|
87
150
|
|
|
88
|
-
|
|
151
|
+
interface SessionButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
152
|
+
asChild?: boolean;
|
|
153
|
+
}
|
|
154
|
+
declare const CreateSession: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
155
|
+
declare const ConfirmSession: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
156
|
+
declare const StartResolving: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
157
|
+
declare const ResolveSession: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
158
|
+
|
|
159
|
+
type FeedbackSessionProviderProps = {
|
|
160
|
+
children: ReactNode;
|
|
161
|
+
/** Resume a session, for example after a reload */
|
|
162
|
+
initialSession?: InitialFeedbackSession;
|
|
163
|
+
/** Default project id sent to onCreateSession */
|
|
164
|
+
projectId?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Whether the current user may start the resolution of a session, resolve a
|
|
167
|
+
* session, and resolve and reopen comments.
|
|
168
|
+
* @default false
|
|
169
|
+
*/
|
|
170
|
+
canResolveSession?: boolean;
|
|
171
|
+
onCreateSession?: (input: CreateSessionInput) => Promise<FeedbackSession>;
|
|
172
|
+
onConfirmSession?: (sessionId: string, type: SessionType) => Promise<void>;
|
|
173
|
+
onStartResolving?: (sessionId: string) => Promise<void>;
|
|
174
|
+
onResolveSession?: (sessionId: string) => Promise<void>;
|
|
175
|
+
onError?: (error: KnownError) => void;
|
|
176
|
+
};
|
|
177
|
+
type ActionResult = {
|
|
178
|
+
error: KnownError | null;
|
|
179
|
+
};
|
|
180
|
+
type FeedbackSessionContextType = {
|
|
181
|
+
session: ActiveFeedbackSession | null;
|
|
182
|
+
sessionState: SessionOperationState;
|
|
183
|
+
/** Mirrors the canResolveSession prop */
|
|
184
|
+
canResolve: boolean;
|
|
185
|
+
createSession: (options?: {
|
|
186
|
+
type?: SessionType;
|
|
187
|
+
user?: User | null;
|
|
188
|
+
projectId?: string;
|
|
189
|
+
}) => Promise<ActionResult>;
|
|
190
|
+
confirmSession: () => Promise<ActionResult>;
|
|
191
|
+
startResolving: () => Promise<ActionResult>;
|
|
192
|
+
resolveSession: () => Promise<ActionResult>;
|
|
193
|
+
events: SessionEvents;
|
|
194
|
+
};
|
|
195
|
+
declare const FeedbackSessionProvider: ({ children, initialSession, projectId, canResolveSession, onCreateSession, onConfirmSession, onStartResolving, onResolveSession, onError, }: FeedbackSessionProviderProps) => react_jsx_runtime.JSX.Element;
|
|
196
|
+
declare const useFeedbackSession: () => FeedbackSessionContextType;
|
|
197
|
+
|
|
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 };
|