primus-saas-react 1.0.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.
Files changed (49) hide show
  1. package/DEMO.md +68 -0
  2. package/INTEGRATION.md +702 -0
  3. package/README.md +82 -0
  4. package/build_log.txt +0 -0
  5. package/dist/index.d.mts +446 -0
  6. package/dist/index.d.ts +446 -0
  7. package/dist/index.js +2513 -0
  8. package/dist/index.mjs +2445 -0
  9. package/package.json +37 -0
  10. package/postcss.config.js +6 -0
  11. package/src/components/ai/AICopilot.tsx +88 -0
  12. package/src/components/auth/PrimusLogin.tsx +149 -0
  13. package/src/components/auth/UserProfile.tsx +26 -0
  14. package/src/components/banking/accounts/AccountDashboard.tsx +67 -0
  15. package/src/components/banking/cards/CreditCardVisual.tsx +67 -0
  16. package/src/components/banking/credit/CreditScoreCard.tsx +80 -0
  17. package/src/components/banking/kyc/KYCVerification.tsx +76 -0
  18. package/src/components/banking/loans/LoanCalculator.tsx +106 -0
  19. package/src/components/banking/transactions/TransactionHistory.tsx +74 -0
  20. package/src/components/crud/PrimusDataTable.tsx +220 -0
  21. package/src/components/crud/PrimusModal.tsx +68 -0
  22. package/src/components/dashboard/PrimusDashboard.tsx +145 -0
  23. package/src/components/documents/DocumentViewer.tsx +107 -0
  24. package/src/components/featureflags/FeatureFlagToggle.tsx +64 -0
  25. package/src/components/insurance/agents/AgentDirectory.tsx +72 -0
  26. package/src/components/insurance/claims/ClaimStatusTracker.tsx +78 -0
  27. package/src/components/insurance/fraud/FraudDetectionDashboard.tsx +68 -0
  28. package/src/components/insurance/policies/PolicyCard.tsx +77 -0
  29. package/src/components/insurance/premium/PremiumCalculator.tsx +104 -0
  30. package/src/components/insurance/quotes/QuoteComparison.tsx +75 -0
  31. package/src/components/layout/PrimusHeader.tsx +75 -0
  32. package/src/components/layout/PrimusLayout.tsx +47 -0
  33. package/src/components/layout/PrimusSidebar.tsx +102 -0
  34. package/src/components/logging/LogViewer.tsx +90 -0
  35. package/src/components/notifications/NotificationFeed.tsx +106 -0
  36. package/src/components/notifications/PrimusNotificationCenter.tsx +282 -0
  37. package/src/components/payments/CheckoutForm.tsx +167 -0
  38. package/src/components/security/SecurityDashboard.tsx +83 -0
  39. package/src/components/shared/Button.tsx +36 -0
  40. package/src/components/shared/Input.tsx +36 -0
  41. package/src/components/storage/FileUploader.tsx +79 -0
  42. package/src/context/PrimusProvider.tsx +147 -0
  43. package/src/context/PrimusThemeProvider.tsx +160 -0
  44. package/src/hooks/useNotifications.ts +58 -0
  45. package/src/hooks/usePrimusAuth.ts +3 -0
  46. package/src/hooks/useRealtimeNotifications.ts +114 -0
  47. package/src/index.ts +42 -0
  48. package/tailwind.config.js +18 -0
  49. package/tsconfig.json +28 -0
