@jmruthers/pace-core 0.5.191 → 0.6.1
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/CHANGELOG.md +29 -0
- package/README.md +7 -1
- package/cursor-rules/00-pace-core-compliance.mdc +372 -0
- package/cursor-rules/01-standards-compliance.mdc +275 -0
- package/cursor-rules/02-project-structure.mdc +200 -0
- package/cursor-rules/03-solid-principles.mdc +341 -0
- package/cursor-rules/04-testing-standards.mdc +315 -0
- package/cursor-rules/05-bug-reports-and-features.mdc +246 -0
- package/cursor-rules/06-code-quality.mdc +392 -0
- package/cursor-rules/07-tech-stack-compliance.mdc +309 -0
- package/cursor-rules/CHANGELOG.md +101 -0
- package/cursor-rules/README.md +191 -0
- package/dist/{AuthService-CbP_utw2.d.ts → AuthService-DjnJHDtC.d.ts} +1 -0
- package/dist/{DataTable-Be6dH_dR.d.ts → DataTable-CH1U5Tpy.d.ts} +1 -1
- package/dist/{DataTable-WKRZD47S.js → DataTable-DQ7RSOHE.js} +8 -7
- package/dist/{PublicPageProvider-ULXC_u6U.d.ts → PublicPageProvider-ce4xlHYA.d.ts} +37 -156
- package/dist/{UnifiedAuthProvider-BYA9qB-o.d.ts → UnifiedAuthProvider-185Ih4dj.d.ts} +2 -0
- package/dist/{UnifiedAuthProvider-FTSG5XH7.js → UnifiedAuthProvider-ATAP5UTR.js} +3 -3
- package/dist/{api-IHKALJZD.js → api-N774RPUA.js} +2 -2
- package/dist/{chunk-6C4YBBJM.js → chunk-3QRJFVBR.js} +1 -1
- package/dist/chunk-3QRJFVBR.js.map +1 -0
- package/dist/{chunk-OETXORNB.js → chunk-3XTALGJF.js} +211 -136
- package/dist/chunk-3XTALGJF.js.map +1 -0
- package/dist/{chunk-6TQDD426.js → chunk-4N5C5XZU.js} +47 -228
- package/dist/chunk-4N5C5XZU.js.map +1 -0
- package/dist/{chunk-LOMZXPSN.js → chunk-4ZC4GX36.js} +47 -74
- package/dist/chunk-4ZC4GX36.js.map +1 -0
- package/dist/{chunk-6LTQQAT6.js → chunk-BYFSK72L.js} +357 -158
- package/dist/chunk-BYFSK72L.js.map +1 -0
- package/dist/{chunk-XYXSXPUK.js → chunk-EXUD6RNJ.js} +50 -10
- package/dist/chunk-EXUD6RNJ.js.map +1 -0
- package/dist/{chunk-VKB2CO4Z.js → chunk-GLK6VM3F.js} +244 -249
- package/dist/chunk-GLK6VM3F.js.map +1 -0
- package/dist/{chunk-HW3OVDUF.js → chunk-J36DSWQK.js} +1 -1
- package/dist/{chunk-HW3OVDUF.js.map → chunk-J36DSWQK.js.map} +1 -1
- package/dist/{chunk-XNYQOL3Z.js → chunk-JBKQ3SAO.js} +9 -18
- package/dist/chunk-JBKQ3SAO.js.map +1 -0
- package/dist/{chunk-ROXMHMY2.js → chunk-KNC55RTG.js} +13 -3
- package/dist/{chunk-ROXMHMY2.js.map → chunk-KNC55RTG.js.map} +1 -1
- package/dist/{chunk-QWWZ5CAQ.js → chunk-LXQLPRQ2.js} +2 -2
- package/dist/{chunk-ULHIJK66.js → chunk-T33XF5ZC.js} +255 -140
- package/dist/chunk-T33XF5ZC.js.map +1 -0
- package/dist/{chunk-VRGWKHDB.js → chunk-XM25TVIE.js} +100 -33
- package/dist/chunk-XM25TVIE.js.map +1 -0
- package/dist/components.d.ts +4 -4
- package/dist/components.js +9 -9
- package/dist/hooks.d.ts +6 -6
- package/dist/hooks.js +20 -25
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +18 -21
- 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/{usePublicRouteParams-TZe0gy-4.d.ts → usePublicRouteParams-BJAlWfuJ.d.ts} +3 -3
- package/dist/{useToast-C8gR5ir4.d.ts → useToast-AyaT-x7p.d.ts} +2 -2
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +3 -3
- 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 +1 -1
- 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 +194 -209
- package/docs/getting-started/cursor-rules.md +262 -0
- package/docs/getting-started/installation-guide.md +6 -1
- package/docs/getting-started/quick-start.md +6 -1
- package/docs/migration/MIGRATION_GUIDE.md +4 -4
- package/docs/migration/REACT_19_MIGRATION.md +227 -0
- package/docs/migration/database-changes-december-2025.md +2 -1
- package/docs/rbac/event-based-apps.md +124 -6
- package/docs/standards/README.md +39 -0
- package/docs/troubleshooting/migration.md +4 -4
- package/examples/PublicPages/PublicEventPage.tsx +1 -1
- package/package.json +11 -6
- package/scripts/audit-consuming-app.cjs +961 -0
- package/scripts/check-pace-core-compliance.cjs +315 -61
- package/scripts/install-cursor-rules.cjs +236 -0
- package/src/__tests__/helpers/test-providers.tsx +1 -1
- package/src/__tests__/helpers/test-utils.tsx +1 -1
- package/src/__tests__/rls-policies.test.ts +3 -1
- package/src/components/Badge/Badge.tsx +2 -4
- package/src/components/Button/Button.tsx +5 -4
- package/src/components/Calendar/Calendar.tsx +1 -1
- package/src/components/DataTable/DataTable.test.tsx +57 -93
- package/src/components/DataTable/DataTable.tsx +2 -2
- 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 +88 -16
- package/src/components/DataTable/__tests__/ssr.strict-mode.test.tsx +12 -12
- package/src/components/DataTable/components/AccessDeniedPage.tsx +1 -1
- package/src/components/DataTable/components/BulkOperationsDropdown.tsx +1 -1
- package/src/components/DataTable/components/DataTableCore.tsx +4 -7
- package/src/components/DataTable/components/DataTableModals.tsx +1 -1
- package/src/components/DataTable/components/EditableRow.tsx +1 -1
- package/src/components/DataTable/components/UnifiedTableBody.tsx +86 -17
- package/src/components/DataTable/components/__tests__/DataTableModals.test.tsx +23 -23
- package/src/components/DataTable/components/__tests__/EditableRow.test.tsx +11 -11
- package/src/components/DataTable/components/__tests__/ExpandButton.test.tsx +36 -36
- package/src/components/DataTable/components/__tests__/GroupHeader.test.tsx +27 -27
- package/src/components/DataTable/components/__tests__/ImportModal.test.tsx +39 -39
- package/src/components/DataTable/components/__tests__/UnifiedTableBody.test.tsx +33 -33
- package/src/components/DataTable/components/__tests__/ViewRowModal.test.tsx +29 -29
- package/src/components/DataTable/hooks/useColumnReordering.ts +2 -2
- package/src/components/DataTable/hooks/useDataTablePermissions.ts +75 -10
- package/src/components/DataTable/hooks/useKeyboardNavigation.ts +2 -2
- package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.test.tsx +8 -14
- package/src/components/Dialog/Dialog.tsx +6 -5
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +1 -1
- package/src/components/EventSelector/EventSelector.tsx +1 -1
- package/src/components/FileDisplay/FileDisplay.test.tsx +4 -3
- package/src/components/FileDisplay/FileDisplay.tsx +16 -4
- package/src/components/Footer/Footer.tsx +1 -1
- package/src/components/Form/Form.test.tsx +36 -15
- package/src/components/Form/Form.tsx +30 -26
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/InactivityWarningModal/InactivityWarningModal.test.tsx +40 -40
- package/src/components/InactivityWarningModal/InactivityWarningModal.tsx +1 -1
- package/src/components/Input/Input.tsx +28 -30
- package/src/components/Label/Label.tsx +1 -1
- package/src/components/LoadingSpinner/LoadingSpinner.tsx +1 -1
- package/src/components/LoginForm/LoginForm.test.tsx +42 -42
- package/src/components/LoginForm/LoginForm.tsx +8 -8
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +6 -4
- package/src/components/NavigationMenu/NavigationMenu.tsx +2 -11
- package/src/components/OrganisationSelector/OrganisationSelector.tsx +0 -1
- package/src/components/PaceAppLayout/PaceAppLayout.performance.test.tsx +1 -1
- package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +75 -52
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +98 -69
- package/src/components/PaceAppLayout/README.md +1 -1
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +1 -8
- package/src/components/PasswordChange/PasswordChangeForm.test.tsx +33 -33
- package/src/components/PasswordChange/PasswordChangeForm.tsx +1 -1
- package/src/components/Progress/Progress.tsx +1 -1
- package/src/components/ProtectedRoute/ProtectedRoute.test.tsx +5 -9
- package/src/components/ProtectedRoute/ProtectedRoute.tsx +0 -1
- package/src/components/PublicLayout/PublicPageLayout.tsx +1 -1
- package/src/components/PublicLayout/PublicPageProvider.tsx +0 -1
- package/src/components/Select/Select.tsx +33 -22
- package/src/components/SessionRestorationLoader/SessionRestorationLoader.tsx +1 -1
- package/src/components/Table/Table.tsx +1 -1
- package/src/components/Textarea/Textarea.tsx +27 -29
- package/src/components/Toast/Toast.tsx +1 -1
- package/src/components/Tooltip/Tooltip.tsx +1 -1
- package/src/components/UserMenu/UserMenu.tsx +1 -1
- package/src/hooks/__tests__/hooks.integration.test.tsx +80 -55
- package/src/hooks/__tests__/useSecureDataAccess.unit.test.tsx +14 -7
- package/src/hooks/__tests__/useStorage.unit.test.ts +36 -36
- package/src/hooks/public/usePublicEvent.ts +1 -1
- package/src/hooks/public/usePublicEventLogo.ts +1 -1
- package/src/hooks/public/usePublicRouteParams.ts +1 -1
- 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/useDataTableState.ts +8 -18
- package/src/hooks/useFileDisplay.ts +10 -17
- package/src/hooks/useFocusManagement.ts +2 -2
- package/src/hooks/useFocusTrap.ts +4 -4
- package/src/hooks/useFormDialog.ts +8 -7
- package/src/hooks/useInactivityTracker.ts +1 -1
- package/src/hooks/usePermissionCache.ts +1 -1
- package/src/hooks/useSecureDataAccess.test.ts +16 -9
- package/src/hooks/useSecureDataAccess.ts +22 -6
- package/src/hooks/useToast.ts +2 -2
- package/src/providers/__tests__/OrganisationProvider.test.tsx +57 -13
- package/src/providers/__tests__/ProviderLifecycle.test.tsx +21 -6
- package/src/providers/__tests__/UnifiedAuthProvider.test.tsx +10 -10
- package/src/providers/services/EventServiceProvider.tsx +0 -8
- package/src/providers/services/UnifiedAuthProvider.tsx +196 -46
- package/src/providers/services/__tests__/AuthServiceProvider.integration.test.tsx +13 -3
- package/src/rbac/__tests__/adapters.comprehensive.test.tsx +34 -40
- 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 +3 -16
- package/src/rbac/components/NavigationGuard.tsx +2 -11
- package/src/rbac/components/NavigationProvider.tsx +1 -2
- package/src/rbac/components/PagePermissionGuard.tsx +1 -1
- package/src/rbac/components/PagePermissionProvider.tsx +1 -1
- package/src/rbac/components/PermissionEnforcer.tsx +46 -13
- package/src/rbac/components/RoleBasedRouter.tsx +1 -1
- package/src/rbac/components/SecureDataProvider.tsx +1 -2
- 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.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 +43 -0
- package/src/services/EventService.ts +4 -57
- package/src/services/InactivityService.ts +127 -34
- package/src/services/OrganisationService.ts +68 -10
- package/src/utils/security/secureDataAccess.test.ts +31 -20
- package/src/utils/security/secureDataAccess.ts +4 -3
- package/dist/chunk-6C4YBBJM.js.map +0 -1
- package/dist/chunk-6LTQQAT6.js.map +0 -1
- package/dist/chunk-6TQDD426.js.map +0 -1
- package/dist/chunk-LOMZXPSN.js.map +0 -1
- package/dist/chunk-OETXORNB.js.map +0 -1
- package/dist/chunk-ULHIJK66.js.map +0 -1
- package/dist/chunk-VKB2CO4Z.js.map +0 -1
- package/dist/chunk-VRGWKHDB.js.map +0 -1
- package/dist/chunk-XNYQOL3Z.js.map +0 -1
- package/dist/chunk-XYXSXPUK.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-WKRZD47S.js.map → DataTable-DQ7RSOHE.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-FTSG5XH7.js.map → UnifiedAuthProvider-ATAP5UTR.js.map} +0 -0
- /package/dist/{api-IHKALJZD.js.map → api-N774RPUA.js.map} +0 -0
- /package/dist/{chunk-QWWZ5CAQ.js.map → chunk-LXQLPRQ2.js.map} +0 -0
- /package/examples/{rbac → RBAC}/CompleteRBACExample.tsx +0 -0
- /package/examples/{rbac → RBAC}/EventBasedApp.tsx +0 -0
- /package/examples/{rbac → RBAC}/PermissionExample.tsx +0 -0
- /package/examples/{rbac → RBAC}/index.ts +0 -0
|
@@ -25,12 +25,12 @@ import {
|
|
|
25
25
|
SelectSeparator,
|
|
26
26
|
SelectTrigger,
|
|
27
27
|
SelectValue
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-T33XF5ZC.js";
|
|
29
29
|
import {
|
|
30
30
|
useCan,
|
|
31
31
|
usePermissions,
|
|
32
32
|
useRBAC
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-XM25TVIE.js";
|
|
34
34
|
import {
|
|
35
35
|
createFileReferenceService,
|
|
36
36
|
generateFileUrlsBatch,
|
|
@@ -42,10 +42,10 @@ import {
|
|
|
42
42
|
useFileDisplay,
|
|
43
43
|
usePreventTabReload,
|
|
44
44
|
usePublicFileDisplay
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-JBKQ3SAO.js";
|
|
46
46
|
import {
|
|
47
47
|
useToast
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-3QRJFVBR.js";
|
|
49
49
|
import {
|
|
50
50
|
ErrorBoundary,
|
|
51
51
|
PublicPageContext,
|
|
@@ -53,23 +53,23 @@ import {
|
|
|
53
53
|
useEvents,
|
|
54
54
|
useIsPublicPage,
|
|
55
55
|
useResolvedScope
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-3XTALGJF.js";
|
|
57
57
|
import {
|
|
58
58
|
EventServiceContext,
|
|
59
59
|
useOrganisations,
|
|
60
60
|
useSessionRestoration,
|
|
61
61
|
useUnifiedAuth
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-BYFSK72L.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";
|
|
69
69
|
import {
|
|
70
70
|
LoadingSpinner,
|
|
71
71
|
getAppId
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-J36DSWQK.js";
|
|
73
73
|
import {
|
|
74
74
|
cn
|
|
75
75
|
} from "./chunk-R77UEZ4E.js";
|
|
@@ -375,35 +375,32 @@ var Label = React2.forwardRef(({
|
|
|
375
375
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
376
376
|
|
|
377
377
|
// src/components/Textarea/Textarea.tsx
|
|
378
|
-
import * as React3 from "react";
|
|
379
378
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
);
|
|
379
|
+
function Textarea({ className, variant = "default", size = "md", error, ref, ...props }) {
|
|
380
|
+
return /* @__PURE__ */ jsx3(
|
|
381
|
+
"textarea",
|
|
382
|
+
{
|
|
383
|
+
className: cn(
|
|
384
|
+
// Base styles (matching Input component)
|
|
385
|
+
"flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
386
|
+
// Variant styles
|
|
387
|
+
{
|
|
388
|
+
"border-input": variant === "default" && !error,
|
|
389
|
+
"border-destructive focus-visible:ring-destructive": variant === "destructive" || error
|
|
390
|
+
},
|
|
391
|
+
// Size styles
|
|
392
|
+
{
|
|
393
|
+
"min-h-[60px] px-2 py-1 text-xs": size === "sm",
|
|
394
|
+
"min-h-[80px] px-3 py-2 text-sm": size === "md",
|
|
395
|
+
"min-h-[100px] px-4 py-3 text-base": size === "lg"
|
|
396
|
+
},
|
|
397
|
+
className
|
|
398
|
+
),
|
|
399
|
+
ref,
|
|
400
|
+
...props
|
|
401
|
+
}
|
|
402
|
+
);
|
|
403
|
+
}
|
|
407
404
|
Textarea.displayName = "Textarea";
|
|
408
405
|
|
|
409
406
|
// src/components/FileDisplay/FileDisplay.tsx
|
|
@@ -515,6 +512,7 @@ function FileDisplayContent({
|
|
|
515
512
|
displayOnly,
|
|
516
513
|
showDelete,
|
|
517
514
|
className,
|
|
515
|
+
imgClassName,
|
|
518
516
|
children,
|
|
519
517
|
onDelete,
|
|
520
518
|
clearError,
|
|
@@ -637,12 +635,12 @@ function FileDisplayContent({
|
|
|
637
635
|
if (!fileUrl) {
|
|
638
636
|
return /* @__PURE__ */ jsx4("figure", { className: className || "max-w-full h-48", title: "Loading", children: /* @__PURE__ */ jsx4("p", { className: fallbackClasses, children: /* @__PURE__ */ jsx4(LoadingSpinner, {}) }) });
|
|
639
637
|
}
|
|
640
|
-
return /* @__PURE__ */ jsx4("figure", { className: className || "
|
|
638
|
+
return /* @__PURE__ */ jsx4("figure", { className: className || "", children: /* @__PURE__ */ jsx4(
|
|
641
639
|
"img",
|
|
642
640
|
{
|
|
643
641
|
src: fileUrl,
|
|
644
642
|
alt: fileReference.file_metadata.fileName || "File",
|
|
645
|
-
className: "
|
|
643
|
+
className: imgClassName || "object-cover size-full",
|
|
646
644
|
onError: handleImageError
|
|
647
645
|
}
|
|
648
646
|
) });
|
|
@@ -685,7 +683,7 @@ function FileDisplayContent({
|
|
|
685
683
|
{
|
|
686
684
|
src: fileUrl,
|
|
687
685
|
alt: fileReference.file_metadata.fileName || "File",
|
|
688
|
-
className: "
|
|
686
|
+
className: imgClassName || "object-cover size-full",
|
|
689
687
|
onError: handleImageError
|
|
690
688
|
}
|
|
691
689
|
),
|
|
@@ -782,7 +780,7 @@ function FileDisplayContent({
|
|
|
782
780
|
{
|
|
783
781
|
src: fileUrl2,
|
|
784
782
|
alt: fileRef.file_metadata.fileName || "File",
|
|
785
|
-
className:
|
|
783
|
+
className: imgClassName || "object-cover size-full",
|
|
786
784
|
onError: handleImageError
|
|
787
785
|
}
|
|
788
786
|
) : /* @__PURE__ */ jsx4("span", { className: "text-2xl", children: getFileIcon(fileRef.file_metadata.fileType || "") }),
|
|
@@ -832,6 +830,7 @@ function FileDisplayPublic({
|
|
|
832
830
|
displayOnly = false,
|
|
833
831
|
showDelete = false,
|
|
834
832
|
className = "",
|
|
833
|
+
imgClassName,
|
|
835
834
|
children,
|
|
836
835
|
loadingComponent,
|
|
837
836
|
errorComponent,
|
|
@@ -861,6 +860,7 @@ function FileDisplayPublic({
|
|
|
861
860
|
displayOnly,
|
|
862
861
|
showDelete: false,
|
|
863
862
|
className,
|
|
863
|
+
imgClassName,
|
|
864
864
|
children,
|
|
865
865
|
onDelete: void 0,
|
|
866
866
|
organisation_id,
|
|
@@ -934,6 +934,7 @@ function FileDisplayPublic({
|
|
|
934
934
|
displayOnly,
|
|
935
935
|
showDelete: false,
|
|
936
936
|
className,
|
|
937
|
+
imgClassName,
|
|
937
938
|
children,
|
|
938
939
|
onDelete: showDelete ? handleDelete : void 0,
|
|
939
940
|
organisation_id,
|
|
@@ -957,6 +958,7 @@ function FileDisplayAuthenticated({
|
|
|
957
958
|
displayOnly = false,
|
|
958
959
|
showDelete = false,
|
|
959
960
|
className = "",
|
|
961
|
+
imgClassName,
|
|
960
962
|
children,
|
|
961
963
|
loadingComponent,
|
|
962
964
|
errorComponent,
|
|
@@ -1042,6 +1044,7 @@ function FileDisplayAuthenticated({
|
|
|
1042
1044
|
displayOnly,
|
|
1043
1045
|
showDelete,
|
|
1044
1046
|
className,
|
|
1047
|
+
imgClassName,
|
|
1045
1048
|
children,
|
|
1046
1049
|
onDelete: showDelete ? handleDelete : void 0,
|
|
1047
1050
|
clearError: refetch,
|
|
@@ -1066,6 +1069,7 @@ function FileDisplay({
|
|
|
1066
1069
|
displayOnly = false,
|
|
1067
1070
|
showDelete = false,
|
|
1068
1071
|
className = "",
|
|
1072
|
+
imgClassName,
|
|
1069
1073
|
children,
|
|
1070
1074
|
loadingComponent,
|
|
1071
1075
|
errorComponent,
|
|
@@ -1089,6 +1093,7 @@ function FileDisplay({
|
|
|
1089
1093
|
displayOnly,
|
|
1090
1094
|
showDelete,
|
|
1091
1095
|
className,
|
|
1096
|
+
imgClassName,
|
|
1092
1097
|
children,
|
|
1093
1098
|
loadingComponent,
|
|
1094
1099
|
errorComponent,
|
|
@@ -1112,6 +1117,7 @@ function FileDisplay({
|
|
|
1112
1117
|
displayOnly,
|
|
1113
1118
|
showDelete,
|
|
1114
1119
|
className,
|
|
1120
|
+
imgClassName,
|
|
1115
1121
|
children,
|
|
1116
1122
|
loadingComponent,
|
|
1117
1123
|
errorComponent,
|
|
@@ -1480,7 +1486,7 @@ function useFilesByCategory(supabase, table_name, record_id, category, organisat
|
|
|
1480
1486
|
}
|
|
1481
1487
|
|
|
1482
1488
|
// src/components/Avatar/Avatar.tsx
|
|
1483
|
-
import * as
|
|
1489
|
+
import * as React4 from "react";
|
|
1484
1490
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1485
1491
|
var sizeClasses = {
|
|
1486
1492
|
xs: "size-4 text-xs",
|
|
@@ -1490,7 +1496,7 @@ var sizeClasses = {
|
|
|
1490
1496
|
xl: "size-16 text-xl",
|
|
1491
1497
|
"2xl": "size-20 text-2xl"
|
|
1492
1498
|
};
|
|
1493
|
-
var Avatar =
|
|
1499
|
+
var Avatar = React4.forwardRef(
|
|
1494
1500
|
({
|
|
1495
1501
|
table_name,
|
|
1496
1502
|
record_id,
|
|
@@ -1504,7 +1510,7 @@ var Avatar = React5.forwardRef(
|
|
|
1504
1510
|
size = "md",
|
|
1505
1511
|
...props
|
|
1506
1512
|
}, ref) => {
|
|
1507
|
-
const [imageError, setImageError] =
|
|
1513
|
+
const [imageError, setImageError] = React4.useState(false);
|
|
1508
1514
|
const { supabase } = useUnifiedAuth();
|
|
1509
1515
|
const canFetchFileId = Boolean(fileId && organisation_id && supabase);
|
|
1510
1516
|
const { fileReference, fileUrl: fileIdUrl, isLoading: fileIdLoading } = useFileReferenceById(
|
|
@@ -1521,10 +1527,10 @@ var Avatar = React5.forwardRef(
|
|
|
1521
1527
|
const fallbackClasses = "size-full grid place-items-center text-center text-sec-50 bg-sec-500";
|
|
1522
1528
|
const imageClasses = "object-cover size-full";
|
|
1523
1529
|
const containerClasses = cn(baseClasses, className);
|
|
1524
|
-
const handleImageError =
|
|
1530
|
+
const handleImageError = React4.useCallback(() => {
|
|
1525
1531
|
setImageError(true);
|
|
1526
1532
|
}, []);
|
|
1527
|
-
|
|
1533
|
+
React4.useEffect(() => {
|
|
1528
1534
|
if (src) {
|
|
1529
1535
|
setImageError(false);
|
|
1530
1536
|
}
|
|
@@ -1583,7 +1589,6 @@ var Avatar = React5.forwardRef(
|
|
|
1583
1589
|
Avatar.displayName = "Avatar";
|
|
1584
1590
|
|
|
1585
1591
|
// src/components/Badge/Badge.tsx
|
|
1586
|
-
import * as React6 from "react";
|
|
1587
1592
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1588
1593
|
var shadeConfig = {
|
|
1589
1594
|
muted: {
|
|
@@ -1649,42 +1654,40 @@ function getBadgeClasses(variant = "solid-main-normal") {
|
|
|
1649
1654
|
const baseClasses = "text-balance rounded-2xl px-3 py-1 mr-1 text-xs font-medium transition-colors box-border";
|
|
1650
1655
|
return `${baseClasses} ${variantClassesMap[variant]}`;
|
|
1651
1656
|
}
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
const finalClasses = `${mergedClasses} shadow-badge-soft ${shadowColorClass}`.trim();
|
|
1662
|
-
return /* @__PURE__ */ jsx6(
|
|
1663
|
-
"span",
|
|
1664
|
-
{
|
|
1665
|
-
ref,
|
|
1666
|
-
className: finalClasses,
|
|
1667
|
-
...props
|
|
1668
|
-
}
|
|
1669
|
-
);
|
|
1670
|
-
}
|
|
1657
|
+
function Badge({ className, variant = "solid-main-normal", ref, ...props }) {
|
|
1658
|
+
const isSoftVariant = variant.startsWith("soft-");
|
|
1659
|
+
if (isSoftVariant) {
|
|
1660
|
+
const variantClasses = getBadgeClasses(variant);
|
|
1661
|
+
const shadowColorMatch = variantClasses.match(/\bshadow-(\w+)-(\d+)\b/);
|
|
1662
|
+
const shadowColorClass = shadowColorMatch ? shadowColorMatch[0] : "";
|
|
1663
|
+
const classesWithoutShadows = variantClasses.replace(/\bshadow-badge-soft\b/g, "").replace(/\bshadow-\w+-\d+\b/g, "").replace(/\s+/g, " ").trim();
|
|
1664
|
+
const mergedClasses = cn(classesWithoutShadows, className);
|
|
1665
|
+
const finalClasses = `${mergedClasses} shadow-badge-soft ${shadowColorClass}`.trim();
|
|
1671
1666
|
return /* @__PURE__ */ jsx6(
|
|
1672
1667
|
"span",
|
|
1673
1668
|
{
|
|
1674
1669
|
ref,
|
|
1675
|
-
className:
|
|
1670
|
+
className: finalClasses,
|
|
1676
1671
|
...props
|
|
1677
1672
|
}
|
|
1678
1673
|
);
|
|
1679
1674
|
}
|
|
1680
|
-
|
|
1675
|
+
return /* @__PURE__ */ jsx6(
|
|
1676
|
+
"span",
|
|
1677
|
+
{
|
|
1678
|
+
ref,
|
|
1679
|
+
className: cn(getBadgeClasses(variant), className),
|
|
1680
|
+
...props
|
|
1681
|
+
}
|
|
1682
|
+
);
|
|
1683
|
+
}
|
|
1681
1684
|
Badge.displayName = "Badge";
|
|
1682
1685
|
|
|
1683
1686
|
// src/components/Switch/Switch.tsx
|
|
1684
|
-
import * as
|
|
1687
|
+
import * as React5 from "react";
|
|
1685
1688
|
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
1686
1689
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1687
|
-
var Switch =
|
|
1690
|
+
var Switch = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
|
|
1688
1691
|
SwitchPrimitive.Root,
|
|
1689
1692
|
{
|
|
1690
1693
|
className: cn(
|
|
@@ -1727,12 +1730,12 @@ var Switch = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
1727
1730
|
Switch.displayName = SwitchPrimitive.Root.displayName;
|
|
1728
1731
|
|
|
1729
1732
|
// src/components/Tabs/Tabs.tsx
|
|
1730
|
-
import * as
|
|
1733
|
+
import * as React6 from "react";
|
|
1731
1734
|
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
1732
1735
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1733
|
-
var Tabs =
|
|
1736
|
+
var Tabs = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx8(TabsPrimitive.Root, { asChild: true, ...props, children: /* @__PURE__ */ jsx8("section", { ref, className, children }) }));
|
|
1734
1737
|
Tabs.displayName = TabsPrimitive.Root.displayName || "Tabs";
|
|
1735
|
-
var TabsList =
|
|
1738
|
+
var TabsList = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx8(TabsPrimitive.List, { asChild: true, ...props, children: /* @__PURE__ */ jsx8(
|
|
1736
1739
|
"nav",
|
|
1737
1740
|
{
|
|
1738
1741
|
ref,
|
|
@@ -1744,7 +1747,7 @@ var TabsList = React8.forwardRef(({ className, children, ...props }, ref) => /*
|
|
|
1744
1747
|
}
|
|
1745
1748
|
) }));
|
|
1746
1749
|
TabsList.displayName = TabsPrimitive.List.displayName || "TabsList";
|
|
1747
|
-
var TabsTrigger =
|
|
1750
|
+
var TabsTrigger = React6.forwardRef(({ className, variant, size, children, ...props }, ref) => {
|
|
1748
1751
|
return /* @__PURE__ */ jsx8(TabsPrimitive.Trigger, { asChild: true, ...props, children: /* @__PURE__ */ jsx8(
|
|
1749
1752
|
Button,
|
|
1750
1753
|
{
|
|
@@ -1763,7 +1766,7 @@ var TabsTrigger = React8.forwardRef(({ className, variant, size, children, ...pr
|
|
|
1763
1766
|
) });
|
|
1764
1767
|
});
|
|
1765
1768
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName || "TabsTrigger";
|
|
1766
|
-
var TabsContent =
|
|
1769
|
+
var TabsContent = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx8(TabsPrimitive.Content, { asChild: true, ...props, children: /* @__PURE__ */ jsx8(
|
|
1767
1770
|
"aside",
|
|
1768
1771
|
{
|
|
1769
1772
|
ref,
|
|
@@ -1777,7 +1780,7 @@ var TabsContent = React8.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
1777
1780
|
TabsContent.displayName = TabsPrimitive.Content.displayName || "TabsContent";
|
|
1778
1781
|
|
|
1779
1782
|
// src/components/Calendar/Calendar.tsx
|
|
1780
|
-
import * as
|
|
1783
|
+
import * as React7 from "react";
|
|
1781
1784
|
import {
|
|
1782
1785
|
DayPicker,
|
|
1783
1786
|
useDayPicker
|
|
@@ -1794,10 +1797,10 @@ var assignToRef = (ref, value) => {
|
|
|
1794
1797
|
}
|
|
1795
1798
|
ref.current = value;
|
|
1796
1799
|
};
|
|
1797
|
-
var Calendar =
|
|
1800
|
+
var Calendar = React7.forwardRef(
|
|
1798
1801
|
({ className, classNames, mode, components, locale, month: controlledMonth, onMonthChange: controlledOnMonthChange, onSelect, ...props }, ref) => {
|
|
1799
|
-
const tableRef =
|
|
1800
|
-
const setForwardedRef =
|
|
1802
|
+
const tableRef = React7.useRef(null);
|
|
1803
|
+
const setForwardedRef = React7.useCallback(
|
|
1801
1804
|
(node) => {
|
|
1802
1805
|
tableRef.current = node;
|
|
1803
1806
|
if (!ref) {
|
|
@@ -1811,14 +1814,14 @@ var Calendar = React9.forwardRef(
|
|
|
1811
1814
|
},
|
|
1812
1815
|
[ref]
|
|
1813
1816
|
);
|
|
1814
|
-
const rootPropsRef =
|
|
1817
|
+
const rootPropsRef = React7.useRef(null);
|
|
1815
1818
|
const selected = props.selected;
|
|
1816
1819
|
const isMonthControlled = controlledMonth !== void 0;
|
|
1817
|
-
const [internalMonth, setInternalMonth] =
|
|
1820
|
+
const [internalMonth, setInternalMonth] = React7.useState(() => {
|
|
1818
1821
|
const now = /* @__PURE__ */ new Date();
|
|
1819
1822
|
return new Date(now.getFullYear(), now.getMonth(), 1);
|
|
1820
1823
|
});
|
|
1821
|
-
const month =
|
|
1824
|
+
const month = React7.useMemo(() => {
|
|
1822
1825
|
const monthToUse = isMonthControlled ? controlledMonth : internalMonth;
|
|
1823
1826
|
if (!monthToUse) {
|
|
1824
1827
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -1827,16 +1830,16 @@ var Calendar = React9.forwardRef(
|
|
|
1827
1830
|
const normalized = new Date(monthToUse.getFullYear(), monthToUse.getMonth(), 1);
|
|
1828
1831
|
return normalized;
|
|
1829
1832
|
}, [isMonthControlled, controlledMonth, internalMonth]);
|
|
1830
|
-
const handleMonthChange =
|
|
1833
|
+
const handleMonthChange = React7.useCallback((newMonth) => {
|
|
1831
1834
|
if (!isMonthControlled) {
|
|
1832
1835
|
setInternalMonth(newMonth);
|
|
1833
1836
|
}
|
|
1834
1837
|
controlledOnMonthChange?.(newMonth);
|
|
1835
1838
|
}, [isMonthControlled, controlledOnMonthChange]);
|
|
1836
|
-
const wrappedHandleMonthChange =
|
|
1839
|
+
const wrappedHandleMonthChange = React7.useCallback((newMonth) => {
|
|
1837
1840
|
handleMonthChange(newMonth);
|
|
1838
1841
|
}, [handleMonthChange]);
|
|
1839
|
-
const CustomRoot =
|
|
1842
|
+
const CustomRoot = React7.memo(({ children, rootRef: dayPickerRootRef, ...rootProps }) => {
|
|
1840
1843
|
const {
|
|
1841
1844
|
className: rootClassName,
|
|
1842
1845
|
style: rootStyle,
|
|
@@ -1852,29 +1855,29 @@ var Calendar = React9.forwardRef(
|
|
|
1852
1855
|
return /* @__PURE__ */ jsx9(Fragment4, { children });
|
|
1853
1856
|
});
|
|
1854
1857
|
CustomRoot.displayName = "CustomRoot";
|
|
1855
|
-
const CustomMonths =
|
|
1858
|
+
const CustomMonths = React7.memo(({ children }) => {
|
|
1856
1859
|
return /* @__PURE__ */ jsx9(Fragment4, { children });
|
|
1857
1860
|
});
|
|
1858
1861
|
CustomMonths.displayName = "CustomMonths";
|
|
1859
|
-
const CustomMonthGrid =
|
|
1862
|
+
const CustomMonthGrid = React7.forwardRef((props2, forwardedRef) => {
|
|
1860
1863
|
return /* @__PURE__ */ jsx9("table", { ref: forwardedRef, ...props2 });
|
|
1861
1864
|
});
|
|
1862
1865
|
CustomMonthGrid.displayName = "CustomMonthGrid";
|
|
1863
|
-
const CustomMonth =
|
|
1866
|
+
const CustomMonth = React7.memo(({ calendarMonth, displayIndex, className: className2, children }) => {
|
|
1864
1867
|
const { formatters, components: components2, labels, classNames: classNames2, previousMonth, nextMonth, goToMonth } = useDayPicker();
|
|
1865
1868
|
const caption = formatters.formatCaption(calendarMonth.date, {});
|
|
1866
1869
|
const Chevron = components2?.Chevron;
|
|
1867
|
-
const childrenArray =
|
|
1870
|
+
const childrenArray = React7.Children.toArray(children);
|
|
1868
1871
|
const monthGridIndex = childrenArray.findIndex((child) => {
|
|
1869
|
-
if (!
|
|
1872
|
+
if (!React7.isValidElement(child)) return false;
|
|
1870
1873
|
const childType = child.type;
|
|
1871
1874
|
return typeof childType === "function" && childType.displayName === "MonthGrid" || child.type === "table";
|
|
1872
1875
|
});
|
|
1873
1876
|
return /* @__PURE__ */ jsx9(Fragment4, { children: childrenArray.map((child, index) => {
|
|
1874
|
-
if (
|
|
1877
|
+
if (React7.isValidElement(child) && child.type?.displayName === "MonthCaption") {
|
|
1875
1878
|
return null;
|
|
1876
1879
|
}
|
|
1877
|
-
if (index === monthGridIndex &&
|
|
1880
|
+
if (index === monthGridIndex && React7.isValidElement(child)) {
|
|
1878
1881
|
const monthGridChild = child;
|
|
1879
1882
|
const applyRootProps = displayIndex === 0 && index === monthGridIndex;
|
|
1880
1883
|
const storedRootProps = applyRootProps ? rootPropsRef.current : null;
|
|
@@ -1924,7 +1927,7 @@ var Calendar = React9.forwardRef(
|
|
|
1924
1927
|
}
|
|
1925
1928
|
assignToRef(monthGridElement.ref, node);
|
|
1926
1929
|
} : void 0;
|
|
1927
|
-
return
|
|
1930
|
+
return React7.cloneElement(
|
|
1928
1931
|
monthGridElement,
|
|
1929
1932
|
{
|
|
1930
1933
|
key: child.key ?? `month-grid-${displayIndex}`,
|
|
@@ -1983,11 +1986,11 @@ var Calendar = React9.forwardRef(
|
|
|
1983
1986
|
}) });
|
|
1984
1987
|
});
|
|
1985
1988
|
CustomMonth.displayName = "CustomMonth";
|
|
1986
|
-
const CustomWeekdays =
|
|
1989
|
+
const CustomWeekdays = React7.memo(({ className: className2, children, ...props2 }) => {
|
|
1987
1990
|
return /* @__PURE__ */ jsx9("thead", { children: /* @__PURE__ */ jsx9("tr", { className: cn("text-xs text-sec-500", className2), ...props2, children }) });
|
|
1988
1991
|
});
|
|
1989
1992
|
CustomWeekdays.displayName = "CustomWeekdays";
|
|
1990
|
-
const defaultComponents =
|
|
1993
|
+
const defaultComponents = React7.useMemo(() => ({
|
|
1991
1994
|
Root: CustomRoot,
|
|
1992
1995
|
Months: CustomMonths,
|
|
1993
1996
|
Month: CustomMonth,
|
|
@@ -2075,12 +2078,12 @@ var Calendar = React9.forwardRef(
|
|
|
2075
2078
|
Calendar.displayName = "Calendar";
|
|
2076
2079
|
|
|
2077
2080
|
// src/components/Toast/Toast.tsx
|
|
2078
|
-
import * as
|
|
2081
|
+
import * as React8 from "react";
|
|
2079
2082
|
import * as ToastPrimitives from "@radix-ui/react-toast";
|
|
2080
2083
|
import { X } from "lucide-react";
|
|
2081
2084
|
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2082
2085
|
var ToastProvider = ToastPrimitives.Provider;
|
|
2083
|
-
var ToastViewport =
|
|
2086
|
+
var ToastViewport = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
|
|
2084
2087
|
ToastPrimitives.Viewport,
|
|
2085
2088
|
{
|
|
2086
2089
|
ref,
|
|
@@ -2093,7 +2096,7 @@ var ToastViewport = React10.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
2093
2096
|
}
|
|
2094
2097
|
));
|
|
2095
2098
|
ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
|
|
2096
|
-
var Toast =
|
|
2099
|
+
var Toast = React8.forwardRef(({ className, ...props }, ref) => {
|
|
2097
2100
|
return /* @__PURE__ */ jsx10(
|
|
2098
2101
|
ToastPrimitives.Root,
|
|
2099
2102
|
{
|
|
@@ -2108,7 +2111,7 @@ var Toast = React10.forwardRef(({ className, ...props }, ref) => {
|
|
|
2108
2111
|
);
|
|
2109
2112
|
});
|
|
2110
2113
|
Toast.displayName = ToastPrimitives.Root.displayName;
|
|
2111
|
-
var ToastAction =
|
|
2114
|
+
var ToastAction = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
|
|
2112
2115
|
ToastPrimitives.Action,
|
|
2113
2116
|
{
|
|
2114
2117
|
ref,
|
|
@@ -2121,7 +2124,7 @@ var ToastAction = React10.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
2121
2124
|
}
|
|
2122
2125
|
));
|
|
2123
2126
|
ToastAction.displayName = ToastPrimitives.Action.displayName;
|
|
2124
|
-
var ToastClose =
|
|
2127
|
+
var ToastClose = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
|
|
2125
2128
|
ToastPrimitives.Close,
|
|
2126
2129
|
{
|
|
2127
2130
|
ref,
|
|
@@ -2136,7 +2139,7 @@ var ToastClose = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
2136
2139
|
}
|
|
2137
2140
|
));
|
|
2138
2141
|
ToastClose.displayName = ToastPrimitives.Close.displayName;
|
|
2139
|
-
var ToastTitle =
|
|
2142
|
+
var ToastTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
|
|
2140
2143
|
ToastPrimitives.Title,
|
|
2141
2144
|
{
|
|
2142
2145
|
ref,
|
|
@@ -2146,7 +2149,7 @@ var ToastTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
2146
2149
|
}
|
|
2147
2150
|
));
|
|
2148
2151
|
ToastTitle.displayName = ToastPrimitives.Title.displayName;
|
|
2149
|
-
var ToastDescription =
|
|
2152
|
+
var ToastDescription = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
|
|
2150
2153
|
ToastPrimitives.Description,
|
|
2151
2154
|
{
|
|
2152
2155
|
ref,
|
|
@@ -2175,7 +2178,7 @@ function Toaster() {
|
|
|
2175
2178
|
// src/components/Form/Form.tsx
|
|
2176
2179
|
import { useForm, FormProvider, useFormContext, Controller } from "react-hook-form";
|
|
2177
2180
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
2178
|
-
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2181
|
+
import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2179
2182
|
function Form({
|
|
2180
2183
|
schema,
|
|
2181
2184
|
defaultValues,
|
|
@@ -2188,7 +2191,8 @@ function Form({
|
|
|
2188
2191
|
const methods = useForm({
|
|
2189
2192
|
resolver: schema ? zodResolver(schema) : void 0,
|
|
2190
2193
|
defaultValues,
|
|
2191
|
-
mode
|
|
2194
|
+
mode,
|
|
2195
|
+
shouldUnregister: false
|
|
2192
2196
|
});
|
|
2193
2197
|
const handleSubmit = methods.handleSubmit(onSubmit, onError);
|
|
2194
2198
|
return /* @__PURE__ */ jsx11(FormProvider, { ...methods, children: /* @__PURE__ */ jsx11("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), children: typeof children === "function" ? children(methods) : children }) });
|
|
@@ -2204,9 +2208,7 @@ function FormField({
|
|
|
2204
2208
|
"data-testid": testId,
|
|
2205
2209
|
className
|
|
2206
2210
|
}) {
|
|
2207
|
-
const { control
|
|
2208
|
-
const fieldError = errors[name];
|
|
2209
|
-
const errorMessage = fieldError && typeof fieldError === "object" && "message" in fieldError ? String(fieldError.message) : void 0;
|
|
2211
|
+
const { control } = useFormContext();
|
|
2210
2212
|
return /* @__PURE__ */ jsxs6("div", { className: cn("space-y-2", className), children: [
|
|
2211
2213
|
label && /* @__PURE__ */ jsxs6(Label, { htmlFor: name, children: [
|
|
2212
2214
|
label,
|
|
@@ -2219,35 +2221,40 @@ function FormField({
|
|
|
2219
2221
|
control,
|
|
2220
2222
|
rules: validation,
|
|
2221
2223
|
render: (props) => {
|
|
2224
|
+
const { field, fieldState } = props;
|
|
2225
|
+
const fieldError = fieldState.error;
|
|
2226
|
+
const errorMessage = fieldError && typeof fieldError === "object" && "message" in fieldError ? String(fieldError.message) : void 0;
|
|
2222
2227
|
if (render) {
|
|
2223
2228
|
return render(props);
|
|
2224
2229
|
}
|
|
2225
|
-
return /* @__PURE__ */
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2230
|
+
return /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
2231
|
+
/* @__PURE__ */ jsx11(
|
|
2232
|
+
"input",
|
|
2233
|
+
{
|
|
2234
|
+
...field,
|
|
2235
|
+
id: name,
|
|
2236
|
+
type,
|
|
2237
|
+
placeholder,
|
|
2238
|
+
"data-testid": testId,
|
|
2239
|
+
className: cn(
|
|
2240
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
2241
|
+
fieldError && "border-destructive focus-visible:ring-destructive"
|
|
2242
|
+
),
|
|
2243
|
+
...inputProps
|
|
2244
|
+
}
|
|
2245
|
+
),
|
|
2246
|
+
errorMessage && /* @__PURE__ */ jsx11("p", { className: "text-destructive", role: "alert", children: errorMessage })
|
|
2247
|
+
] });
|
|
2240
2248
|
}
|
|
2241
2249
|
}
|
|
2242
|
-
)
|
|
2243
|
-
errorMessage && /* @__PURE__ */ jsx11("p", { className: "text-destructive", role: "alert", children: errorMessage })
|
|
2250
|
+
)
|
|
2244
2251
|
] });
|
|
2245
2252
|
}
|
|
2246
2253
|
|
|
2247
2254
|
// src/components/LoginForm/LoginForm.tsx
|
|
2248
|
-
import
|
|
2255
|
+
import React9, { useState as useState7, useCallback as useCallback7, useMemo as useMemo4 } from "react";
|
|
2249
2256
|
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2250
|
-
var LoginForm =
|
|
2257
|
+
var LoginForm = React9.memo(({
|
|
2251
2258
|
onSignIn,
|
|
2252
2259
|
onSuccess,
|
|
2253
2260
|
onError,
|
|
@@ -2264,12 +2271,12 @@ var LoginForm = React11.memo(({
|
|
|
2264
2271
|
const isFormValid = useMemo4(() => {
|
|
2265
2272
|
return formData.email.length > 0 && formData.password.length > 0;
|
|
2266
2273
|
}, [formData.email, formData.password]);
|
|
2267
|
-
const handleEmailChange =
|
|
2274
|
+
const handleEmailChange = (e) => {
|
|
2268
2275
|
setFormData((prev) => ({ ...prev, email: e.target.value }));
|
|
2269
|
-
}
|
|
2270
|
-
const handlePasswordChange =
|
|
2276
|
+
};
|
|
2277
|
+
const handlePasswordChange = (e) => {
|
|
2271
2278
|
setFormData((prev) => ({ ...prev, password: e.target.value }));
|
|
2272
|
-
}
|
|
2279
|
+
};
|
|
2273
2280
|
const handleSubmit = useCallback7(async (e) => {
|
|
2274
2281
|
e.preventDefault();
|
|
2275
2282
|
setError(null);
|
|
@@ -2283,9 +2290,9 @@ var LoginForm = React11.memo(({
|
|
|
2283
2290
|
onError?.(err instanceof Error ? err : new Error(errorMessage));
|
|
2284
2291
|
}
|
|
2285
2292
|
}, [formData, isFormValid, isLoading, onSignIn, onSuccess, onError]);
|
|
2286
|
-
const handleSignUpClick =
|
|
2293
|
+
const handleSignUpClick = () => {
|
|
2287
2294
|
onSignUp?.();
|
|
2288
|
-
}
|
|
2295
|
+
};
|
|
2289
2296
|
const displayTitle = useMemo4(() => title || (appName ? `Sign in to ${appName}` : "Sign In"), [title, appName]);
|
|
2290
2297
|
const displaySubtitle = useMemo4(() => subtitle || "Enter your credentials to continue.", [subtitle]);
|
|
2291
2298
|
return /* @__PURE__ */ jsx12(Card, { className: cn("w-full max-w-md mx-auto", className), children: /* @__PURE__ */ jsxs7("form", { onSubmit: handleSubmit, "data-testid": "login-form", children: [
|
|
@@ -2598,7 +2605,6 @@ function OrganisationSelector({
|
|
|
2598
2605
|
if (newOrganisation && onOrganisationChange) {
|
|
2599
2606
|
onOrganisationChange(newOrganisation);
|
|
2600
2607
|
}
|
|
2601
|
-
logger.debug("OrganisationSelector", "Successfully switched to organisation:", orgId);
|
|
2602
2608
|
} catch (error) {
|
|
2603
2609
|
logger.error("OrganisationSelector", "Failed to switch organisation:", error);
|
|
2604
2610
|
setSwitchError(error instanceof Error ? error.message : "Failed to switch organisation");
|
|
@@ -2816,10 +2822,10 @@ function PasswordChangeForm({ onSubmit, className }) {
|
|
|
2816
2822
|
}
|
|
2817
2823
|
|
|
2818
2824
|
// src/components/UserMenu/UserMenu.tsx
|
|
2819
|
-
import
|
|
2825
|
+
import React12, { useCallback as useCallback9, useMemo as useMemo7, useState as useState10 } from "react";
|
|
2820
2826
|
import { ChevronDown, LogOut, KeyRound } from "lucide-react";
|
|
2821
2827
|
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2822
|
-
var UserMenu =
|
|
2828
|
+
var UserMenu = React12.memo(function UserMenu2({
|
|
2823
2829
|
user,
|
|
2824
2830
|
onSignOut,
|
|
2825
2831
|
onChangePassword,
|
|
@@ -2894,7 +2900,7 @@ var UserMenu = React14.memo(function UserMenu2({
|
|
|
2894
2900
|
] })
|
|
2895
2901
|
] });
|
|
2896
2902
|
});
|
|
2897
|
-
var UserMenuLoading =
|
|
2903
|
+
var UserMenuLoading = React12.memo(function UserMenuLoading2() {
|
|
2898
2904
|
return /* @__PURE__ */ jsxs11("div", { className: "relative inline-block text-left", children: [
|
|
2899
2905
|
/* @__PURE__ */ jsxs11(
|
|
2900
2906
|
"button",
|
|
@@ -2915,10 +2921,10 @@ var UserMenuLoading = React14.memo(function UserMenuLoading2() {
|
|
|
2915
2921
|
UserMenu.Loading = UserMenuLoading;
|
|
2916
2922
|
|
|
2917
2923
|
// src/components/NavigationMenu/NavigationMenu.tsx
|
|
2918
|
-
import * as
|
|
2924
|
+
import * as React13 from "react";
|
|
2919
2925
|
import { ChevronDown as ChevronDown2 } from "lucide-react";
|
|
2920
2926
|
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2921
|
-
var NavigationMenu =
|
|
2927
|
+
var NavigationMenu = React13.forwardRef(({
|
|
2922
2928
|
items,
|
|
2923
2929
|
mode = "dropdown",
|
|
2924
2930
|
currentPath,
|
|
@@ -2936,8 +2942,8 @@ var NavigationMenu = React15.forwardRef(({
|
|
|
2936
2942
|
itemsPreFiltered = false,
|
|
2937
2943
|
...props
|
|
2938
2944
|
}, ref) => {
|
|
2939
|
-
const [expandedItems, setExpandedItems] =
|
|
2940
|
-
const buttonRef =
|
|
2945
|
+
const [expandedItems, setExpandedItems] = React13.useState(/* @__PURE__ */ new Set());
|
|
2946
|
+
const buttonRef = React13.useRef(null);
|
|
2941
2947
|
let authContext = null;
|
|
2942
2948
|
try {
|
|
2943
2949
|
authContext = useUnifiedAuth();
|
|
@@ -2962,15 +2968,15 @@ var NavigationMenu = React15.forwardRef(({
|
|
|
2962
2968
|
selectedOrganisationId: itemsPreFiltered ? null : selectedOrganisation?.id || null,
|
|
2963
2969
|
selectedEventId: itemsPreFiltered ? null : selectedEvent?.event_id || null
|
|
2964
2970
|
});
|
|
2965
|
-
const [resolvedAppId, setResolvedAppId] =
|
|
2966
|
-
|
|
2971
|
+
const [resolvedAppId, setResolvedAppId] = React13.useState(void 0);
|
|
2972
|
+
React13.useEffect(() => {
|
|
2967
2973
|
if (!scopeLoading && !resolvedScope?.appId && selectedOrganisation?.id && authContext?.appName && authContext?.user?.id && !resolvedAppId) {
|
|
2968
2974
|
if (!authContext.user || !authContext.appName) {
|
|
2969
2975
|
return;
|
|
2970
2976
|
}
|
|
2971
2977
|
const userId2 = authContext.user.id;
|
|
2972
2978
|
const appName = authContext.appName;
|
|
2973
|
-
import("./api-
|
|
2979
|
+
import("./api-N774RPUA.js").then(({ resolveAppContext }) => {
|
|
2974
2980
|
resolveAppContext({
|
|
2975
2981
|
userId: userId2,
|
|
2976
2982
|
appName
|
|
@@ -2979,12 +2985,11 @@ var NavigationMenu = React15.forwardRef(({
|
|
|
2979
2985
|
setResolvedAppId(result.appId);
|
|
2980
2986
|
}
|
|
2981
2987
|
}).catch((error) => {
|
|
2982
|
-
logger.debug("NavigationMenu", "Failed to resolve appId", error);
|
|
2983
2988
|
});
|
|
2984
2989
|
});
|
|
2985
2990
|
}
|
|
2986
2991
|
}, [scopeLoading, resolvedScope?.appId, selectedOrganisation?.id, authContext?.appName, authContext?.user?.id, resolvedAppId]);
|
|
2987
|
-
const effectiveScope =
|
|
2992
|
+
const effectiveScope = React13.useMemo(() => {
|
|
2988
2993
|
if (resolvedScope?.organisationId) {
|
|
2989
2994
|
return resolvedScope;
|
|
2990
2995
|
}
|
|
@@ -2999,7 +3004,7 @@ var NavigationMenu = React15.forwardRef(({
|
|
|
2999
3004
|
return null;
|
|
3000
3005
|
}, [resolvedScope, selectedOrganisation?.id, selectedEvent?.event_id, resolvedAppId]);
|
|
3001
3006
|
const scopeKey = effectiveScope ? `${effectiveScope.organisationId || ""}-${effectiveScope.eventId || ""}-${effectiveScope.appId || ""}` : "empty";
|
|
3002
|
-
const stableScope =
|
|
3007
|
+
const stableScope = React13.useMemo(() => {
|
|
3003
3008
|
if (effectiveScope?.organisationId) {
|
|
3004
3009
|
return {
|
|
3005
3010
|
organisationId: effectiveScope.organisationId,
|
|
@@ -3024,8 +3029,8 @@ var NavigationMenu = React15.forwardRef(({
|
|
|
3024
3029
|
itemsPreFiltered ? void 0 : stableScope.appId
|
|
3025
3030
|
// Skip if pre-filtered
|
|
3026
3031
|
);
|
|
3027
|
-
const previousFilteredItemsRef =
|
|
3028
|
-
const filteredItems =
|
|
3032
|
+
const previousFilteredItemsRef = React13.useRef([]);
|
|
3033
|
+
const filteredItems = React13.useMemo(() => {
|
|
3029
3034
|
if (itemsPreFiltered && items && items.length > 0) {
|
|
3030
3035
|
const visibleItems = (items || []).filter((item) => !item.meta?.hidden);
|
|
3031
3036
|
previousFilteredItemsRef.current = visibleItems;
|
|
@@ -3220,15 +3225,6 @@ var NavigationMenu = React15.forwardRef(({
|
|
|
3220
3225
|
};
|
|
3221
3226
|
const handleItemClick = (item) => {
|
|
3222
3227
|
if (auditLog) {
|
|
3223
|
-
logger.debug("NavigationMenu", "Navigation access attempt:", {
|
|
3224
|
-
itemId: item.id,
|
|
3225
|
-
label: item.label,
|
|
3226
|
-
href: item.href,
|
|
3227
|
-
permissions: item.permissions,
|
|
3228
|
-
roles: item.roles,
|
|
3229
|
-
accessLevel: item.accessLevel,
|
|
3230
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
3231
|
-
});
|
|
3232
3228
|
}
|
|
3233
3229
|
if (!authContext) {
|
|
3234
3230
|
if (onNavigate) {
|
|
@@ -3342,7 +3338,7 @@ var NavigationMenu = React15.forwardRef(({
|
|
|
3342
3338
|
id: `submenu-${item.id}`,
|
|
3343
3339
|
role: "menu",
|
|
3344
3340
|
"aria-label": `${item.label} submenu`,
|
|
3345
|
-
children: item.children.map((child) => /* @__PURE__ */ jsx17(
|
|
3341
|
+
children: item.children.map((child) => /* @__PURE__ */ jsx17(React13.Fragment, { children: renderHierarchicalItem(child, level + 1) }, child.id))
|
|
3346
3342
|
}
|
|
3347
3343
|
)
|
|
3348
3344
|
] }) : /* @__PURE__ */ jsx17(
|
|
@@ -3404,7 +3400,7 @@ var NavigationMenu = React15.forwardRef(({
|
|
|
3404
3400
|
className,
|
|
3405
3401
|
"aria-label": navigationLabel,
|
|
3406
3402
|
...props,
|
|
3407
|
-
children: /* @__PURE__ */ jsx17("ul", { role: "menubar", children: filteredItems.map((item) => /* @__PURE__ */ jsx17(
|
|
3403
|
+
children: /* @__PURE__ */ jsx17("ul", { role: "menubar", children: filteredItems.map((item) => /* @__PURE__ */ jsx17(React13.Fragment, { children: renderHierarchicalItem(item, 0) }, item.id)) })
|
|
3408
3404
|
}
|
|
3409
3405
|
);
|
|
3410
3406
|
});
|
|
@@ -3515,8 +3511,8 @@ function Header({
|
|
|
3515
3511
|
}
|
|
3516
3512
|
|
|
3517
3513
|
// src/components/Footer/Footer.tsx
|
|
3518
|
-
import
|
|
3519
|
-
import { Fragment as
|
|
3514
|
+
import React14 from "react";
|
|
3515
|
+
import { Fragment as Fragment7, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3520
3516
|
var FooterComponent = ({
|
|
3521
3517
|
companyName = "Solvera Solutions Pty Ltd",
|
|
3522
3518
|
year = (/* @__PURE__ */ new Date()).getFullYear(),
|
|
@@ -3529,19 +3525,19 @@ var FooterComponent = ({
|
|
|
3529
3525
|
const copyrightText = copyright || `\xA9 Copyright 2022\u2013${year} all rights reserved, ${companyName}.`;
|
|
3530
3526
|
return /* @__PURE__ */ jsx19("footer", { className: cn("mt-8 py-6 flex justify-center border-t border-border bg-main-100", className), children: /* @__PURE__ */ jsxs14("section", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto text-center", children: [
|
|
3531
3527
|
logo && /* @__PURE__ */ jsx19("img", { src: logo, alt: "Logo", className: "h-8 w-auto" }),
|
|
3532
|
-
children && /* @__PURE__ */ jsx19(
|
|
3528
|
+
children && /* @__PURE__ */ jsx19(Fragment7, { children }),
|
|
3533
3529
|
/* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: copyrightText }),
|
|
3534
3530
|
links && links.length > 0 && /* @__PURE__ */ jsx19("ul", { className: "flex gap-4 mt-2 md:mt-0", children: links.map((link, index) => /* @__PURE__ */ jsx19("li", { children: /* @__PURE__ */ jsx19("a", { href: link.href, className: "text-muted-foreground hover:text-foreground", children: link.label }) }, index)) })
|
|
3535
3531
|
] }) });
|
|
3536
3532
|
};
|
|
3537
3533
|
FooterComponent.displayName = "Footer";
|
|
3538
|
-
var Footer =
|
|
3534
|
+
var Footer = React14.memo(FooterComponent);
|
|
3539
3535
|
Footer.displayName = "Footer";
|
|
3540
3536
|
|
|
3541
3537
|
// src/components/PaceAppLayout/PaceAppLayout.tsx
|
|
3542
3538
|
import { useState as useState12, useEffect as useEffect8, useMemo as useMemo9 } from "react";
|
|
3543
3539
|
import { Outlet, useNavigate, useLocation } from "react-router-dom";
|
|
3544
|
-
import { Fragment as
|
|
3540
|
+
import { Fragment as Fragment8, jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3545
3541
|
var EMPTY_PAGE_ID_MAPPING = {};
|
|
3546
3542
|
var EMPTY_ROUTE_PERMISSIONS = {};
|
|
3547
3543
|
function PaceAppLayout({
|
|
@@ -3574,7 +3570,7 @@ function PaceAppLayout({
|
|
|
3574
3570
|
onRouteAccessDenied,
|
|
3575
3571
|
onRouteStrictModeViolation
|
|
3576
3572
|
}) {
|
|
3577
|
-
const { user, signOut, updatePassword, supabase, appId: contextAppId } = useUnifiedAuth();
|
|
3573
|
+
const { user, signOut, updatePassword, supabase, appId: contextAppId, selectedOrganisationId } = useUnifiedAuth();
|
|
3578
3574
|
const {
|
|
3579
3575
|
selectedOrganisation,
|
|
3580
3576
|
isContextReady,
|
|
@@ -3582,6 +3578,34 @@ function PaceAppLayout({
|
|
|
3582
3578
|
ensureOrganisationContext,
|
|
3583
3579
|
isLoading: organisationLoading
|
|
3584
3580
|
} = useOrganisations();
|
|
3581
|
+
const { isSuperAdmin: isSuperAdminFromRBAC, isLoading: rbacLoading } = useRBAC();
|
|
3582
|
+
const [isSuperAdminDirect, setIsSuperAdminDirect] = useState12(false);
|
|
3583
|
+
const [isCheckingSuperAdminDirect, setIsCheckingSuperAdminDirect] = useState12(false);
|
|
3584
|
+
useEffect8(() => {
|
|
3585
|
+
const checkSuperAdminDirect = async () => {
|
|
3586
|
+
if (!user?.id) {
|
|
3587
|
+
setIsSuperAdminDirect(false);
|
|
3588
|
+
setIsCheckingSuperAdminDirect(false);
|
|
3589
|
+
return;
|
|
3590
|
+
}
|
|
3591
|
+
if (isSuperAdminFromRBAC) {
|
|
3592
|
+
setIsCheckingSuperAdminDirect(false);
|
|
3593
|
+
return;
|
|
3594
|
+
}
|
|
3595
|
+
setIsCheckingSuperAdminDirect(true);
|
|
3596
|
+
try {
|
|
3597
|
+
const superAdminStatus = await isSuperAdmin(user.id);
|
|
3598
|
+
setIsSuperAdminDirect(superAdminStatus);
|
|
3599
|
+
} catch (error) {
|
|
3600
|
+
logger.error("PaceAppLayout", "Error checking super admin status directly", { userId: user?.id, error });
|
|
3601
|
+
setIsSuperAdminDirect(false);
|
|
3602
|
+
} finally {
|
|
3603
|
+
setIsCheckingSuperAdminDirect(false);
|
|
3604
|
+
}
|
|
3605
|
+
};
|
|
3606
|
+
checkSuperAdminDirect();
|
|
3607
|
+
}, [user?.id, isSuperAdminFromRBAC]);
|
|
3608
|
+
const isSuperAdmin2 = isSuperAdminFromRBAC || isSuperAdminDirect;
|
|
3585
3609
|
const navigate = useNavigate();
|
|
3586
3610
|
const location = useLocation();
|
|
3587
3611
|
useEventTheme();
|
|
@@ -3597,23 +3621,22 @@ function PaceAppLayout({
|
|
|
3597
3621
|
selectedEventId: selectedEvent?.event_id || null
|
|
3598
3622
|
});
|
|
3599
3623
|
const resolvedAppId = contextAppId || resolvedScope?.appId;
|
|
3624
|
+
const scopeOrgId = resolvedScope?.organisationId || selectedOrganisation?.id || "";
|
|
3625
|
+
const scopeEventId = resolvedScope?.eventId || selectedEvent?.event_id || void 0;
|
|
3626
|
+
const scopeAppId = resolvedScope?.appId || resolvedAppId || void 0;
|
|
3600
3627
|
const scope = useMemo9(() => {
|
|
3601
|
-
|
|
3602
|
-
|
|
3628
|
+
const newScope = {};
|
|
3629
|
+
if (scopeOrgId) {
|
|
3630
|
+
newScope.organisationId = scopeOrgId;
|
|
3603
3631
|
}
|
|
3604
|
-
if (
|
|
3605
|
-
|
|
3606
|
-
organisationId: selectedOrganisation.id,
|
|
3607
|
-
eventId: selectedEvent?.event_id || void 0,
|
|
3608
|
-
appId: resolvedAppId || resolvedScope?.appId || void 0
|
|
3609
|
-
};
|
|
3632
|
+
if (scopeEventId) {
|
|
3633
|
+
newScope.eventId = scopeEventId;
|
|
3610
3634
|
}
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
}, [resolvedScope, selectedOrganisation?.id, selectedEvent?.event_id, resolvedAppId]);
|
|
3635
|
+
if (scopeAppId) {
|
|
3636
|
+
newScope.appId = scopeAppId;
|
|
3637
|
+
}
|
|
3638
|
+
return newScope;
|
|
3639
|
+
}, [scopeOrgId, scopeEventId, scopeAppId]);
|
|
3617
3640
|
const defaultNavItems = useMemo9(() => [
|
|
3618
3641
|
{ id: "home", label: "Home", href: "/", icon: "Home" },
|
|
3619
3642
|
{ id: "dashboard", label: "Dashboard", href: "/dashboard", icon: "LayoutDashboard" },
|
|
@@ -3632,72 +3655,51 @@ function PaceAppLayout({
|
|
|
3632
3655
|
return pageIdMapping[currentPath];
|
|
3633
3656
|
}
|
|
3634
3657
|
const pathSegments = currentPath.slice(1).split("/").filter(Boolean);
|
|
3635
|
-
return pathSegments[0] || "
|
|
3658
|
+
return pathSegments[0] || "";
|
|
3636
3659
|
}, [location.pathname, pageIdMapping]);
|
|
3637
3660
|
const currentPermission = useMemo9(() => {
|
|
3638
|
-
if (!enforcePermissions) {
|
|
3639
|
-
return "
|
|
3661
|
+
if (!enforcePermissions || !currentPageId) {
|
|
3662
|
+
return "";
|
|
3640
3663
|
}
|
|
3641
3664
|
const permissionString = `${currentRoutePermission}:page.${currentPageId}`;
|
|
3642
3665
|
return permissionString;
|
|
3643
3666
|
}, [enforcePermissions, currentRoutePermission, currentPageId]);
|
|
3644
|
-
const
|
|
3645
|
-
const [isCheckingSuperAdmin, setIsCheckingSuperAdmin] = useState12(false);
|
|
3646
|
-
useEffect8(() => {
|
|
3647
|
-
const checkSuperAdminStatus = async () => {
|
|
3648
|
-
if (!user?.id) {
|
|
3649
|
-
setIsSuperAdminUser(false);
|
|
3650
|
-
setIsCheckingSuperAdmin(false);
|
|
3651
|
-
return;
|
|
3652
|
-
}
|
|
3653
|
-
setIsCheckingSuperAdmin(true);
|
|
3654
|
-
try {
|
|
3655
|
-
const superAdminStatus = await isSuperAdmin(user.id);
|
|
3656
|
-
setIsSuperAdminUser(superAdminStatus);
|
|
3657
|
-
} catch (error) {
|
|
3658
|
-
logger.error("PaceAppLayout", "Error checking super admin status", { userId: user?.id, error });
|
|
3659
|
-
setIsSuperAdminUser(false);
|
|
3660
|
-
} finally {
|
|
3661
|
-
setIsCheckingSuperAdmin(false);
|
|
3662
|
-
}
|
|
3663
|
-
};
|
|
3664
|
-
checkSuperAdminStatus();
|
|
3665
|
-
}, [user?.id]);
|
|
3667
|
+
const shouldCheckPermission = enforcePermissions && !!currentPermission && !!currentPageId;
|
|
3666
3668
|
const { can: canFromHook, isLoading: isCheckingPermission, error: permissionError } = useCan(
|
|
3667
3669
|
user?.id || "",
|
|
3668
3670
|
scope,
|
|
3669
|
-
currentPermission,
|
|
3670
|
-
currentPageId,
|
|
3671
|
+
shouldCheckPermission ? currentPermission : "",
|
|
3672
|
+
shouldCheckPermission ? currentPageId : "",
|
|
3671
3673
|
true,
|
|
3672
3674
|
// useCache
|
|
3673
3675
|
appName
|
|
3674
3676
|
// Pass appName for PORTAL/ADMIN special case
|
|
3675
3677
|
);
|
|
3676
|
-
const can =
|
|
3678
|
+
const can = isSuperAdmin2 ? true : canFromHook;
|
|
3677
3679
|
const hasPermission = enforcePermissions ? can : true;
|
|
3678
3680
|
useEffect8(() => {
|
|
3679
3681
|
if (!enforcePermissions) {
|
|
3680
3682
|
return;
|
|
3681
3683
|
}
|
|
3682
|
-
if (
|
|
3684
|
+
if (isCheckingPermission) {
|
|
3683
3685
|
return;
|
|
3684
3686
|
}
|
|
3685
|
-
if (strictMode && !
|
|
3687
|
+
if (strictMode && !isSuperAdmin2 && !can) {
|
|
3686
3688
|
logger.error("PaceAppLayout", "STRICT MODE VIOLATION: User attempted to access protected page without permission", {
|
|
3687
3689
|
pageName: currentPageId,
|
|
3688
3690
|
operation: currentRoutePermission,
|
|
3689
3691
|
userId: user?.id,
|
|
3690
|
-
isSuperAdmin:
|
|
3692
|
+
isSuperAdmin: isSuperAdmin2,
|
|
3691
3693
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
3692
3694
|
});
|
|
3693
3695
|
if (onStrictModeViolation) {
|
|
3694
3696
|
onStrictModeViolation(currentPageId, currentRoutePermission);
|
|
3695
3697
|
}
|
|
3696
3698
|
}
|
|
3697
|
-
if (!
|
|
3699
|
+
if (!isSuperAdmin2 && !can && onPageAccessDenied) {
|
|
3698
3700
|
onPageAccessDenied(currentPageId, currentRoutePermission);
|
|
3699
3701
|
}
|
|
3700
|
-
}, [enforcePermissions, can, isCheckingPermission,
|
|
3702
|
+
}, [enforcePermissions, can, isCheckingPermission, isSuperAdmin2, currentPageId, currentRoutePermission, user?.id, strictMode, auditLog, onPageAccessDenied, onStrictModeViolation]);
|
|
3701
3703
|
const [filteredMenuItems, setFilteredMenuItems] = useState12(baseMenuItems);
|
|
3702
3704
|
useEffect8(() => {
|
|
3703
3705
|
let isMounted = true;
|
|
@@ -3725,8 +3727,8 @@ function PaceAppLayout({
|
|
|
3725
3727
|
return;
|
|
3726
3728
|
}
|
|
3727
3729
|
try {
|
|
3728
|
-
const { isSuperAdmin:
|
|
3729
|
-
const isSuper = await
|
|
3730
|
+
const { isSuperAdmin: checkSuperAdminDynamic } = await import("./api-N774RPUA.js");
|
|
3731
|
+
const isSuper = await checkSuperAdminDynamic(user.id);
|
|
3730
3732
|
if (isSuper) {
|
|
3731
3733
|
if (isMounted) {
|
|
3732
3734
|
setFilteredMenuItems(baseMenuItems);
|
|
@@ -3740,7 +3742,7 @@ function PaceAppLayout({
|
|
|
3740
3742
|
}
|
|
3741
3743
|
}
|
|
3742
3744
|
try {
|
|
3743
|
-
const { getPermissionMap } = await import("./api-
|
|
3745
|
+
const { getPermissionMap } = await import("./api-N774RPUA.js");
|
|
3744
3746
|
const permissionScope = {
|
|
3745
3747
|
organisationId: currentScope.organisationId,
|
|
3746
3748
|
eventId: currentScope.eventId,
|
|
@@ -3796,7 +3798,7 @@ function PaceAppLayout({
|
|
|
3796
3798
|
let hasAccess = true;
|
|
3797
3799
|
if (currentRoute.pageId && currentRoute.permissions && currentRoute.permissions.length > 0) {
|
|
3798
3800
|
try {
|
|
3799
|
-
const { isPermittedCached } = await import("./api-
|
|
3801
|
+
const { isPermittedCached } = await import("./api-N774RPUA.js");
|
|
3800
3802
|
const hasPagePermission = await isPermittedCached({
|
|
3801
3803
|
userId: user?.id || "",
|
|
3802
3804
|
scope,
|
|
@@ -3812,7 +3814,7 @@ function PaceAppLayout({
|
|
|
3812
3814
|
}
|
|
3813
3815
|
}
|
|
3814
3816
|
if (hasAccess && currentRoute.roles && currentRoute.roles.length > 0 && user?.id) {
|
|
3815
|
-
const { useUnifiedAuth: useUnifiedAuth2 } = await import("./UnifiedAuthProvider-
|
|
3817
|
+
const { useUnifiedAuth: useUnifiedAuth2 } = await import("./UnifiedAuthProvider-ATAP5UTR.js");
|
|
3816
3818
|
hasAccess = true;
|
|
3817
3819
|
}
|
|
3818
3820
|
if (!isMounted) return;
|
|
@@ -3858,31 +3860,31 @@ function PaceAppLayout({
|
|
|
3858
3860
|
}
|
|
3859
3861
|
return {};
|
|
3860
3862
|
};
|
|
3861
|
-
if (user?.id && organisationLoading) {
|
|
3863
|
+
if (user?.id && organisationLoading && !isSuperAdmin2 && !isCheckingSuperAdminDirect && !rbacLoading && !selectedOrganisationId) {
|
|
3862
3864
|
return /* @__PURE__ */ jsx20("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs15("div", { className: "text-center", children: [
|
|
3863
3865
|
/* @__PURE__ */ jsx20("div", { className: "animate-spin rounded-full size-8 border-b-2 border-sec-900 mx-auto mb-4" }),
|
|
3864
3866
|
/* @__PURE__ */ jsx20("p", { className: "text-sec-600", children: "Loading organisation context..." })
|
|
3865
3867
|
] }) });
|
|
3866
3868
|
}
|
|
3867
|
-
if (enforcePermissions &&
|
|
3869
|
+
if (enforcePermissions && isCheckingPermission) {
|
|
3868
3870
|
return /* @__PURE__ */ jsx20("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs15("div", { className: "text-center", children: [
|
|
3869
3871
|
/* @__PURE__ */ jsx20("div", { className: "animate-spin rounded-full size-8 border-b-2 border-sec-900 mx-auto mb-4" }),
|
|
3870
3872
|
/* @__PURE__ */ jsx20("p", { className: "text-sec-600", children: "Checking permissions..." })
|
|
3871
3873
|
] }) });
|
|
3872
3874
|
}
|
|
3873
|
-
if (enforcePermissions && permissionError && !
|
|
3875
|
+
if (enforcePermissions && permissionError && !isSuperAdmin2) {
|
|
3874
3876
|
return /* @__PURE__ */ jsx20("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs15("div", { className: "text-center", children: [
|
|
3875
3877
|
/* @__PURE__ */ jsx20("h2", { className: "text-xl font-semibold text-acc-600 mb-2", children: "Permission Error" }),
|
|
3876
3878
|
/* @__PURE__ */ jsx20("p", { className: "text-sec-600 mb-4", children: permissionError.message }),
|
|
3877
3879
|
/* @__PURE__ */ jsx20(Button, { onClick: () => navigate("/"), children: "Go Home" })
|
|
3878
3880
|
] }) });
|
|
3879
3881
|
}
|
|
3880
|
-
if (enforcePermissions && hasPermission === false && !
|
|
3882
|
+
if (enforcePermissions && hasPermission === false && !isCheckingSuperAdminDirect && !isSuperAdmin2) {
|
|
3881
3883
|
if (enforcePagePermissions && pagePermissionFallback) {
|
|
3882
|
-
return /* @__PURE__ */ jsx20(
|
|
3884
|
+
return /* @__PURE__ */ jsx20(Fragment8, { children: pagePermissionFallback });
|
|
3883
3885
|
}
|
|
3884
3886
|
if (permissionFallback) {
|
|
3885
|
-
return /* @__PURE__ */ jsx20(
|
|
3887
|
+
return /* @__PURE__ */ jsx20(Fragment8, { children: permissionFallback });
|
|
3886
3888
|
}
|
|
3887
3889
|
return /* @__PURE__ */ jsx20("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs15("div", { className: "text-center", children: [
|
|
3888
3890
|
/* @__PURE__ */ jsx20("h2", { className: "text-xl font-semibold text-acc-600 mb-2", children: "Access Denied" }),
|
|
@@ -3903,7 +3905,7 @@ function PaceAppLayout({
|
|
|
3903
3905
|
] })
|
|
3904
3906
|
] }) });
|
|
3905
3907
|
}
|
|
3906
|
-
return /* @__PURE__ */ jsxs15(
|
|
3908
|
+
return /* @__PURE__ */ jsxs15(Fragment8, { children: [
|
|
3907
3909
|
/* @__PURE__ */ jsx20(
|
|
3908
3910
|
Header,
|
|
3909
3911
|
{
|
|
@@ -3968,7 +3970,6 @@ var PaceLoginPage = ({
|
|
|
3968
3970
|
await eventService.restorePersistedEvent();
|
|
3969
3971
|
}
|
|
3970
3972
|
} catch (error) {
|
|
3971
|
-
logger.debug("PaceLoginPage", "Could not restore persisted event (service may not be ready):", error);
|
|
3972
3973
|
}
|
|
3973
3974
|
};
|
|
3974
3975
|
const timeoutId = setTimeout(() => {
|
|
@@ -4002,7 +4003,6 @@ var PaceLoginPage = ({
|
|
|
4002
4003
|
}
|
|
4003
4004
|
const { data: pagesData, error: pagesError } = await supabase.from("rbac_app_pages").select("id, page_name").eq("app_id", appData.id);
|
|
4004
4005
|
if (pagesError || !pagesData || pagesData.length === 0) {
|
|
4005
|
-
logger.debug("PaceLoginPage", "No pages configured for app:", appName);
|
|
4006
4006
|
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.`);
|
|
4007
4007
|
setIsCheckingAccess(false);
|
|
4008
4008
|
return;
|
|
@@ -4010,7 +4010,6 @@ var PaceLoginPage = ({
|
|
|
4010
4010
|
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();
|
|
4011
4011
|
const organisationId = orgRow?.organisation_id;
|
|
4012
4012
|
if (!organisationId) {
|
|
4013
|
-
logger.debug("PaceLoginPage", "User has no organisation access");
|
|
4014
4013
|
setAccessError(`You do not have permission to access ${appName}. You are not assigned to any organisation. Please contact your administrator.`);
|
|
4015
4014
|
setIsCheckingAccess(false);
|
|
4016
4015
|
return;
|
|
@@ -4027,19 +4026,16 @@ var PaceLoginPage = ({
|
|
|
4027
4026
|
p_page_id: page.page_name
|
|
4028
4027
|
// Page name to resolve to UUID
|
|
4029
4028
|
});
|
|
4030
|
-
logger.debug("PaceLoginPage", "Permission check for page:", { pageName: page.page_name, hasPermission, error: permError });
|
|
4031
4029
|
if (!permError && hasPermission === true) {
|
|
4032
4030
|
hasAnyAccess = true;
|
|
4033
4031
|
break;
|
|
4034
4032
|
}
|
|
4035
4033
|
}
|
|
4036
4034
|
if (hasAnyAccess) {
|
|
4037
|
-
logger.debug("PaceLoginPage", "User has access to app");
|
|
4038
4035
|
setIsCheckingAccess(false);
|
|
4039
4036
|
navigate(onSuccessRedirectPath, { replace: true });
|
|
4040
4037
|
return;
|
|
4041
4038
|
}
|
|
4042
|
-
logger.debug("PaceLoginPage", "Access denied - no permissions");
|
|
4043
4039
|
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.`);
|
|
4044
4040
|
setIsCheckingAccess(false);
|
|
4045
4041
|
} catch (error) {
|
|
@@ -4251,7 +4247,6 @@ function ProtectedRoute({
|
|
|
4251
4247
|
] }) });
|
|
4252
4248
|
}
|
|
4253
4249
|
if (!selectedEvent) {
|
|
4254
|
-
logger.debug("ProtectedRoute", "Events available but none selected - allowing render so selector is visible");
|
|
4255
4250
|
return /* @__PURE__ */ jsx23(Outlet2, {});
|
|
4256
4251
|
}
|
|
4257
4252
|
return /* @__PURE__ */ jsx23(Outlet2, {});
|
|
@@ -4259,7 +4254,7 @@ function ProtectedRoute({
|
|
|
4259
4254
|
|
|
4260
4255
|
// src/components/FileUpload/FileUpload.tsx
|
|
4261
4256
|
import { useState as useState15, useCallback as useCallback11, useRef as useRef9, useEffect as useEffect11, useMemo as useMemo11 } from "react";
|
|
4262
|
-
import { Fragment as
|
|
4257
|
+
import { Fragment as Fragment9, jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4263
4258
|
function FileUpload({
|
|
4264
4259
|
supabase,
|
|
4265
4260
|
table_name,
|
|
@@ -4624,7 +4619,7 @@ function FileUpload({
|
|
|
4624
4619
|
"data-testid": "file-input"
|
|
4625
4620
|
}
|
|
4626
4621
|
),
|
|
4627
|
-
/* @__PURE__ */ jsx24("div", { className: "text-sec-600", children: isResolvingAppId ? "Resolving app configuration..." : isDragging ? "Drop files here..." : /* @__PURE__ */ jsxs19(
|
|
4622
|
+
/* @__PURE__ */ jsx24("div", { className: "text-sec-600", children: isResolvingAppId ? "Resolving app configuration..." : isDragging ? "Drop files here..." : /* @__PURE__ */ jsxs19(Fragment9, { children: [
|
|
4628
4623
|
/* @__PURE__ */ jsx24("span", { className: "font-medium", children: "Click to upload" }),
|
|
4629
4624
|
" ",
|
|
4630
4625
|
"or drag and drop"
|
|
@@ -4730,9 +4725,9 @@ function FileUpload({
|
|
|
4730
4725
|
}
|
|
4731
4726
|
|
|
4732
4727
|
// src/components/Table/Table.tsx
|
|
4733
|
-
import * as
|
|
4728
|
+
import * as React19 from "react";
|
|
4734
4729
|
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
4735
|
-
var Table =
|
|
4730
|
+
var Table = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
|
|
4736
4731
|
"table",
|
|
4737
4732
|
{
|
|
4738
4733
|
ref,
|
|
@@ -4741,9 +4736,9 @@ var Table = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
4741
4736
|
}
|
|
4742
4737
|
));
|
|
4743
4738
|
Table.displayName = "Table";
|
|
4744
|
-
var TableHeader =
|
|
4739
|
+
var TableHeader = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
4745
4740
|
TableHeader.displayName = "TableHeader";
|
|
4746
|
-
var TableBody =
|
|
4741
|
+
var TableBody = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
|
|
4747
4742
|
"tbody",
|
|
4748
4743
|
{
|
|
4749
4744
|
ref,
|
|
@@ -4752,7 +4747,7 @@ var TableBody = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
4752
4747
|
}
|
|
4753
4748
|
));
|
|
4754
4749
|
TableBody.displayName = "TableBody";
|
|
4755
|
-
var TableFooter =
|
|
4750
|
+
var TableFooter = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
|
|
4756
4751
|
"tfoot",
|
|
4757
4752
|
{
|
|
4758
4753
|
ref,
|
|
@@ -4764,7 +4759,7 @@ var TableFooter = React21.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
4764
4759
|
}
|
|
4765
4760
|
));
|
|
4766
4761
|
TableFooter.displayName = "TableFooter";
|
|
4767
|
-
var TableRow =
|
|
4762
|
+
var TableRow = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
|
|
4768
4763
|
"tr",
|
|
4769
4764
|
{
|
|
4770
4765
|
ref,
|
|
@@ -4776,7 +4771,7 @@ var TableRow = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
4776
4771
|
}
|
|
4777
4772
|
));
|
|
4778
4773
|
TableRow.displayName = "TableRow";
|
|
4779
|
-
var TableHead =
|
|
4774
|
+
var TableHead = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
|
|
4780
4775
|
"th",
|
|
4781
4776
|
{
|
|
4782
4777
|
ref,
|
|
@@ -4788,7 +4783,7 @@ var TableHead = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
4788
4783
|
}
|
|
4789
4784
|
));
|
|
4790
4785
|
TableHead.displayName = "TableHead";
|
|
4791
|
-
var TableCell =
|
|
4786
|
+
var TableCell = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
|
|
4792
4787
|
"td",
|
|
4793
4788
|
{
|
|
4794
4789
|
ref,
|
|
@@ -4797,7 +4792,7 @@ var TableCell = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
4797
4792
|
}
|
|
4798
4793
|
));
|
|
4799
4794
|
TableCell.displayName = "TableCell";
|
|
4800
|
-
var TableCaption =
|
|
4795
|
+
var TableCaption = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
|
|
4801
4796
|
"caption",
|
|
4802
4797
|
{
|
|
4803
4798
|
ref,
|
|
@@ -4808,7 +4803,7 @@ var TableCaption = React21.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
4808
4803
|
TableCaption.displayName = "TableCaption";
|
|
4809
4804
|
|
|
4810
4805
|
// src/components/PublicLayout/PublicPageLayout.tsx
|
|
4811
|
-
import { Fragment as
|
|
4806
|
+
import { Fragment as Fragment10, jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4812
4807
|
function PublicPageHeader({
|
|
4813
4808
|
event,
|
|
4814
4809
|
eventCode,
|
|
@@ -4833,9 +4828,9 @@ function PublicPageHeader({
|
|
|
4833
4828
|
alt: appName
|
|
4834
4829
|
}
|
|
4835
4830
|
),
|
|
4836
|
-
event && /* @__PURE__ */ jsxs20(
|
|
4831
|
+
event && /* @__PURE__ */ jsxs20(Fragment10, { children: [
|
|
4837
4832
|
/* @__PURE__ */ jsx26("h1", { children: event.event_name }),
|
|
4838
|
-
showEventLogo && event && /* @__PURE__ */ jsx26(
|
|
4833
|
+
showEventLogo && event && /* @__PURE__ */ jsx26(Fragment10, { children: customEventLogo || /* @__PURE__ */ jsx26(
|
|
4839
4834
|
FileDisplay,
|
|
4840
4835
|
{
|
|
4841
4836
|
table_name: "event",
|
|
@@ -4854,11 +4849,11 @@ function PublicPageHeader({
|
|
|
4854
4849
|
) }),
|
|
4855
4850
|
event.event_venue && /* @__PURE__ */ jsx26("h4", { children: event.event_venue })
|
|
4856
4851
|
] }),
|
|
4857
|
-
title && /* @__PURE__ */ jsxs20(
|
|
4852
|
+
title && /* @__PURE__ */ jsxs20(Fragment10, { children: [
|
|
4858
4853
|
/* @__PURE__ */ jsx26("h1", { children: title }),
|
|
4859
4854
|
description && /* @__PURE__ */ jsx26("p", { className: "text-lg text-sec-600 max-w-3xl mx-auto", children: description })
|
|
4860
4855
|
] }),
|
|
4861
|
-
children && /* @__PURE__ */ jsx26(
|
|
4856
|
+
children && /* @__PURE__ */ jsx26(Fragment10, { children })
|
|
4862
4857
|
] });
|
|
4863
4858
|
}
|
|
4864
4859
|
function PublicPageFooter({
|
|
@@ -4874,7 +4869,7 @@ function PublicPageFooter({
|
|
|
4874
4869
|
const copyrightText = copyright || `\xA9 Copyright 2022\u2013${year} all rights reserved, ${companyName}.`;
|
|
4875
4870
|
return /* @__PURE__ */ jsx26("footer", { className: cn("mt-8 py-6 flex justify-center", className), children: /* @__PURE__ */ jsxs20("section", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto text-center", children: [
|
|
4876
4871
|
logo && /* @__PURE__ */ jsx26("img", { src: logo, alt: "Logo", className: "h-8 w-auto" }),
|
|
4877
|
-
children && /* @__PURE__ */ jsx26(
|
|
4872
|
+
children && /* @__PURE__ */ jsx26(Fragment10, { children }),
|
|
4878
4873
|
/* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: copyrightText }),
|
|
4879
4874
|
links && links.length > 0 && /* @__PURE__ */ jsx26("ul", { className: "flex gap-4 mt-2 md:mt-0", children: links.map((link, index) => /* @__PURE__ */ jsx26("li", { children: /* @__PURE__ */ jsx26("a", { href: link.href, className: "text-muted-foreground hover:text-foreground", children: link.label }) }, index)) })
|
|
4880
4875
|
] }) });
|
|
@@ -4928,7 +4923,7 @@ function PublicPageLayout({
|
|
|
4928
4923
|
handleRefetch && /* @__PURE__ */ jsx26(Button, { onClick: handleRefetch, children: "Try Again" })
|
|
4929
4924
|
] });
|
|
4930
4925
|
}
|
|
4931
|
-
return /* @__PURE__ */ jsx26(ErrorBoundary, { componentName: "PublicPageLayout", children: /* @__PURE__ */ jsxs20(
|
|
4926
|
+
return /* @__PURE__ */ jsx26(ErrorBoundary, { componentName: "PublicPageLayout", children: /* @__PURE__ */ jsxs20(Fragment10, { children: [
|
|
4932
4927
|
customHeader || /* @__PURE__ */ jsx26(
|
|
4933
4928
|
PublicPageHeader,
|
|
4934
4929
|
{
|
|
@@ -4993,4 +4988,4 @@ export {
|
|
|
4993
4988
|
PublicPageFooter,
|
|
4994
4989
|
PublicPageLayout
|
|
4995
4990
|
};
|
|
4996
|
-
//# sourceMappingURL=chunk-
|
|
4991
|
+
//# sourceMappingURL=chunk-GLK6VM3F.js.map
|