@jmruthers/pace-core 0.5.190 → 0.5.193
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AuthService-CbP_utw2.d.ts → AuthService-DjnJHDtC.d.ts} +1 -0
- package/dist/{DataTable-ON3IXISJ.js → DataTable-5FU7IESH.js} +7 -6
- package/dist/{DataTable-IVYljGJ6.d.ts → DataTable-Be6dH_dR.d.ts} +1 -1
- package/dist/{PublicPageProvider-C4uxosp6.d.ts → PublicPageProvider-C0Sm_e5k.d.ts} +4 -2
- package/dist/{UnifiedAuthProvider-BYA9qB-o.d.ts → UnifiedAuthProvider-185Ih4dj.d.ts} +2 -0
- package/dist/{UnifiedAuthProvider-X5NXANVI.js → UnifiedAuthProvider-RGJTDE2C.js} +3 -3
- package/dist/{api-I6UCQ5S6.js → api-N774RPUA.js} +2 -2
- package/dist/chunk-6C4YBBJM 5.js +628 -0
- package/dist/chunk-7D4SUZUM.js 2.map +1 -0
- package/dist/{chunk-73HSNNOQ.js → chunk-7EQTDTTJ.js} +47 -74
- package/dist/chunk-7EQTDTTJ.js 2.map +1 -0
- package/dist/chunk-7EQTDTTJ.js.map +1 -0
- package/dist/{chunk-J2XXC7R5.js → chunk-7FLMSG37.js} +409 -244
- package/dist/chunk-7FLMSG37.js 2.map +1 -0
- package/dist/chunk-7FLMSG37.js.map +1 -0
- package/dist/{chunk-NIU6J6OX.js → chunk-BC4IJKSL.js} +23 -32
- package/dist/chunk-BC4IJKSL.js.map +1 -0
- package/dist/{chunk-SDMHPX3X.js → chunk-E3SPN4VZ 5.js } +198 -53
- package/dist/chunk-E3SPN4VZ.js +12917 -0
- package/dist/{chunk-SDMHPX3X.js.map → chunk-E3SPN4VZ.js.map} +1 -1
- package/dist/chunk-E66EQZE6 5.js +37 -0
- package/dist/chunk-E66EQZE6.js 2.map +1 -0
- package/dist/{chunk-DZWK57KZ.js → chunk-G37KK66H.js} +1 -1
- package/dist/{chunk-DZWK57KZ.js.map → chunk-G37KK66H.js.map} +1 -1
- package/dist/{chunk-STYK4OH2.js → chunk-HWIIPPNI.js} +44 -225
- package/dist/chunk-HWIIPPNI.js.map +1 -0
- package/dist/chunk-I7PSE6JW 5.js +191 -0
- package/dist/chunk-I7PSE6JW.js 2.map +1 -0
- package/dist/{chunk-Y4BUBBHD.js → chunk-IIELH4DL.js} +211 -136
- package/dist/chunk-IIELH4DL.js.map +1 -0
- package/dist/{chunk-RUYZKXOD.js → chunk-KNC55RTG.js} +17 -5
- package/dist/chunk-KNC55RTG.js 5.map +1 -0
- package/dist/chunk-KNC55RTG.js.map +1 -0
- package/dist/chunk-KQCRWDSA.js 5.map +1 -0
- package/dist/{chunk-4QYC5L4K.js → chunk-LFNCN2SP.js} +26 -30
- package/dist/chunk-LFNCN2SP.js 2.map +1 -0
- package/dist/chunk-LFNCN2SP.js.map +1 -0
- package/dist/chunk-LMC26NLJ 2.js +84 -0
- package/dist/{chunk-VVBAW5A5.js → chunk-NOAYCWCX 5.js } +118 -110
- package/dist/chunk-NOAYCWCX.js +4993 -0
- package/dist/chunk-NOAYCWCX.js.map +1 -0
- package/dist/chunk-QWWZ5CAQ.js 3.map +1 -0
- package/dist/chunk-QXHPKYJV 3.js +113 -0
- package/dist/chunk-R77UEZ4E 3.js +68 -0
- package/dist/chunk-VBXEHIUJ.js 6.map +1 -0
- package/dist/{chunk-HQVPB5MZ.js → chunk-XNXXZ43G.js} +77 -33
- package/dist/chunk-XNXXZ43G.js.map +1 -0
- package/dist/chunk-ZSAAAMVR 6.js +25 -0
- package/dist/components.d.ts +4 -4
- package/dist/components.js +8 -8
- package/dist/components.js 5.map +1 -0
- package/dist/{database.generated-DI89OQeI.d.ts → database.generated-CzIvgcPu.d.ts} +165 -201
- package/dist/hooks.d.ts +12 -12
- package/dist/hooks.js +9 -9
- package/dist/index.d.ts +11 -11
- package/dist/index.js +20 -27
- package/dist/index.js.map +1 -1
- package/dist/providers.d.ts +3 -3
- package/dist/providers.js +2 -2
- package/dist/rbac/index.d.ts +2 -20
- package/dist/rbac/index.js +7 -9
- package/dist/styles/index 2.js +12 -0
- package/dist/styles/index.js 5.map +1 -0
- package/dist/theming/runtime 5.js +19 -0
- package/dist/theming/runtime.js 5.map +1 -0
- package/dist/{types-Bwgl--Xo.d.ts → types-CEpcvwwF.d.ts} +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/{usePublicRouteParams-DxIDS4bC.d.ts → usePublicRouteParams-TZe0gy-4.d.ts} +1 -1
- package/dist/utils.d.ts +8 -8
- package/dist/utils.js +2 -2
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/Logger.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +2 -2
- package/docs/api/classes/RBACAuditManager.md +2 -2
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +2 -2
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +10 -10
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/enums/LogLevel.md +1 -1
- package/docs/api/enums/RBACErrorCode.md +1 -1
- package/docs/api/enums/RPCFunction.md +1 -1
- package/docs/api/interfaces/AddressFieldProps.md +1 -1
- package/docs/api/interfaces/AddressFieldRef.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/AutocompleteOptions.md +1 -1
- package/docs/api/interfaces/AvatarProps.md +1 -1
- package/docs/api/interfaces/BadgeProps.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CalendarProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/ComplianceResult.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/DatabaseComplianceResult.md +1 -1
- package/docs/api/interfaces/DatabaseIssue.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventAppRoleData.md +1 -1
- package/docs/api/interfaces/ExportColumn.md +1 -1
- package/docs/api/interfaces/ExportOptions.md +1 -1
- package/docs/api/interfaces/FileDisplayProps.md +24 -11
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/FormFieldProps.md +1 -1
- package/docs/api/interfaces/FormProps.md +1 -1
- package/docs/api/interfaces/GrantEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoggerConfig.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +2 -2
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +2 -2
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/ParsedAddress.md +2 -2
- package/docs/api/interfaces/PermissionEnforcerProps.md +4 -4
- package/docs/api/interfaces/ProgressProps.md +1 -1
- package/docs/api/interfaces/ProtectedRouteProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/QuickFix.md +1 -1
- package/docs/api/interfaces/RBACAccessValidateParams.md +1 -1
- package/docs/api/interfaces/RBACAccessValidateResult.md +1 -1
- package/docs/api/interfaces/RBACAuditLogParams.md +1 -1
- package/docs/api/interfaces/RBACAuditLogResult.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +2 -2
- package/docs/api/interfaces/RBACContext.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RBACPageAccessCheckParams.md +1 -1
- package/docs/api/interfaces/RBACPerformanceMetrics.md +1 -1
- package/docs/api/interfaces/RBACPermissionCheckParams.md +1 -1
- package/docs/api/interfaces/RBACPermissionCheckResult.md +2 -2
- package/docs/api/interfaces/RBACPermissionsGetParams.md +1 -1
- package/docs/api/interfaces/RBACPermissionsGetResult.md +1 -1
- package/docs/api/interfaces/RBACResult.md +1 -1
- package/docs/api/interfaces/RBACRoleGrantParams.md +2 -2
- package/docs/api/interfaces/RBACRoleGrantResult.md +1 -1
- package/docs/api/interfaces/RBACRoleRevokeParams.md +2 -2
- package/docs/api/interfaces/RBACRoleRevokeResult.md +1 -1
- package/docs/api/interfaces/RBACRoleValidateParams.md +2 -2
- package/docs/api/interfaces/RBACRoleValidateResult.md +1 -1
- package/docs/api/interfaces/RBACRolesListParams.md +1 -1
- package/docs/api/interfaces/RBACRolesListResult.md +2 -2
- package/docs/api/interfaces/RBACSessionTrackParams.md +1 -1
- package/docs/api/interfaces/RBACSessionTrackResult.md +1 -1
- package/docs/api/interfaces/ResourcePermissions.md +1 -1
- package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RoleManagementResult.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +2 -2
- package/docs/api/interfaces/RouteConfig.md +2 -2
- package/docs/api/interfaces/RuntimeComplianceResult.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/SessionRestorationLoaderProps.md +1 -1
- package/docs/api/interfaces/SetupIssue.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/SwitchProps.md +1 -1
- package/docs/api/interfaces/TabsContentProps.md +1 -1
- package/docs/api/interfaces/TabsListProps.md +1 -1
- package/docs/api/interfaces/TabsProps.md +1 -1
- package/docs/api/interfaces/TabsTriggerProps.md +1 -1
- package/docs/api/interfaces/TextareaProps.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +60 -38
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +13 -13
- package/docs/api/interfaces/UseFormDialogOptions.md +1 -1
- package/docs/api/interfaces/UseFormDialogReturn.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +2 -2
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +2 -2
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +2 -2
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UseResourcePermissionsOptions.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +202 -217
- package/docs/migration/README.md +18 -0
- package/docs/migration/database-changes-december-2025.md +768 -0
- package/docs/migration/person-scoped-profiles-migration-guide.md +472 -0
- package/docs/rbac/event-based-apps.md +124 -6
- package/package.json +1 -1
- package/scripts/check-pace-core-compliance.cjs +292 -57
- package/src/__tests__/public-recipe-view.test.ts +10 -10
- package/src/__tests__/rls-policies.test.ts +16 -14
- package/src/components/AddressField/README.md +6 -6
- package/src/components/DataTable/__tests__/DataTable.default-state.test.tsx +172 -45
- package/src/components/DataTable/__tests__/DataTable.grouping-aggregation.test.tsx +121 -28
- package/src/components/DataTable/__tests__/DataTableCore.test-setup.ts +9 -8
- package/src/components/DataTable/__tests__/DataTableCore.test.tsx +20 -52
- package/src/components/DataTable/__tests__/a11y.basic.test.tsx +170 -34
- package/src/components/DataTable/__tests__/keyboard.test.tsx +75 -12
- package/src/components/DataTable/__tests__/pagination.modes.test.tsx +75 -11
- package/src/components/DataTable/components/UnifiedTableBody.tsx +85 -14
- package/src/components/DataTable/hooks/useDataTablePermissions.ts +75 -10
- package/src/components/FileDisplay/FileDisplay.test.tsx +2 -1
- package/src/components/FileDisplay/FileDisplay.tsx +16 -4
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +6 -4
- package/src/components/NavigationMenu/NavigationMenu.tsx +1 -10
- package/src/components/OrganisationSelector/OrganisationSelector.tsx +35 -16
- package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +25 -2
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +97 -68
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +0 -7
- package/src/components/ProtectedRoute/ProtectedRoute.test.tsx +5 -9
- package/src/components/ProtectedRoute/ProtectedRoute.tsx +0 -1
- package/src/components/PublicLayout/PublicPageProvider.tsx +0 -1
- package/src/components/Select/Select.test.tsx +4 -1
- package/src/components/Select/Select.tsx +60 -15
- package/src/hooks/__tests__/usePermissionCache.simple.test.ts +192 -0
- package/src/hooks/__tests__/usePermissionCache.unit.test.ts +741 -0
- package/src/hooks/__tests__/usePublicEvent.simple.test.ts +703 -0
- package/src/hooks/__tests__/usePublicEvent.unit.test.ts +581 -0
- package/src/hooks/__tests__/useSecureDataAccess.unit.test.tsx +23 -15
- package/src/hooks/public/usePublicEvent.ts +8 -8
- package/src/hooks/public/usePublicFileDisplay.ts +2 -2
- package/src/hooks/services/useAuthService.ts +21 -3
- package/src/hooks/services/useEventService.ts +21 -3
- package/src/hooks/services/useInactivityService.ts +21 -3
- package/src/hooks/services/useOrganisationService.ts +21 -3
- package/src/hooks/useFileDisplay.ts +18 -26
- package/src/hooks/useQueryCache.ts +6 -6
- package/src/hooks/useSecureDataAccess.test.ts +24 -17
- package/src/hooks/useSecureDataAccess.ts +18 -13
- package/src/providers/__tests__/OrganisationProvider.test.tsx +27 -21
- package/src/providers/services/EventServiceProvider.tsx +0 -8
- package/src/providers/services/UnifiedAuthProvider.tsx +174 -24
- package/src/rbac/__tests__/adapters.comprehensive.test.tsx +10 -16
- package/src/rbac/__tests__/isSuperAdmin.real.test.ts +82 -0
- package/src/rbac/adapters.tsx +3 -22
- package/src/rbac/api.test.ts +2 -2
- package/src/rbac/api.ts +7 -1
- package/src/rbac/components/EnhancedNavigationMenu.tsx +2 -15
- package/src/rbac/components/NavigationGuard.tsx +1 -10
- package/src/rbac/components/NavigationProvider.tsx +0 -1
- package/src/rbac/components/PermissionEnforcer.tsx +45 -12
- package/src/rbac/components/SecureDataProvider.tsx +0 -1
- package/src/rbac/components/__tests__/EnhancedNavigationMenu.test.tsx +7 -43
- package/src/rbac/components/__tests__/NavigationGuard.test.tsx +4 -11
- package/src/rbac/components/__tests__/NavigationProvider.test.tsx +3 -3
- package/src/rbac/components/__tests__/SecureDataProvider.fixed.test.tsx +1 -1
- package/src/rbac/components/__tests__/SecureDataProvider.test.tsx +1 -1
- package/src/rbac/engine.ts +14 -2
- package/src/rbac/hooks/index.ts +0 -3
- package/src/rbac/hooks/usePermissions.ts +51 -11
- package/src/rbac/hooks/useRBAC.simple.test.ts +95 -0
- package/src/rbac/hooks/useRBAC.ts +3 -13
- package/src/rbac/hooks/useResolvedScope.test.ts +75 -54
- package/src/rbac/hooks/useResolvedScope.ts +58 -33
- package/src/rbac/hooks/useSecureSupabase.ts +4 -9
- package/src/rbac/secureClient.ts +31 -0
- package/src/rbac/utils/__tests__/eventContext.test.ts +2 -2
- package/src/rbac/utils/__tests__/eventContext.unit.test.ts +490 -0
- package/src/rbac/utils/eventContext.ts +5 -2
- package/src/services/AuthService.ts +37 -8
- package/src/services/EventService.ts +4 -57
- package/src/services/InactivityService.ts +127 -34
- package/src/services/OrganisationService.ts +160 -149
- package/src/services/__tests__/OrganisationService.pagination.test.ts +34 -8
- package/src/services/__tests__/OrganisationService.test.ts +218 -86
- package/src/types/database.generated.ts +166 -201
- package/src/types/supabase.ts +2 -2
- package/src/utils/__tests__/secureDataAccess.unit.test.ts +3 -2
- package/src/utils/file-reference/index.ts +4 -4
- package/src/utils/google-places/googlePlacesUtils.ts +1 -1
- package/src/utils/google-places/types.ts +1 -1
- package/src/utils/request-deduplication.ts +4 -4
- package/src/utils/security/secureDataAccess.test.ts +1 -1
- package/src/utils/security/secureDataAccess.ts +7 -4
- package/src/utils/storage/README.md +1 -1
- package/dist/chunk-4QYC5L4K.js.map +0 -1
- package/dist/chunk-73HSNNOQ.js.map +0 -1
- package/dist/chunk-HQVPB5MZ.js.map +0 -1
- package/dist/chunk-J2XXC7R5.js.map +0 -1
- package/dist/chunk-NIU6J6OX.js.map +0 -1
- package/dist/chunk-RUYZKXOD.js.map +0 -1
- package/dist/chunk-STYK4OH2.js.map +0 -1
- package/dist/chunk-VVBAW5A5.js.map +0 -1
- package/dist/chunk-Y4BUBBHD.js.map +0 -1
- package/scripts/check-pace-core-compliance.js +0 -512
- package/src/rbac/hooks/useSuperAdminBypass.ts +0 -126
- package/src/utils/context/superAdminOverride.ts +0 -58
- /package/dist/{DataTable-ON3IXISJ.js.map → DataTable-5FU7IESH.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-X5NXANVI.js.map → UnifiedAuthProvider-RGJTDE2C.js.map} +0 -0
- /package/dist/{api-I6UCQ5S6.js.map → api-N774RPUA.js.map} +0 -0
|
@@ -25,12 +25,12 @@ import {
|
|
|
25
25
|
SelectSeparator,
|
|
26
26
|
SelectTrigger,
|
|
27
27
|
SelectValue
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-E3SPN4VZ.js";
|
|
29
29
|
import {
|
|
30
30
|
useCan,
|
|
31
31
|
usePermissions,
|
|
32
32
|
useRBAC
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-XNXXZ43G.js";
|
|
34
34
|
import {
|
|
35
35
|
createFileReferenceService,
|
|
36
36
|
generateFileUrlsBatch,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
useFileDisplay,
|
|
43
43
|
usePreventTabReload,
|
|
44
44
|
usePublicFileDisplay
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-BC4IJKSL.js";
|
|
46
46
|
import {
|
|
47
47
|
useToast
|
|
48
48
|
} from "./chunk-6C4YBBJM.js";
|
|
@@ -53,16 +53,16 @@ import {
|
|
|
53
53
|
useEvents,
|
|
54
54
|
useIsPublicPage,
|
|
55
55
|
useResolvedScope
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-IIELH4DL.js";
|
|
57
57
|
import {
|
|
58
58
|
EventServiceContext,
|
|
59
59
|
useOrganisations,
|
|
60
60
|
useSessionRestoration,
|
|
61
61
|
useUnifiedAuth
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-7FLMSG37.js";
|
|
63
63
|
import {
|
|
64
64
|
isSuperAdmin
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-KNC55RTG.js";
|
|
66
66
|
import {
|
|
67
67
|
assertAppId
|
|
68
68
|
} from "./chunk-QXHPKYJV.js";
|
|
@@ -515,6 +515,7 @@ function FileDisplayContent({
|
|
|
515
515
|
displayOnly,
|
|
516
516
|
showDelete,
|
|
517
517
|
className,
|
|
518
|
+
imgClassName,
|
|
518
519
|
children,
|
|
519
520
|
onDelete,
|
|
520
521
|
clearError,
|
|
@@ -637,12 +638,12 @@ function FileDisplayContent({
|
|
|
637
638
|
if (!fileUrl) {
|
|
638
639
|
return /* @__PURE__ */ jsx4("figure", { className: className || "max-w-full h-48", title: "Loading", children: /* @__PURE__ */ jsx4("p", { className: fallbackClasses, children: /* @__PURE__ */ jsx4(LoadingSpinner, {}) }) });
|
|
639
640
|
}
|
|
640
|
-
return /* @__PURE__ */ jsx4("figure", { className: className || "
|
|
641
|
+
return /* @__PURE__ */ jsx4("figure", { className: className || "", children: /* @__PURE__ */ jsx4(
|
|
641
642
|
"img",
|
|
642
643
|
{
|
|
643
644
|
src: fileUrl,
|
|
644
645
|
alt: fileReference.file_metadata.fileName || "File",
|
|
645
|
-
className: "
|
|
646
|
+
className: imgClassName || "object-cover size-full",
|
|
646
647
|
onError: handleImageError
|
|
647
648
|
}
|
|
648
649
|
) });
|
|
@@ -685,7 +686,7 @@ function FileDisplayContent({
|
|
|
685
686
|
{
|
|
686
687
|
src: fileUrl,
|
|
687
688
|
alt: fileReference.file_metadata.fileName || "File",
|
|
688
|
-
className: "
|
|
689
|
+
className: imgClassName || "object-cover size-full",
|
|
689
690
|
onError: handleImageError
|
|
690
691
|
}
|
|
691
692
|
),
|
|
@@ -782,7 +783,7 @@ function FileDisplayContent({
|
|
|
782
783
|
{
|
|
783
784
|
src: fileUrl2,
|
|
784
785
|
alt: fileRef.file_metadata.fileName || "File",
|
|
785
|
-
className:
|
|
786
|
+
className: imgClassName || "object-cover size-full",
|
|
786
787
|
onError: handleImageError
|
|
787
788
|
}
|
|
788
789
|
) : /* @__PURE__ */ jsx4("span", { className: "text-2xl", children: getFileIcon(fileRef.file_metadata.fileType || "") }),
|
|
@@ -832,6 +833,7 @@ function FileDisplayPublic({
|
|
|
832
833
|
displayOnly = false,
|
|
833
834
|
showDelete = false,
|
|
834
835
|
className = "",
|
|
836
|
+
imgClassName,
|
|
835
837
|
children,
|
|
836
838
|
loadingComponent,
|
|
837
839
|
errorComponent,
|
|
@@ -861,6 +863,7 @@ function FileDisplayPublic({
|
|
|
861
863
|
displayOnly,
|
|
862
864
|
showDelete: false,
|
|
863
865
|
className,
|
|
866
|
+
imgClassName,
|
|
864
867
|
children,
|
|
865
868
|
onDelete: void 0,
|
|
866
869
|
organisation_id,
|
|
@@ -934,6 +937,7 @@ function FileDisplayPublic({
|
|
|
934
937
|
displayOnly,
|
|
935
938
|
showDelete: false,
|
|
936
939
|
className,
|
|
940
|
+
imgClassName,
|
|
937
941
|
children,
|
|
938
942
|
onDelete: showDelete ? handleDelete : void 0,
|
|
939
943
|
organisation_id,
|
|
@@ -957,6 +961,7 @@ function FileDisplayAuthenticated({
|
|
|
957
961
|
displayOnly = false,
|
|
958
962
|
showDelete = false,
|
|
959
963
|
className = "",
|
|
964
|
+
imgClassName,
|
|
960
965
|
children,
|
|
961
966
|
loadingComponent,
|
|
962
967
|
errorComponent,
|
|
@@ -1042,6 +1047,7 @@ function FileDisplayAuthenticated({
|
|
|
1042
1047
|
displayOnly,
|
|
1043
1048
|
showDelete,
|
|
1044
1049
|
className,
|
|
1050
|
+
imgClassName,
|
|
1045
1051
|
children,
|
|
1046
1052
|
onDelete: showDelete ? handleDelete : void 0,
|
|
1047
1053
|
clearError: refetch,
|
|
@@ -1066,6 +1072,7 @@ function FileDisplay({
|
|
|
1066
1072
|
displayOnly = false,
|
|
1067
1073
|
showDelete = false,
|
|
1068
1074
|
className = "",
|
|
1075
|
+
imgClassName,
|
|
1069
1076
|
children,
|
|
1070
1077
|
loadingComponent,
|
|
1071
1078
|
errorComponent,
|
|
@@ -1089,6 +1096,7 @@ function FileDisplay({
|
|
|
1089
1096
|
displayOnly,
|
|
1090
1097
|
showDelete,
|
|
1091
1098
|
className,
|
|
1099
|
+
imgClassName,
|
|
1092
1100
|
children,
|
|
1093
1101
|
loadingComponent,
|
|
1094
1102
|
errorComponent,
|
|
@@ -1112,6 +1120,7 @@ function FileDisplay({
|
|
|
1112
1120
|
displayOnly,
|
|
1113
1121
|
showDelete,
|
|
1114
1122
|
className,
|
|
1123
|
+
imgClassName,
|
|
1115
1124
|
children,
|
|
1116
1125
|
loadingComponent,
|
|
1117
1126
|
errorComponent,
|
|
@@ -2560,7 +2569,7 @@ function EventSelector({
|
|
|
2560
2569
|
}
|
|
2561
2570
|
|
|
2562
2571
|
// src/components/OrganisationSelector/OrganisationSelector.tsx
|
|
2563
|
-
import { useState as useState8, useCallback as useCallback8 } from "react";
|
|
2572
|
+
import { useState as useState8, useCallback as useCallback8, useMemo as useMemo6 } from "react";
|
|
2564
2573
|
import { RefreshCw as RefreshCw2, AlertCircle as AlertCircle2, Building2, Shield } from "lucide-react";
|
|
2565
2574
|
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2566
2575
|
function OrganisationSelector({
|
|
@@ -2598,7 +2607,6 @@ function OrganisationSelector({
|
|
|
2598
2607
|
if (newOrganisation && onOrganisationChange) {
|
|
2599
2608
|
onOrganisationChange(newOrganisation);
|
|
2600
2609
|
}
|
|
2601
|
-
logger.debug("OrganisationSelector", "Successfully switched to organisation:", orgId);
|
|
2602
2610
|
} catch (error) {
|
|
2603
2611
|
logger.error("OrganisationSelector", "Failed to switch organisation:", error);
|
|
2604
2612
|
setSwitchError(error instanceof Error ? error.message : "Failed to switch organisation");
|
|
@@ -2685,18 +2693,29 @@ function OrganisationSelector({
|
|
|
2685
2693
|
/* @__PURE__ */ jsx14(AlertCircle2, { className: "size-4" }),
|
|
2686
2694
|
/* @__PURE__ */ jsx14(AlertDescription, { children: switchError })
|
|
2687
2695
|
] });
|
|
2688
|
-
|
|
2696
|
+
const isSelectDisabled = disabled || isLoading;
|
|
2697
|
+
const selectValue = useMemo6(() => {
|
|
2698
|
+
return selectedOrganisation?.id || "";
|
|
2699
|
+
}, [selectedOrganisation?.id]);
|
|
2700
|
+
return /* @__PURE__ */ jsxs9("div", { className, children: [
|
|
2689
2701
|
/* @__PURE__ */ jsxs9(
|
|
2690
2702
|
Select,
|
|
2691
2703
|
{
|
|
2692
|
-
value:
|
|
2704
|
+
value: selectValue,
|
|
2693
2705
|
onValueChange: handleOrganisationChange,
|
|
2694
|
-
disabled:
|
|
2706
|
+
disabled: isSelectDisabled,
|
|
2695
2707
|
children: [
|
|
2696
|
-
/* @__PURE__ */ jsx14(
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2708
|
+
/* @__PURE__ */ jsx14(
|
|
2709
|
+
SelectTrigger,
|
|
2710
|
+
{
|
|
2711
|
+
className: "text-left",
|
|
2712
|
+
variant: "outline",
|
|
2713
|
+
children: /* @__PURE__ */ jsx14(SelectValue, { placeholder, children: selectedOrganisation && /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
|
|
2714
|
+
isLoading ? /* @__PURE__ */ jsx14(LoadingSpinner, { size: "sm" }) : /* @__PURE__ */ jsx14(Building2, { className: "size-4 flex-shrink-0" }),
|
|
2715
|
+
/* @__PURE__ */ jsx14("span", { className: "truncate", children: selectedOrganisation.display_name })
|
|
2716
|
+
] }) })
|
|
2717
|
+
}
|
|
2718
|
+
),
|
|
2700
2719
|
/* @__PURE__ */ jsx14(SelectContent, { children: organisations.map((org) => {
|
|
2701
2720
|
const userRole = getUserRole(org.id);
|
|
2702
2721
|
const hasAccess = validateOrganisationAccess(org.id);
|
|
@@ -2726,7 +2745,7 @@ function OrganisationSelector({
|
|
|
2726
2745
|
]
|
|
2727
2746
|
}
|
|
2728
2747
|
),
|
|
2729
|
-
switchErrorDisplay
|
|
2748
|
+
switchErrorDisplay && /* @__PURE__ */ jsx14("div", { className: "mt-2", children: switchErrorDisplay })
|
|
2730
2749
|
] });
|
|
2731
2750
|
}
|
|
2732
2751
|
|
|
@@ -2805,7 +2824,7 @@ function PasswordChangeForm({ onSubmit, className }) {
|
|
|
2805
2824
|
}
|
|
2806
2825
|
|
|
2807
2826
|
// src/components/UserMenu/UserMenu.tsx
|
|
2808
|
-
import React14, { useCallback as useCallback9, useMemo as
|
|
2827
|
+
import React14, { useCallback as useCallback9, useMemo as useMemo7, useState as useState10 } from "react";
|
|
2809
2828
|
import { ChevronDown, LogOut, KeyRound } from "lucide-react";
|
|
2810
2829
|
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2811
2830
|
var UserMenu = React14.memo(function UserMenu2({
|
|
@@ -2816,7 +2835,7 @@ var UserMenu = React14.memo(function UserMenu2({
|
|
|
2816
2835
|
showAvatar = true
|
|
2817
2836
|
}) {
|
|
2818
2837
|
const [isPasswordDialogOpen, setPasswordDialogOpen] = useState10(false);
|
|
2819
|
-
const userInfo =
|
|
2838
|
+
const userInfo = useMemo7(() => {
|
|
2820
2839
|
if (!user) return null;
|
|
2821
2840
|
return {
|
|
2822
2841
|
email: user.email,
|
|
@@ -2959,7 +2978,7 @@ var NavigationMenu = React15.forwardRef(({
|
|
|
2959
2978
|
}
|
|
2960
2979
|
const userId2 = authContext.user.id;
|
|
2961
2980
|
const appName = authContext.appName;
|
|
2962
|
-
import("./api-
|
|
2981
|
+
import("./api-N774RPUA.js").then(({ resolveAppContext }) => {
|
|
2963
2982
|
resolveAppContext({
|
|
2964
2983
|
userId: userId2,
|
|
2965
2984
|
appName
|
|
@@ -2968,7 +2987,6 @@ var NavigationMenu = React15.forwardRef(({
|
|
|
2968
2987
|
setResolvedAppId(result.appId);
|
|
2969
2988
|
}
|
|
2970
2989
|
}).catch((error) => {
|
|
2971
|
-
logger.debug("NavigationMenu", "Failed to resolve appId", error);
|
|
2972
2990
|
});
|
|
2973
2991
|
});
|
|
2974
2992
|
}
|
|
@@ -3209,15 +3227,6 @@ var NavigationMenu = React15.forwardRef(({
|
|
|
3209
3227
|
};
|
|
3210
3228
|
const handleItemClick = (item) => {
|
|
3211
3229
|
if (auditLog) {
|
|
3212
|
-
logger.debug("NavigationMenu", "Navigation access attempt:", {
|
|
3213
|
-
itemId: item.id,
|
|
3214
|
-
label: item.label,
|
|
3215
|
-
href: item.href,
|
|
3216
|
-
permissions: item.permissions,
|
|
3217
|
-
roles: item.roles,
|
|
3218
|
-
accessLevel: item.accessLevel,
|
|
3219
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
3220
|
-
});
|
|
3221
3230
|
}
|
|
3222
3231
|
if (!authContext) {
|
|
3223
3232
|
if (onNavigate) {
|
|
@@ -3528,7 +3537,7 @@ var Footer = React16.memo(FooterComponent);
|
|
|
3528
3537
|
Footer.displayName = "Footer";
|
|
3529
3538
|
|
|
3530
3539
|
// src/components/PaceAppLayout/PaceAppLayout.tsx
|
|
3531
|
-
import { useState as useState12, useEffect as useEffect8, useMemo as
|
|
3540
|
+
import { useState as useState12, useEffect as useEffect8, useMemo as useMemo9 } from "react";
|
|
3532
3541
|
import { Outlet, useNavigate, useLocation } from "react-router-dom";
|
|
3533
3542
|
import { Fragment as Fragment7, jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3534
3543
|
var EMPTY_PAGE_ID_MAPPING = {};
|
|
@@ -3563,7 +3572,7 @@ function PaceAppLayout({
|
|
|
3563
3572
|
onRouteAccessDenied,
|
|
3564
3573
|
onRouteStrictModeViolation
|
|
3565
3574
|
}) {
|
|
3566
|
-
const { user, signOut, updatePassword, supabase, appId: contextAppId } = useUnifiedAuth();
|
|
3575
|
+
const { user, signOut, updatePassword, supabase, appId: contextAppId, selectedOrganisationId } = useUnifiedAuth();
|
|
3567
3576
|
const {
|
|
3568
3577
|
selectedOrganisation,
|
|
3569
3578
|
isContextReady,
|
|
@@ -3571,6 +3580,34 @@ function PaceAppLayout({
|
|
|
3571
3580
|
ensureOrganisationContext,
|
|
3572
3581
|
isLoading: organisationLoading
|
|
3573
3582
|
} = useOrganisations();
|
|
3583
|
+
const { isSuperAdmin: isSuperAdminFromRBAC, isLoading: rbacLoading } = useRBAC();
|
|
3584
|
+
const [isSuperAdminDirect, setIsSuperAdminDirect] = useState12(false);
|
|
3585
|
+
const [isCheckingSuperAdminDirect, setIsCheckingSuperAdminDirect] = useState12(false);
|
|
3586
|
+
useEffect8(() => {
|
|
3587
|
+
const checkSuperAdminDirect = async () => {
|
|
3588
|
+
if (!user?.id) {
|
|
3589
|
+
setIsSuperAdminDirect(false);
|
|
3590
|
+
setIsCheckingSuperAdminDirect(false);
|
|
3591
|
+
return;
|
|
3592
|
+
}
|
|
3593
|
+
if (isSuperAdminFromRBAC) {
|
|
3594
|
+
setIsCheckingSuperAdminDirect(false);
|
|
3595
|
+
return;
|
|
3596
|
+
}
|
|
3597
|
+
setIsCheckingSuperAdminDirect(true);
|
|
3598
|
+
try {
|
|
3599
|
+
const superAdminStatus = await isSuperAdmin(user.id);
|
|
3600
|
+
setIsSuperAdminDirect(superAdminStatus);
|
|
3601
|
+
} catch (error) {
|
|
3602
|
+
logger.error("PaceAppLayout", "Error checking super admin status directly", { userId: user?.id, error });
|
|
3603
|
+
setIsSuperAdminDirect(false);
|
|
3604
|
+
} finally {
|
|
3605
|
+
setIsCheckingSuperAdminDirect(false);
|
|
3606
|
+
}
|
|
3607
|
+
};
|
|
3608
|
+
checkSuperAdminDirect();
|
|
3609
|
+
}, [user?.id, isSuperAdminFromRBAC]);
|
|
3610
|
+
const isSuperAdmin2 = isSuperAdminFromRBAC || isSuperAdminDirect;
|
|
3574
3611
|
const navigate = useNavigate();
|
|
3575
3612
|
const location = useLocation();
|
|
3576
3613
|
useEventTheme();
|
|
@@ -3586,107 +3623,85 @@ function PaceAppLayout({
|
|
|
3586
3623
|
selectedEventId: selectedEvent?.event_id || null
|
|
3587
3624
|
});
|
|
3588
3625
|
const resolvedAppId = contextAppId || resolvedScope?.appId;
|
|
3589
|
-
const
|
|
3590
|
-
|
|
3591
|
-
|
|
3626
|
+
const scopeOrgId = resolvedScope?.organisationId || selectedOrganisation?.id || "";
|
|
3627
|
+
const scopeEventId = resolvedScope?.eventId || selectedEvent?.event_id || void 0;
|
|
3628
|
+
const scopeAppId = resolvedScope?.appId || resolvedAppId || void 0;
|
|
3629
|
+
const scope = useMemo9(() => {
|
|
3630
|
+
const newScope = {};
|
|
3631
|
+
if (scopeOrgId) {
|
|
3632
|
+
newScope.organisationId = scopeOrgId;
|
|
3592
3633
|
}
|
|
3593
|
-
if (
|
|
3594
|
-
|
|
3595
|
-
organisationId: selectedOrganisation.id,
|
|
3596
|
-
eventId: selectedEvent?.event_id || void 0,
|
|
3597
|
-
appId: resolvedAppId || resolvedScope?.appId || void 0
|
|
3598
|
-
};
|
|
3634
|
+
if (scopeEventId) {
|
|
3635
|
+
newScope.eventId = scopeEventId;
|
|
3599
3636
|
}
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
const defaultNavItems = useMemo8(() => [
|
|
3637
|
+
if (scopeAppId) {
|
|
3638
|
+
newScope.appId = scopeAppId;
|
|
3639
|
+
}
|
|
3640
|
+
return newScope;
|
|
3641
|
+
}, [scopeOrgId, scopeEventId, scopeAppId]);
|
|
3642
|
+
const defaultNavItems = useMemo9(() => [
|
|
3607
3643
|
{ id: "home", label: "Home", href: "/", icon: "Home" },
|
|
3608
3644
|
{ id: "dashboard", label: "Dashboard", href: "/dashboard", icon: "LayoutDashboard" },
|
|
3609
3645
|
{ id: "settings", label: "Settings", href: "/settings", icon: "Settings" },
|
|
3610
3646
|
{ id: "ui-showcase", label: "UI Showcase", href: "/ui-showcase", icon: "Component" },
|
|
3611
3647
|
{ id: "data-table-showcase", label: "DataTable Showcase", href: "/data-table-showcase", icon: "Table" }
|
|
3612
3648
|
], []);
|
|
3613
|
-
const baseMenuItems =
|
|
3614
|
-
const currentRoutePermission =
|
|
3649
|
+
const baseMenuItems = useMemo9(() => navItems || defaultNavItems, [navItems]);
|
|
3650
|
+
const currentRoutePermission = useMemo9(() => {
|
|
3615
3651
|
const currentPath = location.pathname;
|
|
3616
3652
|
return routePermissions[currentPath] || defaultPermission;
|
|
3617
3653
|
}, [location.pathname, routePermissions, defaultPermission]);
|
|
3618
|
-
const currentPageId =
|
|
3654
|
+
const currentPageId = useMemo9(() => {
|
|
3619
3655
|
const currentPath = location.pathname;
|
|
3620
3656
|
if (pageIdMapping[currentPath]) {
|
|
3621
3657
|
return pageIdMapping[currentPath];
|
|
3622
3658
|
}
|
|
3623
3659
|
const pathSegments = currentPath.slice(1).split("/").filter(Boolean);
|
|
3624
|
-
return pathSegments[0] || "
|
|
3660
|
+
return pathSegments[0] || "";
|
|
3625
3661
|
}, [location.pathname, pageIdMapping]);
|
|
3626
|
-
const currentPermission =
|
|
3627
|
-
if (!enforcePermissions) {
|
|
3628
|
-
return "
|
|
3662
|
+
const currentPermission = useMemo9(() => {
|
|
3663
|
+
if (!enforcePermissions || !currentPageId) {
|
|
3664
|
+
return "";
|
|
3629
3665
|
}
|
|
3630
3666
|
const permissionString = `${currentRoutePermission}:page.${currentPageId}`;
|
|
3631
3667
|
return permissionString;
|
|
3632
3668
|
}, [enforcePermissions, currentRoutePermission, currentPageId]);
|
|
3633
|
-
const
|
|
3634
|
-
const [isCheckingSuperAdmin, setIsCheckingSuperAdmin] = useState12(false);
|
|
3635
|
-
useEffect8(() => {
|
|
3636
|
-
const checkSuperAdminStatus = async () => {
|
|
3637
|
-
if (!user?.id) {
|
|
3638
|
-
setIsSuperAdminUser(false);
|
|
3639
|
-
setIsCheckingSuperAdmin(false);
|
|
3640
|
-
return;
|
|
3641
|
-
}
|
|
3642
|
-
setIsCheckingSuperAdmin(true);
|
|
3643
|
-
try {
|
|
3644
|
-
const superAdminStatus = await isSuperAdmin(user.id);
|
|
3645
|
-
setIsSuperAdminUser(superAdminStatus);
|
|
3646
|
-
} catch (error) {
|
|
3647
|
-
logger.error("PaceAppLayout", "Error checking super admin status", { userId: user?.id, error });
|
|
3648
|
-
setIsSuperAdminUser(false);
|
|
3649
|
-
} finally {
|
|
3650
|
-
setIsCheckingSuperAdmin(false);
|
|
3651
|
-
}
|
|
3652
|
-
};
|
|
3653
|
-
checkSuperAdminStatus();
|
|
3654
|
-
}, [user?.id]);
|
|
3669
|
+
const shouldCheckPermission = enforcePermissions && !!currentPermission && !!currentPageId;
|
|
3655
3670
|
const { can: canFromHook, isLoading: isCheckingPermission, error: permissionError } = useCan(
|
|
3656
3671
|
user?.id || "",
|
|
3657
3672
|
scope,
|
|
3658
|
-
currentPermission,
|
|
3659
|
-
currentPageId,
|
|
3673
|
+
shouldCheckPermission ? currentPermission : "",
|
|
3674
|
+
shouldCheckPermission ? currentPageId : "",
|
|
3660
3675
|
true,
|
|
3661
3676
|
// useCache
|
|
3662
3677
|
appName
|
|
3663
3678
|
// Pass appName for PORTAL/ADMIN special case
|
|
3664
3679
|
);
|
|
3665
|
-
const can =
|
|
3680
|
+
const can = isSuperAdmin2 ? true : canFromHook;
|
|
3666
3681
|
const hasPermission = enforcePermissions ? can : true;
|
|
3667
3682
|
useEffect8(() => {
|
|
3668
3683
|
if (!enforcePermissions) {
|
|
3669
3684
|
return;
|
|
3670
3685
|
}
|
|
3671
|
-
if (
|
|
3686
|
+
if (isCheckingPermission) {
|
|
3672
3687
|
return;
|
|
3673
3688
|
}
|
|
3674
|
-
if (strictMode && !
|
|
3689
|
+
if (strictMode && !isSuperAdmin2 && !can) {
|
|
3675
3690
|
logger.error("PaceAppLayout", "STRICT MODE VIOLATION: User attempted to access protected page without permission", {
|
|
3676
3691
|
pageName: currentPageId,
|
|
3677
3692
|
operation: currentRoutePermission,
|
|
3678
3693
|
userId: user?.id,
|
|
3679
|
-
isSuperAdmin:
|
|
3694
|
+
isSuperAdmin: isSuperAdmin2,
|
|
3680
3695
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
3681
3696
|
});
|
|
3682
3697
|
if (onStrictModeViolation) {
|
|
3683
3698
|
onStrictModeViolation(currentPageId, currentRoutePermission);
|
|
3684
3699
|
}
|
|
3685
3700
|
}
|
|
3686
|
-
if (!
|
|
3701
|
+
if (!isSuperAdmin2 && !can && onPageAccessDenied) {
|
|
3687
3702
|
onPageAccessDenied(currentPageId, currentRoutePermission);
|
|
3688
3703
|
}
|
|
3689
|
-
}, [enforcePermissions, can, isCheckingPermission,
|
|
3704
|
+
}, [enforcePermissions, can, isCheckingPermission, isSuperAdmin2, currentPageId, currentRoutePermission, user?.id, strictMode, auditLog, onPageAccessDenied, onStrictModeViolation]);
|
|
3690
3705
|
const [filteredMenuItems, setFilteredMenuItems] = useState12(baseMenuItems);
|
|
3691
3706
|
useEffect8(() => {
|
|
3692
3707
|
let isMounted = true;
|
|
@@ -3714,8 +3729,8 @@ function PaceAppLayout({
|
|
|
3714
3729
|
return;
|
|
3715
3730
|
}
|
|
3716
3731
|
try {
|
|
3717
|
-
const { isSuperAdmin:
|
|
3718
|
-
const isSuper = await
|
|
3732
|
+
const { isSuperAdmin: checkSuperAdminDynamic } = await import("./api-N774RPUA.js");
|
|
3733
|
+
const isSuper = await checkSuperAdminDynamic(user.id);
|
|
3719
3734
|
if (isSuper) {
|
|
3720
3735
|
if (isMounted) {
|
|
3721
3736
|
setFilteredMenuItems(baseMenuItems);
|
|
@@ -3729,7 +3744,7 @@ function PaceAppLayout({
|
|
|
3729
3744
|
}
|
|
3730
3745
|
}
|
|
3731
3746
|
try {
|
|
3732
|
-
const { getPermissionMap } = await import("./api-
|
|
3747
|
+
const { getPermissionMap } = await import("./api-N774RPUA.js");
|
|
3733
3748
|
const permissionScope = {
|
|
3734
3749
|
organisationId: currentScope.organisationId,
|
|
3735
3750
|
eventId: currentScope.eventId,
|
|
@@ -3785,7 +3800,7 @@ function PaceAppLayout({
|
|
|
3785
3800
|
let hasAccess = true;
|
|
3786
3801
|
if (currentRoute.pageId && currentRoute.permissions && currentRoute.permissions.length > 0) {
|
|
3787
3802
|
try {
|
|
3788
|
-
const { isPermittedCached } = await import("./api-
|
|
3803
|
+
const { isPermittedCached } = await import("./api-N774RPUA.js");
|
|
3789
3804
|
const hasPagePermission = await isPermittedCached({
|
|
3790
3805
|
userId: user?.id || "",
|
|
3791
3806
|
scope,
|
|
@@ -3801,7 +3816,7 @@ function PaceAppLayout({
|
|
|
3801
3816
|
}
|
|
3802
3817
|
}
|
|
3803
3818
|
if (hasAccess && currentRoute.roles && currentRoute.roles.length > 0 && user?.id) {
|
|
3804
|
-
const { useUnifiedAuth: useUnifiedAuth2 } = await import("./UnifiedAuthProvider-
|
|
3819
|
+
const { useUnifiedAuth: useUnifiedAuth2 } = await import("./UnifiedAuthProvider-RGJTDE2C.js");
|
|
3805
3820
|
hasAccess = true;
|
|
3806
3821
|
}
|
|
3807
3822
|
if (!isMounted) return;
|
|
@@ -3847,26 +3862,26 @@ function PaceAppLayout({
|
|
|
3847
3862
|
}
|
|
3848
3863
|
return {};
|
|
3849
3864
|
};
|
|
3850
|
-
if (user?.id && organisationLoading) {
|
|
3865
|
+
if (user?.id && organisationLoading && !isSuperAdmin2 && !isCheckingSuperAdminDirect && !rbacLoading && !selectedOrganisationId) {
|
|
3851
3866
|
return /* @__PURE__ */ jsx20("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs15("div", { className: "text-center", children: [
|
|
3852
3867
|
/* @__PURE__ */ jsx20("div", { className: "animate-spin rounded-full size-8 border-b-2 border-sec-900 mx-auto mb-4" }),
|
|
3853
3868
|
/* @__PURE__ */ jsx20("p", { className: "text-sec-600", children: "Loading organisation context..." })
|
|
3854
3869
|
] }) });
|
|
3855
3870
|
}
|
|
3856
|
-
if (enforcePermissions &&
|
|
3871
|
+
if (enforcePermissions && isCheckingPermission) {
|
|
3857
3872
|
return /* @__PURE__ */ jsx20("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs15("div", { className: "text-center", children: [
|
|
3858
3873
|
/* @__PURE__ */ jsx20("div", { className: "animate-spin rounded-full size-8 border-b-2 border-sec-900 mx-auto mb-4" }),
|
|
3859
3874
|
/* @__PURE__ */ jsx20("p", { className: "text-sec-600", children: "Checking permissions..." })
|
|
3860
3875
|
] }) });
|
|
3861
3876
|
}
|
|
3862
|
-
if (enforcePermissions && permissionError && !
|
|
3877
|
+
if (enforcePermissions && permissionError && !isSuperAdmin2) {
|
|
3863
3878
|
return /* @__PURE__ */ jsx20("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs15("div", { className: "text-center", children: [
|
|
3864
3879
|
/* @__PURE__ */ jsx20("h2", { className: "text-xl font-semibold text-acc-600 mb-2", children: "Permission Error" }),
|
|
3865
3880
|
/* @__PURE__ */ jsx20("p", { className: "text-sec-600 mb-4", children: permissionError.message }),
|
|
3866
3881
|
/* @__PURE__ */ jsx20(Button, { onClick: () => navigate("/"), children: "Go Home" })
|
|
3867
3882
|
] }) });
|
|
3868
3883
|
}
|
|
3869
|
-
if (enforcePermissions && hasPermission === false && !
|
|
3884
|
+
if (enforcePermissions && hasPermission === false && !isCheckingSuperAdminDirect && !isSuperAdmin2) {
|
|
3870
3885
|
if (enforcePagePermissions && pagePermissionFallback) {
|
|
3871
3886
|
return /* @__PURE__ */ jsx20(Fragment7, { children: pagePermissionFallback });
|
|
3872
3887
|
}
|
|
@@ -3957,7 +3972,6 @@ var PaceLoginPage = ({
|
|
|
3957
3972
|
await eventService.restorePersistedEvent();
|
|
3958
3973
|
}
|
|
3959
3974
|
} catch (error) {
|
|
3960
|
-
logger.debug("PaceLoginPage", "Could not restore persisted event (service may not be ready):", error);
|
|
3961
3975
|
}
|
|
3962
3976
|
};
|
|
3963
3977
|
const timeoutId = setTimeout(() => {
|
|
@@ -3991,7 +4005,6 @@ var PaceLoginPage = ({
|
|
|
3991
4005
|
}
|
|
3992
4006
|
const { data: pagesData, error: pagesError } = await supabase.from("rbac_app_pages").select("id, page_name").eq("app_id", appData.id);
|
|
3993
4007
|
if (pagesError || !pagesData || pagesData.length === 0) {
|
|
3994
|
-
logger.debug("PaceLoginPage", "No pages configured for app:", appName);
|
|
3995
4008
|
setAccessError(`You do not have permission to access ${appName}. This application is currently unavailable. Please contact your administrator if you believe you should have access.`);
|
|
3996
4009
|
setIsCheckingAccess(false);
|
|
3997
4010
|
return;
|
|
@@ -3999,7 +4012,6 @@ var PaceLoginPage = ({
|
|
|
3999
4012
|
const { data: orgRow } = await supabase.from("rbac_organisation_roles").select("organisation_id").eq("user_id", userId).eq("status", "active").is("revoked_at", null).limit(1).maybeSingle();
|
|
4000
4013
|
const organisationId = orgRow?.organisation_id;
|
|
4001
4014
|
if (!organisationId) {
|
|
4002
|
-
logger.debug("PaceLoginPage", "User has no organisation access");
|
|
4003
4015
|
setAccessError(`You do not have permission to access ${appName}. You are not assigned to any organisation. Please contact your administrator.`);
|
|
4004
4016
|
setIsCheckingAccess(false);
|
|
4005
4017
|
return;
|
|
@@ -4016,19 +4028,16 @@ var PaceLoginPage = ({
|
|
|
4016
4028
|
p_page_id: page.page_name
|
|
4017
4029
|
// Page name to resolve to UUID
|
|
4018
4030
|
});
|
|
4019
|
-
logger.debug("PaceLoginPage", "Permission check for page:", { pageName: page.page_name, hasPermission, error: permError });
|
|
4020
4031
|
if (!permError && hasPermission === true) {
|
|
4021
4032
|
hasAnyAccess = true;
|
|
4022
4033
|
break;
|
|
4023
4034
|
}
|
|
4024
4035
|
}
|
|
4025
4036
|
if (hasAnyAccess) {
|
|
4026
|
-
logger.debug("PaceLoginPage", "User has access to app");
|
|
4027
4037
|
setIsCheckingAccess(false);
|
|
4028
4038
|
navigate(onSuccessRedirectPath, { replace: true });
|
|
4029
4039
|
return;
|
|
4030
4040
|
}
|
|
4031
|
-
logger.debug("PaceLoginPage", "Access denied - no permissions");
|
|
4032
4041
|
setAccessError(`You do not have permission to access ${appName}. This application is restricted to authorized users only. Please contact your administrator if you believe you should have access.`);
|
|
4033
4042
|
setIsCheckingAccess(false);
|
|
4034
4043
|
} catch (error) {
|
|
@@ -4113,7 +4122,7 @@ var SessionRestorationLoader = ({
|
|
|
4113
4122
|
};
|
|
4114
4123
|
|
|
4115
4124
|
// src/components/ProtectedRoute/ProtectedRoute.tsx
|
|
4116
|
-
import { useMemo as
|
|
4125
|
+
import { useMemo as useMemo10, useEffect as useEffect10, useRef as useRef8, useState as useState14 } from "react";
|
|
4117
4126
|
import { Navigate, Outlet as Outlet2 } from "react-router-dom";
|
|
4118
4127
|
import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4119
4128
|
function ProtectedRoute({
|
|
@@ -4190,7 +4199,7 @@ function ProtectedRoute({
|
|
|
4190
4199
|
tabJustBecameVisibleRef.current = false;
|
|
4191
4200
|
}
|
|
4192
4201
|
}, [isAuthenticated]);
|
|
4193
|
-
const isRestoringSession =
|
|
4202
|
+
const isRestoringSession = useMemo10(() => {
|
|
4194
4203
|
return sessionRestoration.isRestoring && !sessionRestoration.restorationComplete && !sessionRestoration.restorationError && !sessionRestoration.hasTimedOut;
|
|
4195
4204
|
}, [
|
|
4196
4205
|
sessionRestoration.isRestoring,
|
|
@@ -4240,14 +4249,13 @@ function ProtectedRoute({
|
|
|
4240
4249
|
] }) });
|
|
4241
4250
|
}
|
|
4242
4251
|
if (!selectedEvent) {
|
|
4243
|
-
logger.debug("ProtectedRoute", "Events available but none selected - allowing render so selector is visible");
|
|
4244
4252
|
return /* @__PURE__ */ jsx23(Outlet2, {});
|
|
4245
4253
|
}
|
|
4246
4254
|
return /* @__PURE__ */ jsx23(Outlet2, {});
|
|
4247
4255
|
}
|
|
4248
4256
|
|
|
4249
4257
|
// src/components/FileUpload/FileUpload.tsx
|
|
4250
|
-
import { useState as useState15, useCallback as useCallback11, useRef as useRef9, useEffect as useEffect11, useMemo as
|
|
4258
|
+
import { useState as useState15, useCallback as useCallback11, useRef as useRef9, useEffect as useEffect11, useMemo as useMemo11 } from "react";
|
|
4251
4259
|
import { Fragment as Fragment8, jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4252
4260
|
function FileUpload({
|
|
4253
4261
|
supabase,
|
|
@@ -4316,12 +4324,12 @@ function FileUpload({
|
|
|
4316
4324
|
};
|
|
4317
4325
|
resolveAppId();
|
|
4318
4326
|
}, [app_id, supabase]);
|
|
4319
|
-
const isUploading =
|
|
4327
|
+
const isUploading = useMemo11(() => {
|
|
4320
4328
|
return uploadStates.size > 0 && Array.from(uploadStates.values()).some(
|
|
4321
4329
|
(state) => state.progress.status === "uploading" || state.progress.status === "processing"
|
|
4322
4330
|
);
|
|
4323
4331
|
}, [uploadStates]);
|
|
4324
|
-
const isDisabled =
|
|
4332
|
+
const isDisabled = useMemo11(() => {
|
|
4325
4333
|
return disabled || isUploading || isResolvingAppId || !resolvedAppId;
|
|
4326
4334
|
}, [disabled, isUploading, isResolvingAppId, resolvedAppId]);
|
|
4327
4335
|
const generatePreview = useCallback11((file) => {
|
|
@@ -4982,4 +4990,4 @@ export {
|
|
|
4982
4990
|
PublicPageFooter,
|
|
4983
4991
|
PublicPageLayout
|
|
4984
4992
|
};
|
|
4985
|
-
//# sourceMappingURL=chunk-
|
|
4993
|
+
//# sourceMappingURL=chunk-NOAYCWCX.js.map
|