package/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # @primus-saas/react
2
+
3
+ Premium React UI components for building modern SaaS applications with the Primus Framework.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @primus-saas/react
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```tsx
14
+ import { PrimusProvider, PrimusLogin } from '@primus-saas/react';
15
+
16
+ function App() {
17
+ return (
18
+ <PrimusProvider authority="https://your-auth.com" clientId="your-client-id">
19
+ <PrimusLogin allowSocial />
20
+ </PrimusProvider>
21
+ );
22
+ }
23
+ ```
24
+
25
+ ## Components
26
+
27
+ ### Platform
28
+ | Component | Description |
29
+ |-----------|-------------|
30
+ | `<PrimusLogin />` | Universal login form with social providers |
31
+ | `<UserProfile />` | User profile display with avatar |
32
+ | `<NotificationFeed />` | Real-time notification list |
33
+ | `<CheckoutForm />` | Payment checkout with card input |
34
+ | `<DocumentViewer />` | Universal document viewer (PDF, images) |
35
+
36
+ ### Banking
37
+ | Component | Description |
38
+ |-----------|-------------|
39
+ | `<CreditCardVisual />` | 3D credit card display |
40
+ | `<TransactionHistory />` | Transaction list with filters |
41
+
42
+ ### Insurance
43
+ | Component | Description |
44
+ |-----------|-------------|
45
+ | `<PolicyCard />` | Insurance policy summary |
46
+ | `<ClaimStatusTracker />` | Claim progress tracker |
47
+
48
+ ## Props Reference
49
+
50
+ ### PrimusLogin
51
+ | Prop | Type | Description |
52
+ |------|------|-------------|
53
+ | `allowSocial` | `boolean` | Enable Google/GitHub login |
54
+ | `onSuccess` | `(user) => void` | Login success callback |
55
+
56
+ ### CreditCardVisual
57
+ | Prop | Type | Description |
58
+ |------|------|-------------|
59
+ | `cardHolder` | `string` | Name on card |
60
+ | `last4` | `string` | Last 4 digits |
61
+ | `expiry` | `string` | MM/YY format |
62
+ | `variant` | `'black' \| 'gold' \| 'platinum'` | Card theme |
63
+ | `brand` | `'visa' \| 'mastercard'` | Card network |
64
+
65
+ ### CheckoutForm
66
+ | Prop | Type | Description |
67
+ |------|------|-------------|
68
+ | `amount` | `number` | Charge amount (required) |
69
+ | `onSubmit` | `() => Promise<void>` | Submit handler |
70
+
71
+ ### PolicyCard
72
+ | Prop | Type | Description |
73
+ |------|------|-------------|
74
+ | `policyNumber` | `string` | Policy ID |
75
+ | `type` | `string` | Auto, Home, Life, etc. |
76
+ | `status` | `'active' \| 'pending' \| 'expired'` | Status |
77
+ | `coverageAmount` | `number` | Coverage limit |
78
+ | `premiumAmount` | `number` | Monthly cost |
79
+
80
+ ## License
81
+
82
+ MIT © Primus SaaS Framework
package/build_log.txt ADDED
Binary file
@@ -0,0 +1,446 @@
1
+ import React, { ReactNode } from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+
4
+ declare const AccountDashboard: React.FC<{
5
+ apiUrl?: string;
6
+ }>;
7
+
8
+ declare const KYCVerification: React.FC<{
9
+ userId: string;
10
+ apiUrl?: string;
11
+ }>;
12
+
13
+ declare const LoanCalculator: React.FC<{
14
+ apiUrl?: string;
15
+ }>;
16
+
17
+ declare const CreditScoreCard: React.FC<{
18
+ userId: string;
19
+ apiUrl?: string;
20
+ }>;
21
+
22
+ declare const QuoteComparison: React.FC<{
23
+ apiUrl?: string;
24
+ }>;
25
+
26
+ declare const AgentDirectory: React.FC<{
27
+ apiUrl?: string;
28
+ }>;
29
+
30
+ declare const FraudDetectionDashboard: React.FC<{
31
+ apiUrl?: string;
32
+ }>;
33
+
34
+ declare const PremiumCalculator: React.FC<{
35
+ apiUrl?: string;
36
+ }>;
37
+
38
+ declare const AICopilot: React.FC<{
39
+ apiUrl?: string;
40
+ }>;
41
+
42
+ declare const FileUploader: React.FC<{
43
+ apiUrl?: string;
44
+ onUploadComplete?: (file: any) => void;
45
+ }>;
46
+
47
+ declare const SecurityDashboard: React.FC<{
48
+ apiUrl?: string;
49
+ }>;
50
+
51
+ interface PrimusLoginProps {
52
+ /** Custom logo URL */
53
+ logo?: string;
54
+ /** Login form title */
55
+ title?: string;
56
+ /** Show social login buttons */
57
+ allowSocial?: boolean;
58
+ /** Called after successful login */
59
+ onSuccess?: (user: any, token: string) => void;
60
+ /** Called on login failure */
61
+ onError?: (error: string) => void;
62
+ /** Show loading spinner overlay */
63
+ showLoadingOverlay?: boolean;
64
+ }
65
+ declare const PrimusLogin: React.FC<PrimusLoginProps>;
66
+
67
+ interface PrimusUser {
68
+ id?: string;
69
+ name: string;
70
+ email: string;
71
+ roles?: string[];
72
+ claims?: Record<string, any>;
73
+ }
74
+ interface PrimusAuthContextType {
75
+ isAuthenticated: boolean;
76
+ user: PrimusUser | null;
77
+ login: (credentials: {
78
+ email: string;
79
+ password: string;
80
+ } | {
81
+ provider: 'auth0' | 'azure' | 'google' | 'github';
82
+ }) => Promise<{
83
+ success: boolean;
84
+ error?: string;
85
+ }>;
86
+ logout: () => Promise<void>;
87
+ token: string | null;
88
+ isLoading: boolean;
89
+ }
90
+ interface PrimusProviderProps {
91
+ children: React.ReactNode;
92
+ /** Base URL for authentication API (e.g., http://localhost:5221) */
93
+ authority: string;
94
+ clientId: string;
95
+ redirectUri?: string;
96
+ /** Called after successful login */
97
+ onLoginSuccess?: (user: PrimusUser, token: string) => void;
98
+ /** Called on login failure */
99
+ onLoginError?: (error: string) => void;
100
+ }
101
+ declare const PrimusProvider: React.FC<PrimusProviderProps>;
102
+ declare const usePrimusAuth: () => PrimusAuthContextType;
103
+
104
+ type PrimusTheme = 'light' | 'dark';
105
+ interface ThemeColors {
106
+ bg: string;
107
+ bgSecondary: string;
108
+ bgTertiary: string;
109
+ bgHover: string;
110
+ border: string;
111
+ borderSecondary: string;
112
+ text: string;
113
+ textSecondary: string;
114
+ textMuted: string;
115
+ accent: string;
116
+ accentHover: string;
117
+ accentText: string;
118
+ badge: string;
119
+ success: string;
120
+ warning: string;
121
+ error: string;
122
+ info: string;
123
+ }
124
+ declare const themeColors: Record<PrimusTheme, ThemeColors>;
125
+ interface PrimusThemeContextValue {
126
+ theme: PrimusTheme;
127
+ colors: ThemeColors;
128
+ setTheme: (theme: PrimusTheme) => void;
129
+ toggleTheme: () => void;
130
+ }
131
+ interface PrimusThemeProviderProps {
132
+ children: ReactNode;
133
+ defaultTheme?: PrimusTheme;
134
+ }
135
+ /**
136
+ * PrimusThemeProvider - Global Theme Context for Primus UI Components
137
+ *
138
+ * Wrap your app with this provider to enable consistent theming across all Primus components.
139
+ *
140
+ * @example
141
+ * ```tsx
142
+ * <PrimusThemeProvider defaultTheme="dark">
143
+ * <App />
144
+ * </PrimusThemeProvider>
145
+ * ```
146
+ */
147
+ declare function PrimusThemeProvider({ children, defaultTheme }: PrimusThemeProviderProps): react_jsx_runtime.JSX.Element;
148
+ /**
149
+ * usePrimusTheme - Hook to access the current Primus theme
150
+ *
151
+ * @example
152
+ * ```tsx
153
+ * const { theme, colors, toggleTheme } = usePrimusTheme();
154
+ * ```
155
+ */
156
+ declare function usePrimusTheme(): PrimusThemeContextValue;
157
+ /**
158
+ * PrimusThemeToggle - A button to toggle between light and dark themes
159
+ */
160
+ declare function PrimusThemeToggle(): react_jsx_runtime.JSX.Element;
161
+
162
+ declare const NotificationFeed: React.FC;
163
+
164
+ interface PrimusNotificationCenterProps {
165
+ /** Override the theme from context (optional) */
166
+ theme?: PrimusTheme;
167
+ /** Custom API URL (optional) */
168
+ apiUrl?: string;
169
+ }
170
+ /**
171
+ * PrimusNotificationCenter - Enterprise Notification Component
172
+ *
173
+ * Features:
174
+ * - Automatic theme inheritance from PrimusThemeProvider
175
+ * - Bell icon with animated badge
176
+ * - Admin panel for sending notifications
177
+ * - Real-time polling (3 second intervals)
178
+ * - Type-specific icons and colors
179
+ *
180
+ * @example
181
+ * ```tsx
182
+ * // With theme provider (recommended)
183
+ * <PrimusThemeProvider defaultTheme="dark">
184
+ * <PrimusNotificationCenter />
185
+ * </PrimusThemeProvider>
186
+ *
187
+ * // With manual override
188
+ * <PrimusNotificationCenter theme="light" />
189
+ * ```
190
+ */
191
+ declare function PrimusNotificationCenter({ theme: themeOverride, apiUrl }: PrimusNotificationCenterProps): react_jsx_runtime.JSX.Element;
192
+ declare const NotificationBell: typeof PrimusNotificationCenter;
193
+ declare const PrimusNotifications: typeof PrimusNotificationCenter;
194
+
195
+ interface Notification {
196
+ id: string;
197
+ title: string;
198
+ message: string;
199
+ type: 'info' | 'success' | 'warning' | 'error';
200
+ timestamp: string;
201
+ read: boolean;
202
+ }
203
+ declare const useNotifications: (apiUrl?: string) => {
204
+ notifications: Notification[];
205
+ unreadCount: number;
206
+ loading: boolean;
207
+ markAsRead: (id: string) => void;
208
+ markAllAsRead: () => void;
209
+ refresh: () => Promise<void>;
210
+ };
211
+
212
+ interface PrimusNotification {
213
+ id: string;
214
+ title: string;
215
+ message: string;
216
+ type: 'info' | 'success' | 'warning' | 'error';
217
+ timestamp: string;
218
+ read: boolean;
219
+ }
220
+ interface UseRealtimeNotificationsOptions {
221
+ apiUrl: string;
222
+ pollInterval?: number;
223
+ userId?: string;
224
+ }
225
+ /**
226
+ * Hook for managing real-time notifications from Primus Backend.
227
+ * Supports both polling and SignalR (when available).
228
+ */
229
+ declare const useRealtimeNotifications: (options: UseRealtimeNotificationsOptions) => {
230
+ notifications: PrimusNotification[];
231
+ unreadCount: number;
232
+ loading: boolean;
233
+ error: string | null;
234
+ sendNotification: (title: string, message: string, type?: "info" | "success" | "warning" | "error") => Promise<boolean>;
235
+ markAsRead: (id: string) => Promise<void>;
236
+ markAllAsRead: () => Promise<void>;
237
+ deleteNotification: (id: string) => Promise<void>;
238
+ refresh: () => Promise<void>;
239
+ };
240
+
241
+ interface CheckoutFormProps {
242
+ amount: number;
243
+ currency?: string;
244
+ apiUrl?: string;
245
+ onSuccess?: (result: any) => void;
246
+ onError?: (error: string) => void;
247
+ }
248
+ declare const CheckoutForm: React.FC<CheckoutFormProps>;
249
+
250
+ interface Document {
251
+ id: string;
252
+ name: string;
253
+ type: 'pdf' | 'image' | 'text';
254
+ url: string;
255
+ size?: string;
256
+ date?: string;
257
+ }
258
+ interface DocumentViewerProps {
259
+ document: Document;
260
+ onClose?: () => void;
261
+ onDownload?: () => void;
262
+ }
263
+ declare const DocumentViewer: React.FC<DocumentViewerProps>;
264
+
265
+ interface CreditCardProps {
266
+ cardHolder: string;
267
+ last4: string;
268
+ expiry: string;
269
+ brand?: 'visa' | 'mastercard' | 'amex';
270
+ variant?: 'black' | 'blue' | 'gold' | 'platinum';
271
+ }
272
+ declare const CreditCardVisual: React.FC<CreditCardProps>;
273
+
274
+ interface Transaction {
275
+ id: string;
276
+ description: string;
277
+ amount: number;
278
+ date: string;
279
+ type: 'credit' | 'debit';
280
+ category?: 'shopping' | 'transfer' | 'food' | 'other';
281
+ status?: 'pending' | 'completed' | 'failed';
282
+ }
283
+ interface TransactionHistoryProps {
284
+ transactions: Transaction[];
285
+ onTransactionClick?: (id: string) => void;
286
+ }
287
+ declare const TransactionHistory: React.FC<TransactionHistoryProps>;
288
+
289
+ interface PolicyProps {
290
+ policyNumber: string;
291
+ type: string;
292
+ status: 'active' | 'expired' | 'pending';
293
+ coverageAmount: number;
294
+ nextPaymentDate: string;
295
+ premiumAmount: number;
296
+ }
297
+ declare const PolicyCard: React.FC<PolicyProps>;
298
+
299
+ interface ClaimStep {
300
+ id: string;
301
+ label: string;
302
+ status: 'completed' | 'current' | 'upcoming';
303
+ date?: string;
304
+ }
305
+ interface ClaimStatusTrackerProps {
306
+ claimId: string;
307
+ steps: ClaimStep[];
308
+ }
309
+ declare const ClaimStatusTracker: React.FC<ClaimStatusTrackerProps>;
310
+
311
+ interface FeatureFlag {
312
+ name: string;
313
+ enabled: boolean;
314
+ description: string;
315
+ rolloutPercentage?: number;
316
+ }
317
+ declare const FeatureFlagToggle: React.FC<{
318
+ apiUrl?: string;
319
+ }>;
320
+
321
+ declare const LogViewer: React.FC<{
322
+ apiUrl?: string;
323
+ }>;
324
+
325
+ interface PrimusLayoutProps {
326
+ children: React.ReactNode;
327
+ sidebar?: React.ReactNode;
328
+ header?: React.ReactNode;
329
+ /** Dark mode */
330
+ darkMode?: boolean;
331
+ }
332
+ declare const PrimusLayout: React.FC<PrimusLayoutProps>;
333
+
334
+ interface SidebarItem {
335
+ id: string;
336
+ label: string;
337
+ icon?: React.ReactNode;
338
+ href?: string;
339
+ onClick?: () => void;
340
+ active?: boolean;
341
+ badge?: string | number;
342
+ }
343
+ interface PrimusSidebarProps {
344
+ /** App logo or title */
345
+ logo?: React.ReactNode;
346
+ /** Navigation items */
347
+ items: SidebarItem[];
348
+ /** Footer content */
349
+ footer?: React.ReactNode;
350
+ /** Callback when item clicked */
351
+ onItemClick?: (item: SidebarItem) => void;
352
+ /** Currently active item id */
353
+ activeId?: string;
354
+ }
355
+ declare const PrimusSidebar: React.FC<PrimusSidebarProps>;
356
+
357
+ interface PrimusHeaderProps {
358
+ /** Page title */
359
+ title?: string;
360
+ /** Breadcrumb items */
361
+ breadcrumbs?: {
362
+ label: string;
363
+ href?: string;
364
+ }[];
365
+ /** Right side actions */
366
+ actions?: React.ReactNode;
367
+ /** User info/avatar */
368
+ user?: {
369
+ name: string;
370
+ email?: string;
371
+ avatar?: string;
372
+ };
373
+ /** On user click */
374
+ onUserClick?: () => void;
375
+ }
376
+ declare const PrimusHeader: React.FC<PrimusHeaderProps>;
377
+
378
+ interface Column<T> {
379
+ key: keyof T | string;
380
+ header: string;
381
+ render?: (value: any, row: T) => React.ReactNode;
382
+ sortable?: boolean;
383
+ width?: string;
384
+ }
385
+ interface PrimusDataTableProps<T> {
386
+ data: T[];
387
+ columns: Column<T>[];
388
+ /** Row key field */
389
+ rowKey: keyof T;
390
+ /** Loading state */
391
+ loading?: boolean;
392
+ /** Enable row selection */
393
+ selectable?: boolean;
394
+ /** Selected row keys */
395
+ selectedKeys?: (string | number)[];
396
+ /** On selection change */
397
+ onSelectionChange?: (keys: (string | number)[]) => void;
398
+ /** On row click */
399
+ onRowClick?: (row: T) => void;
400
+ /** Actions column renderer */
401
+ actions?: (row: T) => React.ReactNode;
402
+ /** Empty state message */
403
+ emptyMessage?: string;
404
+ /** Search placeholder */
405
+ searchPlaceholder?: string;
406
+ /** Enable search */
407
+ searchable?: boolean;
408
+ }
409
+ declare function PrimusDataTable<T extends Record<string, any>>({ data, columns, rowKey, loading, selectable, selectedKeys, onSelectionChange, onRowClick, actions, emptyMessage, searchPlaceholder, searchable, }: PrimusDataTableProps<T>): react_jsx_runtime.JSX.Element;
410
+
411
+ interface PrimusModalProps {
412
+ open: boolean;
413
+ onClose: () => void;
414
+ title?: string;
415
+ children: React.ReactNode;
416
+ footer?: React.ReactNode;
417
+ size?: 'sm' | 'md' | 'lg' | 'xl';
418
+ }
419
+ declare const PrimusModal: React.FC<PrimusModalProps>;
420
+
421
+ interface StatCardProps {
422
+ title: string;
423
+ value: string | number;
424
+ change?: {
425
+ value: number;
426
+ type: 'increase' | 'decrease' | 'neutral';
427
+ };
428
+ icon?: React.ReactNode;
429
+ description?: string;
430
+ trend?: number[];
431
+ }
432
+ declare const PrimusStatCard: React.FC<StatCardProps>;
433
+ interface PrimusDashboardProps {
434
+ children: React.ReactNode;
435
+ title?: string;
436
+ subtitle?: string;
437
+ actions?: React.ReactNode;
438
+ }
439
+ declare const PrimusDashboard: React.FC<PrimusDashboardProps>;
440
+ interface DashboardGridProps {
441
+ children: React.ReactNode;
442
+ columns?: 1 | 2 | 3 | 4;
443
+ }
444
+ declare const DashboardGrid: React.FC<DashboardGridProps>;
445
+
446
+ export { AICopilot, AccountDashboard, AgentDirectory, CheckoutForm, CheckoutFormProps, ClaimStatusTracker, ClaimStatusTrackerProps, ClaimStep, Column, CreditCardProps, CreditCardVisual, CreditScoreCard, DashboardGrid, DashboardGridProps, Document, DocumentViewer, DocumentViewerProps, FeatureFlag, FeatureFlagToggle, FileUploader, FraudDetectionDashboard, KYCVerification, LoanCalculator, LogViewer, Notification, NotificationBell, NotificationFeed, PolicyCard, PolicyProps, PremiumCalculator, PrimusDashboard, PrimusDashboardProps, PrimusDataTable, PrimusDataTableProps, PrimusHeader, PrimusHeaderProps, PrimusLayout, PrimusLayoutProps, PrimusLogin, PrimusLoginProps, PrimusModal, PrimusModalProps, PrimusNotification, PrimusNotificationCenter, PrimusNotifications, PrimusProvider, PrimusProviderProps, PrimusSidebar, PrimusSidebarProps, PrimusStatCard, PrimusTheme, PrimusThemeProvider, PrimusThemeToggle, QuoteComparison, SecurityDashboard, SidebarItem, StatCardProps, Transaction, TransactionHistory, TransactionHistoryProps, UseRealtimeNotificationsOptions, themeColors, useNotifications, usePrimusAuth, usePrimusTheme, useRealtimeNotifications };