@checkstack/auth-frontend 0.0.2
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/CHANGELOG.md +207 -0
- package/e2e/login.e2e.ts +63 -0
- package/package.json +34 -0
- package/playwright-report/data/774b616fd991c36e57f6aa95d67906b877dff5d1.md +20 -0
- package/playwright-report/data/d37ef869a8ef03c489f7ca3b80d67da69614c383.png +3 -0
- package/playwright-report/index.html +85 -0
- package/playwright.config.ts +5 -0
- package/src/api.ts +78 -0
- package/src/components/ApplicationsTab.tsx +452 -0
- package/src/components/AuthErrorPage.tsx +94 -0
- package/src/components/AuthSettingsPage.tsx +249 -0
- package/src/components/AuthStrategyCard.tsx +77 -0
- package/src/components/ChangePasswordPage.tsx +259 -0
- package/src/components/CreateUserDialog.tsx +156 -0
- package/src/components/ForgotPasswordPage.tsx +131 -0
- package/src/components/LoginPage.tsx +330 -0
- package/src/components/RegisterPage.tsx +350 -0
- package/src/components/ResetPasswordPage.tsx +262 -0
- package/src/components/RoleDialog.tsx +284 -0
- package/src/components/RolesTab.tsx +219 -0
- package/src/components/SocialProviderButton.tsx +30 -0
- package/src/components/StrategiesTab.tsx +276 -0
- package/src/components/UsersTab.tsx +234 -0
- package/src/hooks/useEnabledStrategies.ts +54 -0
- package/src/hooks/usePermissions.ts +43 -0
- package/src/index.test.tsx +95 -0
- package/src/index.tsx +271 -0
- package/src/lib/auth-client.ts +55 -0
- package/test-results/login-Login-Page-should-show-login-form-elements-chromium/test-failed-1.png +3 -0
- package/tsconfig.json +6 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# @checkstack/auth-frontend
|
|
2
|
+
|
|
3
|
+
## 0.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d20d274: Initial release of all @checkstack packages. Rebranded from Checkmate to Checkstack with new npm organization @checkstack and domain checkstack.dev.
|
|
8
|
+
- Updated dependencies [d20d274]
|
|
9
|
+
- @checkstack/auth-common@0.0.2
|
|
10
|
+
- @checkstack/common@0.0.2
|
|
11
|
+
- @checkstack/frontend-api@0.0.2
|
|
12
|
+
- @checkstack/ui@0.0.2
|
|
13
|
+
|
|
14
|
+
## 0.3.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- 52231ef: # Auth Settings Page Refactoring
|
|
19
|
+
|
|
20
|
+
## Auth Frontend
|
|
21
|
+
|
|
22
|
+
Refactored the `AuthSettingsPage` into modular, self-contained tab components:
|
|
23
|
+
|
|
24
|
+
- **New Components**: Created `UsersTab`, `RolesTab`, `StrategiesTab`, and `ApplicationsTab` components
|
|
25
|
+
- **Dynamic Tab Visibility**: Tabs are now conditionally shown based on user permissions
|
|
26
|
+
- **Auto-Select Logic**: Automatically selects the first available tab if the current tab becomes inaccessible
|
|
27
|
+
- **Self-Contained State**: Each tab component manages its own state, handlers, and dialogs, reducing prop drilling
|
|
28
|
+
|
|
29
|
+
## UI Package
|
|
30
|
+
|
|
31
|
+
- **Responsive Tabs**: Tabs now use column layout on small screens and row layout on medium+ screens
|
|
32
|
+
|
|
33
|
+
- a65e002: Add command palette commands and deep-linking support
|
|
34
|
+
|
|
35
|
+
**Backend Changes:**
|
|
36
|
+
|
|
37
|
+
- `healthcheck-backend`: Add "Manage Health Checks" (⇧⌘H) and "Create Health Check" commands
|
|
38
|
+
- `catalog-backend`: Add "Manage Systems" (⇧⌘S) and "Create System" commands
|
|
39
|
+
- `integration-backend`: Add "Manage Integrations" (⇧⌘G), "Create Integration Subscription", and "View Integration Logs" commands
|
|
40
|
+
- `auth-backend`: Add "Manage Users" (⇧⌘U), "Create User", "Manage Roles", and "Manage Applications" commands
|
|
41
|
+
- `command-backend`: Auto-cleanup command registrations when plugins are deregistered
|
|
42
|
+
|
|
43
|
+
**Frontend Changes:**
|
|
44
|
+
|
|
45
|
+
- `HealthCheckConfigPage`: Handle `?action=create` URL parameter
|
|
46
|
+
- `CatalogConfigPage`: Handle `?action=create` URL parameter
|
|
47
|
+
- `IntegrationsPage`: Handle `?action=create` URL parameter
|
|
48
|
+
- `AuthSettingsPage`: Handle `?tab=` and `?action=create` URL parameters
|
|
49
|
+
|
|
50
|
+
- 32ea706: ### User Menu Loading State Fix
|
|
51
|
+
|
|
52
|
+
Fixed user menu items "popping in" one after another due to independent async permission checks.
|
|
53
|
+
|
|
54
|
+
**Changes:**
|
|
55
|
+
|
|
56
|
+
- Added `UserMenuItemsContext` interface with `permissions` and `hasCredentialAccount` to `@checkstack/frontend-api`
|
|
57
|
+
- `LoginNavbarAction` now pre-fetches all permissions and credential account info before rendering the menu
|
|
58
|
+
- All user menu item components now use the passed context for synchronous permission checks instead of async hooks
|
|
59
|
+
- Uses `qualifyPermissionId` helper for fully-qualified permission IDs
|
|
60
|
+
|
|
61
|
+
**Result:** All menu items appear simultaneously when the user menu opens.
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- 54cc787: ### Fix Access Denied Flash on Page Load
|
|
66
|
+
|
|
67
|
+
Fixed the "Access Denied" screen briefly flashing when loading permission-protected pages.
|
|
68
|
+
|
|
69
|
+
**Root cause:** The `usePermissions` hook was setting `loading: false` when the session was still pending, causing a brief moment where permissions appeared to be denied.
|
|
70
|
+
|
|
71
|
+
**Changes:**
|
|
72
|
+
|
|
73
|
+
- `usePermissions` hook now waits for session to finish loading (`isPending`) before determining permission state
|
|
74
|
+
- `PageLayout` component now treats `loading=undefined` with `allowed=false` as a loading state
|
|
75
|
+
- `AuthSettingsPage` now explicitly waits for permission hooks to finish loading before checking access
|
|
76
|
+
|
|
77
|
+
**Result:** Pages show a loading spinner until permissions are fully resolved, eliminating the flash.
|
|
78
|
+
|
|
79
|
+
- a65e002: Add compile-time type safety for Lucide icon names
|
|
80
|
+
|
|
81
|
+
- Add `LucideIconName` type and `lucideIconSchema` Zod schema to `@checkstack/common`
|
|
82
|
+
- Update backend interfaces (`AuthStrategy`, `NotificationStrategy`, `IntegrationProvider`, `CommandDefinition`) to use `LucideIconName`
|
|
83
|
+
- Update RPC contracts to use `lucideIconSchema` for proper type inference across RPC boundaries
|
|
84
|
+
- Simplify `SocialProviderButton` to use `DynamicIcon` directly (removes 30+ lines of pascalCase conversion)
|
|
85
|
+
- Replace static `iconMap` in `SearchDialog` with `DynamicIcon` for dynamic icon rendering
|
|
86
|
+
- Add fallback handling in `DynamicIcon` when icon name isn't found
|
|
87
|
+
- Fix legacy kebab-case icon names to PascalCase: `mail`→`Mail`, `send`→`Send`, `github`→`Github`, `key-round`→`KeyRound`, `network`→`Network`, `AlertCircle`→`CircleAlert`
|
|
88
|
+
|
|
89
|
+
- ae33df2: Move command palette from dashboard to centered navbar position
|
|
90
|
+
|
|
91
|
+
- Converted `command-frontend` into a plugin with `NavbarCenterSlot` extension
|
|
92
|
+
- Added compact `NavbarSearch` component with responsive search trigger
|
|
93
|
+
- Moved `SearchDialog` from dashboard-frontend to command-frontend
|
|
94
|
+
- Keyboard shortcut (⌘K / Ctrl+K) now works on every page
|
|
95
|
+
- Renamed navbar slots for clarity:
|
|
96
|
+
- `NavbarSlot` → `NavbarRightSlot`
|
|
97
|
+
- `NavbarMainSlot` → `NavbarLeftSlot`
|
|
98
|
+
- Added new `NavbarCenterSlot` for centered content
|
|
99
|
+
|
|
100
|
+
- Updated dependencies [52231ef]
|
|
101
|
+
- Updated dependencies [b0124ef]
|
|
102
|
+
- Updated dependencies [54cc787]
|
|
103
|
+
- Updated dependencies [a65e002]
|
|
104
|
+
- Updated dependencies [ae33df2]
|
|
105
|
+
- Updated dependencies [32ea706]
|
|
106
|
+
- @checkstack/ui@0.1.2
|
|
107
|
+
- @checkstack/common@0.2.0
|
|
108
|
+
- @checkstack/auth-common@0.2.1
|
|
109
|
+
- @checkstack/frontend-api@0.1.0
|
|
110
|
+
|
|
111
|
+
## 0.2.1
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- 1bf71bb: Hide "Change Password" menu item for non-credential users
|
|
116
|
+
|
|
117
|
+
The change password feature now only appears in the user menu for users who have
|
|
118
|
+
a credential-based account (email/password). Users who authenticated exclusively
|
|
119
|
+
via OAuth providers (e.g., GitHub, Google) will no longer see this option since
|
|
120
|
+
they don't have a password to change.
|
|
121
|
+
|
|
122
|
+
## 0.2.0
|
|
123
|
+
|
|
124
|
+
### Minor Changes
|
|
125
|
+
|
|
126
|
+
- e26c08e: Add password change functionality for credential-authenticated users
|
|
127
|
+
|
|
128
|
+
- Add `changePassword` route to auth-common
|
|
129
|
+
- Create `ChangePasswordPage.tsx` component with password validation, current password verification, and session revocation option
|
|
130
|
+
- Add "Change Password" menu item in User Menu
|
|
131
|
+
- Reuses patterns from existing password reset flow for consistency
|
|
132
|
+
|
|
133
|
+
### Patch Changes
|
|
134
|
+
|
|
135
|
+
- Updated dependencies [e26c08e]
|
|
136
|
+
- @checkstack/auth-common@0.2.0
|
|
137
|
+
|
|
138
|
+
## 0.1.1
|
|
139
|
+
|
|
140
|
+
### Patch Changes
|
|
141
|
+
|
|
142
|
+
- 0f8cc7d: Add runtime configuration API for Docker deployments
|
|
143
|
+
|
|
144
|
+
- Backend: Add `/api/config` endpoint serving `BASE_URL` at runtime
|
|
145
|
+
- Backend: Update CORS to use `BASE_URL` and auto-allow Vite dev server
|
|
146
|
+
- Backend: `INTERNAL_URL` now defaults to `localhost:3000` (no BASE_URL fallback)
|
|
147
|
+
- Frontend API: Add `RuntimeConfigProvider` context for runtime config
|
|
148
|
+
- Frontend: Use `RuntimeConfigProvider` from `frontend-api`
|
|
149
|
+
- Auth Frontend: Add `useAuthClient()` hook using runtime config
|
|
150
|
+
|
|
151
|
+
- Updated dependencies [0f8cc7d]
|
|
152
|
+
- @checkstack/frontend-api@0.0.3
|
|
153
|
+
- @checkstack/ui@0.1.1
|
|
154
|
+
|
|
155
|
+
## 0.1.0
|
|
156
|
+
|
|
157
|
+
### Minor Changes
|
|
158
|
+
|
|
159
|
+
- 32f2535: Refactor application role assignment
|
|
160
|
+
|
|
161
|
+
- Removed role selection from the application creation dialog
|
|
162
|
+
- New applications now automatically receive the "Applications" role
|
|
163
|
+
- Roles are now manageable inline in the Applications table (similar to user role management)
|
|
164
|
+
- Added informational alert in create dialog explaining default role behavior
|
|
165
|
+
|
|
166
|
+
- b354ab3: # Strategy Instructions Support & Telegram Notification Plugin
|
|
167
|
+
|
|
168
|
+
## Strategy Instructions Interface
|
|
169
|
+
|
|
170
|
+
Added `adminInstructions` and `userInstructions` optional fields to the `NotificationStrategy` interface. These allow strategies to export markdown-formatted setup guides that are displayed in the configuration UI:
|
|
171
|
+
|
|
172
|
+
- **`adminInstructions`**: Shown when admins configure platform-wide strategy settings (e.g., how to create API keys)
|
|
173
|
+
- **`userInstructions`**: Shown when users configure their personal settings (e.g., how to link their account)
|
|
174
|
+
|
|
175
|
+
### Updated Components
|
|
176
|
+
|
|
177
|
+
- `StrategyConfigCard` now accepts an `instructions` prop and renders it before config sections
|
|
178
|
+
- `StrategyCard` passes `adminInstructions` to `StrategyConfigCard`
|
|
179
|
+
- `UserChannelCard` renders `userInstructions` when users need to connect
|
|
180
|
+
|
|
181
|
+
## New Telegram Notification Plugin
|
|
182
|
+
|
|
183
|
+
Added `@checkstack/notification-telegram-backend` plugin for sending notifications via Telegram:
|
|
184
|
+
|
|
185
|
+
- Uses [grammY](https://grammy.dev/) framework for Telegram Bot API integration
|
|
186
|
+
- Sends messages with MarkdownV2 formatting and inline keyboard buttons for actions
|
|
187
|
+
- Includes comprehensive admin instructions for bot setup via @BotFather
|
|
188
|
+
- Includes user instructions for account linking
|
|
189
|
+
|
|
190
|
+
### Configuration
|
|
191
|
+
|
|
192
|
+
Admins need to configure a Telegram Bot Token obtained from @BotFather.
|
|
193
|
+
|
|
194
|
+
### User Linking
|
|
195
|
+
|
|
196
|
+
The strategy uses `contactResolution: { type: "custom" }` for Telegram Login Widget integration. Full frontend integration for the Login Widget is pending future work.
|
|
197
|
+
|
|
198
|
+
### Patch Changes
|
|
199
|
+
|
|
200
|
+
- Updated dependencies [eff5b4e]
|
|
201
|
+
- Updated dependencies [ffc28f6]
|
|
202
|
+
- Updated dependencies [32f2535]
|
|
203
|
+
- Updated dependencies [b354ab3]
|
|
204
|
+
- @checkstack/ui@0.1.0
|
|
205
|
+
- @checkstack/common@0.1.0
|
|
206
|
+
- @checkstack/auth-common@0.1.0
|
|
207
|
+
- @checkstack/frontend-api@0.0.2
|
package/e2e/login.e2e.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
test,
|
|
3
|
+
expect,
|
|
4
|
+
} from "@checkstack/test-utils-frontend/playwright";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Sample E2E test for auth-frontend login page.
|
|
8
|
+
*
|
|
9
|
+
* Prerequisites:
|
|
10
|
+
* - Frontend dev server running: bun run dev (in packages/frontend)
|
|
11
|
+
* - Backend dev server running: bun run dev (in packages/backend)
|
|
12
|
+
*
|
|
13
|
+
* Run with: bun run test:e2e
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
test.describe("Login Page", () => {
|
|
17
|
+
test("should display the login page", async ({ page }) => {
|
|
18
|
+
await page.goto("/login");
|
|
19
|
+
|
|
20
|
+
// Check that the page title or main heading is visible
|
|
21
|
+
await expect(page.locator("h1, h2").first()).toBeVisible();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test("should show login form elements", async ({ page }) => {
|
|
25
|
+
await page.goto("/login");
|
|
26
|
+
|
|
27
|
+
// Check for common login form elements
|
|
28
|
+
// Using flexible selectors since actual implementation may vary
|
|
29
|
+
const emailInput = page.locator(
|
|
30
|
+
'input[type="email"], input[name="email"], input[placeholder*="email" i]'
|
|
31
|
+
);
|
|
32
|
+
const passwordInput = page.locator(
|
|
33
|
+
'input[type="password"], input[name="password"]'
|
|
34
|
+
);
|
|
35
|
+
const submitButton = page.locator(
|
|
36
|
+
'button[type="submit"], button:has-text("Login"), button:has-text("Sign in")'
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// At least one of these should be present for a login page
|
|
40
|
+
const hasLoginForm =
|
|
41
|
+
(await emailInput.count()) > 0 ||
|
|
42
|
+
(await passwordInput.count()) > 0 ||
|
|
43
|
+
(await submitButton.count()) > 0;
|
|
44
|
+
|
|
45
|
+
expect(hasLoginForm).toBe(true);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test("should navigate to register page from login", async ({ page }) => {
|
|
49
|
+
await page.goto("/login");
|
|
50
|
+
|
|
51
|
+
// Look for a register/sign up link
|
|
52
|
+
const registerLink = page.locator(
|
|
53
|
+
'a:has-text("Register"), a:has-text("Sign up"), a[href*="register"]'
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
if ((await registerLink.count()) > 0) {
|
|
57
|
+
await registerLink.first().click();
|
|
58
|
+
|
|
59
|
+
// Should navigate to a register page
|
|
60
|
+
await expect(page).toHaveURL(/register|signup/);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@checkstack/auth-frontend",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "src/index.tsx",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./src/index.tsx",
|
|
8
|
+
"./api": "./src/api.ts"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"typecheck": "tsc --noEmit",
|
|
12
|
+
"lint": "bun run lint:code",
|
|
13
|
+
"lint:code": "eslint . --max-warnings 0",
|
|
14
|
+
"test:e2e": "bunx playwright test"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@checkstack/frontend-api": "workspace:*",
|
|
18
|
+
"@checkstack/common": "workspace:*",
|
|
19
|
+
"@checkstack/ui": "workspace:*",
|
|
20
|
+
"react": "^18.2.0",
|
|
21
|
+
"react-router-dom": "^6.22.0",
|
|
22
|
+
"lucide-react": "^0.344.0",
|
|
23
|
+
"better-auth": "^1.1.8",
|
|
24
|
+
"@checkstack/auth-common": "workspace:*"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"typescript": "^5.0.0",
|
|
28
|
+
"@types/react": "^18.2.0",
|
|
29
|
+
"@playwright/test": "^1.49.0",
|
|
30
|
+
"@checkstack/test-utils-frontend": "workspace:*",
|
|
31
|
+
"@checkstack/tsconfig": "workspace:*",
|
|
32
|
+
"@checkstack/scripts": "workspace:*"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Page snapshot
|
|
2
|
+
|
|
3
|
+
```yaml
|
|
4
|
+
- generic [ref=e3]:
|
|
5
|
+
- banner [ref=e4]:
|
|
6
|
+
- generic [ref=e5]:
|
|
7
|
+
- link "Checkstack" [ref=e6] [cursor=pointer]:
|
|
8
|
+
- /url: /
|
|
9
|
+
- heading "Checkstack" [level=1] [ref=e7]
|
|
10
|
+
- navigation
|
|
11
|
+
- generic [ref=e8]:
|
|
12
|
+
- link "Login" [ref=e9] [cursor=pointer]:
|
|
13
|
+
- /url: /auth/login
|
|
14
|
+
- button "Login" [ref=e10]:
|
|
15
|
+
- img [ref=e11]
|
|
16
|
+
- text: Login
|
|
17
|
+
- button [ref=e16] [cursor=pointer]:
|
|
18
|
+
- img [ref=e17]
|
|
19
|
+
- main [ref=e20]
|
|
20
|
+
```
|