@jmruthers/pace-core 0.5.108 → 0.5.109

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 (177) hide show
  1. package/CHANGELOG.md +75 -177
  2. package/dist/{AuthService-1D2ifNfa.d.ts → AuthService-DrHrvXNZ.d.ts} +8 -1
  3. package/dist/{DataTable-WFCHVWTY.js → DataTable-5HITILXS.js} +7 -7
  4. package/dist/{UnifiedAuthProvider-XU4BHFXZ.js → UnifiedAuthProvider-A7I23UCN.js} +3 -3
  5. package/dist/{api-KG4A2X7P.js → api-5I3E47G2.js} +2 -2
  6. package/dist/{chunk-DMNMZKWS.js → chunk-2W4WKJVF.js} +4 -4
  7. package/dist/{chunk-MOMYOQMC.js → chunk-3TKTL5AZ.js} +13 -13
  8. package/dist/{chunk-X4FRXJV6.js → chunk-AUXS7XSO.js} +57 -6
  9. package/dist/{chunk-X4FRXJV6.js.map → chunk-AUXS7XSO.js.map} +1 -1
  10. package/dist/{chunk-LT6RKRA7.js → chunk-D6MEKC27.js} +2 -2
  11. package/dist/{chunk-KBG34SVL.js → chunk-EYSXQ756.js} +2 -2
  12. package/dist/{chunk-ZXY5NTJB.js → chunk-EZ64QG2I.js} +2 -2
  13. package/dist/{chunk-S63MFSY6.js → chunk-F6TSYCKP.js} +4 -2
  14. package/dist/{chunk-S63MFSY6.js.map → chunk-F6TSYCKP.js.map} +1 -1
  15. package/dist/chunk-GZRXOUBE.js +176 -0
  16. package/dist/chunk-GZRXOUBE.js.map +1 -0
  17. package/dist/{chunk-B3QX32P5.js → chunk-P72NKAT5.js} +41 -24
  18. package/dist/chunk-P72NKAT5.js.map +1 -0
  19. package/dist/{chunk-VJ7MPS2K.js → chunk-S4D3Z723.js} +6 -6
  20. package/dist/{chunk-IMZGJ2X7.js → chunk-UW2DE6JX.js} +4 -4
  21. package/dist/{chunk-QDDUU625.js → chunk-WWNOVFDC.js} +4 -4
  22. package/dist/{chunk-GVRSXXAA.js → chunk-YFMENCR4.js} +3 -3
  23. package/dist/components.js +9 -9
  24. package/dist/{database-BXAfr2Y_.d.ts → database-C6jy7EOu.d.ts} +21 -9
  25. package/dist/{formatting-BiEv5oEk.d.ts → formatting-B1jSqgl-.d.ts} +16 -1
  26. package/dist/hooks.d.ts +2 -2
  27. package/dist/hooks.js +7 -7
  28. package/dist/index.d.ts +6 -6
  29. package/dist/index.js +16 -14
  30. package/dist/index.js.map +1 -1
  31. package/dist/providers.d.ts +4 -3
  32. package/dist/providers.js +2 -2
  33. package/dist/rbac/index.d.ts +1 -1
  34. package/dist/rbac/index.js +8 -8
  35. package/dist/types.d.ts +2 -2
  36. package/dist/{usePublicRouteParams-CnM-IK2I.d.ts → usePublicRouteParams-BdF8bZgs.d.ts} +1 -1
  37. package/dist/utils.d.ts +2 -15
  38. package/dist/utils.js +4 -145
  39. package/dist/utils.js.map +1 -1
  40. package/dist/validation.d.ts +1 -1
  41. package/docs/api/classes/ColumnFactory.md +1 -1
  42. package/docs/api/classes/ErrorBoundary.md +1 -1
  43. package/docs/api/classes/InvalidScopeError.md +1 -1
  44. package/docs/api/classes/MissingUserContextError.md +1 -1
  45. package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
  46. package/docs/api/classes/PermissionDeniedError.md +1 -1
  47. package/docs/api/classes/PublicErrorBoundary.md +1 -1
  48. package/docs/api/classes/RBACAuditManager.md +1 -1
  49. package/docs/api/classes/RBACCache.md +1 -1
  50. package/docs/api/classes/RBACEngine.md +1 -1
  51. package/docs/api/classes/RBACError.md +1 -1
  52. package/docs/api/classes/RBACNotInitializedError.md +1 -1
  53. package/docs/api/classes/SecureSupabaseClient.md +1 -1
  54. package/docs/api/classes/StorageUtils.md +1 -1
  55. package/docs/api/enums/FileCategory.md +1 -1
  56. package/docs/api/interfaces/AggregateConfig.md +1 -1
  57. package/docs/api/interfaces/ButtonProps.md +1 -1
  58. package/docs/api/interfaces/CardProps.md +1 -1
  59. package/docs/api/interfaces/ColorPalette.md +1 -1
  60. package/docs/api/interfaces/ColorShade.md +1 -1
  61. package/docs/api/interfaces/DataAccessRecord.md +1 -1
  62. package/docs/api/interfaces/DataRecord.md +1 -1
  63. package/docs/api/interfaces/DataTableAction.md +1 -1
  64. package/docs/api/interfaces/DataTableColumn.md +3 -3
  65. package/docs/api/interfaces/DataTableProps.md +1 -1
  66. package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
  67. package/docs/api/interfaces/EmptyStateConfig.md +1 -1
  68. package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
  69. package/docs/api/interfaces/FileDisplayProps.md +1 -1
  70. package/docs/api/interfaces/FileMetadata.md +1 -1
  71. package/docs/api/interfaces/FileReference.md +1 -1
  72. package/docs/api/interfaces/FileSizeLimits.md +1 -1
  73. package/docs/api/interfaces/FileUploadOptions.md +1 -1
  74. package/docs/api/interfaces/FileUploadProps.md +1 -1
  75. package/docs/api/interfaces/FooterProps.md +1 -1
  76. package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
  77. package/docs/api/interfaces/InputProps.md +1 -1
  78. package/docs/api/interfaces/LabelProps.md +1 -1
  79. package/docs/api/interfaces/LoginFormProps.md +1 -1
  80. package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
  81. package/docs/api/interfaces/NavigationContextType.md +1 -1
  82. package/docs/api/interfaces/NavigationGuardProps.md +1 -1
  83. package/docs/api/interfaces/NavigationItem.md +1 -1
  84. package/docs/api/interfaces/NavigationMenuProps.md +1 -1
  85. package/docs/api/interfaces/NavigationProviderProps.md +1 -1
  86. package/docs/api/interfaces/Organisation.md +1 -1
  87. package/docs/api/interfaces/OrganisationContextType.md +1 -1
  88. package/docs/api/interfaces/OrganisationMembership.md +1 -1
  89. package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
  90. package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
  91. package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
  92. package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
  93. package/docs/api/interfaces/PageAccessRecord.md +1 -1
  94. package/docs/api/interfaces/PagePermissionContextType.md +1 -1
  95. package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
  96. package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
  97. package/docs/api/interfaces/PaletteData.md +1 -1
  98. package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
  99. package/docs/api/interfaces/ProtectedRouteProps.md +1 -1
  100. package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
  101. package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
  102. package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
  103. package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
  104. package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
  105. package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
  106. package/docs/api/interfaces/RBACConfig.md +1 -1
  107. package/docs/api/interfaces/RBACLogger.md +1 -1
  108. package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
  109. package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
  110. package/docs/api/interfaces/RouteAccessRecord.md +1 -1
  111. package/docs/api/interfaces/RouteConfig.md +1 -1
  112. package/docs/api/interfaces/SecureDataContextType.md +1 -1
  113. package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
  114. package/docs/api/interfaces/StorageConfig.md +1 -1
  115. package/docs/api/interfaces/StorageFileInfo.md +1 -1
  116. package/docs/api/interfaces/StorageFileMetadata.md +1 -1
  117. package/docs/api/interfaces/StorageListOptions.md +1 -1
  118. package/docs/api/interfaces/StorageListResult.md +1 -1
  119. package/docs/api/interfaces/StorageUploadOptions.md +1 -1
  120. package/docs/api/interfaces/StorageUploadResult.md +1 -1
  121. package/docs/api/interfaces/StorageUrlOptions.md +1 -1
  122. package/docs/api/interfaces/StyleImport.md +1 -1
  123. package/docs/api/interfaces/SwitchProps.md +1 -1
  124. package/docs/api/interfaces/ToastActionElement.md +1 -1
  125. package/docs/api/interfaces/ToastProps.md +1 -1
  126. package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
  127. package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
  128. package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
  129. package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
  130. package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
  131. package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
  132. package/docs/api/interfaces/UsePublicFileDisplayOptions.md +1 -1
  133. package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
  134. package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
  135. package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
  136. package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
  137. package/docs/api/interfaces/UserEventAccess.md +1 -1
  138. package/docs/api/interfaces/UserMenuProps.md +1 -1
  139. package/docs/api/interfaces/UserProfile.md +1 -1
  140. package/docs/api/modules.md +37 -3
  141. package/docs/api-reference/hooks.md +53 -0
  142. package/docs/api-reference/providers.md +60 -0
  143. package/docs/core-concepts/authentication.md +2 -0
  144. package/docs/implementation-guides/authentication.md +1 -0
  145. package/docs/security/README.md +59 -0
  146. package/package.json +1 -1
  147. package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +2 -2
  148. package/src/components/PaceAppLayout/PaceAppLayout.tsx +48 -16
  149. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.security.test.tsx +2 -1
  150. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.unit.test.tsx +9 -9
  151. package/src/index.ts +3 -0
  152. package/src/providers/services/AuthServiceProvider.tsx +4 -3
  153. package/src/providers/services/UnifiedAuthProvider.tsx +1 -1
  154. package/src/rbac/engine.ts +2 -0
  155. package/src/services/AuthService.ts +79 -1
  156. package/src/services/__tests__/AuthService.test.ts +184 -0
  157. package/src/types/database.ts +21 -9
  158. package/src/types/rbac-functions.ts +2 -1
  159. package/src/utils/__tests__/sessionTracking.unit.test.ts +6 -171
  160. package/src/utils/sessionTracking.ts +7 -81
  161. package/dist/chunk-B3QX32P5.js.map +0 -1
  162. package/dist/chunk-NFPV7MRN.js +0 -94
  163. package/dist/chunk-NFPV7MRN.js.map +0 -1
  164. package/src/providers/AuthProvider.simplified.tsx +0 -974
  165. package/dist/{DataTable-WFCHVWTY.js.map → DataTable-5HITILXS.js.map} +0 -0
  166. package/dist/{UnifiedAuthProvider-XU4BHFXZ.js.map → UnifiedAuthProvider-A7I23UCN.js.map} +0 -0
  167. package/dist/{api-KG4A2X7P.js.map → api-5I3E47G2.js.map} +0 -0
  168. package/dist/{chunk-DMNMZKWS.js.map → chunk-2W4WKJVF.js.map} +0 -0
  169. package/dist/{chunk-MOMYOQMC.js.map → chunk-3TKTL5AZ.js.map} +0 -0
  170. package/dist/{chunk-LT6RKRA7.js.map → chunk-D6MEKC27.js.map} +0 -0
  171. package/dist/{chunk-KBG34SVL.js.map → chunk-EYSXQ756.js.map} +0 -0
  172. package/dist/{chunk-ZXY5NTJB.js.map → chunk-EZ64QG2I.js.map} +0 -0
  173. package/dist/{chunk-VJ7MPS2K.js.map → chunk-S4D3Z723.js.map} +0 -0
  174. package/dist/{chunk-IMZGJ2X7.js.map → chunk-UW2DE6JX.js.map} +0 -0
  175. package/dist/{chunk-QDDUU625.js.map → chunk-WWNOVFDC.js.map} +0 -0
  176. package/dist/{chunk-GVRSXXAA.js.map → chunk-YFMENCR4.js.map} +0 -0
  177. package/dist/{validation-D8VcbTzC.d.ts → validation-DnhrNMju.d.ts} +2 -2
