@jmruthers/pace-core 0.5.137 → 0.5.140
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/{DataTable-6M4L6BI2.js → DataTable-JXFCA2BJ.js} +3 -3
- package/dist/{chunk-KYRHUBIU.js → chunk-5JMOHWDI.js} +3 -3
- package/dist/{chunk-BCIBECNB.js → chunk-6DXZ6V5Q.js} +2 -2
- package/dist/{chunk-BLCXZEYF.js → chunk-BOOI7GK2.js} +36 -10
- package/dist/chunk-BOOI7GK2.js.map +1 -0
- package/dist/{chunk-HAWZXGR2.js → chunk-TLT2ZR3L.js} +2 -2
- package/dist/components.js +3 -3
- package/dist/index.js +4 -4
- package/dist/rbac/index.js +2 -2
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +17 -5
- package/dist/utils.js.map +1 -1
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +1 -1
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +1 -1
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +1 -1
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/BadgeProps.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventAppRoleData.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/ExportColumn.md +1 -1
- package/docs/api/interfaces/ExportOptions.md +1 -1
- package/docs/api/interfaces/FileDisplayProps.md +1 -1
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/GrantEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
- package/docs/api/interfaces/ProtectedRouteProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RoleManagementResult.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/SessionRestorationLoaderProps.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/SwitchProps.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +7 -7
- package/docs/getting-started/examples/basic-auth-app.md +196 -0
- package/docs/getting-started/examples/full-featured-app.md +616 -0
- package/package.json +1 -1
- package/src/rbac/hooks/useCan.test.ts +24 -0
- package/src/rbac/hooks/usePermissions.ts +49 -12
- package/src/utils/performance/bundleAnalysis.ts +17 -3
- package/dist/chunk-BLCXZEYF.js.map +0 -1
- /package/dist/{DataTable-6M4L6BI2.js.map → DataTable-JXFCA2BJ.js.map} +0 -0
- /package/dist/{chunk-KYRHUBIU.js.map → chunk-5JMOHWDI.js.map} +0 -0
- /package/dist/{chunk-BCIBECNB.js.map → chunk-6DXZ6V5Q.js.map} +0 -0
- /package/dist/{chunk-HAWZXGR2.js.map → chunk-TLT2ZR3L.js.map} +0 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Basic Authentication App
|
|
2
|
+
|
|
3
|
+
A minimal PACE Core application showing just authentication and basic UI components.
|
|
4
|
+
|
|
5
|
+
## 🎯 What This Example Shows
|
|
6
|
+
|
|
7
|
+
- Basic authentication setup
|
|
8
|
+
- Simple login/logout flow
|
|
9
|
+
- Basic dashboard with cards
|
|
10
|
+
- Responsive navigation
|
|
11
|
+
- Minimal code structure
|
|
12
|
+
|
|
13
|
+
## 📁 Project Structure
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
src/
|
|
17
|
+
├── App.tsx # Main app with providers
|
|
18
|
+
├── lib/
|
|
19
|
+
│ └── supabase.ts # Supabase client
|
|
20
|
+
├── components/
|
|
21
|
+
│ ├── LoginPage.tsx # Login form
|
|
22
|
+
│ ├── Dashboard.tsx # Simple dashboard
|
|
23
|
+
│ └── Navigation.tsx # Basic navigation
|
|
24
|
+
└── main.tsx # App entry point
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 🚀 Implementation
|
|
28
|
+
|
|
29
|
+
### 1. App.tsx - Main Application
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { UnifiedAuthProvider } from '@jmruthers/pace-core';
|
|
33
|
+
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
|
34
|
+
import { supabase } from './lib/supabase';
|
|
35
|
+
import { LoginPage } from './components/LoginPage';
|
|
36
|
+
import { Dashboard } from './components/Dashboard';
|
|
37
|
+
|
|
38
|
+
function App() {
|
|
39
|
+
return (
|
|
40
|
+
<UnifiedAuthProvider
|
|
41
|
+
supabaseClient={supabase}
|
|
42
|
+
appName="basic-auth-app"
|
|
43
|
+
>
|
|
44
|
+
<BrowserRouter>
|
|
45
|
+
<Routes>
|
|
46
|
+
<Route path="/login" element={<LoginPage />} />
|
|
47
|
+
<Route path="/" element={<Dashboard />} />
|
|
48
|
+
</Routes>
|
|
49
|
+
</BrowserRouter>
|
|
50
|
+
</UnifiedAuthProvider>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default App;
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 2. lib/supabase.ts - Supabase Client
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { createClient } from '@supabase/supabase-js';
|
|
61
|
+
|
|
62
|
+
const supabaseUrl = process.env.REACT_APP_SUPABASE_URL!;
|
|
63
|
+
const supabaseAnonKey = process.env.REACT_APP_SUPABASE_ANON_KEY!;
|
|
64
|
+
|
|
65
|
+
export const supabase = createClient(supabaseUrl, supabaseAnonKey);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 3. components/LoginPage.tsx - Login Form
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import { LoginForm, Card, CardHeader, CardTitle, CardContent } from '@jmruthers/pace-core';
|
|
72
|
+
import { useNavigate } from 'react-router-dom';
|
|
73
|
+
|
|
74
|
+
export function LoginPage() {
|
|
75
|
+
const navigate = useNavigate();
|
|
76
|
+
|
|
77
|
+
const handleLoginSuccess = () => {
|
|
78
|
+
navigate('/');
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<div className="min-h-screen flex items-center justify-center bg-sec-50">
|
|
83
|
+
<Card className="w-full max-w-md">
|
|
84
|
+
<CardHeader>
|
|
85
|
+
<CardTitle className="text-center">Welcome Back</CardTitle>
|
|
86
|
+
</CardHeader>
|
|
87
|
+
<CardContent>
|
|
88
|
+
<LoginForm onLoginSuccess={handleLoginSuccess} />
|
|
89
|
+
</CardContent>
|
|
90
|
+
</Card>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 4. components/Dashboard.tsx - Simple Dashboard
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
import { Card, CardHeader, CardTitle, CardContent, Button } from '@jmruthers/pace-core';
|
|
100
|
+
import { useUnifiedAuth } from '@jmruthers/pace-core';
|
|
101
|
+
import { useNavigate } from 'react-router-dom';
|
|
102
|
+
|
|
103
|
+
export function Dashboard() {
|
|
104
|
+
const { user, signOut } = useUnifiedAuth();
|
|
105
|
+
const navigate = useNavigate();
|
|
106
|
+
|
|
107
|
+
const handleSignOut = async () => {
|
|
108
|
+
await signOut();
|
|
109
|
+
navigate('/login');
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<div className="min-h-screen bg-sec-50 p-6">
|
|
114
|
+
<div className="max-w-4xl mx-auto">
|
|
115
|
+
{/* Header */}
|
|
116
|
+
<div className="flex justify-between items-center mb-8">
|
|
117
|
+
<h1 className="text-3xl font-bold text-sec-900">Dashboard</h1>
|
|
118
|
+
<div className="flex items-center gap-4">
|
|
119
|
+
<span className="text-sec-600">Welcome, {user?.email}</span>
|
|
120
|
+
<Button variant="outline" onClick={handleSignOut}>
|
|
121
|
+
Sign Out
|
|
122
|
+
</Button>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
{/* Content Cards */}
|
|
127
|
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
128
|
+
<Card>
|
|
129
|
+
<CardHeader>
|
|
130
|
+
<CardTitle>Getting Started</CardTitle>
|
|
131
|
+
</CardHeader>
|
|
132
|
+
<CardContent>
|
|
133
|
+
<p className="text-sec-600">
|
|
134
|
+
Welcome to your PACE Core application! This is a basic example showing authentication and UI components.
|
|
135
|
+
</p>
|
|
136
|
+
</CardContent>
|
|
137
|
+
</Card>
|
|
138
|
+
|
|
139
|
+
<Card>
|
|
140
|
+
<CardHeader>
|
|
141
|
+
<CardTitle>Next Steps</CardTitle>
|
|
142
|
+
</CardHeader>
|
|
143
|
+
<CardContent>
|
|
144
|
+
<p className="text-sec-600">
|
|
145
|
+
Explore the examples to learn about DataTables, forms, navigation, and more advanced features.
|
|
146
|
+
</p>
|
|
147
|
+
</CardContent>
|
|
148
|
+
</Card>
|
|
149
|
+
|
|
150
|
+
<Card>
|
|
151
|
+
<CardHeader>
|
|
152
|
+
<CardTitle>Resources</CardTitle>
|
|
153
|
+
</CardHeader>
|
|
154
|
+
<CardContent>
|
|
155
|
+
<p className="text-sec-600">
|
|
156
|
+
Check out the documentation for implementation guides, API reference, and best practices.
|
|
157
|
+
</p>
|
|
158
|
+
</CardContent>
|
|
159
|
+
</Card>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## 🔧 Environment Setup
|
|
168
|
+
|
|
169
|
+
Create `.env.local`:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
REACT_APP_SUPABASE_URL=https://your-project.supabase.co
|
|
173
|
+
REACT_APP_SUPABASE_ANON_KEY=your-anon-key-here
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## 🎉 What You Get
|
|
177
|
+
|
|
178
|
+
- ✅ User authentication with Supabase
|
|
179
|
+
- ✅ Protected dashboard route
|
|
180
|
+
- ✅ Responsive UI components
|
|
181
|
+
- ✅ Clean, minimal code structure
|
|
182
|
+
- ✅ Easy to extend and customize
|
|
183
|
+
|
|
184
|
+
## 🚀 Next Steps
|
|
185
|
+
|
|
186
|
+
- **Add more features** - Forms, data tables, navigation
|
|
187
|
+
- **Implement RBAC** - Role-based access control
|
|
188
|
+
- **Add organisation support** - Multi-tenant features
|
|
189
|
+
- **Explore components** - See all available UI components
|
|
190
|
+
|
|
191
|
+
## 📚 Related Documentation
|
|
192
|
+
|
|
193
|
+
- **[Quick Start](../quick-start.md)** - Build a full-featured app
|
|
194
|
+
- **[Core Concepts](../core-concepts/)** - Understand authentication and RBAC
|
|
195
|
+
- **[API Reference](../api-reference/)** - Explore all components and hooks
|
|
196
|
+
- **[Implementation Guides](../implementation-guides/)** - Advanced patterns
|