@jmruthers/pace-core 0.5.140 → 0.5.142

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 (180) hide show
  1. package/README.md +2 -2
  2. package/dist/{DataTable-JXFCA2BJ.js → DataTable-SKCX4SCB.js} +6 -6
  3. package/dist/{EventLogo-rFL_kRjk.d.ts → EventLogo-B3V3otev.d.ts} +307 -1
  4. package/dist/{UnifiedAuthProvider-XIQQ7LVU.js → UnifiedAuthProvider-BMJAP6Z7.js} +3 -3
  5. package/dist/{chunk-22WKWKRX.js → chunk-2AKRP5QZ.js} +4 -4
  6. package/dist/{chunk-4C7EXCAR.js → chunk-CRGFNQ2L.js} +4 -4
  7. package/dist/{chunk-TLT2ZR3L.js → chunk-E6ZCVF4T.js} +4 -4
  8. package/dist/{chunk-INQLMHPF.js → chunk-ERGKJX4D.js} +2 -2
  9. package/dist/{chunk-6LAAY47Q.js → chunk-MSHEVJXS.js} +2 -2
  10. package/dist/{chunk-MA6EPSGZ.js → chunk-PKW27QVS.js} +2 -2
  11. package/dist/{chunk-T6JN6LH6.js → chunk-R53TUSFK.js} +3 -3
  12. package/dist/{chunk-6DXZ6V5Q.js → chunk-SFVL7ZFI.js} +5 -5
  13. package/dist/{chunk-5JMOHWDI.js → chunk-TUJSIWX6.js} +497 -329
  14. package/dist/chunk-TUJSIWX6.js.map +1 -0
  15. package/dist/{chunk-BOOI7GK2.js → chunk-VOJBGZYI.js} +119 -3
  16. package/dist/chunk-VOJBGZYI.js.map +1 -0
  17. package/dist/{chunk-YCWDTTUK.js → chunk-WM26XK7I.js} +22 -8
  18. package/dist/chunk-WM26XK7I.js.map +1 -0
  19. package/dist/components.d.ts +3 -1
  20. package/dist/components.js +20 -8
  21. package/dist/components.js.map +1 -1
  22. package/dist/hooks.js +7 -7
  23. package/dist/index.d.ts +4 -2
  24. package/dist/index.js +25 -11
  25. package/dist/index.js.map +1 -1
  26. package/dist/providers.js +2 -2
  27. package/dist/rbac/index.d.ts +94 -1
  28. package/dist/rbac/index.js +9 -7
  29. package/dist/utils.js +1 -1
  30. package/docs/api/README.md +2 -2
  31. package/docs/api/classes/ColumnFactory.md +1 -1
  32. package/docs/api/classes/ErrorBoundary.md +1 -1
  33. package/docs/api/classes/InvalidScopeError.md +1 -1
  34. package/docs/api/classes/MissingUserContextError.md +1 -1
  35. package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
  36. package/docs/api/classes/PermissionDeniedError.md +1 -1
  37. package/docs/api/classes/PublicErrorBoundary.md +1 -1
  38. package/docs/api/classes/RBACAuditManager.md +1 -1
  39. package/docs/api/classes/RBACCache.md +1 -1
  40. package/docs/api/classes/RBACEngine.md +1 -1
  41. package/docs/api/classes/RBACError.md +1 -1
  42. package/docs/api/classes/RBACNotInitializedError.md +1 -1
  43. package/docs/api/classes/SecureSupabaseClient.md +1 -1
  44. package/docs/api/classes/StorageUtils.md +1 -1
  45. package/docs/api/enums/FileCategory.md +1 -1
  46. package/docs/api/interfaces/AggregateConfig.md +1 -1
  47. package/docs/api/interfaces/BadgeProps.md +1 -1
  48. package/docs/api/interfaces/ButtonProps.md +1 -1
  49. package/docs/api/interfaces/CalendarProps.md +40 -0
  50. package/docs/api/interfaces/CardProps.md +1 -1
  51. package/docs/api/interfaces/ColorPalette.md +1 -1
  52. package/docs/api/interfaces/ColorShade.md +1 -1
  53. package/docs/api/interfaces/DataAccessRecord.md +1 -1
  54. package/docs/api/interfaces/DataRecord.md +1 -1
  55. package/docs/api/interfaces/DataTableAction.md +1 -1
  56. package/docs/api/interfaces/DataTableColumn.md +1 -1
  57. package/docs/api/interfaces/DataTableProps.md +1 -1
  58. package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
  59. package/docs/api/interfaces/EmptyStateConfig.md +1 -1
  60. package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
  61. package/docs/api/interfaces/EventAppRoleData.md +1 -1
  62. package/docs/api/interfaces/EventLogoProps.md +1 -1
  63. package/docs/api/interfaces/ExportColumn.md +1 -1
  64. package/docs/api/interfaces/ExportOptions.md +1 -1
  65. package/docs/api/interfaces/FileDisplayProps.md +1 -1
  66. package/docs/api/interfaces/FileMetadata.md +1 -1
  67. package/docs/api/interfaces/FileReference.md +1 -1
  68. package/docs/api/interfaces/FileSizeLimits.md +1 -1
  69. package/docs/api/interfaces/FileUploadOptions.md +1 -1
  70. package/docs/api/interfaces/FileUploadProps.md +1 -1
  71. package/docs/api/interfaces/FooterProps.md +1 -1
  72. package/docs/api/interfaces/GrantEventAppRoleParams.md +1 -1
  73. package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
  74. package/docs/api/interfaces/InputProps.md +1 -1
  75. package/docs/api/interfaces/LabelProps.md +1 -1
  76. package/docs/api/interfaces/LoginFormProps.md +1 -1
  77. package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
  78. package/docs/api/interfaces/NavigationContextType.md +1 -1
  79. package/docs/api/interfaces/NavigationGuardProps.md +1 -1
  80. package/docs/api/interfaces/NavigationItem.md +1 -1
  81. package/docs/api/interfaces/NavigationMenuProps.md +1 -1
  82. package/docs/api/interfaces/NavigationProviderProps.md +1 -1
  83. package/docs/api/interfaces/Organisation.md +1 -1
  84. package/docs/api/interfaces/OrganisationContextType.md +1 -1
  85. package/docs/api/interfaces/OrganisationMembership.md +1 -1
  86. package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
  87. package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
  88. package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
  89. package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
  90. package/docs/api/interfaces/PageAccessRecord.md +1 -1
  91. package/docs/api/interfaces/PagePermissionContextType.md +1 -1
  92. package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
  93. package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
  94. package/docs/api/interfaces/PaletteData.md +1 -1
  95. package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
  96. package/docs/api/interfaces/ProtectedRouteProps.md +1 -1
  97. package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
  98. package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
  99. package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
  100. package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
  101. package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
  102. package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
  103. package/docs/api/interfaces/RBACConfig.md +1 -1
  104. package/docs/api/interfaces/RBACLogger.md +1 -1
  105. package/docs/api/interfaces/ResourcePermissions.md +155 -0
  106. package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
  107. package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
  108. package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
  109. package/docs/api/interfaces/RoleManagementResult.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/SessionRestorationLoaderProps.md +1 -1
  115. package/docs/api/interfaces/StorageConfig.md +1 -1
  116. package/docs/api/interfaces/StorageFileInfo.md +1 -1
  117. package/docs/api/interfaces/StorageFileMetadata.md +1 -1
  118. package/docs/api/interfaces/StorageListOptions.md +1 -1
  119. package/docs/api/interfaces/StorageListResult.md +1 -1
  120. package/docs/api/interfaces/StorageUploadOptions.md +1 -1
  121. package/docs/api/interfaces/StorageUploadResult.md +1 -1
  122. package/docs/api/interfaces/StorageUrlOptions.md +1 -1
  123. package/docs/api/interfaces/StyleImport.md +1 -1
  124. package/docs/api/interfaces/SwitchProps.md +1 -1
  125. package/docs/api/interfaces/TabsContentProps.md +9 -0
  126. package/docs/api/interfaces/TabsListProps.md +9 -0
  127. package/docs/api/interfaces/TabsProps.md +9 -0
  128. package/docs/api/interfaces/TabsTriggerProps.md +9 -0
  129. package/docs/api/interfaces/TextareaProps.md +53 -0
  130. package/docs/api/interfaces/ToastActionElement.md +1 -1
  131. package/docs/api/interfaces/ToastProps.md +1 -1
  132. package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
  133. package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
  134. package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
  135. package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
  136. package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
  137. package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
  138. package/docs/api/interfaces/UsePublicFileDisplayOptions.md +1 -1
  139. package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
  140. package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
  141. package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
  142. package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
  143. package/docs/api/interfaces/UseResourcePermissionsOptions.md +34 -0
  144. package/docs/api/interfaces/UserEventAccess.md +1 -1
  145. package/docs/api/interfaces/UserMenuProps.md +1 -1
  146. package/docs/api/interfaces/UserProfile.md +1 -1
  147. package/docs/api/modules.md +289 -2
  148. package/docs/rbac/README.md +2 -1
  149. package/docs/rbac/event-based-apps.md +872 -0
  150. package/package.json +3 -1
  151. package/src/components/Calendar/Calendar.test.tsx +338 -0
  152. package/src/components/Calendar/Calendar.tsx +192 -0
  153. package/src/components/Calendar/index.ts +10 -0
  154. package/src/components/Tabs/Tabs.test.tsx +439 -0
  155. package/src/components/Tabs/Tabs.tsx +202 -0
  156. package/src/components/Tabs/index.ts +10 -0
  157. package/src/components/Textarea/Textarea.test.tsx +269 -0
  158. package/src/components/Textarea/Textarea.tsx +133 -0
  159. package/src/components/Textarea/index.ts +10 -0
  160. package/src/components/index.ts +11 -0
  161. package/src/index.ts +11 -0
  162. package/src/rbac/hooks/index.ts +2 -0
  163. package/src/rbac/hooks/useResourcePermissions.test.ts +633 -0
  164. package/src/rbac/hooks/useResourcePermissions.ts +235 -0
  165. package/src/services/EventService.ts +29 -8
  166. package/src/services/__tests__/EventService.test.ts +48 -8
  167. package/dist/chunk-5JMOHWDI.js.map +0 -1
  168. package/dist/chunk-BOOI7GK2.js.map +0 -1
  169. package/dist/chunk-YCWDTTUK.js.map +0 -1
  170. package/src/rbac/docs/event-based-apps.md +0 -285
  171. /package/dist/{DataTable-JXFCA2BJ.js.map → DataTable-SKCX4SCB.js.map} +0 -0
  172. /package/dist/{UnifiedAuthProvider-XIQQ7LVU.js.map → UnifiedAuthProvider-BMJAP6Z7.js.map} +0 -0
  173. /package/dist/{chunk-22WKWKRX.js.map → chunk-2AKRP5QZ.js.map} +0 -0
  174. /package/dist/{chunk-4C7EXCAR.js.map → chunk-CRGFNQ2L.js.map} +0 -0
  175. /package/dist/{chunk-TLT2ZR3L.js.map → chunk-E6ZCVF4T.js.map} +0 -0
  176. /package/dist/{chunk-INQLMHPF.js.map → chunk-ERGKJX4D.js.map} +0 -0
  177. /package/dist/{chunk-6LAAY47Q.js.map → chunk-MSHEVJXS.js.map} +0 -0
  178. /package/dist/{chunk-MA6EPSGZ.js.map → chunk-PKW27QVS.js.map} +0 -0
  179. /package/dist/{chunk-T6JN6LH6.js.map → chunk-R53TUSFK.js.map} +0 -0
  180. /package/dist/{chunk-6DXZ6V5Q.js.map → chunk-SFVL7ZFI.js.map} +0 -0
package/dist/hooks.js CHANGED
@@ -8,10 +8,10 @@ import {
8
8
  usePublicEvent,
9
9
  usePublicEventCode,
10
10
  usePublicRouteParams
11
- } from "./chunk-22WKWKRX.js";
11
+ } from "./chunk-2AKRP5QZ.js";
12
12
  import {
13
13
  useSecureDataAccess
14
- } from "./chunk-T6JN6LH6.js";
14
+ } from "./chunk-R53TUSFK.js";
15
15
  import {
16
16
  clearFileDisplayCache,
17
17
  clearPublicFileDisplayCache,
@@ -22,15 +22,15 @@ import {
22
22
  useEventTheme,
23
23
  useFileDisplay,
24
24
  usePublicFileDisplay
25
- } from "./chunk-4C7EXCAR.js";
25
+ } from "./chunk-CRGFNQ2L.js";
26
26
  import {
27
27
  useDataTablePerformance,
28
28
  useToast
29
29
  } from "./chunk-BESYRHQM.js";