package/dist/providers.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./chunk-LT6RKRA7.js";
1
+ import "./chunk-D6MEKC27.js";
2
2
  import {
3
3
  AuthServiceContext,
4
4
  AuthServiceProvider,
@@ -14,7 +14,7 @@ import {
14
14
  useInactivityService,
15
15
  useOrganisationService,
16
16
  useUnifiedAuth
17
- } from "./chunk-X4FRXJV6.js";
17
+ } from "./chunk-AUXS7XSO.js";
18
18
  import "./chunk-BDZUMRBD.js";
19
19
  import "./chunk-SMJZMKYN.js";
20
20
  import "./chunk-PLDDJCW6.js";
@@ -1,5 +1,5 @@
1
1
  import { SupabaseClient } from '@supabase/supabase-js';
2
- import { D as Database } from '../database-BXAfr2Y_.js';
2
+ import { D as Database } from '../database-C6jy7EOu.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import React__default, { ReactNode } from 'react';
5
5
 
@@ -30,7 +30,7 @@ import {
30
30
  withAccessLevelGuard,
31
31
  withPermissionGuard,
32
32
  withRoleGuard
33
- } from "../chunk-MOMYOQMC.js";
33
+ } from "../chunk-3TKTL5AZ.js";
34
34
  import {
35
35
  useAccessLevel,
36
36
  useCachedPermissions,
@@ -41,7 +41,7 @@ import {
41
41
  usePermissions,
42
42
  useRBAC,
43
43
  useResolvedScope
44
- } from "../chunk-QDDUU625.js";
44
+ } from "../chunk-WWNOVFDC.js";
45
45
  import {
46
46
  CACHE_PATTERNS,
47
47
  RBACCache,
@@ -63,7 +63,7 @@ import {
63
63
  rbacCache,
64
64
  resolveAppContext,
65
65
  setupRBAC
66
- } from "../chunk-S63MFSY6.js";
66
+ } from "../chunk-F6TSYCKP.js";
67
67
  import {
68
68
  RBACAuditManager,
69
69
  createAuditManager,
@@ -71,11 +71,11 @@ import {
71
71
  getGlobalAuditManager,
72
72
  setGlobalAuditManager
73
73
  } from "../chunk-Q7APDV6H.js";
74
- import "../chunk-GVRSXXAA.js";
75
- import "../chunk-ZXY5NTJB.js";
76
- import "../chunk-KBG34SVL.js";
77
- import "../chunk-LT6RKRA7.js";
78
- import "../chunk-X4FRXJV6.js";
74
+ import "../chunk-YFMENCR4.js";
75
+ import "../chunk-EZ64QG2I.js";
76
+ import "../chunk-EYSXQ756.js";
77
+ import "../chunk-D6MEKC27.js";
78
+ import "../chunk-AUXS7XSO.js";
79
79
  import "../chunk-JCQZ6LA7.js";
80
80
  import "../chunk-BDZUMRBD.js";
81
81
  import "../chunk-SMJZMKYN.js";
package/dist/types.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { U as User, S as Session, A as AuthError, a as UserPermissions, P as PermissionError, b as PermissionString, c as AccessLevel, d as AuthErrorCode } from './unified-DQ4VcT7H.js';
2
2
  export { D as DataRecord, t as DataTableAction, u as DataTableColumn, E as Event, s as EventContextType, r as EventTheme, q as PermissionContext, e as PermissionErrorCode, p as PermissionMap, R as RequestId, g as SessionToken, T as ThemeColors, f as UserId, j as createPermissionString, k as createRequestId, i as createSessionToken, h as createUserId, n as isPermissionString, o as isRequestId, m as isSessionToken, l as isUserId } from './unified-DQ4VcT7H.js';
3
3
  import { SupabaseClient } from '@supabase/supabase-js';
4
- export { D as Database } from './database-BXAfr2Y_.js';
5
- export { C as ChangePasswordFormValues, t as ContactFormData, F as FormData, m as LoginFormData, L as LoginFormValues, P as PasswordResetFormValues, q as ProfileFormData, o as RegistrationFormData, R as RegistrationFormValues, S as SecureLoginFormValues, k as SecurePasswordResetFormValues, j as SecureRegistrationFormValues, U as UserProfileFormValues, V as ValidationError, a as ValidationResult, g as changePasswordSchema, w as combineSchemas, i as contactFormSchema, d as dateSchema, e as emailSchema, l as loginSchema, n as nameSchema, f as passwordResetSchema, b as passwordSchema, p as phoneSchema, v as pickSchema, r as registrationSchema, c as secureLoginSchema, s as securePasswordSchema, u as urlSchema, h as userProfileSchema } from './validation-D8VcbTzC.js';
4
+ export { D as Database } from './database-C6jy7EOu.js';
5
+ export { C as ChangePasswordFormValues, t as ContactFormData, F as FormData, m as LoginFormData, L as LoginFormValues, P as PasswordResetFormValues, q as ProfileFormData, o as RegistrationFormData, R as RegistrationFormValues, S as SecureLoginFormValues, k as SecurePasswordResetFormValues, j as SecureRegistrationFormValues, U as UserProfileFormValues, V as ValidationError, a as ValidationResult, g as changePasswordSchema, w as combineSchemas, i as contactFormSchema, d as dateSchema, e as emailSchema, l as loginSchema, n as nameSchema, f as passwordResetSchema, b as passwordSchema, p as phoneSchema, v as pickSchema, r as registrationSchema, c as secureLoginSchema, s as securePasswordSchema, u as urlSchema, h as userProfileSchema } from './validation-DnhrNMju.js';
6
6
  export { S as SessionRestorationState } from './auth-DReDSLq9.js';
7
7
  export { g as BucketInfo, B as BulkUploadResult, b as FileCategory, a as FileMetadata, F as FileReference, d as FileReferenceService, f as FileReferenceWithUrl, c as FileUploadOptions, e as FileUploadResult, h as FileUrlInfo, S as StorageUploadOptions, U as UploadProgress } from './file-reference-C9isKNPn.js';
8
8
  import 'zod';
@@ -1,7 +1,7 @@
1
1
  import { b as OrganisationRole, c as OrganisationPermission, S as SuperAdminContext } from './organisation-D6qRDtbF.js';
2
2
  import { E as Event } from './unified-DQ4VcT7H.js';
3
3
  import { SupabaseClient } from '@supabase/supabase-js';
4
- import { D as Database } from './database-BXAfr2Y_.js';
4
+ import { D as Database } from './database-C6jy7EOu.js';
5
5
  import { b as FileCategory, F as FileReference } from './file-reference-C9isKNPn.js';
6
6
 
7
7
  /**
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AppConfig, S as SecureDataAccess, a as cn, j as formatCompactNumber, e as formatCurrency, f as formatDate, k as formatFileSize, h as formatNumber, i as formatPercent, g as getAppConfig, d as getCurrentAppId, b as getCurrentAppName, s as setAppConfig } from './formatting-BiEv5oEk.js';
1
+ export { A as AppConfig, S as SecureDataAccess, a as cn, j as formatCompactNumber, e as formatCurrency, f as formatDate, k as formatFileSize, h as formatNumber, i as formatPercent, g as getAppConfig, d as getCurrentAppId, b as getCurrentAppName, s as setAppConfig, u as useSessionTracking } from './formatting-B1jSqgl-.js';
2
2
  import { z } from 'zod';
3
3
  export { u as useComponentPerformance } from './useComponentPerformance-DE9l5RkL.js';
4
4
  import * as date_fns from 'date-fns';
@@ -478,19 +478,6 @@ declare class SecurityMonitor {
478
478
  }
479
479
  declare const securityMonitor: SecurityMonitor;
480
480
 
481
- /**
482
- * Hook for tracking user sessions and event interactions using the new RBAC system
483
- * @param supabaseClient - Supabase client instance
484
- * @param appName - Optional application name for tracking
485
- * @returns Object containing tracking functions
486
- */
487
- declare function useSessionTracking(supabaseClient: SupabaseClient, appName?: string): {
488
- trackLogin: (eventId?: string) => Promise<void>;
489
- trackEventSwitch: (eventId: string) => Promise<void>;
490
- trackLogout: () => Promise<void>;
491
- trackSessionExpired: () => Promise<void>;
492
- };
493
-
494
481
  /**
495
482
  * @file Audit Logger - General Utility
496
483
  *
@@ -610,4 +597,4 @@ declare function getOrganisationContext(supabase: SupabaseClient): Promise<strin
610
597
  */
611
598
  declare function isOrganisationContextAvailable(supabase: SupabaseClient): Promise<boolean>;
612
599
 
613
- export { CSP_DIRECTIVES, DebugLogger, LazyDataTable, PERFORMANCE_BUDGETS, PERFORMANCE_THRESHOLDS, type PerformanceMetrics$1 as PerformanceMetrics, PermissionType, RateLimiter, type SanitizationOptions, type SecurityEvent$1 as SecurityEvent, auditLog, auditLogger, bundleAnalyzer, clearOrganisationContext, combineSchemas, createLazyComponent, createLazyUtility, createPerformanceBenchmark, deepMerge, emailSchema, generateCSPHeader, generateDeviceFingerprint, getAppNameFromBuildTime, getAppNameFromEnvironment, getAppNameFromGlobal, getAppNameFromPackageJson, getCurrentAppNameWithFallback, getOrganisationContext, getSecurityHeaders, hasAllPermissions, hasAnyPermission, hasPermission, isEmpty, isObject, isOrganisationContextAvailable, isStrongPassword, isValidDate, isValidEmail, isValidUrl, isWithinRange, lazyCSVUtils, lazyChartUtils, lazyDateUtils, lazyFormUtils, lazyLodash, loadCSVUtils, loadChartUtils, loadDateUtils, loadFormUtils, loadLodash, logAuditEvent, logAuthEvent, logPermissionEvent, logSecurityEvent, matchesPattern, measureRenderPerformance, nameSchema, parsePermission, passwordSchema, performanceBudgetMonitor, phoneSchema, pickSchema, sanitizeEmail, sanitizeFileName, sanitizeFormData, sanitizePhoneNumber, sanitizeSqlInput, sanitizeUrl, sanitizeUserInput, sanitizeUserInput_deprecated, securityMonitor, setOrganisationContext, setRBACAppName, trackDynamicImport, transformPermissionMapToBoolean, urlSchema, useSessionTracking, usernameSchema, validateDeviceFingerprint, validateImportPattern, validateSecurityHeaders, validateUserInput };
600
+ export { CSP_DIRECTIVES, DebugLogger, LazyDataTable, PERFORMANCE_BUDGETS, PERFORMANCE_THRESHOLDS, type PerformanceMetrics$1 as PerformanceMetrics, PermissionType, RateLimiter, type SanitizationOptions, type SecurityEvent$1 as SecurityEvent, auditLog, auditLogger, bundleAnalyzer, clearOrganisationContext, combineSchemas, createLazyComponent, createLazyUtility, createPerformanceBenchmark, deepMerge, emailSchema, generateCSPHeader, generateDeviceFingerprint, getAppNameFromBuildTime, getAppNameFromEnvironment, getAppNameFromGlobal, getAppNameFromPackageJson, getCurrentAppNameWithFallback, getOrganisationContext, getSecurityHeaders, hasAllPermissions, hasAnyPermission, hasPermission, isEmpty, isObject, isOrganisationContextAvailable, isStrongPassword, isValidDate, isValidEmail, isValidUrl, isWithinRange, lazyCSVUtils, lazyChartUtils, lazyDateUtils, lazyFormUtils, lazyLodash, loadCSVUtils, loadChartUtils, loadDateUtils, loadFormUtils, loadLodash, logAuditEvent, logAuthEvent, logPermissionEvent, logSecurityEvent, matchesPattern, measureRenderPerformance, nameSchema, parsePermission, passwordSchema, performanceBudgetMonitor, phoneSchema, pickSchema, sanitizeEmail, sanitizeFileName, sanitizeFormData, sanitizePhoneNumber, sanitizeSqlInput, sanitizeUrl, sanitizeUserInput, sanitizeUserInput_deprecated, securityMonitor, setOrganisationContext, setRBACAppName, trackDynamicImport, transformPermissionMapToBoolean, urlSchema, usernameSchema, validateDeviceFingerprint, validateImportPattern, validateSecurityHeaders, validateUserInput };
package/dist/utils.js CHANGED
@@ -8,8 +8,9 @@ import {
8
8
  getAppConfig,
9
9
  getCurrentAppId,
10
10
  getCurrentAppName,
11
- setAppConfig
12
- } from "./chunk-NFPV7MRN.js";
11
+ setAppConfig,
12
+ useSessionTracking
13
+ } from "./chunk-GZRXOUBE.js";
13
14
  import {
14
15
  LoadingSpinner
15
16
  } from "./chunk-CDQ3PX7L.js";
