hale-commenting-system 1.0.2 → 1.0.4

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.ts CHANGED
@@ -1,87 +1,186 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
2
 
3
3
  interface CommentOverlayProps {
4
4
  selectedThreadId: string | null;
5
- onThreadSelect: (threadId: string | null) => void;
5
+ onThreadSelect: (id: string) => void;
6
6
  }
7
- declare const CommentOverlay: React.FC<CommentOverlayProps>;
7
+ declare const CommentOverlay: React.FunctionComponent<CommentOverlayProps>;
8
8
 
9
9
  interface CommentDrawerProps {
10
- selectedThreadId: string | null;
11
- onThreadSelect: (threadId: string | null) => void;
12
10
  children: React.ReactNode;
11
+ selectedThreadId: string | null;
12
+ onThreadSelect: (id: string | null) => void;
13
13
  }
14
- declare const CommentDrawer: React.FC<CommentDrawerProps>;
14
+ declare const CommentDrawer: React.FunctionComponent<CommentDrawerProps>;
15
15
 
16
- declare const CommentPin: React.FC;
16
+ type SyncStatus = 'synced' | 'local' | 'pending' | 'syncing' | 'error';
17
+ interface Comment {
18
+ id: string;
19
+ author?: string;
20
+ text: string;
21
+ createdAt: string;
22
+ githubCommentId?: number;
23
+ }
24
+ interface Thread {
25
+ id: string;
26
+ x: number;
27
+ y: number;
28
+ route: string;
29
+ comments: Comment[];
30
+ issueNumber?: number;
31
+ syncStatus: SyncStatus;
32
+ syncError?: string;
33
+ version?: string;
34
+ provider?: 'github' | 'gitlab';
35
+ }
36
+ interface CommentContextType {
37
+ threads: Thread[];
38
+ showPins: boolean;
39
+ enableCommenting: boolean;
40
+ toggleShowPins: () => void;
41
+ toggleEnableCommenting: () => void;
42
+ addThread: (x: number, y: number, route: string, version?: string) => string;
43
+ addReply: (threadId: string, text: string) => Promise<void>;
44
+ updateComment: (threadId: string, commentId: string, text: string) => Promise<void>;
45
+ deleteComment: (threadId: string, commentId: string) => Promise<void>;
46
+ deleteThread: (threadId: string) => Promise<void>;
47
+ clearAllThreads: () => void;
48
+ getThreadsForRoute: (route: string, version?: string) => Thread[];
49
+ syncFromGitHub: (route: string) => Promise<void>;
50
+ retrySync: () => Promise<void>;
51
+ isSyncing: boolean;
52
+ hasPendingSync: boolean;
53
+ }
54
+ declare const CommentProvider: React.FunctionComponent<{
55
+ children: React.ReactNode;
56
+ }>;
57
+ declare const useComments: () => CommentContextType;
17
58
 
18
- declare const AIAssistant: React.FC;
59
+ interface CommentPinProps {
60
+ thread: Thread;
61
+ onPinClick: () => void;
62
+ isSelected?: boolean;
63
+ }
64
+ declare const CommentPin: React.FunctionComponent<CommentPinProps>;
19
65
 
20
- declare const AIChatPanel: React.FC;
66
+ declare const AIAssistant: React.FunctionComponent;
21
67
 
22
- declare const CommentProvider: React.FC<{
23
- children: React.ReactNode;
24
- }>;
25
- declare const useComments: () => any;
68
+ declare const AIChatPanel: React.FunctionComponent;
26
69
 
