@checkmate-monitor/auth-frontend 0.1.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/CHANGELOG.md +55 -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 +77 -0
- package/src/components/AuthErrorPage.tsx +94 -0
- package/src/components/AuthSettingsPage.tsx +1206 -0
- package/src/components/AuthStrategyCard.tsx +73 -0
- package/src/components/CreateUserDialog.tsx +156 -0
- package/src/components/ForgotPasswordPage.tsx +130 -0
- package/src/components/LoginPage.tsx +302 -0
- package/src/components/RegisterPage.tsx +349 -0
- package/src/components/ResetPasswordPage.tsx +261 -0
- package/src/components/RoleDialog.tsx +284 -0
- package/src/components/SocialProviderButton.tsx +55 -0
- package/src/hooks/useEnabledStrategies.ts +54 -0
- package/src/hooks/usePermissions.ts +36 -0
- package/src/index.test.tsx +95 -0
- package/src/index.tsx +241 -0
- package/src/lib/auth-client.ts +6 -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,55 @@
|
|
|
1
|
+
# @checkmate-monitor/auth-frontend
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 32f2535: Refactor application role assignment
|
|
8
|
+
|
|
9
|
+
- Removed role selection from the application creation dialog
|
|
10
|
+
- New applications now automatically receive the "Applications" role
|
|
11
|
+
- Roles are now manageable inline in the Applications table (similar to user role management)
|
|
12
|
+
- Added informational alert in create dialog explaining default role behavior
|
|
13
|
+
|
|
14
|
+
- b354ab3: # Strategy Instructions Support & Telegram Notification Plugin
|
|
15
|
+
|
|
16
|
+
## Strategy Instructions Interface
|
|
17
|
+
|
|
18
|
+
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:
|
|
19
|
+
|
|
20
|
+
- **`adminInstructions`**: Shown when admins configure platform-wide strategy settings (e.g., how to create API keys)
|
|
21
|
+
- **`userInstructions`**: Shown when users configure their personal settings (e.g., how to link their account)
|
|
22
|
+
|
|
23
|
+
### Updated Components
|
|
24
|
+
|
|
25
|
+
- `StrategyConfigCard` now accepts an `instructions` prop and renders it before config sections
|
|
26
|
+
- `StrategyCard` passes `adminInstructions` to `StrategyConfigCard`
|
|
27
|
+
- `UserChannelCard` renders `userInstructions` when users need to connect
|
|
28
|
+
|
|
29
|
+
## New Telegram Notification Plugin
|
|
30
|
+
|
|
31
|
+
Added `@checkmate-monitor/notification-telegram-backend` plugin for sending notifications via Telegram:
|
|
32
|
+
|
|
33
|
+
- Uses [grammY](https://grammy.dev/) framework for Telegram Bot API integration
|
|
34
|
+
- Sends messages with MarkdownV2 formatting and inline keyboard buttons for actions
|
|
35
|
+
- Includes comprehensive admin instructions for bot setup via @BotFather
|
|
36
|
+
- Includes user instructions for account linking
|
|
37
|
+
|
|
38
|
+
### Configuration
|
|
39
|
+
|
|
40
|
+
Admins need to configure a Telegram Bot Token obtained from @BotFather.
|
|
41
|
+
|
|
42
|
+
### User Linking
|
|
43
|
+
|
|
44
|
+
The strategy uses `contactResolution: { type: "custom" }` for Telegram Login Widget integration. Full frontend integration for the Login Widget is pending future work.
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- Updated dependencies [eff5b4e]
|
|
49
|
+
- Updated dependencies [ffc28f6]
|
|
50
|
+
- Updated dependencies [32f2535]
|
|
51
|
+
- Updated dependencies [b354ab3]
|
|
52
|
+
- @checkmate-monitor/ui@0.1.0
|
|
53
|
+
- @checkmate-monitor/common@0.1.0
|
|
54
|
+
- @checkmate-monitor/auth-common@0.1.0
|
|
55
|
+
- @checkmate-monitor/frontend-api@0.0.2
|
package/e2e/login.e2e.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
test,
|
|
3
|
+
expect,
|
|
4
|
+
} from "@checkmate-monitor/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": "@checkmate-monitor/auth-frontend",
|
|
3
|
+
"version": "0.1.0",
|
|
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
|
+
"@checkmate-monitor/frontend-api": "workspace:*",
|
|
18
|
+
"@checkmate-monitor/common": "workspace:*",
|
|
19
|
+
"@checkmate-monitor/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
|
+
"@checkmate-monitor/auth-common": "workspace:*"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"typescript": "^5.0.0",
|
|
28
|
+
"@types/react": "^18.2.0",
|
|
29
|
+
"@playwright/test": "^1.49.0",
|
|
30
|
+
"@checkmate-monitor/test-utils-frontend": "workspace:*",
|
|
31
|
+
"@checkmate-monitor/tsconfig": "workspace:*",
|
|
32
|
+
"@checkmate-monitor/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 "Checkmate" [ref=e6] [cursor=pointer]:
|
|
8
|
+
- /url: /
|
|
9
|
+
- heading "Checkmate" [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
|
+
```
|