30
- import "./chunk-MA6EPSGZ.js";
31
- import "./chunk-6LAAY47Q.js";
32
- import "./chunk-INQLMHPF.js";
33
- import "./chunk-YCWDTTUK.js";
30
+ import "./chunk-PKW27QVS.js";
31
+ import "./chunk-MSHEVJXS.js";
32
+ import "./chunk-ERGKJX4D.js";
33
+ import "./chunk-WM26XK7I.js";
34
34
  import {
35
35
  useComponentPerformance
36
36
  } from "./chunk-ANBQRTPX.js";
package/dist/index.d.ts CHANGED
@@ -7,8 +7,8 @@ export { O as Organisation, a as OrganisationMembership, f as OrganisationProvid
7
7
  import { E as Event } from './unified-DQ4VcT7H.js';
8
8
  import { S as SessionRestorationState } from './auth-DReDSLq9.js';
9
9
  import * as react_jsx_runtime from 'react/jsx-runtime';
10
- export { ALL_PERMISSIONS, AccessLevel, AccessLevelGuard, AllPermissions, CACHE_PATTERNS, DataAccessRecord, EVENT_APP_PERMISSIONS, EnhancedNavigationMenu, EnhancedNavigationMenuProps, EventAppRole, EventAppRoleData, GLOBAL_PERMISSIONS, GlobalRole, GrantEventAppRoleParams, InvalidScopeError, LogLevel, MissingUserContextError, NavigationAccessRecord, NavigationContextType, NavigationGuard, NavigationGuardProps, NavigationProvider, NavigationProviderProps, ORGANISATION_PERMISSIONS, Operation, OrganisationContextRequiredError, OrganisationRole, PAGE_PERMISSIONS, PageAccessRecord, PagePermissionContextType, PagePermissionGuard, PagePermissionGuardProps, PagePermissionProvider, PagePermissionProviderProps, Permission, PermissionCheck, PermissionDeniedError, PermissionEnforcer, PermissionEnforcerProps, PermissionGuard, PermissionMap, RBACAuditManager, RBACCache, RBACConfig, RBACEngine, RBACError, RBACLogger, RBACNotInitializedError, RevokeEventAppRoleParams, RoleBasedRouter, RoleBasedRouterContextType, RoleBasedRouterProps, RoleManagementResult, RouteAccessRecord, RouteConfig, Scope, SecureDataContextType, SecureDataProvider, SecureDataProviderProps, SecureSupabaseClient, UUID, UseResolvedScopeOptions, UseResolvedScopeReturn, createAuditManager, createRBACConfig, createRBACEngine, createRBACExpressMiddleware, createRBACMiddleware, createSecureClient, emitAuditEvent, fromSupabaseClient, getAccessLevel, getGlobalAuditManager, getPermissionMap, getPermissionsForRole, getRBACConfig, getRBACLogger, getRoleContext, hasAllPermissions, hasAnyPermission, hasAnyPermissionCached, hasPermission, hasPermissionCached, isDebugMode, isDevelopmentMode, isPermitted, isPermittedCached, isValidPermission, rbacCache, resolveAppContext, setGlobalAuditManager, setupRBAC, useAccessLevel, useCachedPermissions, useCan, useHasAllPermissions, useHasAnyPermission, useMultiplePermissions, useNavigationPermissions, usePagePermissions, usePermissions, useRBAC, useResolvedScope, useRoleBasedRouter, useRoleManagement, useSecureData, withAccessLevelGuard, withPermissionGuard, withRoleGuard } from './rbac/index.js';
11
- export { A as Alert, m as AlertDescription, l as AlertTitle, n as Avatar, p as AvatarFallback, o as AvatarImage, q as Badge, r as BadgeProps, s as BadgeVariant, B as Button, a as ButtonProps, C as Card, g as CardActions, f as CardContent, e as CardDescription, c as CardFooter, b as CardHeader, h as CardProps, d as CardTitle, t as Checkbox, b4 as DefaultPublicErrorFallback, F as Dialog, O as DialogBody, K as DialogClose, M as DialogContent, U as DialogDescription, Q as DialogFooter, N as DialogHeader, H as DialogOverlay, G as DialogPortal, R as DialogTitle, J as DialogTrigger, aE as ErrorBoundary, b8 as EventLogo, b9 as EventLogoCompact, ba as EventLogoLarge, bb as EventLogoProps, aK as EventSelector, aN as FileDisplay, aO as FileDisplayProps, aL as FileUpload, aM as FileUploadProps, au as Footer, av as FooterProps, ap as Form, at as Header, I as Input, j as InputProps, L as Label, k as LabelProps, aH as LoadingSpinner, ar as LoginForm, as as LoginFormProps, aA as NavigationItem, ay as NavigationMenu, az as NavigationMenuProps, aB as OrganisationSelector, bj as PaceAppLayout, bi as PaceAppLayoutProps, bl as PaceLoginPage, bk as PaceLoginPageProps, P as Progress, aw as ProtectedRoute, ax as ProtectedRouteProps, b2 as PublicErrorBoundary, bf as PublicErrorBoundaryProps, bg as PublicErrorBoundaryState, b7 as PublicLoadingSkeleton, b5 as PublicLoadingSpinner, b6 as PublicLoadingSpinnerFullPage, bh as PublicLoadingSpinnerProps, b1 as PublicPageContextChecker, b0 as PublicPageFooter, be as PublicPageFooterProps, aY as PublicPageHeader, bd as PublicPageHeaderProps, aW as PublicPageLayout, bc as PublicPageLayoutProps, aZ as PublicPageProvider, a2 as Select, a6 as SelectContent, a3 as SelectGroup, a8 as SelectItem, a7 as SelectLabel, a9 as SelectSeparator, a5 as SelectTrigger, a4 as SelectValue, aI as SessionRestorationLoader, aJ as SessionRestorationLoaderProps, S as Switch, u as SwitchProps, T as Table, w as TableBody, x as TableCaption, y as TableCell, z as TableFooter, D as TableHead, v as TableHeader, E as TableRow, aa as Toast, ac as ToastAction, ai as ToastActionElement, ah as ToastClose, ag as ToastDescription, aj as ToastProps, ad as ToastProvider, af as ToastTitle, ae as ToastViewport, ab as Toaster, ak as Tooltip, am as TooltipContent, an as TooltipProvider, ao as TooltipRoot, al as TooltipTrigger, aV as UseFileReferenceForRecordReturn, aT as UseFileReferenceOptions, aU as UseFileReferenceReturn, aD as UserMenu, bm as UserMenuProps, b3 as useErrorBoundary, aP as useFileReference, aR as useFileReferenceById, aQ as useFileReferenceForRecord, aS as useFilesByCategory, a$ as useIsPublicPage, aX as usePublicPageContext, a_ as usePublicPageProviderContext } from './EventLogo-rFL_kRjk.js';
10
+ export { ALL_PERMISSIONS, AccessLevel, AccessLevelGuard, AllPermissions, CACHE_PATTERNS, DataAccessRecord, EVENT_APP_PERMISSIONS, EnhancedNavigationMenu, EnhancedNavigationMenuProps, EventAppRole, EventAppRoleData, GLOBAL_PERMISSIONS, GlobalRole, GrantEventAppRoleParams, InvalidScopeError, LogLevel, MissingUserContextError, NavigationAccessRecord, NavigationContextType, NavigationGuard, NavigationGuardProps, NavigationProvider, NavigationProviderProps, ORGANISATION_PERMISSIONS, Operation, OrganisationContextRequiredError, OrganisationRole, PAGE_PERMISSIONS, PageAccessRecord, PagePermissionContextType, PagePermissionGuard, PagePermissionGuardProps, PagePermissionProvider, PagePermissionProviderProps, Permission, PermissionCheck, PermissionDeniedError, PermissionEnforcer, PermissionEnforcerProps, PermissionGuard, PermissionMap, RBACAuditManager, RBACCache, RBACConfig, RBACEngine, RBACError, RBACLogger, RBACNotInitializedError, ResourcePermissions, RevokeEventAppRoleParams, RoleBasedRouter, RoleBasedRouterContextType, RoleBasedRouterProps, RoleManagementResult, RouteAccessRecord, RouteConfig, Scope, SecureDataContextType, SecureDataProvider, SecureDataProviderProps, SecureSupabaseClient, UUID, UseResolvedScopeOptions, UseResolvedScopeReturn, UseResourcePermissionsOptions, createAuditManager, createRBACConfig, createRBACEngine, createRBACExpressMiddleware, createRBACMiddleware, createSecureClient, emitAuditEvent, fromSupabaseClient, getAccessLevel, getGlobalAuditManager, getPermissionMap, getPermissionsForRole, getRBACConfig, getRBACLogger, getRoleContext, hasAllPermissions, hasAnyPermission, hasAnyPermissionCached, hasPermission, hasPermissionCached, isDebugMode, isDevelopmentMode, isPermitted, isPermittedCached, isValidPermission, rbacCache, resolveAppContext, setGlobalAuditManager, setupRBAC, useAccessLevel, useCachedPermissions, useCan, useHasAllPermissions, useHasAnyPermission, useMultiplePermissions, useNavigationPermissions, usePagePermissions, usePermissions, useRBAC, useResolvedScope, useResourcePermissions, useRoleBasedRouter, useRoleManagement, useSecureData, withAccessLevelGuard, withPermissionGuard, withRoleGuard } from './rbac/index.js';
11
+ export { A as Alert, n as AlertDescription, m as AlertTitle, o as Avatar, q as AvatarFallback, p as AvatarImage, r as Badge, s as BadgeProps, t as BadgeVariant, B as Button, a as ButtonProps, ak as Calendar, al as CalendarProps, C as Card, g as CardActions, f as CardContent, e as CardDescription, c as CardFooter, b as CardHeader, h as CardProps, d as CardTitle, u as Checkbox, bg as DefaultPublicErrorFallback, H as Dialog, R as DialogBody, N as DialogClose, O as DialogContent, W as DialogDescription, U as DialogFooter, Q as DialogHeader, K as DialogOverlay, J as DialogPortal, V as DialogTitle, M as DialogTrigger, aQ as ErrorBoundary, bk as EventLogo, bl as EventLogoCompact, bm as EventLogoLarge, bn as EventLogoProps, aW as EventSelector, aZ as FileDisplay, a_ as FileDisplayProps, aX as FileUpload, aY as FileUploadProps, aG as Footer, aH as FooterProps, aB as Form, aF as Header, I as Input, j as InputProps, L as Label, k as LabelProps, aT as LoadingSpinner, aD as LoginForm, aE as LoginFormProps, aM as NavigationItem, aK as NavigationMenu, aL as NavigationMenuProps, aN as OrganisationSelector, bv as PaceAppLayout, bu as PaceAppLayoutProps, bx as PaceLoginPage, bw as PaceLoginPageProps, P as Progress, aI as ProtectedRoute, aJ as ProtectedRouteProps, be as PublicErrorBoundary, br as PublicErrorBoundaryProps, bs as PublicErrorBoundaryState, bj as PublicLoadingSkeleton, bh as PublicLoadingSpinner, bi as PublicLoadingSpinnerFullPage, bt as PublicLoadingSpinnerProps, bd as PublicPageContextChecker, bc as PublicPageFooter, bq as PublicPageFooterProps, b8 as PublicPageHeader, bp as PublicPageHeaderProps, b6 as PublicPageLayout, bo as PublicPageLayoutProps, b9 as PublicPageProvider, a4 as Select, a8 as SelectContent, a5 as SelectGroup, aa as SelectItem, a9 as SelectLabel, ab as SelectSeparator, a7 as SelectTrigger, a6 as SelectValue, aU as SessionRestorationLoader, aV as SessionRestorationLoaderProps, S as Switch, v as SwitchProps, w as Table, y as TableBody, z as TableCaption, D as TableCell, E as TableFooter, F as TableHead, x as TableHeader, G as TableRow, ac as Tabs, af as TabsContent, aj as TabsContentProps, ad as TabsList, ah as TabsListProps, ag as TabsProps, ae as TabsTrigger, ai as TabsTriggerProps, T as Textarea, l as TextareaProps, am as Toast, ao as ToastAction, au as ToastActionElement, at as ToastClose, as as ToastDescription, av as ToastProps, ap as ToastProvider, ar as ToastTitle, aq as ToastViewport, an as Toaster, aw as Tooltip, ay as TooltipContent, az as TooltipProvider, aA as TooltipRoot, ax as TooltipTrigger, b5 as UseFileReferenceForRecordReturn, b3 as UseFileReferenceOptions, b4 as UseFileReferenceReturn, aP as UserMenu, by as UserMenuProps, bf as useErrorBoundary, a$ as useFileReference, b1 as useFileReferenceById, b0 as useFileReferenceForRecord, b2 as useFilesByCategory, bb as useIsPublicPage, b7 as usePublicPageContext, ba as usePublicPageProviderContext } from './EventLogo-B3V3otev.js';
12
12
  export { u as useToast } from './useToast-C8gR5ir4.js';
13
13
  export { D as DataTable, a as DataTableProps } from './DataTable-CWAZZcXC.js';
14
14
  import { c as DataRecord, a as DataTableAction, D as DataTableColumn } from './types-Dfz9dmVH.js';
@@ -28,6 +28,8 @@ import '@radix-ui/react-checkbox';
28
28
  import '@radix-ui/react-switch';
29
29
  import '@radix-ui/react-progress';
30
30
  import '@radix-ui/react-dialog';
31
+ import '@radix-ui/react-tabs';
32
+ import 'react-day-picker';
31
33
  import '@radix-ui/react-toast';
32
34
  import '@radix-ui/react-tooltip';
33
35
  import 'react-hook-form';
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ import {
30
30
  withAccessLevelGuard,
31
31
  withPermissionGuard,
32
32
  withRoleGuard
33
- } from "./chunk-6DXZ6V5Q.js";
33
+ } from "./chunk-SFVL7ZFI.js";
34
34
  import {
35
35
  init_useInactivityTracker,
36
36
  useInactivityTracker
@@ -40,6 +40,7 @@ import {
40
40
  AvatarFallback,
41
41
  AvatarImage,
42
42
  Badge,
43
+ Calendar,
43
44
  ErrorBoundary,
44
45
  EventLogo,
45
46
  EventLogoCompact,
@@ -75,6 +76,11 @@ import {
75
76
  TableHead,
76
77
  TableHeader,
77
78
  TableRow,
79
+ Tabs,
80
+ TabsContent,
81
+ TabsList,
82
+ TabsTrigger,
83
+ Textarea,
78
84
  Toast,
79
85
  ToastAction,
80
86
  ToastClose,
@@ -90,7 +96,7 @@ import {
90
96
  useFileReferenceForRecord,
91
97
  useFilesByCategory,
92
98
  usePublicPageContext as usePublicPageContext2
93
- } from "./chunk-5JMOHWDI.js";
99
+ } from "./chunk-TUJSIWX6.js";
94
100
  import {
95
101
  Alert,
96
102
  AlertDescription,
@@ -140,7 +146,7 @@ import {
140
146
  max,
141
147
  min,
142
148
  sum
143
- } from "./chunk-TLT2ZR3L.js";
149
+ } from "./chunk-E6ZCVF4T.js";
144
150
  import {
145
151
  useAccessLevel,
146
152
  useCachedPermissions,
@@ -151,8 +157,9 @@ import {
151
157
  usePermissions,
152
158
  useRBAC,
153
159
  useResolvedScope,
160
+ useResourcePermissions,
154
161
  useRoleManagement
155
- } from "./chunk-BOOI7GK2.js";
162
+ } from "./chunk-VOJBGZYI.js";
156
163
  import {
157
164
  CACHE_PATTERNS,
158
165
  RBACCache,
@@ -192,8 +199,8 @@ import {
192
199
  usePublicEvent,
193
200
  usePublicEventCode,
194
201
  usePublicRouteParams
195
- } from "./chunk-22WKWKRX.js";
196
- import "./chunk-T6JN6LH6.js";
202
+ } from "./chunk-2AKRP5QZ.js";
203
+ import "./chunk-R53TUSFK.js";
197
204
  import {
198
205
  APP_PATH_MAPPING,
199
206
  DEFAULT_FILE_SIZE_LIMIT,
@@ -224,7 +231,7 @@ import {
224
231
  usePublicFileDisplay,
225
232
  usePublicPageContext,
226
233
  validateFileSize
227
- } from "./chunk-4C7EXCAR.js";
234
+ } from "./chunk-CRGFNQ2L.js";
228
235
  import {
229
236
  useToast
230
237
  } from "./chunk-BESYRHQM.js";
@@ -232,11 +239,11 @@ import {
232
239
  init_useOrganisations,
233
240
  useEvents,
234
241
  useOrganisations
235
- } from "./chunk-MA6EPSGZ.js";
242
+ } from "./chunk-PKW27QVS.js";
236
243
  import {
237
244
  init_UnifiedAuthProvider
238
- } from "./chunk-6LAAY47Q.js";
239
- import "./chunk-INQLMHPF.js";
245
+ } from "./chunk-MSHEVJXS.js";
246
+ import "./chunk-ERGKJX4D.js";
240
247
  import {
241
248
  EventServiceProvider,
242
249
  InactivityServiceProvider,
@@ -254,7 +261,7 @@ import {
254
261
  useOrganisationService2 as useOrganisationService,
255
262
  useSessionRestoration,
256
263
  useUnifiedAuth
257
- } from "./chunk-YCWDTTUK.js";
264
+ } from "./chunk-WM26XK7I.js";
258
265
  import {
259
266
  FileCategory
260
267
  } from "./chunk-XJ2HZOBU.js";