27
- declare const VersionProvider: React.FC<{
70
+ interface VersionContextType {
71
+ currentVersion: string;
72
+ setCurrentVersion: (version: string) => void;
73
+ }
74
+ declare const VersionProvider: React.FunctionComponent<{
28
75
  children: React.ReactNode;
29
76
  }>;
30
- declare const useVersion: () => any;
77
+ declare const useVersion: () => VersionContextType;
31
78
 
79
+ interface GitHubUser {
80
+ login: string;
81
+ avatar: string;
82
+ }
83
+ interface GitHubAuthContextType {
84
+ user: GitHubUser | null;
85
+ isAuthenticated: boolean;
86
+ login: () => void;
87
+ logout: () => void;
88
+ }
32
89
  declare const GitHubAuthProvider: React.FC<{
33
90
  children: React.ReactNode;
34
- config?: any;
35
91
  }>;
36
- declare const useGitHubAuth: () => any;
92
+ declare const useGitHubAuth: () => GitHubAuthContextType;
37
93
 
94
+ interface GitLabUser {
95
+ username?: string;
96
+ avatar?: string;
97
+ }
98
+ interface GitLabAuthContextType {
99
+ user: GitLabUser | null;
100
+ isAuthenticated: boolean;
101
+ login: () => void;
102
+ logout: () => void;
103
+ getToken: () => string | null;
104
+ }
38
105
  declare const GitLabAuthProvider: React.FC<{
39
106
  children: React.ReactNode;
40
107
  }>;
41
- declare const useGitLabAuth: () => any;
108
+ declare const useGitLabAuth: () => GitLabAuthContextType;
42
109
 
43
- declare const AIProvider: React.FC<{
110
+ interface AIMessage {
111
+ id: string;
112
+ role: 'user' | 'bot';
113
+ content: string;
114
+ timestamp: string;
115
+ }
116
+ interface AIContextType {
117
+ isChatbotVisible: boolean;
118
+ messages: AIMessage[];
119
+ isLoading: boolean;
120
+ toggleChatbot: () => void;
121
+ sendMessage: (content: string, commentContext?: {
122
+ threads: any[];
123
+ version: string;
124
+ route?: string;
125
+ }) => Promise<void>;
126
+ clearHistory: () => void;
127
+ }
128
+ declare const AIProvider: React.FunctionComponent<{
44
129
  children: React.ReactNode;
45
130
  }>;
46
- declare const useAIContext: () => any;
131
+ declare const useAIContext: () => AIContextType;
47
132
 
48
- declare const githubAdapter: {};
49
133
  declare const isGitHubConfigured: () => boolean;
50
-
51
- declare const gitlabAdapter: {};
52
- declare const isGitLabConfigured: () => boolean;
53
-
54
- interface Comment {
55
- id: string;
56
- text: string;
57
- author: string;
58
- timestamp: Date;
59
- threadId: string;
60
- }
61
- interface Thread {
62
- id: string;
63
- comments: Comment[];
64
- position: {
65
- x: number;
66
- y: number;
67
- };
68
- status: 'open' | 'resolved';
69
- }
70
- interface SyncStatus {
71
- synced: boolean;
72
- lastSync?: Date;
134
+ interface GitHubResult<T = any> {
135
+ success: boolean;
136
+ data?: T;
73
137
  error?: string;
74
138
  }
75
- interface AIMessage {
76
- id: string;
77
- role: 'user' | 'assistant';
78
- content: string;
79
- timestamp: Date;
80
- }
81
- interface GitHubResult {
139
+ declare const githubAdapter: {
140
+ /**
141
+ * Create a new GitHub Issue for a comment thread
142
+ */
143
+ createIssue(title: string, body: string, route: string, x: number, y: number, version?: string): Promise<GitHubResult>;
144
+ /**
145
+ * Add a comment to an existing GitHub Issue
146
+ */
147
+ createComment(issueNumber: number, body: string): Promise<GitHubResult>;
148
+ /**
149
+ * Fetch all issues for a specific route
150
+ */
151
+ fetchIssues(route: string): Promise<any>;
152
+ /**
153
+ * Fetch all comments for a specific issue
154
+ */
155
+ fetchComments(issueNumber: number): Promise<any>;
156
+ /**
157
+ * Close a GitHub Issue (when deleting a thread)
158
+ */
159
+ closeIssue(issueNumber: number): Promise<GitHubResult>;
160
+ /**
161
+ * Update an existing comment on a GitHub Issue
162
+ */
163
+ updateComment(commentId: number, body: string): Promise<GitHubResult>;
164
+ /**
165
+ * Delete a comment on a GitHub Issue
166
+ */
167
+ deleteComment(commentId: number): Promise<GitHubResult>;
168
+ };
169
+
170
+ declare const isGitLabConfigured: () => boolean;
171
+ interface GitLabResult<T = any> {
82
172
  success: boolean;
83
- issueNumber?: number;
173
+ data?: T;
84
174
  error?: string;
85
175
  }
176
+ declare const gitlabAdapter: {
177
+ createIssue(title: string, body: string, route: string, x: number, y: number, version?: string): Promise<GitLabResult>;
178
+ createComment(issueNumber: number, body: string): Promise<GitLabResult>;
179
+ updateComment(commentId: number, body: string): Promise<GitLabResult>;
180
+ deleteComment(commentId: number): Promise<GitLabResult>;
181
+ closeIssue(issueNumber: number): Promise<GitLabResult>;
182
+ fetchIssues(route: string): Promise<any>;
183
+ fetchComments(issueNumber: number): Promise<any>;
184
+ };
86
185
 
87
186
  export { AIAssistant, AIChatPanel, type AIMessage, AIProvider, type Comment, CommentDrawer, CommentOverlay, CommentPin, CommentProvider, GitHubAuthProvider, type GitHubResult, GitLabAuthProvider, type SyncStatus, type Thread, VersionProvider, githubAdapter, gitlabAdapter, isGitHubConfigured, isGitLabConfigured, useAIContext, useComments, useGitHubAuth, useGitLabAuth, useVersion };