@@ -594,7 +595,7 @@ function createLazyComponent(importFn, componentName, options = {}) {
594
595
  return WrappedComponent;
595
596
  }
596
597
  var LazyDataTable = createLazyComponent(
597
- () => import("./DataTable-WFCHVWTY.js").then((module) => ({ default: module.DataTable })),
598
+ () => import("./DataTable-5HITILXS.js").then((module) => ({ default: module.DataTable })),
598
599
  "DataTable"
599
600
  );
600
601
 
@@ -694,148 +695,6 @@ var SecurityMonitor = class {
694
695
  };
695
696
  var securityMonitor = new SecurityMonitor();
696
697
 
697
- // src/utils/sessionTracking.ts
698
- function useSessionTracking(supabaseClient, appName) {
699
- const resolveAppId = async () => {
700
- if (!appName) return void 0;
701
- try {
702
- const { data, error } = await supabaseClient.from("rbac_apps").select("id").eq("name", appName).eq("is_active", true).single();
703
- if (error || !data) {
704
- console.warn("App not found or inactive:", appName);
705
- return void 0;
706
- }
707
- return data.id;
708
- } catch (error) {
709
- console.error("Failed to resolve app ID:", error);
710
- return void 0;
711
- }
712
- };
713
- const trackLogin = async (eventId) => {
714
- try {
715
- const { data: { user } } = await supabaseClient.auth.getUser();
716
- if (!user) {
717
- console.warn("No authenticated user found for session tracking");
718
- return;
719
- }
720
- const appId = await resolveAppId();
721
- const params = {
722
- p_session_type: "login",
723
- p_event_id: eventId,
724
- p_app_id: appId
725
- };
726
- const { error } = await supabaseClient.rpc("rbac_session_track", {
727
- p_user_id: user?.id,
728
- p_session_type: params.p_session_type,
729
- p_event_id: params.p_event_id,
730
- p_app_id: params.p_app_id,
731
- p_ip_address: params.ip_address,
732
- p_user_agent: params.user_agent
733
- });
734
- if (error) {
735
- console.error("Failed to track login session:", error);
736
- } else {
737
- console.log("Login session tracked successfully");
738
- }
739
- } catch (error) {
740
- console.error("Failed to track login:", error);
741
- }
742
- };
743
- const trackEventSwitch = async (eventId) => {
744
- try {
745
- const { data: { user } } = await supabaseClient.auth.getUser();
746
- if (!user) {
747
- console.warn("No authenticated user found for session tracking");
748
- return;
749
- }
750
- const appId = await resolveAppId();
751
- const params = {
752
- p_session_type: "event_switch",
753
- p_event_id: eventId,
754
- p_app_id: appId
755
- };
756
- const { error } = await supabaseClient.rpc("rbac_session_track", {
757
- p_user_id: user?.id,
758
- p_session_type: params.p_session_type,
759
- p_event_id: params.p_event_id,
760
- p_app_id: params.p_app_id,
761
- p_ip_address: params.ip_address,
762
- p_user_agent: params.user_agent
763
- });
764
- if (error) {
765
- console.error("Failed to track event switch session:", error);
766
- } else {
767
- console.log("Event switch session tracked successfully");
768
- }
769
- } catch (error) {
770
- console.error("Failed to track event switch:", error);
771
- }
772
- };
773
- const trackLogout = async () => {
774
- try {
775
- const { data: { user } } = await supabaseClient.auth.getUser();
776
- if (!user) {
777
- console.warn("No authenticated user found for session tracking");
778
- return;
779
- }
780
- const appId = await resolveAppId();
781
- const params = {
782
- p_session_type: "logout",
783
- p_app_id: appId
784
- };
785
- const { error } = await supabaseClient.rpc("rbac_session_track", {
786
- p_user_id: user?.id,
787
- p_session_type: params.p_session_type,
788
- p_event_id: params.p_event_id,
789
- p_app_id: params.p_app_id,
790
- p_ip_address: params.ip_address,
791
- p_user_agent: params.user_agent
792
- });
793
- if (error) {
794
- console.error("Failed to track logout session:", error);
795
- } else {
796
- console.log("Logout session tracked successfully");
797
- }
798
- } catch (error) {
799
- console.error("Failed to track logout:", error);
800
- }
801
- };
802
- const trackSessionExpired = async () => {
803
- try {
804
- const { data: { user } } = await supabaseClient.auth.getUser();
805
- if (!user) {
806
- console.warn("No authenticated user found for session tracking");
807
- return;
808
- }
809
- const appId = await resolveAppId();
810
- const params = {
811
- p_session_type: "session_expired",
812
- p_app_id: appId
813
- };
814
- const { error } = await supabaseClient.rpc("rbac_session_track", {
815
- p_user_id: user?.id,
816
- p_session_type: params.p_session_type,
817
- p_event_id: params.p_event_id,
818
- p_app_id: params.p_app_id,
819
- p_ip_address: params.ip_address,
820
- p_user_agent: params.user_agent
821
- });
822
- if (error) {
823
- console.error("Failed to track session expiration:", error);
824
- } else {
825
- console.log("Session expiration tracked successfully");
826
- }
827
- } catch (error) {
828
- console.error("Failed to track session expiration:", error);
829
- }
830
- };
831
- return {
832
- trackLogin,
833
- trackEventSwitch,
834
- trackLogout,
835
- trackSessionExpired
836
- };
837
- }
838
-
839
698
  // src/utils/audit.ts
840
699
  var AuditLogger = class {
841
700
  constructor() {