@@ -641,6 +648,7 @@ export {
641
648
  Badge,
642
649
  Button,
643
650
  CACHE_PATTERNS,
651
+ Calendar,
644
652
  Card,
645
653
  CardActions,
646
654
  CardContent,
@@ -737,6 +745,11 @@ export {
737
745
  TableHead,
738
746
  TableHeader,
739
747
  TableRow,
748
+ Tabs,
749
+ TabsContent,
750
+ TabsList,
751
+ TabsTrigger,
752
+ Textarea,
740
753
  Toast,
741
754
  ToastAction,
742
755
  ToastClose,
@@ -862,6 +875,7 @@ export {
862
875
  usePublicRouteParams,
863
876
  useRBAC,
864
877
  useResolvedScope,
878
+ useResourcePermissions,
865
879
  useRoleBasedRouter,
866
880
  useRoleManagement,
867
881
  useSecureData,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/providers/InactivityProvider.tsx","../src/components/InactivityWarningModal/InactivityWarningModal.tsx","../src/utils/security/secureDataAccess.ts","../src/utils/storage/index.ts"],"sourcesContent":["/**\n * @file Complete Component Library Export\n * @package @jmruthers/pace-core\n * @module Core\n * @since 0.1.0\n * \n * This file exports the primary components, hooks, and utilities from the PACE Core library.\n * It is the main entry point for developers using the library.\n * \n * @example\n * // Import common components\n * import { Button, Card, useUnifiedAuth } from '@jmruthers/pace-core';\n * \n * // For specialized components, use the complete library import:\n * import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';\n */\n\n// AUTHENTICATION & AUTHORIZATION\n// Note: Providers are now service-based architecture for better testability and maintainability\nexport { UnifiedAuthProvider, useUnifiedAuth } from './providers/UnifiedAuthProvider';\nexport type { UnifiedAuthProviderProps, UnifiedAuthContextType, UserEventAccess } from './providers/UnifiedAuthProvider';\n\n// Session tracking utility (for manual use if needed)\nexport { useSessionTracking } from './utils/context/sessionTracking';\n\n// Provider components (using service architecture)\nexport { EventProvider } from './providers/EventProvider';\nexport { OrganisationProvider } from './providers/OrganisationProvider';\nexport { InactivityProvider } from './providers/InactivityProvider';\n\n// Convenience hooks for backward compatibility\nexport { useEvents } from './hooks/useEvents';\nexport { useOrganisations } from './hooks/useOrganisations';\n\n// Service hooks for advanced usage (better performance)\nexport { useEventService } from './hooks/services/useEventService';\nexport { useOrganisationService } from './hooks/services/useOrganisationService';\nexport { useAuthService } from './hooks/services/useAuthService';\nexport { useInactivityService } from './hooks/services/useInactivityService';\nexport { useSessionRestoration } from './hooks/useSessionRestoration';\n\nexport type { \n Organisation, \n OrganisationMembership, \n OrganisationContextType, \n OrganisationProviderProps,\n OrganisationSecurityError \n} from './types/organisation';\n\n// INACTIVITY TRACKING\nexport { InactivityWarningModal } from './components/InactivityWarningModal/InactivityWarningModal';\nexport type { InactivityWarningModalProps } from './components/InactivityWarningModal/InactivityWarningModal';\nexport { useInactivityTracker } from './hooks/useInactivityTracker';\nexport type { UseInactivityTrackerOptions, UseInactivityTrackerReturn } from './hooks/useInactivityTracker';\n\n// RBAC SYSTEM - Consolidated RBAC module\nexport * from './rbac';\n\n// BASIC UI COMPONENTS\nexport { Button } from './components/Button/Button';\nexport type { ButtonProps } from './components/Button/Button';\n\nexport { \n Card, \n CardHeader, \n CardFooter, \n CardTitle, \n CardDescription, \n CardContent,\n CardActions\n} from './components/Card/Card';\nexport type { CardProps } from './components/Card/Card';\n\nexport { Input } from './components/Input/Input';\nexport type { InputProps } from './components/Input/Input';\nexport { Label } from './components/Label/Label';\nexport type { LabelProps } from './components/Label/Label';\n\nexport { Alert, AlertTitle, AlertDescription } from './components/Alert/Alert';\nexport { Avatar, AvatarImage, AvatarFallback } from './components/Avatar/Avatar';\n\nexport { Badge } from './components/Badge/Badge';\nexport type { BadgeProps, BadgeVariant } from './components/Badge/Badge';\n\nexport { Checkbox } from './components/Checkbox/Checkbox';\nexport { Switch } from './components/Switch/Switch';\nexport type { SwitchProps } from './components/Switch/Switch';\nexport { Progress } from './components/Progress/Progress';\n\n// ADVANCED UI COMPONENTS\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogBody,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n} from './components/Dialog/Dialog';\n\n// Dropdown Menu exports\n// DropdownMenu components have been merged into Select components\n\n// Select exports\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n} from './components/Select';\n\n// Modal functionality is provided by Dialog components\n\nexport {\n Toast,\n Toaster,\n ToastAction,\n ToastProvider,\n ToastViewport,\n ToastTitle,\n ToastDescription,\n ToastClose,\n} from './components/Toast/Toast';\nexport { useToast } from './hooks/useToast';\nexport type { ToastActionElement, ToastProps } from './components/Toast/Toast';\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, TooltipRoot } from './components/Tooltip/Tooltip';\n\n// DATA DISPLAY COMPONENTS\nexport {\n DataTable,\n type DataTableProps,\n type DataTableColumn,\n type DataTableAction,\n type DataTableToolbarButton,\n type AggregateConfig,\n type EmptyStateConfig,\n type GetRowId,\n type DataTableFeatureConfig,\n ColumnFactory\n} from './components/DataTable';\n\n// Re-export types from DataTable types\nexport type { DataRecord, ExportOptions } from './components/DataTable/types';\n\n// Export DataTable utility functions\nexport {\n exportToCSV,\n exportToCSVWithTableRows,\n generateCSVContent,\n type ExportColumn\n} from './components/DataTable/utils/exportUtils';\n\n// Export DataTable aggregation utilities\nexport {\n sum,\n average,\n count,\n min,\n max\n} from './components/DataTable/utils/aggregationUtils';\n\n// FORM COMPONENTS\nexport { Form } from './components/Form/Form';\nexport { LoginForm } from './components/LoginForm/LoginForm';\nexport type { LoginFormProps } from './components/LoginForm/LoginForm';\n\n// LAYOUT COMPONENTS\nexport { Header } from './components/Header/Header';\nexport { Footer } from './components/Footer/Footer';\nexport type { FooterProps } from './components/Footer/Footer';\n\n// NAVIGATION COMPONENTS\nexport { NavigationMenu } from './components/NavigationMenu/NavigationMenu';\nexport type { NavigationMenuProps, NavigationItem } from './components/NavigationMenu/types';\nexport { UserMenu } from './components/UserMenu/UserMenu';\nexport type { UserMenuProps } from './components/UserMenu/UserMenu';\n\n// Reusable Page/Layout Components\nexport { PaceAppLayout } from './components/PaceAppLayout/PaceAppLayout';\nexport type { PaceAppLayoutProps } from './components/PaceAppLayout/PaceAppLayout';\nexport { PaceLoginPage } from './components/PaceLoginPage/PaceLoginPage';\nexport type { PaceLoginPageProps } from './components/PaceLoginPage/PaceLoginPage';\n\nexport { ProtectedRoute } from './components/ProtectedRoute/ProtectedRoute';\nexport type { ProtectedRouteProps } from './components/ProtectedRoute/ProtectedRoute';\n\n// UTILITY COMPONENTS\nexport { ErrorBoundary } from './components/ErrorBoundary/ErrorBoundary';\nexport { LoadingSpinner } from './components/LoadingSpinner/LoadingSpinner';\nexport { SessionRestorationLoader } from './components/SessionRestorationLoader/SessionRestorationLoader';\nexport type { SessionRestorationLoaderProps } from './components/SessionRestorationLoader/SessionRestorationLoader';\n\n// EVENT MANAGEMENT\nexport { EventSelector } from './components/EventSelector/EventSelector';\n\n// ORGANISATION MANAGEMENT\nexport { OrganisationSelector } from './components/OrganisationSelector/OrganisationSelector';\nexport { useOrganisationPermissions } from './hooks/useOrganisationPermissions';\nexport { useOrganisationSecurity } from './hooks/useOrganisationSecurity';\nexport { createSecureDataAccess } from './utils/security/secureDataAccess';\n\n// TYPES\nexport type { UserProfile } from './types/organisation';\n\n// AUTHENTICATION FORMS\nexport { PasswordChangeForm } from './components/PasswordReset/PasswordChangeForm';\n\n// UTILS & HOOKS\nexport { useAppConfig } from './hooks/useAppConfig';\nexport { useEventTheme } from './hooks/useEventTheme';\nexport { cn } from './utils/core/cn';\nexport { setAppConfig, getAppConfig, getCurrentAppName, getCurrentAppId } from './utils/app/appConfig';\n\n// FORMATTING UTILITIES\nexport { \n formatDate, \n formatCurrency, \n formatNumber,\n formatPercent,\n formatCompactNumber,\n formatFileSize\n} from './utils/formatting/formatting';\n\n// STORAGE UTILITIES\nexport { FileUpload } from './components/FileUpload';\nexport type { FileUploadProps } from './components/FileUpload';\nexport { FileDisplay } from './components/FileDisplay';\nexport type { FileDisplayProps } from './components/FileDisplay';\nexport { FileCategory } from './types/file-reference';\nexport type { FileReference, FileMetadata, FileUploadOptions } from './types/file-reference';\nexport { \n useFileReference, \n useFileReferenceForRecord,\n useFileReferenceById,\n useFilesByCategory\n} from './hooks/useFileReference';\nexport type { \n UseFileReferenceOptions, \n UseFileReferenceReturn, \n UseFileReferenceForRecordReturn \n} from './hooks/useFileReference';\nexport * from './utils/storage';\n\n// Table components\nexport {\n Table,\n TableHeader,\n TableBody,\n TableCaption,\n TableCell,\n TableFooter,\n TableHead,\n TableRow,\n} from './components/Table/Table';\n\n// STYLES & THEMING\nexport * from './styles';\n// Direct export of theming utilities for convenience\nexport { parseAndNormalizeEventColours } from './theming/parseEventColours';\n\n// PUBLIC PAGES\nexport * from './hooks/public';\nexport * from './components/PublicLayout';\n","/**\n * @file Re-export for InactivityProvider\n * @package @jmruthers/pace-core\n * @module Providers\n * @since 0.1.0\n * \n * Re-exports the service-based InactivityProvider for backward compatibility.\n */\n\nexport { InactivityServiceProvider as InactivityProvider } from './services/InactivityServiceProvider';\nexport type { InactivityServiceProviderProps as InactivityProviderProps, InactivityServiceContextType as InactivityContextType } from './services/InactivityServiceProvider';\n\n// Re-export hook\nexport { useInactivityService as useInactivity } from '../hooks/services/useInactivityService';\n\n","/**\n * @file Inactivity Warning Modal\n * @package @jmruthers/pace-core\n * @module Components/InactivityWarningModal\n * @since 0.1.0\n *\n * A modal dialog that warns users about impending auto-logout due to inactivity.\n * Provides a countdown timer and action buttons to either stay signed in or sign out immediately.\n *\n * Features:\n * - Accessible modal dialog with focus management\n * - Live countdown timer with 1-second updates\n * - Clear action buttons (Stay Signed In / Sign Out Now)\n * - Keyboard navigation support (Escape to stay signed in)\n * - Cross-tab awareness and synchronization\n * - Tailwind v4 styling with pace-core theme tokens\n * - Production-safe with no arbitrary bracket classes\n *\n * @example\n * ```tsx\n * <InactivityWarningModal\n * isOpen={showWarning}\n * timeRemaining={45}\n * onStaySignedIn={() => setShowWarning(false)}\n * onSignOutNow={() => signOut()}\n * />\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Focus trap within modal content\n * - Screen reader announcements for countdown changes\n * - Keyboard navigation support\n * - Clear visual hierarchy and contrast\n * - Escape key to stay signed in (safe default)\n *\n * @performance\n * - Efficient countdown updates (1-second intervals)\n * - Minimal re-renders with stable references\n * - Memory leak prevention with cleanup\n * - Optimized timer management\n *\n * @dependencies\n * - React 18+ - Hooks and effects\n * - Dialog components - Modal functionality\n * - Tailwind CSS v4 - Styling\n */\n\nimport React, { useEffect, useState, useCallback } from 'react';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from '../Dialog/Dialog';\nimport { Button } from '../Button/Button';\nimport { Clock, AlertTriangle } from 'lucide-react';\n\nexport interface InactivityWarningModalProps {\n /** Whether the modal is open */\n isOpen: boolean;\n /** Time remaining in seconds before auto-logout */\n timeRemaining: number;\n /** Callback when user chooses to stay signed in */\n onStaySignedIn: () => void;\n /** Callback when user chooses to sign out immediately */\n onSignOutNow: () => void;\n /** Optional custom title */\n title?: string;\n /** Optional custom description */\n description?: string;\n /** Optional custom className */\n className?: string;\n}\n\nexport function InactivityWarningModal({\n isOpen,\n timeRemaining,\n onStaySignedIn,\n onSignOutNow,\n title = \"Session Timeout Warning\",\n description = \"You've been inactive for a while. Your session will expire soon for security reasons.\",\n className\n}: InactivityWarningModalProps) {\n const [displayTime, setDisplayTime] = useState(timeRemaining);\n\n // Update display time when timeRemaining prop changes\n useEffect(() => {\n setDisplayTime(timeRemaining);\n }, [timeRemaining]);\n\n // Format time for display (MM:SS)\n const formatTime = useCallback((seconds: number) => {\n const mins = Math.floor(seconds / 60);\n const secs = seconds % 60;\n return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;\n }, []);\n\n\n\n\n return (\n <Dialog open={isOpen} onOpenChange={(open) => !open && onStaySignedIn()}>\n <DialogContent \n className={`sm:max-w-md ${className || ''}`}\n preventCloseOnEscape={false}\n preventCloseOnOutsideClick={true}\n data-testid=\"inactivity-warning-modal\"\n >\n <DialogHeader>\n <div className=\"flex items-center gap-3\">\n <div className=\"flex-shrink-0\">\n <AlertTriangle className=\"h-6 w-6 text-acc-600\" />\n </div>\n <div>\n <DialogTitle className=\"text-lg font-semibold text-main-900\">\n {title}\n </DialogTitle>\n </div>\n </div>\n <DialogDescription className=\"text-main-700 mt-2\">\n {description}\n </DialogDescription>\n </DialogHeader>\n\n <div className=\"space-y-6\">\n {/* Countdown Timer */}\n <div className=\"text-center\">\n <div className=\"inline-flex items-center gap-2 px-4 py-3 bg-acc-50 border border-acc-200 rounded-lg\">\n <Clock className=\"h-5 w-5 text-acc-600\" />\n <span className=\"text-2xl font-mono font-bold text-acc-700\">\n {formatTime(displayTime)}\n </span>\n </div>\n <p className=\"text-sm text-main-600 mt-2\">\n Time remaining before automatic logout\n </p>\n </div>\n\n {/* Action Buttons */}\n <div className=\"flex flex-col sm:flex-row gap-3\">\n <Button\n onClick={onStaySignedIn}\n className=\"flex-1 bg-main-600 hover:bg-main-700 text-main-50\"\n size=\"lg\"\n >\n Stay Signed In\n </Button>\n <Button\n onClick={onSignOutNow}\n variant=\"outline\"\n className=\"flex-1 border-acc-300 text-acc-700 hover:bg-acc-50\"\n size=\"lg\"\n >\n Sign Out Now\n </Button>\n </div>\n\n {/* Additional Info */}\n <div className=\"text-xs text-main-500 text-center\">\n <p>\n For security reasons, you'll be automatically signed out after 30 minutes of inactivity.\n </p>\n </div>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n","/**\n * @file Secure Data Access Utility\n * @package @jmruthers/pace-core\n * @module Utils/SecureDataAccess\n * @since 0.4.0\n *\n * Secure data access utilities that enforce organisation context for all database operations.\n * Prevents data leakage between organisations and ensures proper access validation.\n */\n\nimport type { SupabaseClient } from '@supabase/supabase-js';\n\n// Generic database record type\nexport interface DatabaseRecord {\n id: string;\n organisation_id: string;\n [key: string]: unknown;\n}\n\n// Generic data for insert/update operations\nexport interface DatabaseData {\n [key: string]: unknown;\n}\n\n// Generic filters for queries\nexport interface DatabaseFilters {\n [key: string]: unknown;\n}\n\n// Secure query options\nexport interface SecureQueryOptions {\n table: string;\n select: string;\n organisationId: string;\n filters?: DatabaseFilters;\n orderBy?: string;\n limit?: number;\n offset?: number;\n}\n\nexport interface SecureDataAccess {\n // Secure query methods\n secureQuery: <T extends DatabaseRecord = DatabaseRecord>(options: SecureQueryOptions) => Promise<T[]>;\n secureSingleQuery: <T extends DatabaseRecord = DatabaseRecord>(options: SecureQueryOptions) => Promise<T | null>;\n \n // Secure mutation methods\n secureInsert: <T extends DatabaseRecord = DatabaseRecord>(table: string, data: DatabaseData, organisationId: string) => Promise<T | null>;\n secureUpdate: <T extends DatabaseRecord = DatabaseRecord>(table: string, data: DatabaseData, filters: DatabaseFilters, organisationId: string) => Promise<T | null>;\n secureDelete: (table: string, filters: DatabaseFilters, organisationId: string) => Promise<boolean>;\n \n // Organisation-scoped queries\n queryByOrganisation: <T extends DatabaseRecord = DatabaseRecord>(table: string, select: string, organisationId: string, filters?: DatabaseFilters) => Promise<T[]>;\n \n // Validation helpers\n validateOrganisationContext: (organisationId: string) => void;\n ensureOrganisationColumn: (table: string) => boolean;\n}\n\nexport interface SecureQueryBuilder {\n table: string;\n select: string;\n organisationId: string;\n filters?: DatabaseFilters;\n orderBy?: string;\n limit?: number;\n offset?: number;\n}\n\n/**\n * Create a secure data access instance\n * @param supabase - Supabase client instance\n * @param organisationId - Current organisation context\n * @param isSuperAdmin - Whether user has super admin privileges\n * @returns Secure data access utilities\n */\nexport const createSecureDataAccess = (\n supabase: SupabaseClient,\n organisationId: string,\n isSuperAdmin: boolean = false\n): SecureDataAccess => {\n \n // Validate organisation context\n const validateOrganisationContext = (orgId: string): void => {\n if (!orgId) {\n throw new Error('Organisation context is required for secure data access');\n }\n \n if (!isSuperAdmin && !orgId) {\n throw new Error('Organisation context is mandatory for non-super admin users');\n }\n };\n\n // Check if table has organisation_id column\n const ensureOrganisationColumn = (table: string): boolean => {\n // This is a simplified check - in production you might want to cache this\n const tablesWithOrganisation = [\n 'event', 'organisation_settings',\n 'rbac_event_app_roles', 'rbac_organisation_roles',\n // SECURITY: Phase 2 additions - complete organisation table mapping\n 'organisation_audit_log', 'organisation_invitations', 'organisation_app_access',\n // SECURITY: Emergency additions for Phase 1 fixes\n 'cake_meal', 'cake_mealtype', 'pace_person', 'pace_member',\n // SECURITY: Phase 3A additions - medical and personal data\n 'medi_profile', 'medi_condition', 'medi_diet', 'medi_action_plan', 'medi_profile_versions',\n 'pace_consent', 'pace_contact', 'pace_id_documents', 'pace_qualifications',\n 'form_responses', 'form_response_values', 'forms',\n // SECURITY: Phase 3B additions - remaining critical tables\n 'invoice', 'line_item', 'credit_balance', 'payment_method',\n 'form_contexts', 'form_field_config', 'form_fields',\n 'cake_delivery', 'cake_diettype', 'cake_diner', 'cake_dish', 'cake_item', \n 'cake_logistics', 'cake_mealplan', 'cake_package', 'cake_recipe', 'cake_supplier', \n 'cake_supply', 'cake_unit', 'event_app_access', 'base_application', 'base_questions'\n ];\n \n return tablesWithOrganisation.includes(table);\n };\n\n // Build secure query with organisation context\n const buildSecureQuery = (options: SecureQueryBuilder) => {\n const { table, select, organisationId: orgId, filters, orderBy, limit, offset } = options;\n \n validateOrganisationContext(orgId);\n \n let query = supabase\n .from(table)\n .select(select);\n \n // Add organisation filter (unless super admin)\n if (!isSuperAdmin && ensureOrganisationColumn(table)) {\n query = query.eq('organisation_id', orgId);\n }\n \n // Add additional filters\n if (filters) {\n Object.entries(filters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n // Handle qualified column names (e.g., 'users.role')\n const columnName = key.includes('.') ? key.split('.').pop()! : key;\n query = query.eq(columnName, value);\n }\n });\n }\n \n // Add ordering\n if (orderBy) {\n // Only use the column name, not a qualified name\n const orderByColumn = orderBy.split('.').pop();\n if (orderByColumn) {\n query = query.order(orderByColumn);\n }\n }\n \n // Add pagination\n if (limit) {\n query = query.limit(limit);\n }\n \n if (offset) {\n query = query.range(offset, offset + (limit || 10) - 1);\n }\n \n return query;\n };\n\n // Secure query for multiple results\n const secureQuery = async <T extends DatabaseRecord = DatabaseRecord>(options: SecureQueryOptions): Promise<T[]> => {\n const { table, select, organisationId: orgId, filters, orderBy, limit, offset } = options;\n \n try {\n const query = buildSecureQuery({\n table,\n select,\n organisationId: orgId,\n filters,\n orderBy,\n limit,\n offset\n });\n \n const { data, error } = await query;\n \n if (error) {\n throw error;\n }\n \n // Ensure data is an array and not an error type\n if (Array.isArray(data)) {\n return data as unknown as T[];\n }\n \n return [];\n } catch (error) {\n throw error;\n }\n };\n\n // Secure query for single result\n const secureSingleQuery = async <T extends DatabaseRecord = DatabaseRecord>(options: SecureQueryOptions): Promise<T | null> => {\n const { table, select, organisationId: orgId, filters, orderBy, limit, offset } = options;\n \n try {\n const query = buildSecureQuery({\n table,\n select,\n organisationId: orgId,\n filters,\n orderBy,\n limit,\n offset\n });\n \n const { data, error } = await query.single();\n \n if (error) {\n if (error.code === 'PGRST116') {\n // No rows returned\n return null;\n }\n throw error;\n }\n \n // Ensure data is not an error type\n if (data && typeof data === 'object' && !('code' in data)) {\n return data as unknown as T;\n }\n \n return null;\n } catch (error) {\n throw error;\n }\n };\n\n // Secure insert with organisation context\n const secureInsert = async <T extends DatabaseRecord = DatabaseRecord>(\n table: string, \n data: DatabaseData, \n organisationId: string\n ): Promise<T | null> => {\n validateOrganisationContext(organisationId);\n \n try {\n const insertData = {\n ...data,\n organisation_id: organisationId\n };\n \n const { data: result, error } = await supabase\n .from(table)\n .insert(insertData)\n .select()\n .single();\n \n if (error) {\n throw error;\n }\n \n return result;\n } catch (error) {\n throw error;\n }\n };\n\n // Secure update with organisation context\n const secureUpdate = async <T extends DatabaseRecord = DatabaseRecord>(\n table: string, \n data: DatabaseData, \n filters: DatabaseFilters, \n organisationId: string\n ): Promise<T | null> => {\n validateOrganisationContext(organisationId);\n \n try {\n let query = supabase\n .from(table)\n .update(data);\n \n // Add organisation filter (unless super admin)\n if (!isSuperAdmin && ensureOrganisationColumn(table)) {\n query = query.eq('organisation_id', organisationId);\n }\n \n // Add additional filters\n if (filters) {\n Object.entries(filters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n query = query.eq(key, value);\n }\n });\n }\n \n const { data: result, error } = await query.select().single();\n \n if (error) {\n throw error;\n }\n \n return result;\n } catch (error) {\n throw error;\n }\n };\n\n // Secure delete with organisation context\n const secureDelete = async (\n table: string, \n filters: DatabaseFilters, \n organisationId: string\n ): Promise<boolean> => {\n validateOrganisationContext(organisationId);\n \n try {\n let query = supabase\n .from(table)\n .delete();\n \n // Add organisation filter (unless super admin)\n if (!isSuperAdmin && ensureOrganisationColumn(table)) {\n query = query.eq('organisation_id', organisationId);\n }\n \n // Add additional filters\n if (filters) {\n Object.entries(filters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n query = query.eq(key, value);\n }\n });\n }\n \n const { error } = await query;\n \n if (error) {\n throw error;\n }\n \n return true;\n } catch (error) {\n throw error;\n }\n };\n\n // Organisation-scoped query helper\n const queryByOrganisation = async <T extends DatabaseRecord = DatabaseRecord>(\n table: string, \n select: string, \n organisationId: string, \n filters?: DatabaseFilters\n ): Promise<T[]> => {\n return secureQuery<T>({\n table,\n select,\n organisationId,\n filters\n });\n };\n\n return {\n secureQuery,\n secureSingleQuery,\n secureInsert,\n secureUpdate,\n secureDelete,\n queryByOrganisation,\n validateOrganisationContext,\n ensureOrganisationColumn\n };\n};\n\n/**\n * Hook for secure data access\n * @returns Secure data access utilities\n */\nexport const useSecureDataAccess = (): SecureDataAccess => {\n // This would typically get the context from providers\n // For now, we'll create a placeholder that can be used with explicit parameters\n throw new Error('useSecureDataAccess must be used with explicit parameters. Use createSecureDataAccess instead.');\n}; ","/**\n * Storage utilities for pace-core\n * \n * Provides app-segregated file storage with organisation-scoped access\n */\n\nexport * from './types';\nexport * from './config';\nexport * from './helpers';\n\n// Import functions for StorageUtils class\nimport {\n uploadFile,\n getPublicUrl,\n getSignedUrl,\n deleteFile,\n downloadFile,\n listFiles,\n archiveFile,\n generateFilePath,\n generateUniqueFileName,\n extractFileMetadata\n} from './helpers';\n\n// Re-export commonly used functions for convenience\nexport {\n uploadFile,\n getPublicUrl,\n getSignedUrl,\n deleteFile,\n downloadFile,\n listFiles,\n archiveFile,\n generateFilePath,\n generateUniqueFileName,\n extractFileMetadata\n};\n\nexport {\n validateFileSize,\n getFileSizeLimit,\n formatFileSize\n} from './config';\n\n\nexport {\n FILE_SIZE_LIMITS,\n DEFAULT_FILE_SIZE_LIMIT,\n STORAGE_CONFIG,\n APP_PATH_MAPPING\n} from './config';\n\n/**\n * StorageUtils class for convenient access to storage functions\n */\nexport class StorageUtils {\n static generateFilePath = generateFilePath;\n static generateUniqueFileName = generateUniqueFileName;\n static extractFileMetadata = extractFileMetadata;\n static uploadFile = uploadFile;\n static getPublicUrl = getPublicUrl;\n static getSignedUrl = getSignedUrl;\n static deleteFile = deleteFile;\n static downloadFile = downloadFile;\n static listFiles = listFiles;\n static archiveFile = archiveFile;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAA,EACF;AAGA,QAAM,sBAAsB,OAC1B,OACA,QACAA,iBACA,YACiB;AACjB,WAAO,YAAe;AAAA,MACpB;AAAA,MACA;AAAA,MACA,gBAAAA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;;;ACvTO,IAAM,eAAN,MAAmB;AAW1B;AAXa,aACJ,mBAAmB;AADf,aAEJ,yBAAyB;AAFrB,aAGJ,sBAAsB;AAHlB,aAIJ,aAAa;AAJT,aAKJ,eAAe;AALX,aAMJ,eAAe;AANX,aAOJ,aAAa;AAPT,aAQJ,eAAe;AARX,aASJ,YAAY;AATR,aAUJ,cAAc;","names":["organisationId"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/providers/InactivityProvider.tsx","../src/components/InactivityWarningModal/InactivityWarningModal.tsx","../src/utils/security/secureDataAccess.ts","../src/utils/storage/index.ts"],"sourcesContent":["/**\n * @file Complete Component Library Export\n * @package @jmruthers/pace-core\n * @module Core\n * @since 0.1.0\n * \n * This file exports the primary components, hooks, and utilities from the PACE Core library.\n * It is the main entry point for developers using the library.\n * \n * @example\n * // Import common components\n * import { Button, Card, useUnifiedAuth } from '@jmruthers/pace-core';\n * \n * // For specialized components, use the complete library import:\n * import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';\n */\n\n// AUTHENTICATION & AUTHORIZATION\n// Note: Providers are now service-based architecture for better testability and maintainability\nexport { UnifiedAuthProvider, useUnifiedAuth } from './providers/UnifiedAuthProvider';\nexport type { UnifiedAuthProviderProps, UnifiedAuthContextType, UserEventAccess } from './providers/UnifiedAuthProvider';\n\n// Session tracking utility (for manual use if needed)\nexport { useSessionTracking } from './utils/context/sessionTracking';\n\n// Provider components (using service architecture)\nexport { EventProvider } from './providers/EventProvider';\nexport { OrganisationProvider } from './providers/OrganisationProvider';\nexport { InactivityProvider } from './providers/InactivityProvider';\n\n// Convenience hooks for backward compatibility\nexport { useEvents } from './hooks/useEvents';\nexport { useOrganisations } from './hooks/useOrganisations';\n\n// Service hooks for advanced usage (better performance)\nexport { useEventService } from './hooks/services/useEventService';\nexport { useOrganisationService } from './hooks/services/useOrganisationService';\nexport { useAuthService } from './hooks/services/useAuthService';\nexport { useInactivityService } from './hooks/services/useInactivityService';\nexport { useSessionRestoration } from './hooks/useSessionRestoration';\n\nexport type { \n Organisation, \n OrganisationMembership, \n OrganisationContextType, \n OrganisationProviderProps,\n OrganisationSecurityError \n} from './types/organisation';\n\n// INACTIVITY TRACKING\nexport { InactivityWarningModal } from './components/InactivityWarningModal/InactivityWarningModal';\nexport type { InactivityWarningModalProps } from './components/InactivityWarningModal/InactivityWarningModal';\nexport { useInactivityTracker } from './hooks/useInactivityTracker';\nexport type { UseInactivityTrackerOptions, UseInactivityTrackerReturn } from './hooks/useInactivityTracker';\n\n// RBAC SYSTEM - Consolidated RBAC module\nexport * from './rbac';\n\n// BASIC UI COMPONENTS\nexport { Button } from './components/Button/Button';\nexport type { ButtonProps } from './components/Button/Button';\n\nexport { \n Card, \n CardHeader, \n CardFooter, \n CardTitle, \n CardDescription, \n CardContent,\n CardActions\n} from './components/Card/Card';\nexport type { CardProps } from './components/Card/Card';\n\nexport { Input } from './components/Input/Input';\nexport type { InputProps } from './components/Input/Input';\nexport { Label } from './components/Label/Label';\nexport type { LabelProps } from './components/Label/Label';\n\nexport { Textarea } from './components/Textarea/Textarea';\nexport type { TextareaProps } from './components/Textarea/Textarea';\n\nexport { Alert, AlertTitle, AlertDescription } from './components/Alert/Alert';\nexport { Avatar, AvatarImage, AvatarFallback } from './components/Avatar/Avatar';\n\nexport { Badge } from './components/Badge/Badge';\nexport type { BadgeProps, BadgeVariant } from './components/Badge/Badge';\n\nexport { Checkbox } from './components/Checkbox/Checkbox';\nexport { Switch } from './components/Switch/Switch';\nexport type { SwitchProps } from './components/Switch/Switch';\nexport { Progress } from './components/Progress/Progress';\n\n// ADVANCED UI COMPONENTS\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogBody,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n} from './components/Dialog/Dialog';\n\n// Dropdown Menu exports\n// DropdownMenu components have been merged into Select components\n\n// Select exports\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n} from './components/Select';\n\n// Tabs exports\nexport { Tabs, TabsList, TabsTrigger, TabsContent } from './components/Tabs/Tabs';\nexport type { TabsProps, TabsListProps, TabsTriggerProps, TabsContentProps } from './components/Tabs/Tabs';\n\n// Calendar exports\nexport { Calendar } from './components/Calendar/Calendar';\nexport type { CalendarProps } from './components/Calendar/Calendar';\n\n// Modal functionality is provided by Dialog components\n\nexport {\n Toast,\n Toaster,\n ToastAction,\n ToastProvider,\n ToastViewport,\n ToastTitle,\n ToastDescription,\n ToastClose,\n} from './components/Toast/Toast';\nexport { useToast } from './hooks/useToast';\nexport type { ToastActionElement, ToastProps } from './components/Toast/Toast';\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, TooltipRoot } from './components/Tooltip/Tooltip';\n\n// DATA DISPLAY COMPONENTS\nexport {\n DataTable,\n type DataTableProps,\n type DataTableColumn,\n type DataTableAction,\n type DataTableToolbarButton,\n type AggregateConfig,\n type EmptyStateConfig,\n type GetRowId,\n type DataTableFeatureConfig,\n ColumnFactory\n} from './components/DataTable';\n\n// Re-export types from DataTable types\nexport type { DataRecord, ExportOptions } from './components/DataTable/types';\n\n// Export DataTable utility functions\nexport {\n exportToCSV,\n exportToCSVWithTableRows,\n generateCSVContent,\n type ExportColumn\n} from './components/DataTable/utils/exportUtils';\n\n// Export DataTable aggregation utilities\nexport {\n sum,\n average,\n count,\n min,\n max\n} from './components/DataTable/utils/aggregationUtils';\n\n// FORM COMPONENTS\nexport { Form } from './components/Form/Form';\nexport { LoginForm } from './components/LoginForm/LoginForm';\nexport type { LoginFormProps } from './components/LoginForm/LoginForm';\n\n// LAYOUT COMPONENTS\nexport { Header } from './components/Header/Header';\nexport { Footer } from './components/Footer/Footer';\nexport type { FooterProps } from './components/Footer/Footer';\n\n// NAVIGATION COMPONENTS\nexport { NavigationMenu } from './components/NavigationMenu/NavigationMenu';\nexport type { NavigationMenuProps, NavigationItem } from './components/NavigationMenu/types';\nexport { UserMenu } from './components/UserMenu/UserMenu';\nexport type { UserMenuProps } from './components/UserMenu/UserMenu';\n\n// Reusable Page/Layout Components\nexport { PaceAppLayout } from './components/PaceAppLayout/PaceAppLayout';\nexport type { PaceAppLayoutProps } from './components/PaceAppLayout/PaceAppLayout';\nexport { PaceLoginPage } from './components/PaceLoginPage/PaceLoginPage';\nexport type { PaceLoginPageProps } from './components/PaceLoginPage/PaceLoginPage';\n\nexport { ProtectedRoute } from './components/ProtectedRoute/ProtectedRoute';\nexport type { ProtectedRouteProps } from './components/ProtectedRoute/ProtectedRoute';\n\n// UTILITY COMPONENTS\nexport { ErrorBoundary } from './components/ErrorBoundary/ErrorBoundary';\nexport { LoadingSpinner } from './components/LoadingSpinner/LoadingSpinner';\nexport { SessionRestorationLoader } from './components/SessionRestorationLoader/SessionRestorationLoader';\nexport type { SessionRestorationLoaderProps } from './components/SessionRestorationLoader/SessionRestorationLoader';\n\n// EVENT MANAGEMENT\nexport { EventSelector } from './components/EventSelector/EventSelector';\n\n// ORGANISATION MANAGEMENT\nexport { OrganisationSelector } from './components/OrganisationSelector/OrganisationSelector';\nexport { useOrganisationPermissions } from './hooks/useOrganisationPermissions';\nexport { useOrganisationSecurity } from './hooks/useOrganisationSecurity';\nexport { createSecureDataAccess } from './utils/security/secureDataAccess';\n\n// TYPES\nexport type { UserProfile } from './types/organisation';\n\n// AUTHENTICATION FORMS\nexport { PasswordChangeForm } from './components/PasswordReset/PasswordChangeForm';\n\n// UTILS & HOOKS\nexport { useAppConfig } from './hooks/useAppConfig';\nexport { useEventTheme } from './hooks/useEventTheme';\nexport { cn } from './utils/core/cn';\nexport { setAppConfig, getAppConfig, getCurrentAppName, getCurrentAppId } from './utils/app/appConfig';\n\n// FORMATTING UTILITIES\nexport { \n formatDate, \n formatCurrency, \n formatNumber,\n formatPercent,\n formatCompactNumber,\n formatFileSize\n} from './utils/formatting/formatting';\n\n// STORAGE UTILITIES\nexport { FileUpload } from './components/FileUpload';\nexport type { FileUploadProps } from './components/FileUpload';\nexport { FileDisplay } from './components/FileDisplay';\nexport type { FileDisplayProps } from './components/FileDisplay';\nexport { FileCategory } from './types/file-reference';\nexport type { FileReference, FileMetadata, FileUploadOptions } from './types/file-reference';\nexport { \n useFileReference, \n useFileReferenceForRecord,\n useFileReferenceById,\n useFilesByCategory\n} from './hooks/useFileReference';\nexport type { \n UseFileReferenceOptions, \n UseFileReferenceReturn, \n UseFileReferenceForRecordReturn \n} from './hooks/useFileReference';\nexport * from './utils/storage';\n\n// Table components\nexport {\n Table,\n TableHeader,\n TableBody,\n TableCaption,\n TableCell,\n TableFooter,\n TableHead,\n TableRow,\n} from './components/Table/Table';\n\n// STYLES & THEMING\nexport * from './styles';\n// Direct export of theming utilities for convenience\nexport { parseAndNormalizeEventColours } from './theming/parseEventColours';\n\n// PUBLIC PAGES\nexport * from './hooks/public';\nexport * from './components/PublicLayout';\n","/**\n * @file Re-export for InactivityProvider\n * @package @jmruthers/pace-core\n * @module Providers\n * @since 0.1.0\n * \n * Re-exports the service-based InactivityProvider for backward compatibility.\n */\n\nexport { InactivityServiceProvider as InactivityProvider } from './services/InactivityServiceProvider';\nexport type { InactivityServiceProviderProps as InactivityProviderProps, InactivityServiceContextType as InactivityContextType } from './services/InactivityServiceProvider';\n\n// Re-export hook\nexport { useInactivityService as useInactivity } from '../hooks/services/useInactivityService';\n\n","/**\n * @file Inactivity Warning Modal\n * @package @jmruthers/pace-core\n * @module Components/InactivityWarningModal\n * @since 0.1.0\n *\n * A modal dialog that warns users about impending auto-logout due to inactivity.\n * Provides a countdown timer and action buttons to either stay signed in or sign out immediately.\n *\n * Features:\n * - Accessible modal dialog with focus management\n * - Live countdown timer with 1-second updates\n * - Clear action buttons (Stay Signed In / Sign Out Now)\n * - Keyboard navigation support (Escape to stay signed in)\n * - Cross-tab awareness and synchronization\n * - Tailwind v4 styling with pace-core theme tokens\n * - Production-safe with no arbitrary bracket classes\n *\n * @example\n * ```tsx\n * <InactivityWarningModal\n * isOpen={showWarning}\n * timeRemaining={45}\n * onStaySignedIn={() => setShowWarning(false)}\n * onSignOutNow={() => signOut()}\n * />\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Focus trap within modal content\n * - Screen reader announcements for countdown changes\n * - Keyboard navigation support\n * - Clear visual hierarchy and contrast\n * - Escape key to stay signed in (safe default)\n *\n * @performance\n * - Efficient countdown updates (1-second intervals)\n * - Minimal re-renders with stable references\n * - Memory leak prevention with cleanup\n * - Optimized timer management\n *\n * @dependencies\n * - React 18+ - Hooks and effects\n * - Dialog components - Modal functionality\n * - Tailwind CSS v4 - Styling\n */\n\nimport React, { useEffect, useState, useCallback } from 'react';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from '../Dialog/Dialog';\nimport { Button } from '../Button/Button';\nimport { Clock, AlertTriangle } from 'lucide-react';\n\nexport interface InactivityWarningModalProps {\n /** Whether the modal is open */\n isOpen: boolean;\n /** Time remaining in seconds before auto-logout */\n timeRemaining: number;\n /** Callback when user chooses to stay signed in */\n onStaySignedIn: () => void;\n /** Callback when user chooses to sign out immediately */\n onSignOutNow: () => void;\n /** Optional custom title */\n title?: string;\n /** Optional custom description */\n description?: string;\n /** Optional custom className */\n className?: string;\n}\n\nexport function InactivityWarningModal({\n isOpen,\n timeRemaining,\n onStaySignedIn,\n onSignOutNow,\n title = \"Session Timeout Warning\",\n description = \"You've been inactive for a while. Your session will expire soon for security reasons.\",\n className\n}: InactivityWarningModalProps) {\n const [displayTime, setDisplayTime] = useState(timeRemaining);\n\n // Update display time when timeRemaining prop changes\n useEffect(() => {\n setDisplayTime(timeRemaining);\n }, [timeRemaining]);\n\n // Format time for display (MM:SS)\n const formatTime = useCallback((seconds: number) => {\n const mins = Math.floor(seconds / 60);\n const secs = seconds % 60;\n return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;\n }, []);\n\n\n\n\n return (\n <Dialog open={isOpen} onOpenChange={(open) => !open && onStaySignedIn()}>\n <DialogContent \n className={`sm:max-w-md ${className || ''}`}\n preventCloseOnEscape={false}\n preventCloseOnOutsideClick={true}\n data-testid=\"inactivity-warning-modal\"\n >\n <DialogHeader>\n <div className=\"flex items-center gap-3\">\n <div className=\"flex-shrink-0\">\n <AlertTriangle className=\"h-6 w-6 text-acc-600\" />\n </div>\n <div>\n <DialogTitle className=\"text-lg font-semibold text-main-900\">\n {title}\n </DialogTitle>\n </div>\n </div>\n <DialogDescription className=\"text-main-700 mt-2\">\n {description}\n </DialogDescription>\n </DialogHeader>\n\n <div className=\"space-y-6\">\n {/* Countdown Timer */}\n <div className=\"text-center\">\n <div className=\"inline-flex items-center gap-2 px-4 py-3 bg-acc-50 border border-acc-200 rounded-lg\">\n <Clock className=\"h-5 w-5 text-acc-600\" />\n <span className=\"text-2xl font-mono font-bold text-acc-700\">\n {formatTime(displayTime)}\n </span>\n </div>\n <p className=\"text-sm text-main-600 mt-2\">\n Time remaining before automatic logout\n </p>\n </div>\n\n {/* Action Buttons */}\n <div className=\"flex flex-col sm:flex-row gap-3\">\n <Button\n onClick={onStaySignedIn}\n className=\"flex-1 bg-main-600 hover:bg-main-700 text-main-50\"\n size=\"lg\"\n >\n Stay Signed In\n </Button>\n <Button\n onClick={onSignOutNow}\n variant=\"outline\"\n className=\"flex-1 border-acc-300 text-acc-700 hover:bg-acc-50\"\n size=\"lg\"\n >\n Sign Out Now\n </Button>\n </div>\n\n {/* Additional Info */}\n <div className=\"text-xs text-main-500 text-center\">\n <p>\n For security reasons, you'll be automatically signed out after 30 minutes of inactivity.\n </p>\n </div>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n","/**\n * @file Secure Data Access Utility\n * @package @jmruthers/pace-core\n * @module Utils/SecureDataAccess\n * @since 0.4.0\n *\n * Secure data access utilities that enforce organisation context for all database operations.\n * Prevents data leakage between organisations and ensures proper access validation.\n */\n\nimport type { SupabaseClient } from '@supabase/supabase-js';\n\n// Generic database record type\nexport interface DatabaseRecord {\n id: string;\n organisation_id: string;\n [key: string]: unknown;\n}\n\n// Generic data for insert/update operations\nexport interface DatabaseData {\n [key: string]: unknown;\n}\n\n// Generic filters for queries\nexport interface DatabaseFilters {\n [key: string]: unknown;\n}\n\n// Secure query options\nexport interface SecureQueryOptions {\n table: string;\n select: string;\n organisationId: string;\n filters?: DatabaseFilters;\n orderBy?: string;\n limit?: number;\n offset?: number;\n}\n\nexport interface SecureDataAccess {\n // Secure query methods\n secureQuery: <T extends DatabaseRecord = DatabaseRecord>(options: SecureQueryOptions) => Promise<T[]>;\n secureSingleQuery: <T extends DatabaseRecord = DatabaseRecord>(options: SecureQueryOptions) => Promise<T | null>;\n \n // Secure mutation methods\n secureInsert: <T extends DatabaseRecord = DatabaseRecord>(table: string, data: DatabaseData, organisationId: string) => Promise<T | null>;\n secureUpdate: <T extends DatabaseRecord = DatabaseRecord>(table: string, data: DatabaseData, filters: DatabaseFilters, organisationId: string) => Promise<T | null>;\n secureDelete: (table: string, filters: DatabaseFilters, organisationId: string) => Promise<boolean>;\n \n // Organisation-scoped queries\n queryByOrganisation: <T extends DatabaseRecord = DatabaseRecord>(table: string, select: string, organisationId: string, filters?: DatabaseFilters) => Promise<T[]>;\n \n // Validation helpers\n validateOrganisationContext: (organisationId: string) => void;\n ensureOrganisationColumn: (table: string) => boolean;\n}\n\nexport interface SecureQueryBuilder {\n table: string;\n select: string;\n organisationId: string;\n filters?: DatabaseFilters;\n orderBy?: string;\n limit?: number;\n offset?: number;\n}\n\n/**\n * Create a secure data access instance\n * @param supabase - Supabase client instance\n * @param organisationId - Current organisation context\n * @param isSuperAdmin - Whether user has super admin privileges\n * @returns Secure data access utilities\n */\nexport const createSecureDataAccess = (\n supabase: SupabaseClient,\n organisationId: string,\n isSuperAdmin: boolean = false\n): SecureDataAccess => {\n \n // Validate organisation context\n const validateOrganisationContext = (orgId: string): void => {\n if (!orgId) {\n throw new Error('Organisation context is required for secure data access');\n }\n \n if (!isSuperAdmin && !orgId) {\n throw new Error('Organisation context is mandatory for non-super admin users');\n }\n };\n\n // Check if table has organisation_id column\n const ensureOrganisationColumn = (table: string): boolean => {\n // This is a simplified check - in production you might want to cache this\n const tablesWithOrganisation = [\n 'event', 'organisation_settings',\n 'rbac_event_app_roles', 'rbac_organisation_roles',\n // SECURITY: Phase 2 additions - complete organisation table mapping\n 'organisation_audit_log', 'organisation_invitations', 'organisation_app_access',\n // SECURITY: Emergency additions for Phase 1 fixes\n 'cake_meal', 'cake_mealtype', 'pace_person', 'pace_member',\n // SECURITY: Phase 3A additions - medical and personal data\n 'medi_profile', 'medi_condition', 'medi_diet', 'medi_action_plan', 'medi_profile_versions',\n 'pace_consent', 'pace_contact', 'pace_id_documents', 'pace_qualifications',\n 'form_responses', 'form_response_values', 'forms',\n // SECURITY: Phase 3B additions - remaining critical tables\n 'invoice', 'line_item', 'credit_balance', 'payment_method',\n 'form_contexts', 'form_field_config', 'form_fields',\n 'cake_delivery', 'cake_diettype', 'cake_diner', 'cake_dish', 'cake_item', \n 'cake_logistics', 'cake_mealplan', 'cake_package', 'cake_recipe', 'cake_supplier', \n 'cake_supply', 'cake_unit', 'event_app_access', 'base_application', 'base_questions'\n ];\n \n return tablesWithOrganisation.includes(table);\n };\n\n // Build secure query with organisation context\n const buildSecureQuery = (options: SecureQueryBuilder) => {\n const { table, select, organisationId: orgId, filters, orderBy, limit, offset } = options;\n \n validateOrganisationContext(orgId);\n \n let query = supabase\n .from(table)\n .select(select);\n \n // Add organisation filter (unless super admin)\n if (!isSuperAdmin && ensureOrganisationColumn(table)) {\n query = query.eq('organisation_id', orgId);\n }\n \n // Add additional filters\n if (filters) {\n Object.entries(filters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n // Handle qualified column names (e.g., 'users.role')\n const columnName = key.includes('.') ? key.split('.').pop()! : key;\n query = query.eq(columnName, value);\n }\n });\n }\n \n // Add ordering\n if (orderBy) {\n // Only use the column name, not a qualified name\n const orderByColumn = orderBy.split('.').pop();\n if (orderByColumn) {\n query = query.order(orderByColumn);\n }\n }\n \n // Add pagination\n if (limit) {\n query = query.limit(limit);\n }\n \n if (offset) {\n query = query.range(offset, offset + (limit || 10) - 1);\n }\n \n return query;\n };\n\n // Secure query for multiple results\n const secureQuery = async <T extends DatabaseRecord = DatabaseRecord>(options: SecureQueryOptions): Promise<T[]> => {\n const { table, select, organisationId: orgId, filters, orderBy, limit, offset } = options;\n \n try {\n const query = buildSecureQuery({\n table,\n select,\n organisationId: orgId,\n filters,\n orderBy,\n limit,\n offset\n });\n \n const { data, error } = await query;\n \n if (error) {\n throw error;\n }\n \n // Ensure data is an array and not an error type\n if (Array.isArray(data)) {\n return data as unknown as T[];\n }\n \n return [];\n } catch (error) {\n throw error;\n }\n };\n\n // Secure query for single result\n const secureSingleQuery = async <T extends DatabaseRecord = DatabaseRecord>(options: SecureQueryOptions): Promise<T | null> => {\n const { table, select, organisationId: orgId, filters, orderBy, limit, offset } = options;\n \n try {\n const query = buildSecureQuery({\n table,\n select,\n organisationId: orgId,\n filters,\n orderBy,\n limit,\n offset\n });\n \n const { data, error } = await query.single();\n \n if (error) {\n if (error.code === 'PGRST116') {\n // No rows returned\n return null;\n }\n throw error;\n }\n \n // Ensure data is not an error type\n if (data && typeof data === 'object' && !('code' in data)) {\n return data as unknown as T;\n }\n \n return null;\n } catch (error) {\n throw error;\n }\n };\n\n // Secure insert with organisation context\n const secureInsert = async <T extends DatabaseRecord = DatabaseRecord>(\n table: string, \n data: DatabaseData, \n organisationId: string\n ): Promise<T | null> => {\n validateOrganisationContext(organisationId);\n \n try {\n const insertData = {\n ...data,\n organisation_id: organisationId\n };\n \n const { data: result, error } = await supabase\n .from(table)\n .insert(insertData)\n .select()\n .single();\n \n if (error) {\n throw error;\n }\n \n return result;\n } catch (error) {\n throw error;\n }\n };\n\n // Secure update with organisation context\n const secureUpdate = async <T extends DatabaseRecord = DatabaseRecord>(\n table: string, \n data: DatabaseData, \n filters: DatabaseFilters, \n organisationId: string\n ): Promise<T | null> => {\n validateOrganisationContext(organisationId);\n \n try {\n let query = supabase\n .from(table)\n .update(data);\n \n // Add organisation filter (unless super admin)\n if (!isSuperAdmin && ensureOrganisationColumn(table)) {\n query = query.eq('organisation_id', organisationId);\n }\n \n // Add additional filters\n if (filters) {\n Object.entries(filters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n query = query.eq(key, value);\n }\n });\n }\n \n const { data: result, error } = await query.select().single();\n \n if (error) {\n throw error;\n }\n \n return result;\n } catch (error) {\n throw error;\n }\n };\n\n // Secure delete with organisation context\n const secureDelete = async (\n table: string, \n filters: DatabaseFilters, \n organisationId: string\n ): Promise<boolean> => {\n validateOrganisationContext(organisationId);\n \n try {\n let query = supabase\n .from(table)\n .delete();\n \n // Add organisation filter (unless super admin)\n if (!isSuperAdmin && ensureOrganisationColumn(table)) {\n query = query.eq('organisation_id', organisationId);\n }\n \n // Add additional filters\n if (filters) {\n Object.entries(filters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n query = query.eq(key, value);\n }\n });\n }\n \n const { error } = await query;\n \n if (error) {\n throw error;\n }\n \n return true;\n } catch (error) {\n throw error;\n }\n };\n\n // Organisation-scoped query helper\n const queryByOrganisation = async <T extends DatabaseRecord = DatabaseRecord>(\n table: string, \n select: string, \n organisationId: string, \n filters?: DatabaseFilters\n ): Promise<T[]> => {\n return secureQuery<T>({\n table,\n select,\n organisationId,\n filters\n });\n };\n\n return {\n secureQuery,\n secureSingleQuery,\n secureInsert,\n secureUpdate,\n secureDelete,\n queryByOrganisation,\n validateOrganisationContext,\n ensureOrganisationColumn\n };\n};\n\n/**\n * Hook for secure data access\n * @returns Secure data access utilities\n */\nexport const useSecureDataAccess = (): SecureDataAccess => {\n // This would typically get the context from providers\n // For now, we'll create a placeholder that can be used with explicit parameters\n throw new Error('useSecureDataAccess must be used with explicit parameters. Use createSecureDataAccess instead.');\n}; ","/**\n * Storage utilities for pace-core\n * \n * Provides app-segregated file storage with organisation-scoped access\n */\n\nexport * from './types';\nexport * from './config';\nexport * from './helpers';\n\n// Import functions for StorageUtils class\nimport {\n uploadFile,\n getPublicUrl,\n getSignedUrl,\n deleteFile,\n downloadFile,\n listFiles,\n archiveFile,\n generateFilePath,\n generateUniqueFileName,\n extractFileMetadata\n} from './helpers';\n\n// Re-export commonly used functions for convenience\nexport {\n uploadFile,\n getPublicUrl,\n getSignedUrl,\n deleteFile,\n downloadFile,\n listFiles,\n archiveFile,\n generateFilePath,\n generateUniqueFileName,\n extractFileMetadata\n};\n\nexport {\n validateFileSize,\n getFileSizeLimit,\n formatFileSize\n} from './config';\n\n\nexport {\n FILE_SIZE_LIMITS,\n DEFAULT_FILE_SIZE_LIMIT,\n STORAGE_CONFIG,\n APP_PATH_MAPPING\n} from './config';\n\n/**\n * StorageUtils class for convenient access to storage functions\n */\nexport class StorageUtils {\n static generateFilePath = generateFilePath;\n static generateUniqueFileName = generateUniqueFileName;\n static extractFileMetadata = extractFileMetadata;\n static uploadFile = uploadFile;\n static getPublicUrl = getPublicUrl;\n static getSignedUrl = getSignedUrl;\n static deleteFile = deleteFile;\n static downloadFile = downloadFile;\n static listFiles = listFiles;\n static archiveFile = archiveFile;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EAAE,MAAM,IAAI,MAAM;AAExB,UAAI,OAAO;AACT,cAAM;AAAA,MACR;AAEA,aAAO;AAAA,IACT,SAAS,OAAO;AACd,YAAM;AAAA,IACR;AAAA,EACF;AAGA,QAAM,sBAAsB,OAC1B,OACA,QACAA,iBACA,YACiB;AACjB,WAAO,YAAe;AAAA,MACpB;AAAA,MACA;AAAA,MACA,gBAAAA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;;;ACvTO,IAAM,eAAN,MAAmB;AAW1B;AAXa,aACJ,mBAAmB;AADf,aAEJ,yBAAyB;AAFrB,aAGJ,sBAAsB;AAHlB,aAIJ,aAAa;AAJT,aAKJ,eAAe;AALX,aAMJ,eAAe;AANX,aAOJ,aAAa;AAPT,aAQJ,eAAe;AARX,aASJ,YAAY;AATR,aAUJ,cAAc;","names":["organisationId"]}
package/dist/providers.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./chunk-INQLMHPF.js";
1
+ import "./chunk-ERGKJX4D.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-YCWDTTUK.js";
17
+ } from "./chunk-WM26XK7I.js";
18
18
  import "./chunk-7QCC6MCP.js";
19
19
  import "./chunk-XDNLUEXI.js";
20
20
  import "./chunk-PLDDJCW6.js";
@@ -1180,6 +1180,99 @@ interface UseResolvedScopeReturn {
1180
1180
  */
1181
1181
  declare function useResolvedScope({ supabase, selectedOrganisationId, selectedEventId }: UseResolvedScopeOptions): UseResolvedScopeReturn;
1182
1182
 
1183
+ /**
1184
+ * @file useResourcePermissions Hook
1185
+ * @package @jmruthers/pace-core
1186
+ * @module RBAC/Hooks
1187
+ * @since 1.0.0
1188
+ *
1189
+ * Hook to check permissions for a specific resource type.
1190
+ * This hook centralizes the common pattern of checking create/update/delete/read
1191
+ * permissions, eliminating ~30 lines of boilerplate code per hook usage.
1192
+ *
1193
+ * @example
1194
+ * ```tsx
1195
+ * import { useResourcePermissions } from '@jmruthers/pace-core/rbac';
1196
+ *
1197
+ * function ContactsHook() {
1198
+ * const { canCreate, canUpdate, canDelete } = useResourcePermissions('contacts');
1199
+ *
1200
+ * const addContact = async (data: ContactData) => {
1201
+ * if (!canCreate('contacts')) {
1202
+ * throw new Error("Permission denied: You do not have permission to create contacts.");
1203
+ * }
1204
+ * // ... perform mutation
1205
+ * };
1206
+ * }
1207
+ * ```
1208
+ *
1209
+ * @example
1210
+ * ```tsx
1211
+ * // With read permissions enabled
1212
+ * const { canRead } = useResourcePermissions('contacts', { enableRead: true });
1213
+ *
1214
+ * if (!canRead('contacts')) {
1215
+ * return <PermissionDenied />;
1216
+ * }
1217
+ * ```
1218
+ *
1219
+ * @security
1220
+ * - Requires organisation context (handled by useResolvedScope)
1221
+ * - All permission checks are scoped to the current organisation/event/app context
1222
+ * - Missing user context results in all permissions being denied
1223
+ */
1224
+
1225
+ interface UseResourcePermissionsOptions {
1226
+ /** Whether to check read permissions (default: false) */
1227
+ enableRead?: boolean;
1228
+ /** Whether scope resolution is required (default: true) */
1229
+ requireScope?: boolean;
1230
+ }
1231
+ interface ResourcePermissions {
1232
+ /** Check if user can create resources of this type */
1233
+ canCreate: (resource: string) => boolean;
1234
+ /** Check if user can update resources of this type */
1235
+ canUpdate: (resource: string) => boolean;
1236
+ /** Check if user can delete resources of this type */
1237
+ canDelete: (resource: string) => boolean;
1238
+ /** Check if user can read resources of this type */
1239
+ canRead: (resource: string) => boolean;
1240
+ /** The resolved scope object (for advanced use cases) */
1241
+ scope: Scope;
1242
+ /** Whether any permission check is currently loading */
1243
+ isLoading: boolean;
1244
+ /** Error from any permission check or scope resolution */
1245
+ error: Error | null;
1246
+ }
1247
+ /**
1248
+ * Hook to check permissions for a specific resource
1249
+ *
1250
+ * This hook encapsulates the common pattern of checking create/update/delete/read
1251
+ * permissions for a resource type. It handles scope resolution, user context,
1252
+ * and provides a simple API for permission checking.
1253
+ *
1254
+ * @param resource - The resource name (e.g., 'contacts', 'risks', 'journal')
1255
+ * @param options - Optional configuration
1256
+ * @param options.enableRead - Whether to check read permissions (default: false)
1257
+ * @param options.requireScope - Whether scope resolution is required (default: true)
1258
+ * @returns Object with permission check functions and scope
1259
+ *
1260
+ * @example
1261
+ * ```tsx
1262
+ * function useContacts() {
1263
+ * const { canCreate, canUpdate, canDelete } = useResourcePermissions('contacts');
1264
+ *
1265
+ * const addContact = async (data: ContactData) => {
1266
+ * if (!canCreate('contacts')) {
1267
+ * throw new Error("Permission denied");
1268
+ * }
1269
+ * // ... perform mutation
1270
+ * };
1271
+ * }
1272
+ * ```
1273
+ */
1274
+ declare function useResourcePermissions(resource: string, options?: UseResourcePermissionsOptions): ResourcePermissions;
1275
+
1183
1276
  /**
1184
1277
  * @file RBAC Permission Hooks
1185
1278
  * @package @jmruthers/pace-core
@@ -2056,4 +2149,4 @@ declare const ALL_PERMISSIONS: {
2056
2149
  };
2057
2150
  type AllPermissions = typeof ALL_PERMISSIONS;
2058
2151
 
2059
- export { ALL_PERMISSIONS, type AccessLevel, AccessLevelGuard, type AllPermissions, CACHE_PATTERNS, type DataAccessRecord, EVENT_APP_PERMISSIONS, EnhancedNavigationMenu, type EnhancedNavigationMenuProps, type EventAppRole, type EventAppRoleData, GLOBAL_PERMISSIONS, type GlobalRole, type GrantEventAppRoleParams, InvalidScopeError, type LogLevel, MissingUserContextError, type NavigationAccessRecord, type NavigationContextType, NavigationGuard, type NavigationGuardProps, type NavigationItem, NavigationProvider, type NavigationProviderProps, ORGANISATION_PERMISSIONS, type Operation, OrganisationContextRequiredError, type OrganisationRole, PAGE_PERMISSIONS, type PageAccessRecord, type PagePermissionContextType, PagePermissionGuard, type PagePermissionGuardProps, PagePermissionProvider, type PagePermissionProviderProps, type Permission, type PermissionCheck, PermissionDeniedError, PermissionEnforcer, type PermissionEnforcerProps, PermissionGuard, type PermissionMap, RBACAuditManager, RBACCache, type RBACConfig, RBACEngine, RBACError, type RBACLogger, RBACNotInitializedError, type RevokeEventAppRoleParams, RoleBasedRouter, type RoleBasedRouterContextType, type RoleBasedRouterProps, type RoleManagementResult, type RouteAccessRecord, type RouteConfig, type Scope, type SecureDataContextType, SecureDataProvider, type SecureDataProviderProps, SecureSupabaseClient, type UUID, type UseResolvedScopeOptions, type UseResolvedScopeReturn, createAuditManager, createRBACConfig, createRBACEngine, createRBACExpressMiddleware, createRBACMiddleware, createSecureClient, emitAuditEvent, fromSupabaseClient, getAccessLevel, getGlobalAuditManager, getPermissionMap, getPermissionsForRole, getRBACConfig, getRBACLogger, getRoleContext, hasAllPermissions, hasAnyPermission, hasAnyPermissionCached, hasPermission, hasPermissionCached, isDebugMode, isDevelopmentMode, isPermitted, isPermittedCached, isValidPermission, rbacCache, resolveAppContext, setGlobalAuditManager, setupRBAC, useAccessLevel, useCachedPermissions, useCan, useHasAllPermissions, useHasAnyPermission, useMultiplePermissions, useNavigationPermissions, usePagePermissions, usePermissions, useRBAC, useResolvedScope, useRoleBasedRouter, useRoleManagement, useSecureData, withAccessLevelGuard, withPermissionGuard, withRoleGuard };
2152
+ export { ALL_PERMISSIONS, type AccessLevel, AccessLevelGuard, type AllPermissions, CACHE_PATTERNS, type DataAccessRecord, EVENT_APP_PERMISSIONS, EnhancedNavigationMenu, type EnhancedNavigationMenuProps, type EventAppRole, type EventAppRoleData, GLOBAL_PERMISSIONS, type GlobalRole, type GrantEventAppRoleParams, InvalidScopeError, type LogLevel, MissingUserContextError, type NavigationAccessRecord, type NavigationContextType, NavigationGuard, type NavigationGuardProps, type NavigationItem, NavigationProvider, type NavigationProviderProps, ORGANISATION_PERMISSIONS, type Operation, OrganisationContextRequiredError, type OrganisationRole, PAGE_PERMISSIONS, type PageAccessRecord, type PagePermissionContextType, PagePermissionGuard, type PagePermissionGuardProps, PagePermissionProvider, type PagePermissionProviderProps, type Permission, type PermissionCheck, PermissionDeniedError, PermissionEnforcer, type PermissionEnforcerProps, PermissionGuard, type PermissionMap, RBACAuditManager, RBACCache, type RBACConfig, RBACEngine, RBACError, type RBACLogger, RBACNotInitializedError, type ResourcePermissions, type RevokeEventAppRoleParams, RoleBasedRouter, type RoleBasedRouterContextType, type RoleBasedRouterProps, type RoleManagementResult, type RouteAccessRecord, type RouteConfig, type Scope, type SecureDataContextType, SecureDataProvider, type SecureDataProviderProps, SecureSupabaseClient, type UUID, type UseResolvedScopeOptions, type UseResolvedScopeReturn, type UseResourcePermissionsOptions, createAuditManager, createRBACConfig, createRBACEngine, createRBACExpressMiddleware, createRBACMiddleware, createSecureClient, emitAuditEvent, fromSupabaseClient, getAccessLevel, getGlobalAuditManager, getPermissionMap, getPermissionsForRole, getRBACConfig, getRBACLogger, getRoleContext, hasAllPermissions, hasAnyPermission, hasAnyPermissionCached, hasPermission, hasPermissionCached, isDebugMode, isDevelopmentMode, isPermitted, isPermittedCached, isValidPermission, rbacCache, resolveAppContext, setGlobalAuditManager, setupRBAC, useAccessLevel, useCachedPermissions, useCan, useHasAllPermissions, useHasAnyPermission, useMultiplePermissions, useNavigationPermissions, usePagePermissions, usePermissions, useRBAC, useResolvedScope, useResourcePermissions, useRoleBasedRouter, useRoleManagement, useSecureData, withAccessLevelGuard, withPermissionGuard, withRoleGuard };
@@ -30,7 +30,7 @@ import {
30
30
  withAccessLevelGuard,
31
31
  withPermissionGuard,
32
32
  withRoleGuard
33
- } from "../chunk-6DXZ6V5Q.js";
33
+ } from "../chunk-SFVL7ZFI.js";
34
34
  import {
35
35
  useAccessLevel,
36
36
  useCachedPermissions,
@@ -41,8 +41,9 @@ import {
41
41
  usePermissions,
42
42
  useRBAC,
43
43
  useResolvedScope,
44
+ useResourcePermissions,
44
45
  useRoleManagement
45
- } from "../chunk-BOOI7GK2.js";
46
+ } from "../chunk-VOJBGZYI.js";
46
47
  import {
47
48
  CACHE_PATTERNS,
48
49
  RBACCache,
@@ -72,11 +73,11 @@ import {
72
73
  getGlobalAuditManager,
73
74
  setGlobalAuditManager
74
75
  } from "../chunk-SBVILCCA.js";
75
- import "../chunk-T6JN6LH6.js";
76
- import "../chunk-MA6EPSGZ.js";
77
- import "../chunk-6LAAY47Q.js";
78
- import "../chunk-INQLMHPF.js";
79
- import "../chunk-YCWDTTUK.js";
76
+ import "../chunk-R53TUSFK.js";
77
+ import "../chunk-PKW27QVS.js";
78
+ import "../chunk-MSHEVJXS.js";
79
+ import "../chunk-ERGKJX4D.js";
80
+ import "../chunk-WM26XK7I.js";
80
81
  import "../chunk-Q5QRDWKI.js";
81
82
  import "../chunk-7QCC6MCP.js";
82
83
  import "../chunk-XDNLUEXI.js";
@@ -142,6 +143,7 @@ export {
142
143
  usePermissions,
143
144
  useRBAC,
144
145
  useResolvedScope,
146
+ useResourcePermissions,
145
147
  useRoleBasedRouter,
146
148
  useRoleManagement,
147
149
  useSecureData,
package/dist/utils.js CHANGED
@@ -614,7 +614,7 @@ function createLazyComponent(importFn, componentName, options = {}) {
614
614
  return WrappedComponent;
615
615
  }
616
616
  var LazyDataTable = createLazyComponent(
617
- () => import("./DataTable-JXFCA2BJ.js").then((module) => ({ default: module.DataTable })),
617
+ () => import("./DataTable-SKCX4SCB.js").then((module) => ({ default: module.DataTable })),
618
618
  "DataTable"
619
619
  );
620
620
 
@@ -305,8 +305,8 @@ import {
305
305
  ```
306
306
 
307
307
  **Available from main export:**
308
- - **Basic UI**: Button, Card, Input, Label, Alert, Avatar, Checkbox, Progress
309
- - **Advanced UI**: Dialog (with HTML content), DropdownMenu, Select, Toast, Tooltip
308
+ - **Basic UI**: Button, Card, Input, Textarea, Label, Alert, Avatar, Checkbox, Progress
309
+ - **Advanced UI**: Dialog (with HTML content), DropdownMenu, Select, Toast, Tooltip, Tabs, Calendar
310
310
  - **Data Display**: DataTable (with hierarchical actions & expand/collapse all), Table
311
311
  - **Forms**: Form, LoginForm
312
312
  - **Layout**: PaceAppLayout, Header, Footer, NavigationMenu
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.140](../README.md) / [Exports](../modules.md) / ColumnFactory
1
+ [@jmruthers/pace-core - v0.5.142](../README.md) / [Exports](../modules.md) / ColumnFactory
2
2
 
3
3
  # Class: ColumnFactory\<TData\>
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.140](../README.md) / [Exports](../modules.md) / ErrorBoundary
1
+ [@jmruthers/pace-core - v0.5.142](../README.md) / [Exports](../modules.md) / ErrorBoundary
2
2
 
3
3
  # Class: ErrorBoundary
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.140](../README.md) / [Exports](../modules.md) / InvalidScopeError
1
+ [@jmruthers/pace-core - v0.5.142](../README.md) / [Exports](../modules.md) / InvalidScopeError
2
2
 
3
3
  # Class: InvalidScopeError
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.140](../README.md) / [Exports](../modules.md) / MissingUserContextError
1
+ [@jmruthers/pace-core - v0.5.142](../README.md) / [Exports](../modules.md) / MissingUserContextError
2
2
 
3
3
  # Class: MissingUserContextError
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.140](../README.md) / [Exports](../modules.md) / OrganisationContextRequiredError
1
+ [@jmruthers/pace-core - v0.5.142](../README.md) / [Exports](../modules.md) / OrganisationContextRequiredError
2
2
 
3
3
  # Class: OrganisationContextRequiredError
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.140](../README.md) / [Exports](../modules.md) / PermissionDeniedError
1
+ [@jmruthers/pace-core - v0.5.142](../README.md) / [Exports](../modules.md) / PermissionDeniedError
2
2
 
3
3
  # Class: PermissionDeniedError
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.140](../README.md) / [Exports](../modules.md) / PublicErrorBoundary
1
+ [@jmruthers/pace-core - v0.5.142](../README.md) / [Exports](../modules.md) / PublicErrorBoundary
2
2
 
3
3
  # Class: PublicErrorBoundary
4
4