hale-commenting-system 2.0.3 → 2.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/README.md +16 -207
- package/bin/detect.d.ts +1 -0
- package/bin/detect.js +62 -0
- package/bin/generators.d.ts +18 -0
- package/bin/generators.js +193 -0
- package/bin/hale-commenting.js +4 -0
- package/bin/index.d.ts +2 -0
- package/bin/index.js +61 -0
- package/bin/onboarding.d.ts +1 -0
- package/bin/onboarding.js +170 -0
- package/bin/postinstall.d.ts +2 -0
- package/bin/postinstall.js +65 -0
- package/bin/validators.d.ts +2 -0
- package/bin/validators.js +66 -0
- package/dist/cli/detect.d.ts +1 -0
- package/dist/cli/detect.js +62 -0
- package/dist/cli/generators.d.ts +18 -0
- package/dist/cli/generators.js +193 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +61 -0
- package/dist/cli/onboarding.d.ts +1 -0
- package/dist/cli/onboarding.js +170 -0
- package/dist/cli/postinstall.d.ts +2 -0
- package/dist/cli/postinstall.js +65 -0
- package/dist/cli/validators.d.ts +2 -0
- package/dist/cli/validators.js +66 -0
- package/dist/components/CommentOverlay.d.ts +2 -0
- package/dist/components/CommentOverlay.js +101 -0
- package/dist/components/CommentPanel.d.ts +6 -0
- package/dist/components/CommentPanel.js +334 -0
- package/dist/components/CommentPin.d.ts +11 -0
- package/dist/components/CommentPin.js +64 -0
- package/dist/components/DetailsTab.d.ts +2 -0
- package/dist/components/DetailsTab.js +380 -0
- package/dist/components/FloatingWidget.d.ts +8 -0
- package/dist/components/FloatingWidget.js +128 -0
- package/dist/components/JiraTab.d.ts +2 -0
- package/dist/components/JiraTab.js +507 -0
- package/dist/contexts/CommentContext.d.ts +30 -0
- package/dist/contexts/CommentContext.js +891 -0
- package/dist/contexts/GitHubAuthContext.d.ts +13 -0
- package/dist/contexts/GitHubAuthContext.js +96 -0
- package/dist/index.d.ts +10 -97
- package/dist/index.js +26 -786
- package/dist/services/githubAdapter.d.ts +56 -0
- package/dist/services/githubAdapter.js +321 -0
- package/dist/types/index.d.ts +25 -0
- package/dist/types/index.js +2 -0
- package/dist/utils/version.d.ts +1 -0
- package/dist/utils/version.js +23 -0
- package/package.json +39 -38
- package/templates/webpack-middleware.js +226 -0
- package/cli/dist/index.js +0 -370
- package/cli/dist/index.js.map +0 -1
- package/dist/index.d.mts +0 -97
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -759
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GitHubUser } from '../services/githubAdapter';
|
|
3
|
+
interface GitHubAuthContextType {
|
|
4
|
+
user: GitHubUser | null;
|
|
5
|
+
isAuthenticated: boolean;
|
|
6
|
+
login: () => void;
|
|
7
|
+
logout: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const GitHubAuthProvider: React.FunctionComponent<{
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const useGitHubAuth: () => GitHubAuthContextType;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.useGitHubAuth = exports.GitHubAuthProvider = void 0;
|
|
37
|
+
const React = __importStar(require("react"));
|
|
38
|
+
const githubAdapter_1 = require("../services/githubAdapter");
|
|
39
|
+
const GitHubAuthContext = React.createContext(undefined);
|
|
40
|
+
const GitHubAuthProvider = ({ children }) => {
|
|
41
|
+
const [user, setUser] = React.useState(null);
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
const stored = (0, githubAdapter_1.getStoredUser)();
|
|
44
|
+
if (stored)
|
|
45
|
+
setUser(stored);
|
|
46
|
+
}, []);
|
|
47
|
+
// Handle local dev OAuth callback via hash: /#/auth-callback?token=...&login=...&avatar=...
|
|
48
|
+
React.useEffect(() => {
|
|
49
|
+
const hash = window.location.hash;
|
|
50
|
+
if (!hash.includes('#/auth-callback'))
|
|
51
|
+
return;
|
|
52
|
+
const query = hash.split('?')[1] || '';
|
|
53
|
+
const params = new URLSearchParams(query);
|
|
54
|
+
const token = params.get('token');
|
|
55
|
+
const login = params.get('login');
|
|
56
|
+
const avatar = params.get('avatar');
|
|
57
|
+
if (token && login && avatar) {
|
|
58
|
+
const decodedUser = { login, avatar: decodeURIComponent(avatar) };
|
|
59
|
+
(0, githubAdapter_1.storeGitHubAuth)(token, decodedUser);
|
|
60
|
+
setUser(decodedUser);
|
|
61
|
+
}
|
|
62
|
+
// remove hash and return to home
|
|
63
|
+
window.location.hash = '/';
|
|
64
|
+
}, []);
|
|
65
|
+
const login = () => {
|
|
66
|
+
const clientId = process.env.VITE_GITHUB_CLIENT_ID;
|
|
67
|
+
if (!clientId) {
|
|
68
|
+
// eslint-disable-next-line no-alert
|
|
69
|
+
alert('GitHub login is not configured (missing VITE_GITHUB_CLIENT_ID).');
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const redirectUri = `${window.location.origin}/api/github-oauth-callback`;
|
|
73
|
+
// Use 'repo' scope for full access (works with both public and private repos)
|
|
74
|
+
// Use 'public_repo' only if you only need public repo access
|
|
75
|
+
const scope = 'repo';
|
|
76
|
+
const url = `https://github.com/login/oauth/authorize?client_id=${encodeURIComponent(clientId)}` +
|
|
77
|
+
`&redirect_uri=${encodeURIComponent(redirectUri)}` +
|
|
78
|
+
`&scope=${encodeURIComponent(scope)}`;
|
|
79
|
+
console.log('🔑 GitHub OAuth URL:', url);
|
|
80
|
+
console.log('📋 Scope requested:', scope);
|
|
81
|
+
window.location.href = url;
|
|
82
|
+
};
|
|
83
|
+
const logout = () => {
|
|
84
|
+
(0, githubAdapter_1.clearGitHubAuth)();
|
|
85
|
+
setUser(null);
|
|
86
|
+
};
|
|
87
|
+
return (React.createElement(GitHubAuthContext.Provider, { value: { user, isAuthenticated: !!user, login, logout } }, children));
|
|
88
|
+
};
|
|
89
|
+
exports.GitHubAuthProvider = GitHubAuthProvider;
|
|
90
|
+
const useGitHubAuth = () => {
|
|
91
|
+
const ctx = React.useContext(GitHubAuthContext);
|
|
92
|
+
if (!ctx)
|
|
93
|
+
throw new Error('useGitHubAuth must be used within a GitHubAuthProvider');
|
|
94
|
+
return ctx;
|
|
95
|
+
};
|
|
96
|
+
exports.useGitHubAuth = useGitHubAuth;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,97 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
selectedThreadId: string | null;
|
|
12
|
-
onThreadSelect: (id: string | null) => void;
|
|
13
|
-
}
|
|
14
|
-
declare const CommentDrawer: React.FunctionComponent<CommentDrawerProps>;
|
|
15
|
-
|
|
16
|
-
interface Comment {
|
|
17
|
-
id: string;
|
|
18
|
-
author?: string;
|
|
19
|
-
text: string;
|
|
20
|
-
createdAt: string;
|
|
21
|
-
}
|
|
22
|
-
interface Thread {
|
|
23
|
-
id: string;
|
|
24
|
-
x: number;
|
|
25
|
-
y: number;
|
|
26
|
-
route: string;
|
|
27
|
-
comments: Comment[];
|
|
28
|
-
version?: string;
|
|
29
|
-
}
|
|
30
|
-
interface CommentContextType {
|
|
31
|
-
threads: Thread[];
|
|
32
|
-
showPins: boolean;
|
|
33
|
-
enableCommenting: boolean;
|
|
34
|
-
toggleShowPins: () => void;
|
|
35
|
-
toggleEnableCommenting: () => void;
|
|
36
|
-
addThread: (x: number, y: number, route: string, version?: string) => string;
|
|
37
|
-
addReply: (threadId: string, text: string) => void;
|
|
38
|
-
updateComment: (threadId: string, commentId: string, text: string) => void;
|
|
39
|
-
deleteComment: (threadId: string, commentId: string) => void;
|
|
40
|
-
deleteThread: (threadId: string) => void;
|
|
41
|
-
clearAllThreads: () => void;
|
|
42
|
-
getThreadsForRoute: (route: string, version?: string) => Thread[];
|
|
43
|
-
}
|
|
44
|
-
declare const CommentProvider: React.FunctionComponent<{
|
|
45
|
-
children: React.ReactNode;
|
|
46
|
-
}>;
|
|
47
|
-
declare const useComments: () => CommentContextType;
|
|
48
|
-
|
|
49
|
-
interface CommentPinProps {
|
|
50
|
-
thread: Thread;
|
|
51
|
-
onPinClick: () => void;
|
|
52
|
-
isSelected?: boolean;
|
|
53
|
-
}
|
|
54
|
-
declare const CommentPin: React.FunctionComponent<CommentPinProps>;
|
|
55
|
-
|
|
56
|
-
interface VersionContextType {
|
|
57
|
-
currentVersion: string;
|
|
58
|
-
setCurrentVersion: (version: string) => void;
|
|
59
|
-
}
|
|
60
|
-
declare const VersionProvider: React.FunctionComponent<{
|
|
61
|
-
children: React.ReactNode;
|
|
62
|
-
}>;
|
|
63
|
-
declare const useVersion: () => VersionContextType;
|
|
64
|
-
|
|
65
|
-
interface GitHubUser {
|
|
66
|
-
login: string;
|
|
67
|
-
avatar: string;
|
|
68
|
-
}
|
|
69
|
-
interface GitHubAuthContextType {
|
|
70
|
-
user: GitHubUser | null;
|
|
71
|
-
isAuthenticated: boolean;
|
|
72
|
-
login: () => void;
|
|
73
|
-
logout: () => void;
|
|
74
|
-
}
|
|
75
|
-
declare const GitHubAuthProvider: React.FC<{
|
|
76
|
-
children: React.ReactNode;
|
|
77
|
-
config?: any;
|
|
78
|
-
}>;
|
|
79
|
-
declare const useGitHubAuth: () => GitHubAuthContextType;
|
|
80
|
-
|
|
81
|
-
interface GitLabUser {
|
|
82
|
-
username?: string;
|
|
83
|
-
avatar?: string;
|
|
84
|
-
}
|
|
85
|
-
interface GitLabAuthContextType {
|
|
86
|
-
user: GitLabUser | null;
|
|
87
|
-
isAuthenticated: boolean;
|
|
88
|
-
login: () => void;
|
|
89
|
-
logout: () => void;
|
|
90
|
-
getToken: () => string | null;
|
|
91
|
-
}
|
|
92
|
-
declare const GitLabAuthProvider: React.FC<{
|
|
93
|
-
children: React.ReactNode;
|
|
94
|
-
}>;
|
|
95
|
-
declare const useGitLabAuth: () => GitLabAuthContextType;
|
|
96
|
-
|
|
97
|
-
export { type Comment, CommentDrawer, CommentOverlay, CommentPin, CommentProvider, GitHubAuthProvider, GitLabAuthProvider, type Thread, VersionProvider, useComments, useGitHubAuth, useGitLabAuth, useVersion };
|
|
1
|
+
export { CommentProvider, useComments } from './contexts/CommentContext';
|
|
2
|
+
export { GitHubAuthProvider, useGitHubAuth } from './contexts/GitHubAuthContext';
|
|
3
|
+
export { CommentOverlay } from './components/CommentOverlay';
|
|
4
|
+
export { CommentPin } from './components/CommentPin';
|
|
5
|
+
export { CommentPanel } from './components/CommentPanel';
|
|
6
|
+
export { DetailsTab } from './components/DetailsTab';
|
|
7
|
+
export { JiraTab } from './components/JiraTab';
|
|
8
|
+
export { FloatingWidget } from './components/FloatingWidget';
|
|
9
|
+
export { githubAdapter, isGitHubConfigured } from './services/githubAdapter';
|
|
10
|
+
export type { Comment, Thread, SyncStatus, ThreadStatus } from './types';
|