@jmruthers/pace-core 0.5.135 → 0.5.136
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/{DataTable-C7GaRZye.d.ts → DataTable-CWAZZcXC.d.ts} +1 -1
- package/dist/{DataTable-A36PJG6N.js → DataTable-CYOHOX3O.js} +25 -13
- package/dist/{PublicLoadingSpinner-CUAnTvcg.d.ts → EventLogo-801uofbR.d.ts} +51 -135
- package/dist/UnifiedAuthProvider-5E5TUNMS.js +17 -0
- package/dist/{UnifiedAuthProvider-BVKmQd9u.d.ts → UnifiedAuthProvider-DJxGTftH.d.ts} +1 -1
- package/dist/{api-TNIBJWLM.js → api-45XYYO2A.js} +4 -3
- package/dist/{audit-T36HM7IM.js → audit-64X3VJXB.js} +3 -2
- package/dist/{chunk-CTJRBUX2.js → chunk-2TWNJ46Y.js} +2 -2
- package/dist/{chunk-UJI6WSMD.js → chunk-444EZN6N.js} +3 -3
- package/dist/chunk-444EZN6N.js.map +1 -0
- package/dist/{chunk-3CG5L6RN.js → chunk-4MT5BGGL.js} +90 -73
- package/dist/chunk-4MT5BGGL.js.map +1 -0
- package/dist/{chunk-PYUXFQJ3.js → chunk-56XJ3TU6.js} +2 -2
- package/dist/chunk-56XJ3TU6.js.map +1 -0
- package/dist/chunk-5DPZ5EAT.js +60 -0
- package/dist/chunk-5DPZ5EAT.js.map +1 -0
- package/dist/{chunk-66C4BSAY.js → chunk-ANBQRTPX.js} +9 -2
- package/dist/chunk-ANBQRTPX.js.map +1 -0
- package/dist/chunk-APIBCTL2.js +670 -0
- package/dist/chunk-APIBCTL2.js.map +1 -0
- package/dist/{chunk-GKHF54DI.js → chunk-BESYRHQM.js} +10 -4
- package/dist/chunk-BESYRHQM.js.map +1 -0
- package/dist/{chunk-WP5I5GLN.js → chunk-BVYWGZVV.js} +112 -97
- package/dist/chunk-BVYWGZVV.js.map +1 -0
- package/dist/{chunk-GEVIB2UB.js → chunk-ERISIBYU.js} +14 -5
- package/dist/chunk-ERISIBYU.js.map +1 -0
- package/dist/{chunk-CQZU6TFE.js → chunk-FHWWBIHA.js} +100 -62
- package/dist/chunk-FHWWBIHA.js.map +1 -0
- package/dist/{chunk-O3NWNXDY.js → chunk-FMUCXFII.js} +2 -2
- package/dist/chunk-FMUCXFII.js.map +1 -0
- package/dist/{chunk-GVDR7WNV.js → chunk-HJGGOMQ6.js} +194 -518
- package/dist/chunk-HJGGOMQ6.js.map +1 -0
- package/dist/{chunk-BDZUMRBD.js → chunk-K2WWTH7O.js} +13 -6
- package/dist/chunk-K2WWTH7O.js.map +1 -0
- package/dist/{chunk-BYXRHAIF.js → chunk-L6PGMCMD.js} +23 -14
- package/dist/chunk-L6PGMCMD.js.map +1 -0
- package/dist/chunk-LMC26NLJ.js +84 -0
- package/dist/chunk-LMC26NLJ.js.map +1 -0
- package/dist/{chunk-M6DDYFUD.js → chunk-LS353YLY.js} +19 -16
- package/dist/chunk-LS353YLY.js.map +1 -0
- package/dist/{chunk-ZYZCRSBD.js → chunk-LTV3XIJJ.js} +16 -11
- package/dist/chunk-LTV3XIJJ.js.map +1 -0
- package/dist/{chunk-HMNOSGVA.js → chunk-NOHEVYVX.js} +377 -666
- package/dist/chunk-NOHEVYVX.js.map +1 -0
- package/dist/{chunk-JCQZ6LA7.js → chunk-Q5QRDWKI.js} +9 -3
- package/dist/chunk-Q5QRDWKI.js.map +1 -0
- package/dist/chunk-S5OFRT4M.js +94 -0
- package/dist/chunk-S5OFRT4M.js.map +1 -0
- package/dist/{chunk-3DBFLLLU.js → chunk-SBVILCCA.js} +14 -9
- package/dist/chunk-SBVILCCA.js.map +1 -0
- package/dist/{chunk-TGIY2AR2.js → chunk-SL2YQDR6.js} +4 -3
- package/dist/{chunk-TGIY2AR2.js.map → chunk-SL2YQDR6.js.map} +1 -1
- package/dist/{chunk-VZ5OR6HD.js → chunk-TVYPTYOY.js} +55 -179
- package/dist/chunk-TVYPTYOY.js.map +1 -0
- package/dist/{chunk-ZV77RZMU.js → chunk-XARJS7CD.js} +2 -2
- package/dist/chunk-XDNLUEXI.js +138 -0
- package/dist/chunk-XDNLUEXI.js.map +1 -0
- package/dist/{chunk-F64FFPOZ.js → chunk-YLKIDTUK.js} +26 -20
- package/dist/chunk-YLKIDTUK.js.map +1 -0
- package/dist/{chunk-5F3NDPJV.js → chunk-ZZ2SS7NI.js} +10 -5
- package/dist/chunk-ZZ2SS7NI.js.map +1 -0
- package/dist/components.d.ts +7 -287
- package/dist/components.js +26 -157
- package/dist/components.js.map +1 -1
- package/dist/{file-reference-C9isKNPn.d.ts → file-reference-C6Gkn77H.d.ts} +1 -1
- package/dist/{formatting-DFcCxUEk.d.ts → formatting-CvUXy2mF.d.ts} +1 -1
- package/dist/hooks.d.ts +3 -3
- package/dist/hooks.js +22 -16
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +101 -9
- package/dist/index.js +43 -31
- package/dist/index.js.map +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +5 -4
- package/dist/rbac/index.js +13 -12
- package/dist/styles/index.js +2 -1
- package/dist/theming/runtime.d.ts +2 -19
- package/dist/theming/runtime.js +2 -1
- package/dist/{types-D5rqZQXk.d.ts → types-Dfz9dmVH.d.ts} +12 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.js +1 -1
- package/dist/{useInactivityTracker-MRUU55XI.js → useInactivityTracker-TO6ZOF35.js} +3 -2
- package/dist/{usePublicRouteParams-Dyt1tzI9.d.ts → usePublicRouteParams-B7PabvuH.d.ts} +1 -1
- package/dist/utils.d.ts +195 -232
- package/dist/utils.js +173 -331
- package/dist/utils.js.map +1 -1
- package/dist/{validation-DnhrNMju.d.ts → validation-8npbysjg.d.ts} +26 -8
- package/dist/validation.d.ts +261 -10
- package/dist/validation.js +82 -440
- package/dist/validation.js.map +1 -1
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +6 -6
- package/docs/api/classes/InvalidScopeError.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 +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +6 -6
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +7 -7
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +1 -1
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +4 -4
- package/docs/api/interfaces/ButtonProps.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 +29 -4
- package/docs/api/interfaces/DataAccessRecord.md +9 -9
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +18 -18
- package/docs/api/interfaces/DataTableColumn.md +61 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +7 -7
- package/docs/api/interfaces/EmptyStateConfig.md +5 -5
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +14 -14
- package/docs/api/interfaces/EventAppRoleData.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +152 -0
- package/docs/api/interfaces/ExportColumn.md +1 -1
- package/docs/api/interfaces/ExportOptions.md +8 -8
- package/docs/api/interfaces/FileDisplayProps.md +15 -15
- 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/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/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +10 -10
- package/docs/api/interfaces/NavigationContextType.md +9 -9
- package/docs/api/interfaces/NavigationGuardProps.md +10 -10
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +7 -7
- 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 +27 -27
- package/docs/api/interfaces/PaceLoginPageProps.md +4 -4
- package/docs/api/interfaces/PageAccessRecord.md +8 -8
- package/docs/api/interfaces/PagePermissionContextType.md +8 -8
- package/docs/api/interfaces/PagePermissionGuardProps.md +11 -11
- package/docs/api/interfaces/PagePermissionProviderProps.md +7 -7
- package/docs/api/interfaces/PaletteData.md +4 -4
- package/docs/api/interfaces/PermissionEnforcerProps.md +11 -11
- package/docs/api/interfaces/ProtectedRouteProps.md +6 -6
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.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/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +8 -8
- package/docs/api/interfaces/RoleBasedRouterProps.md +10 -10
- package/docs/api/interfaces/RoleManagementResult.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +10 -10
- package/docs/api/interfaces/RouteConfig.md +10 -10
- package/docs/api/interfaces/SecureDataContextType.md +9 -9
- package/docs/api/interfaces/SecureDataProviderProps.md +8 -8
- package/docs/api/interfaces/SessionRestorationLoaderProps.md +21 -0
- 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/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +53 -53
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +13 -13
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +9 -9
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +8 -8
- package/docs/api/interfaces/UsePublicEventOptions.md +3 -3
- package/docs/api/interfaces/UsePublicEventReturn.md +5 -5
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +4 -4
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +9 -9
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +4 -4
- package/docs/api/interfaces/UseResolvedScopeReturn.md +4 -4
- package/docs/api/interfaces/UserEventAccess.md +11 -11
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +514 -212
- package/docs/api-reference/components.md +106 -26
- package/docs/architecture/README.md +0 -2
- package/docs/implementation-guides/data-tables.md +277 -13
- package/docs/implementation-guides/forms.md +1 -16
- package/docs/implementation-guides/permission-enforcement.md +8 -2
- package/examples/README.md +30 -14
- package/examples/STRUCTURE.md +125 -0
- package/examples/components/DataTable/HierarchicalActionsExample.tsx +421 -0
- package/examples/components/DataTable/HierarchicalExample.tsx +475 -0
- package/examples/components/DataTable/InitialPageSizeExample.tsx +177 -0
- package/examples/components/DataTable/PerformanceExample.tsx +506 -0
- package/examples/components/DataTable/index.ts +13 -0
- package/examples/components/Dialog/BasicHtmlTest.tsx +55 -0
- package/examples/components/Dialog/DebugHtmlExample.tsx +68 -0
- package/examples/components/Dialog/HtmlDialogExample.tsx +202 -0
- package/examples/components/Dialog/ScrollableDialogExample.tsx +290 -0
- package/examples/components/Dialog/SimpleHtmlTest.tsx +61 -0
- package/examples/components/Dialog/SmartDialogExample.tsx +322 -0
- package/examples/components/Dialog/index.ts +15 -0
- package/examples/components/index.ts +11 -0
- package/examples/features/index.ts +12 -0
- package/examples/{public-pages → features/public-pages}/CorrectPublicPageImplementation.tsx +1 -1
- package/examples/{public-pages → features/public-pages}/PublicEventPage.tsx +1 -1
- package/examples/{public-pages → features/public-pages}/PublicPageApp.tsx +1 -1
- package/examples/{public-pages → features/public-pages}/PublicPageUsageExample.tsx +1 -1
- package/examples/index.ts +11 -3
- package/package.json +30 -10
- package/src/components/Alert/Alert.tsx +1 -1
- package/src/components/Avatar/Avatar.tsx +1 -1
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Card/Card.tsx +1 -1
- package/src/components/Checkbox/Checkbox.tsx +1 -1
- package/src/components/DataTable/DataTable.test.tsx +1 -1
- package/src/components/DataTable/DataTable.tsx +1 -30
- package/src/components/DataTable/__tests__/DataTable.grouping-aggregation.test.tsx +562 -0
- package/src/components/DataTable/__tests__/styles.test.ts +2 -2
- package/src/components/DataTable/components/ActionButtons.tsx +0 -15
- package/src/components/DataTable/components/DataTableCore.tsx +4 -185
- package/src/components/DataTable/components/DataTableErrorBoundary.tsx +1 -1
- package/src/components/DataTable/components/DataTableModals.tsx +1 -27
- package/src/components/DataTable/components/EditableRow.tsx +1 -1
- package/src/components/DataTable/components/ImportModal.tsx +2 -14
- package/src/components/DataTable/components/PaginationControls.tsx +1 -1
- package/src/components/DataTable/components/UnifiedTableBody.tsx +109 -82
- package/src/components/DataTable/components/__tests__/ActionButtons.test.tsx +1 -1
- package/src/components/DataTable/components/__tests__/DataTableErrorBoundary.test.tsx +1 -1
- package/src/components/DataTable/components/__tests__/DataTableModals.test.tsx +1 -1
- package/src/components/DataTable/components/__tests__/ImportModal.test.tsx +1 -1
- package/src/components/DataTable/examples/GroupingAggregationExample.tsx +273 -0
- package/src/components/DataTable/examples/HierarchicalActionsExample.tsx +1 -1
- package/src/components/DataTable/examples/__tests__/HierarchicalActionsExample.test.tsx +1 -1
- package/src/components/DataTable/hooks/useColumnOrderPersistence.ts +1 -1
- package/src/components/DataTable/hooks/useColumnVisibilityPersistence.ts +1 -1
- package/src/components/DataTable/hooks/useDataTablePermissions.ts +2 -23
- package/src/components/DataTable/index.ts +4 -0
- package/src/components/DataTable/styles.ts +1 -1
- package/src/components/DataTable/types.ts +13 -0
- package/src/components/DataTable/utils/__tests__/exportUtils.test.ts +1 -1
- package/src/components/DataTable/utils/aggregationUtils.ts +161 -0
- package/src/components/DataTable/utils/exportUtils.ts +1 -1
- package/src/components/DataTable/utils/flexibleImport.ts +1 -11
- package/src/components/DataTable/utils/index.ts +1 -0
- package/src/components/DataTable/utils/paginationUtils.ts +1 -1
- package/src/components/Dialog/Dialog.tsx +2 -2
- package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +35 -7
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +5 -4
- package/src/components/EventSelector/EventSelector.tsx +3 -2
- package/src/components/FileDisplay/FileDisplay.tsx +2 -36
- package/src/components/FileUpload/FileUpload.test.tsx +2 -2
- package/src/components/FileUpload/FileUpload.tsx +2 -2
- package/src/components/Footer/Footer.tsx +1 -1
- package/src/components/Form/Form.test.tsx +4 -509
- package/src/components/Form/Form.tsx +1 -1
- package/src/components/Form/FormField.tsx +1 -1
- package/src/components/Form/index.ts +0 -12
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/Input/Input.tsx +1 -1
- package/src/components/Label/Label.tsx +1 -1
- package/src/components/LoginForm/LoginForm.tsx +1 -1
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +19 -3
- package/src/components/NavigationMenu/NavigationMenu.tsx +9 -8
- package/src/components/OrganisationSelector/OrganisationSelector.tsx +4 -3
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +14 -12
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.integration.test.tsx +0 -16
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.security.test.tsx +0 -1
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.unit.test.tsx +0 -9
- package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +35 -3
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +13 -12
- package/src/components/PasswordReset/PasswordChangeForm.tsx +1 -1
- package/src/components/PasswordReset/index.ts +0 -2
- package/src/components/Progress/Progress.tsx +1 -1
- package/src/components/ProtectedRoute/ProtectedRoute.test.tsx +35 -8
- package/src/components/ProtectedRoute/ProtectedRoute.tsx +3 -2
- package/src/components/PublicLayout/PublicErrorBoundary.tsx +1 -1
- package/src/components/PublicLayout/PublicLoadingSpinner.tsx +1 -1
- package/src/components/PublicLayout/PublicPageContextChecker.tsx +44 -43
- package/src/components/PublicLayout/PublicPageFooter.tsx +1 -1
- package/src/components/PublicLayout/PublicPageHeader.tsx +1 -15
- package/src/components/PublicLayout/PublicPageProvider.tsx +3 -2
- package/src/components/PublicLayout/__tests__/PublicPageContextChecker.test.tsx +2 -0
- package/src/components/PublicLayout/index.ts +4 -2
- package/src/components/Select/Select.tsx +1 -1
- package/src/components/{SessionRestorationLoader.tsx → SessionRestorationLoader/SessionRestorationLoader.tsx} +3 -2
- package/src/components/SessionRestorationLoader/index.ts +3 -0
- package/src/components/Switch/Switch.tsx +1 -1
- package/src/components/Table/Table.tsx +1 -1
- package/src/components/Toast/Toast.tsx +1 -1
- package/src/components/Tooltip/Tooltip.tsx +1 -1
- package/src/components/index.ts +4 -10
- package/src/hooks/__tests__/hooks.integration.test.tsx +37 -22
- package/src/hooks/__tests__/useComponentPerformance.unit.test.tsx +33 -17
- package/src/hooks/__tests__/useDataTablePerformance.unit.test.ts +28 -3
- package/src/hooks/__tests__/useFileDisplay.unit.test.ts +36 -9
- package/src/hooks/__tests__/useInactivityTracker.unit.test.ts +26 -2
- package/src/hooks/__tests__/usePerformanceMonitor.unit.test.ts +19 -6
- package/src/hooks/__tests__/usePermissionCache.simple.test.ts +17 -4
- package/src/hooks/__tests__/usePermissionCache.unit.test.ts +17 -4
- package/src/hooks/__tests__/usePublicEvent.simple.test.ts +26 -6
- package/src/hooks/__tests__/usePublicFileDisplay.test.ts +16 -6
- package/src/hooks/__tests__/useSecureDataAccess.unit.test.tsx +3 -3
- package/src/hooks/__tests__/useSessionRestoration.unit.test.tsx +17 -3
- package/src/hooks/public/usePublicEvent.ts +7 -6
- package/src/hooks/public/usePublicEventLogo.ts +7 -4
- package/src/hooks/public/usePublicFileDisplay.ts +6 -150
- package/src/hooks/useComponentPerformance.ts +4 -1
- package/src/hooks/useDataTablePerformance.ts +4 -3
- package/src/hooks/useEventTheme.test.ts +18 -5
- package/src/hooks/useEventTheme.ts +4 -1
- package/src/hooks/useEvents.ts +2 -0
- package/src/hooks/useFileDisplay.ts +9 -8
- package/src/hooks/useFileReference.ts +4 -1
- package/src/hooks/useFileUrl.ts +4 -1
- package/src/hooks/useInactivityTracker.ts +5 -4
- package/src/hooks/useOrganisationSecurity.test.ts +33 -12
- package/src/hooks/useOrganisationSecurity.ts +8 -7
- package/src/hooks/usePerformanceMonitor.ts +6 -3
- package/src/hooks/usePermissionCache.ts +13 -6
- package/src/hooks/useSecureDataAccess.test.ts +2 -2
- package/src/hooks/useSecureDataAccess.ts +9 -8
- package/src/hooks/useSessionRestoration.ts +4 -1
- package/src/hooks/useStorage.ts +4 -1
- package/src/index.ts +16 -7
- package/src/providers/services/AuthServiceProvider.tsx +3 -2
- package/src/providers/services/EventServiceProvider.tsx +2 -1
- package/src/providers/services/InactivityServiceProvider.tsx +2 -1
- package/src/providers/services/OrganisationServiceProvider.tsx +2 -1
- package/src/providers/services/UnifiedAuthProvider.tsx +4 -3
- package/src/providers/services/__tests__/AuthServiceProvider.integration.test.tsx +22 -2
- package/src/providers/services/__tests__/UnifiedAuthProvider.integration.test.tsx +24 -2
- package/src/rbac/__tests__/cache-invalidation.test.ts +20 -6
- package/src/rbac/api.ts +5 -2
- package/src/rbac/audit-enhanced.ts +6 -6
- package/src/rbac/audit.test.ts +60 -38
- package/src/rbac/audit.ts +8 -8
- package/src/rbac/cache-invalidation.ts +7 -4
- package/src/rbac/components/EnhancedNavigationMenu.tsx +11 -5
- package/src/rbac/components/NavigationGuard.tsx +7 -3
- package/src/rbac/components/NavigationProvider.tsx +6 -3
- package/src/rbac/components/PagePermissionGuard.tsx +28 -16
- package/src/rbac/components/PagePermissionProvider.tsx +4 -1
- package/src/rbac/components/PermissionEnforcer.tsx +9 -3
- package/src/rbac/components/RoleBasedRouter.tsx +3 -1
- package/src/rbac/components/SecureDataProvider.tsx +7 -3
- package/src/rbac/components/__tests__/EnhancedNavigationMenu.test.tsx +87 -61
- package/src/rbac/components/__tests__/NavigationGuard.test.tsx +83 -33
- package/src/rbac/components/__tests__/NavigationProvider.test.tsx +36 -13
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +2 -2
- package/src/rbac/components/__tests__/PagePermissionProvider.test.tsx +22 -8
- package/src/rbac/components/__tests__/PermissionEnforcer.test.tsx +19 -6
- package/src/rbac/components/__tests__/SecureDataProvider.fixed.test.tsx +43 -17
- package/src/rbac/components/__tests__/SecureDataProvider.test.tsx +42 -17
- package/src/rbac/engine.ts +15 -7
- package/src/rbac/hooks/usePermissions.ts +7 -3
- package/src/rbac/hooks/useResolvedScope.test.ts +2 -2
- package/src/rbac/hooks/useResolvedScope.ts +10 -7
- package/src/rbac/permissions.ts +5 -2
- package/src/rbac/security.test.ts +27 -16
- package/src/rbac/security.ts +5 -4
- package/src/services/AuthService.ts +22 -21
- package/src/services/EventService.ts +12 -12
- package/src/services/InactivityService.ts +5 -4
- package/src/services/OrganisationService.ts +26 -25
- package/src/services/__tests__/AuthService.test.ts +51 -19
- package/src/services/__tests__/EventService.test.ts +37 -5
- package/src/services/__tests__/InactivityService.test.ts +38 -4
- package/src/services/__tests__/OrganisationService.test.ts +3 -8
- package/src/services/base/BaseService.ts +3 -1
- package/src/theming/__tests__/runtime.test.ts +21 -12
- package/src/theming/parseEventColours.ts +5 -19
- package/src/theming/runtime.ts +8 -4
- package/src/types/validation.ts +2 -29
- package/src/utils/__tests__/appConfig.unit.test.ts +1 -1
- package/src/utils/__tests__/audit.unit.test.ts +1 -1
- package/src/utils/__tests__/auth-utils.unit.test.ts +1 -1
- package/src/utils/__tests__/bundleAnalysis.unit.test.ts +19 -19
- package/src/utils/__tests__/cn.unit.test.ts +1 -1
- package/src/utils/__tests__/debugLogger.test.ts +1 -1
- package/src/utils/__tests__/deviceFingerprint.unit.test.ts +1 -1
- package/src/utils/__tests__/dynamicUtils.unit.test.ts +1 -1
- package/src/utils/__tests__/formatting.unit.test.ts +1 -1
- package/src/utils/__tests__/lazyLoad.unit.test.tsx +1 -1
- package/src/utils/__tests__/logger.unit.test.ts +1 -1
- package/src/utils/__tests__/organisationContext.unit.test.ts +1 -1
- package/src/utils/__tests__/performanceBenchmark.test.ts +1 -1
- package/src/utils/__tests__/performanceBudgets.unit.test.ts +1 -1
- package/src/utils/__tests__/permissionTypes.unit.test.ts +1 -1
- package/src/utils/__tests__/permissionUtils.unit.test.ts +1 -1
- package/src/utils/__tests__/sanitization.unit.test.ts +1 -1
- package/src/utils/__tests__/schemaUtils.unit.test.ts +1 -1
- package/src/utils/__tests__/secureDataAccess.unit.test.ts +1 -1
- package/src/utils/__tests__/secureErrors.unit.test.ts +33 -15
- package/src/utils/__tests__/secureStorage.unit.test.ts +1 -1
- package/src/utils/__tests__/security.unit.test.ts +40 -18
- package/src/utils/__tests__/securityMonitor.unit.test.ts +1 -1
- package/src/utils/__tests__/sessionTracking.unit.test.ts +40 -29
- package/src/utils/__tests__/validationUtils.unit.test.ts +19 -6
- package/src/utils/{appIdResolver.test.ts → app/appIdResolver.test.ts} +28 -30
- package/src/utils/{appIdResolver.ts → app/appIdResolver.ts} +8 -5
- package/src/utils/{appNameResolver.test.ts → app/appNameResolver.test.ts} +1 -1
- package/src/utils/{appNameResolver.ts → app/appNameResolver.ts} +5 -1
- package/src/utils/{organisationContext.ts → context/organisationContext.ts} +6 -3
- package/src/utils/{sessionTracking.ts → context/sessionTracking.ts} +11 -12
- package/src/utils/{logger.ts → core/logger.ts} +4 -2
- package/src/utils/{deviceFingerprint.ts → device/deviceFingerprint.ts} +1 -1
- package/src/utils/{lazyLoad.tsx → dynamic/lazyLoad.tsx} +2 -2
- package/src/utils/{file-reference.test.ts → file-reference/__tests__/file-reference.test.ts} +5 -5
- package/src/utils/{file-reference.ts → file-reference/index.ts} +20 -38
- package/src/utils/index.ts +32 -54
- package/src/utils/{secureErrors.ts → security/secureErrors.ts} +6 -3
- package/src/utils/{security.ts → security/security.ts} +5 -2
- package/src/utils/storage/__tests__/helpers.unit.test.ts +1 -4
- package/src/utils/storage/helpers.ts +15 -8
- package/src/{components/Dialog/utils/__tests__/safeHtml.unit.test.ts → utils/validation/__tests__/htmlSanitization.unit.test.ts} +9 -15
- package/src/{validation → utils/validation}/csrf.ts +1 -1
- package/src/{components/Dialog/utils/safeHtml.ts → utils/validation/htmlSanitization.ts} +9 -10
- package/src/utils/validation/index.ts +79 -0
- package/src/utils/{sanitization.ts → validation/sanitization.ts} +71 -2
- package/src/{validation/schemaUtils.ts → utils/validation/schema.ts} +11 -6
- package/src/{validation → utils/validation}/sqlInjectionProtection.ts +2 -0
- package/src/utils/{validationUtils.ts → validation/validationUtils.ts} +4 -1
- package/src/validation/index.ts +3 -34
- package/dist/UnifiedAuthProvider-CQDZRJIS.js +0 -16
- package/dist/chunk-24MKLB7U.js +0 -81
- package/dist/chunk-24MKLB7U.js.map +0 -1
- package/dist/chunk-3CG5L6RN.js.map +0 -1
- package/dist/chunk-3DBFLLLU.js.map +0 -1
- package/dist/chunk-5F3NDPJV.js.map +0 -1
- package/dist/chunk-66C4BSAY.js.map +0 -1
- package/dist/chunk-BDZUMRBD.js.map +0 -1
- package/dist/chunk-BYXRHAIF.js.map +0 -1
- package/dist/chunk-CDQ3PX7L.js +0 -18
- package/dist/chunk-CDQ3PX7L.js.map +0 -1
- package/dist/chunk-CQZU6TFE.js.map +0 -1
- package/dist/chunk-F64FFPOZ.js.map +0 -1
- package/dist/chunk-GEVIB2UB.js.map +0 -1
- package/dist/chunk-GKHF54DI.js.map +0 -1
- package/dist/chunk-GVDR7WNV.js.map +0 -1
- package/dist/chunk-HMNOSGVA.js.map +0 -1
- package/dist/chunk-JCQZ6LA7.js.map +0 -1
- package/dist/chunk-M6DDYFUD.js.map +0 -1
- package/dist/chunk-O3NWNXDY.js.map +0 -1
- package/dist/chunk-PYUXFQJ3.js.map +0 -1
- package/dist/chunk-UJI6WSMD.js.map +0 -1
- package/dist/chunk-VZ5OR6HD.js.map +0 -1
- package/dist/chunk-WP5I5GLN.js.map +0 -1
- package/dist/chunk-ZYZCRSBD.js.map +0 -1
- package/src/components/Dialog/README.md +0 -804
- package/src/components/Form/FormErrorSummary.tsx +0 -113
- package/src/components/Form/FormFieldset.tsx +0 -127
- package/src/components/Form/FormLiveRegion.tsx +0 -198
- package/src/components/PasswordReset/PasswordResetForm.test.tsx +0 -597
- package/src/components/PasswordReset/PasswordResetForm.tsx +0 -201
- package/src/components/PublicLayout/PublicPageDebugger.tsx +0 -104
- package/src/components/PublicLayout/PublicPageDiagnostic.tsx +0 -162
- package/src/components/PublicLayout/__tests__/PublicPageDebugger.test.tsx +0 -185
- package/src/examples/CorrectPublicPageImplementation.tsx +0 -304
- package/src/examples/PublicEventPage.tsx +0 -287
- package/src/examples/PublicPageApp.tsx +0 -321
- package/src/examples/PublicPageUsageExample.tsx +0 -218
- package/src/utils/schemaUtils.ts +0 -37
- package/src/validation/__tests__/common.unit.test.ts +0 -101
- package/src/validation/__tests__/csrf.unit.test.ts +0 -365
- package/src/validation/__tests__/passwordSchema.unit.test.ts +0 -203
- package/src/validation/__tests__/sanitization.unit.test.ts +0 -250
- package/src/validation/__tests__/schemaUtils.unit.test.ts +0 -451
- package/src/validation/__tests__/sqlInjectionProtection.unit.test.ts +0 -462
- package/src/validation/__tests__/user.unit.test.ts +0 -440
- package/src/validation/sanitization.ts +0 -96
- /package/dist/{DataTable-A36PJG6N.js.map → DataTable-CYOHOX3O.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-CQDZRJIS.js.map → UnifiedAuthProvider-5E5TUNMS.js.map} +0 -0
- /package/dist/{api-TNIBJWLM.js.map → api-45XYYO2A.js.map} +0 -0
- /package/dist/{audit-T36HM7IM.js.map → audit-64X3VJXB.js.map} +0 -0
- /package/dist/{chunk-CTJRBUX2.js.map → chunk-2TWNJ46Y.js.map} +0 -0
- /package/dist/{chunk-ZV77RZMU.js.map → chunk-XARJS7CD.js.map} +0 -0
- /package/dist/{useInactivityTracker-MRUU55XI.js.map → useInactivityTracker-TO6ZOF35.js.map} +0 -0
- /package/examples/{public-pages → features/public-pages}/index.ts +0 -0
- /package/examples/{RBAC → features/rbac}/CompleteRBACExample.tsx +0 -0
- /package/examples/{RBAC → features/rbac}/EventBasedApp.tsx +0 -0
- /package/examples/{RBAC → features/rbac}/PermissionExample.tsx +0 -0
- /package/examples/{RBAC → features/rbac}/index.ts +0 -0
- /package/src/utils/{appConfig.ts → app/appConfig.ts} +0 -0
- /package/src/utils/{appNameResolver.simple.test.ts → app/appNameResolver.simple.test.ts} +0 -0
- /package/src/utils/{audit.ts → audit/audit.ts} +0 -0
- /package/src/utils/{organisationContext.test.ts → context/organisationContext.test.ts} +0 -0
- /package/src/utils/{cn.ts → core/cn.ts} +0 -0
- /package/src/utils/{debugLogger.ts → core/debugLogger.ts} +0 -0
- /package/src/utils/{dynamicUtils.ts → dynamic/dynamicUtils.ts} +0 -0
- /package/src/utils/{formatDate.test.ts → formatting/formatDate.test.ts} +0 -0
- /package/src/utils/{formatting.ts → formatting/formatting.ts} +0 -0
- /package/src/utils/{bundleAnalysis.ts → performance/bundleAnalysis.ts} +0 -0
- /package/src/utils/{performanceBenchmark.ts → performance/performanceBenchmark.ts} +0 -0
- /package/src/utils/{performanceBudgets.ts → performance/performanceBudgets.ts} +0 -0
- /package/src/utils/{permissionTypes.ts → permissions/permissionTypes.ts} +0 -0
- /package/src/utils/{permissionUtils.test.ts → permissions/permissionUtils.test.ts} +0 -0
- /package/src/utils/{permissionUtils.ts → permissions/permissionUtils.ts} +0 -0
- /package/src/utils/{auth-utils.ts → security/auth-utils.ts} +0 -0
- /package/src/utils/{secureDataAccess.test.ts → security/secureDataAccess.test.ts} +0 -0
- /package/src/utils/{secureDataAccess.ts → security/secureDataAccess.ts} +0 -0
- /package/src/utils/{secureStorage.ts → security/secureStorage.ts} +0 -0
- /package/src/utils/{securityMonitor.ts → security/securityMonitor.ts} +0 -0
- /package/src/{validation → utils/validation}/common.ts +0 -0
- /package/src/{validation → utils/validation}/passwordSchema.ts +0 -0
- /package/src/{validation → utils/validation}/user.ts +0 -0
- /package/src/utils/{validation.ts → validation/validation.ts} +0 -0
|
@@ -25,16 +25,16 @@ import {
|
|
|
25
25
|
SelectSeparator,
|
|
26
26
|
SelectTrigger,
|
|
27
27
|
SelectValue
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-HJGGOMQ6.js";
|
|
29
29
|
import {
|
|
30
30
|
useCan,
|
|
31
31
|
usePermissions,
|
|
32
32
|
useRBAC,
|
|
33
33
|
useResolvedScope
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-L6PGMCMD.js";
|
|
35
35
|
import {
|
|
36
36
|
isSuperAdmin
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-BVYWGZVV.js";
|
|
38
38
|
import {
|
|
39
39
|
OrganisationProvider_exports,
|
|
40
40
|
PublicErrorBoundary,
|
|
@@ -50,19 +50,19 @@ import {
|
|
|
50
50
|
useIsPublicPage,
|
|
51
51
|
usePublicFileDisplay,
|
|
52
52
|
usePublicPageContext
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-TVYPTYOY.js";
|
|
54
54
|
import {
|
|
55
55
|
useToast
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-BESYRHQM.js";
|
|
57
57
|
import {
|
|
58
58
|
init_useOrganisations,
|
|
59
59
|
useEvents,
|
|
60
60
|
useOrganisations
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-SL2YQDR6.js";
|
|
62
62
|
import {
|
|
63
63
|
UnifiedAuthProvider_exports,
|
|
64
64
|
init_UnifiedAuthProvider as init_UnifiedAuthProvider2
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-2TWNJ46Y.js";
|
|
66
66
|
import {
|
|
67
67
|
EventServiceContext,
|
|
68
68
|
EventServiceProvider,
|
|
@@ -72,26 +72,31 @@ import {
|
|
|
72
72
|
useEventService,
|
|
73
73
|
useSessionRestoration,
|
|
74
74
|
useUnifiedAuth
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-4MT5BGGL.js";
|
|
76
76
|
import {
|
|
77
|
-
LoadingSpinner
|
|
78
|
-
|
|
77
|
+
LoadingSpinner,
|
|
78
|
+
getAppId
|
|
79
|
+
} from "./chunk-S5OFRT4M.js";
|
|
79
80
|
import {
|
|
80
81
|
getCurrentAppName
|
|
81
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-Q5QRDWKI.js";
|
|
82
83
|
import {
|
|
83
84
|
performanceBudgetMonitor
|
|
84
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-FMUCXFII.js";
|
|
85
86
|
import {
|
|
86
87
|
cn
|
|
87
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-56XJ3TU6.js";
|
|
88
89
|
import {
|
|
89
90
|
clearPalette
|
|
90
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-ERISIBYU.js";
|
|
92
|
+
import {
|
|
93
|
+
createLogger,
|
|
94
|
+
init_logger,
|
|
95
|
+
logger
|
|
96
|
+
} from "./chunk-XDNLUEXI.js";
|
|
91
97
|
import {
|
|
92
98
|
__esm,
|
|
93
99
|
__export,
|
|
94
|
-
__require,
|
|
95
100
|
__toCommonJS
|
|
96
101
|
} from "./chunk-PLDDJCW6.js";
|
|
97
102
|
|
|
@@ -485,6 +490,7 @@ var LoginForm = React5.memo(({
|
|
|
485
490
|
|
|
486
491
|
// src/components/EventSelector/EventSelector.tsx
|
|
487
492
|
import { RefreshCw, AlertCircle, Lock, Calendar, Star } from "lucide-react";
|
|
493
|
+
init_logger();
|
|
488
494
|
import { useEffect, useMemo as useMemo2 } from "react";
|
|
489
495
|
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
490
496
|
function EventSelector({
|
|
@@ -504,7 +510,7 @@ function EventSelector({
|
|
|
504
510
|
setSelectedEvent,
|
|
505
511
|
refreshEvents
|
|
506
512
|
} = useEvents();
|
|
507
|
-
|
|
513
|
+
logger.debug("EventSelector", "Component render:", {
|
|
508
514
|
eventsCount: events.length,
|
|
509
515
|
events: events.map((e) => ({ id: e.event_id, name: e.event_name })),
|
|
510
516
|
selectedEvent: selectedEvent ? { id: selectedEvent.event_id, name: selectedEvent.event_name } : null,
|
|
@@ -853,6 +859,7 @@ UserMenu.Loading = UserMenuLoading;
|
|
|
853
859
|
import * as React8 from "react";
|
|
854
860
|
import { ChevronDown as ChevronDown2 } from "lucide-react";
|
|
855
861
|
init_UnifiedAuthProvider2();
|
|
862
|
+
init_logger();
|
|
856
863
|
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
857
864
|
var NavigationMenu = React8.forwardRef(({
|
|
858
865
|
items,
|
|
@@ -878,13 +885,13 @@ var NavigationMenu = React8.forwardRef(({
|
|
|
878
885
|
try {
|
|
879
886
|
authContext = useUnifiedAuth();
|
|
880
887
|
} catch (error) {
|
|
881
|
-
|
|
888
|
+
logger.warn("NavigationMenu", "useUnifiedAuth not available, running in unauthenticated mode");
|
|
882
889
|
}
|
|
883
890
|
let rbacContext = null;
|
|
884
891
|
try {
|
|
885
892
|
rbacContext = useRBAC();
|
|
886
893
|
} catch (error) {
|
|
887
|
-
|
|
894
|
+
logger.warn("NavigationMenu", "useRBAC not available, permission filtering disabled");
|
|
888
895
|
}
|
|
889
896
|
const { supabase } = authContext || {};
|
|
890
897
|
const { selectedOrganisation } = authContext || {};
|
|
@@ -938,7 +945,7 @@ var NavigationMenu = React8.forwardRef(({
|
|
|
938
945
|
return [];
|
|
939
946
|
}
|
|
940
947
|
if (permissionsError || !permissionMap || Object.keys(permissionMap).length === 0) {
|
|
941
|
-
|
|
948
|
+
logger.warn("NavigationMenu", "Permission map is empty or has error - showing no items for security", {
|
|
942
949
|
permissionsError: permissionsError?.message,
|
|
943
950
|
permissionMapSize: permissionMap ? Object.keys(permissionMap).length : 0
|
|
944
951
|
});
|
|
@@ -1017,7 +1024,7 @@ var NavigationMenu = React8.forwardRef(({
|
|
|
1017
1024
|
const finalHasPermission = isSuperAdmin2 || hasPagePermission;
|
|
1018
1025
|
if (!finalHasPermission) {
|
|
1019
1026
|
if (auditLog) {
|
|
1020
|
-
|
|
1027
|
+
logger.debug("NavigationMenu", `Filtering out navigation item "${item.label}" - no page permission:`, {
|
|
1021
1028
|
itemId: item.id,
|
|
1022
1029
|
href: item.href,
|
|
1023
1030
|
pageId,
|
|
@@ -1067,7 +1074,7 @@ var NavigationMenu = React8.forwardRef(({
|
|
|
1067
1074
|
]);
|
|
1068
1075
|
React8.useEffect(() => {
|
|
1069
1076
|
if (auditLog && authContext) {
|
|
1070
|
-
|
|
1077
|
+
logger.debug("NavigationMenu", "Navigation access attempt:", {
|
|
1071
1078
|
itemId: "navigation-menu",
|
|
1072
1079
|
label: "Navigation Menu",
|
|
1073
1080
|
href: currentPath,
|
|
@@ -1108,7 +1115,7 @@ var NavigationMenu = React8.forwardRef(({
|
|
|
1108
1115
|
};
|
|
1109
1116
|
const handleItemClick = (item) => {
|
|
1110
1117
|
if (auditLog) {
|
|
1111
|
-
|
|
1118
|
+
logger.debug("NavigationMenu", "Navigation access attempt:", {
|
|
1112
1119
|
itemId: item.id,
|
|
1113
1120
|
label: item.label,
|
|
1114
1121
|
href: item.href,
|
|
@@ -1160,7 +1167,7 @@ var NavigationMenu = React8.forwardRef(({
|
|
|
1160
1167
|
onNavigationAccessDenied(item.id, "Insufficient permissions");
|
|
1161
1168
|
}
|
|
1162
1169
|
if (strictMode) {
|
|
1163
|
-
|
|
1170
|
+
logger.error("NavigationMenu", "STRICT MODE VIOLATION: User attempted to access protected navigation item without permission", {
|
|
1164
1171
|
itemId: item.id,
|
|
1165
1172
|
label: item.label,
|
|
1166
1173
|
href: item.href,
|
|
@@ -1401,6 +1408,7 @@ init_UnifiedAuthProvider2();
|
|
|
1401
1408
|
init_useOrganisations();
|
|
1402
1409
|
import { useState as useState5, useEffect as useEffect3, useMemo as useMemo5 } from "react";
|
|
1403
1410
|
import { Outlet, useNavigate, useLocation } from "react-router-dom";
|
|
1411
|
+
init_logger();
|
|
1404
1412
|
import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1405
1413
|
var EMPTY_PAGE_ID_MAPPING = {};
|
|
1406
1414
|
var EMPTY_ROUTE_PERMISSIONS = {};
|
|
@@ -1501,7 +1509,7 @@ function PaceAppLayout({
|
|
|
1501
1509
|
const superAdminStatus = await isSuperAdmin(user.id);
|
|
1502
1510
|
setIsSuperAdminUser(superAdminStatus);
|
|
1503
1511
|
} catch (error) {
|
|
1504
|
-
|
|
1512
|
+
logger.error("PaceAppLayout", "Error checking super admin status", { userId: user?.id, error });
|
|
1505
1513
|
setIsSuperAdminUser(false);
|
|
1506
1514
|
} finally {
|
|
1507
1515
|
setIsCheckingSuperAdmin(false);
|
|
@@ -1527,7 +1535,7 @@ function PaceAppLayout({
|
|
|
1527
1535
|
return;
|
|
1528
1536
|
}
|
|
1529
1537
|
if (strictMode && !isSuperAdminUser && !can) {
|
|
1530
|
-
|
|
1538
|
+
logger.error("PaceAppLayout", "STRICT MODE VIOLATION: User attempted to access protected page without permission", {
|
|
1531
1539
|
pageName: currentPageId,
|
|
1532
1540
|
operation: currentRoutePermission,
|
|
1533
1541
|
userId: user?.id,
|
|
@@ -1562,7 +1570,7 @@ function PaceAppLayout({
|
|
|
1562
1570
|
appId: user.user_metadata?.appId || user.app_metadata?.appId
|
|
1563
1571
|
};
|
|
1564
1572
|
try {
|
|
1565
|
-
const { isSuperAdmin: isSuperAdmin2 } = await import("./api-
|
|
1573
|
+
const { isSuperAdmin: isSuperAdmin2 } = await import("./api-45XYYO2A.js");
|
|
1566
1574
|
const isSuper = await isSuperAdmin2(user.id);
|
|
1567
1575
|
if (isSuper) {
|
|
1568
1576
|
if (isMounted) {
|
|
@@ -1583,7 +1591,7 @@ function PaceAppLayout({
|
|
|
1583
1591
|
return;
|
|
1584
1592
|
}
|
|
1585
1593
|
try {
|
|
1586
|
-
const { getPermissionMap } = await import("./api-
|
|
1594
|
+
const { getPermissionMap } = await import("./api-45XYYO2A.js");
|
|
1587
1595
|
const permissionMap = await getPermissionMap({
|
|
1588
1596
|
userId: user.id,
|
|
1589
1597
|
scope: scope2
|
|
@@ -1600,7 +1608,7 @@ function PaceAppLayout({
|
|
|
1600
1608
|
const accessibleItems = filtered.filter(({ hasAccess }) => hasAccess).map(({ item }) => item);
|
|
1601
1609
|
setFilteredMenuItems(accessibleItems);
|
|
1602
1610
|
} catch (error) {
|
|
1603
|
-
|
|
1611
|
+
logger.error("PaceAppLayout", "Failed to load permission map for navigation filtering", { userId: user?.id, error });
|
|
1604
1612
|
if (isMounted) {
|
|
1605
1613
|
setFilteredMenuItems(baseMenuItems);
|
|
1606
1614
|
}
|
|
@@ -1619,7 +1627,7 @@ function PaceAppLayout({
|
|
|
1619
1627
|
const currentRoute = routeConfig.find((route) => route.path === currentPath);
|
|
1620
1628
|
if (!currentRoute) {
|
|
1621
1629
|
if (strictMode) {
|
|
1622
|
-
|
|
1630
|
+
logger.error("PaceAppLayout", "STRICT MODE VIOLATION: Route not found in configuration", {
|
|
1623
1631
|
route: currentPath,
|
|
1624
1632
|
userId: user?.id,
|
|
1625
1633
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -1633,7 +1641,7 @@ function PaceAppLayout({
|
|
|
1633
1641
|
let hasAccess = true;
|
|
1634
1642
|
if (currentRoute.pageId && currentRoute.permissions && currentRoute.permissions.length > 0) {
|
|
1635
1643
|
try {
|
|
1636
|
-
const { isPermittedCached } = await import("./api-
|
|
1644
|
+
const { isPermittedCached } = await import("./api-45XYYO2A.js");
|
|
1637
1645
|
const hasPagePermission = await isPermittedCached({
|
|
1638
1646
|
userId: user?.id || "",
|
|
1639
1647
|
scope,
|
|
@@ -1643,13 +1651,13 @@ function PaceAppLayout({
|
|
|
1643
1651
|
if (!isMounted) return;
|
|
1644
1652
|
hasAccess = hasPagePermission;
|
|
1645
1653
|
} catch (error) {
|
|
1646
|
-
|
|
1654
|
+
logger.error("PaceAppLayout", "Failed to check page permission", { route: currentPath, pageId: currentRoute.pageId, error });
|
|
1647
1655
|
if (!isMounted) return;
|
|
1648
1656
|
hasAccess = false;
|
|
1649
1657
|
}
|
|
1650
1658
|
}
|
|
1651
1659
|
if (hasAccess && currentRoute.roles && currentRoute.roles.length > 0 && user?.id) {
|
|
1652
|
-
const { useUnifiedAuth: useUnifiedAuth2 } = await import("./UnifiedAuthProvider-
|
|
1660
|
+
const { useUnifiedAuth: useUnifiedAuth2 } = await import("./UnifiedAuthProvider-5E5TUNMS.js");
|
|
1653
1661
|
hasAccess = true;
|
|
1654
1662
|
}
|
|
1655
1663
|
if (!isMounted) return;
|
|
@@ -1658,7 +1666,7 @@ function PaceAppLayout({
|
|
|
1658
1666
|
onRouteAccessDenied(currentPath, "Insufficient permissions");
|
|
1659
1667
|
}
|
|
1660
1668
|
if (strictMode) {
|
|
1661
|
-
|
|
1669
|
+
logger.error("PaceAppLayout", "STRICT MODE VIOLATION: User attempted to access protected route without permission", {
|
|
1662
1670
|
route: currentPath,
|
|
1663
1671
|
userId: user?.id,
|
|
1664
1672
|
permissions: currentRoute.permissions,
|
|
@@ -1685,17 +1693,17 @@ function PaceAppLayout({
|
|
|
1685
1693
|
const handleChangePassword = async (newPassword) => {
|
|
1686
1694
|
const result = await updatePassword(newPassword);
|
|
1687
1695
|
if (result?.error) {
|
|
1688
|
-
|
|
1696
|
+
logger.error("PaceAppLayout", "Failed to change password", { error: result.error.message });
|
|
1689
1697
|
}
|
|
1690
1698
|
return result || { error: null };
|
|
1691
1699
|
};
|
|
1692
|
-
if (enforcePermissions && (isCheckingSuperAdmin || isCheckingPermission)
|
|
1700
|
+
if (enforcePermissions && (isCheckingSuperAdmin || isCheckingPermission)) {
|
|
1693
1701
|
return /* @__PURE__ */ jsx13("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs10("div", { className: "text-center", children: [
|
|
1694
1702
|
/* @__PURE__ */ jsx13("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-sec-900 mx-auto mb-4" }),
|
|
1695
1703
|
/* @__PURE__ */ jsx13("p", { className: "text-sec-600", children: "Checking permissions..." })
|
|
1696
1704
|
] }) });
|
|
1697
1705
|
}
|
|
1698
|
-
if (enforcePermissions && permissionError && !
|
|
1706
|
+
if (enforcePermissions && permissionError && !isSuperAdminUser) {
|
|
1699
1707
|
return /* @__PURE__ */ jsx13("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs10("div", { className: "text-center", children: [
|
|
1700
1708
|
/* @__PURE__ */ jsx13("h2", { className: "text-xl font-semibold text-acc-600 mb-2", children: "Permission Error" }),
|
|
1701
1709
|
/* @__PURE__ */ jsx13("p", { className: "text-sec-600 mb-4", children: permissionError.message }),
|
|
@@ -1762,6 +1770,7 @@ function PaceAppLayout({
|
|
|
1762
1770
|
import { useEffect as useEffect4, useState as useState6, useContext } from "react";
|
|
1763
1771
|
import { useNavigate as useNavigate2, useLocation as useLocation2 } from "react-router-dom";
|
|
1764
1772
|
init_EventServiceProvider();
|
|
1773
|
+
init_logger();
|
|
1765
1774
|
import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1766
1775
|
var PaceLoginPage = ({
|
|
1767
1776
|
appName = "Pace",
|
|
@@ -1793,7 +1802,7 @@ var PaceLoginPage = ({
|
|
|
1793
1802
|
await eventService.restorePersistedEvent();
|
|
1794
1803
|
}
|
|
1795
1804
|
} catch (error) {
|
|
1796
|
-
|
|
1805
|
+
logger.debug("PaceLoginPage", "Could not restore persisted event (service may not be ready):", error);
|
|
1797
1806
|
}
|
|
1798
1807
|
};
|
|
1799
1808
|
const timeoutId = setTimeout(() => {
|
|
@@ -1810,31 +1819,31 @@ var PaceLoginPage = ({
|
|
|
1810
1819
|
setAccessError(null);
|
|
1811
1820
|
try {
|
|
1812
1821
|
const userId = user.id;
|
|
1813
|
-
|
|
1822
|
+
logger.debug("PaceLoginPage", "Checking app access using RBAC:", { appName, userId });
|
|
1814
1823
|
const superAdminCheck = await isSuperAdmin(userId);
|
|
1815
1824
|
if (superAdminCheck) {
|
|
1816
|
-
|
|
1825
|
+
logger.debug("PaceLoginPage", "User is super admin, granting access");
|
|
1817
1826
|
setIsCheckingAccess(false);
|
|
1818
1827
|
navigate(onSuccessRedirectPath, { replace: true });
|
|
1819
1828
|
return;
|
|
1820
1829
|
}
|
|
1821
1830
|
const { data: appData, error: appError } = await supabase.from("rbac_apps").select("id, name, is_active").eq("name", appName).eq("is_active", true).single();
|
|
1822
1831
|
if (appError || !appData) {
|
|
1823
|
-
|
|
1832
|
+
logger.error("PaceLoginPage", "App not found:", { appName, error: appError });
|
|
1824
1833
|
setAccessError(`Application "${appName}" is not configured. Please contact your administrator.`);
|
|
1825
1834
|
setIsCheckingAccess(false);
|
|
1826
1835
|
return;
|
|
1827
1836
|
}
|
|
1828
1837
|
const { data: pagesData, error: pagesError } = await supabase.from("rbac_app_pages").select("id, page_name").eq("app_id", appData.id);
|
|
1829
1838
|
if (pagesError || !pagesData || pagesData.length === 0) {
|
|
1830
|
-
|
|
1839
|
+
logger.debug("PaceLoginPage", "No pages configured for app:", appName);
|
|
1831
1840
|
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.`);
|
|
1832
1841
|
setIsCheckingAccess(false);
|
|
1833
1842
|
return;
|
|
1834
1843
|
}
|
|
1835
1844
|
const { data: orgData } = await supabase.from("rbac_organisation_roles").select("organisation_id").eq("user_id", userId).eq("status", "active").is("revoked_at", null).limit(1).single();
|
|
1836
1845
|
if (!orgData) {
|
|
1837
|
-
|
|
1846
|
+
logger.debug("PaceLoginPage", "User has no organisation access");
|
|
1838
1847
|
setAccessError(`You do not have permission to access ${appName}. You are not assigned to any organisation. Please contact your administrator.`);
|
|
1839
1848
|
setIsCheckingAccess(false);
|
|
1840
1849
|
return;
|
|
@@ -1851,23 +1860,23 @@ var PaceLoginPage = ({
|
|
|
1851
1860
|
p_page_id: page.page_name
|
|
1852
1861
|
// Page name to resolve to UUID
|
|
1853
1862
|
});
|
|
1854
|
-
|
|
1863
|
+
logger.debug("PaceLoginPage", "Permission check for page:", { pageName: page.page_name, hasPermission, error: permError });
|
|
1855
1864
|
if (!permError && hasPermission === true) {
|
|
1856
1865
|
hasAnyAccess = true;
|
|
1857
1866
|
break;
|
|
1858
1867
|
}
|
|
1859
1868
|
}
|
|
1860
1869
|
if (hasAnyAccess) {
|
|
1861
|
-
|
|
1870
|
+
logger.debug("PaceLoginPage", "User has access to app");
|
|
1862
1871
|
setIsCheckingAccess(false);
|
|
1863
1872
|
navigate(onSuccessRedirectPath, { replace: true });
|
|
1864
1873
|
return;
|
|
1865
1874
|
}
|
|
1866
|
-
|
|
1875
|
+
logger.debug("PaceLoginPage", "Access denied - no permissions");
|
|
1867
1876
|
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.`);
|
|
1868
1877
|
setIsCheckingAccess(false);
|
|
1869
1878
|
} catch (error) {
|
|
1870
|
-
|
|
1879
|
+
logger.error("PaceLoginPage", "Error checking app access:", error);
|
|
1871
1880
|
setAccessError("An error occurred while checking your permissions. Please try again or contact support.");
|
|
1872
1881
|
setIsCheckingAccess(false);
|
|
1873
1882
|
}
|
|
@@ -1886,7 +1895,7 @@ var PaceLoginPage = ({
|
|
|
1886
1895
|
try {
|
|
1887
1896
|
navigate(onSuccessRedirectPath, { replace: true });
|
|
1888
1897
|
} catch (navError) {
|
|
1889
|
-
|
|
1898
|
+
logger.error("PaceLoginPage", "Navigation error after sign-in:", navError);
|
|
1890
1899
|
}
|
|
1891
1900
|
}
|
|
1892
1901
|
} finally {
|
|
@@ -1910,7 +1919,7 @@ var PaceLoginPage = ({
|
|
|
1910
1919
|
appName,
|
|
1911
1920
|
isLoading: isSigningIn,
|
|
1912
1921
|
onError: (error) => {
|
|
1913
|
-
|
|
1922
|
+
logger.error("PaceLoginPage", "Login error:", error);
|
|
1914
1923
|
}
|
|
1915
1924
|
}
|
|
1916
1925
|
),
|
|
@@ -1923,7 +1932,7 @@ var PaceLoginPage = ({
|
|
|
1923
1932
|
] });
|
|
1924
1933
|
};
|
|
1925
1934
|
|
|
1926
|
-
// src/components/SessionRestorationLoader.tsx
|
|
1935
|
+
// src/components/SessionRestorationLoader/SessionRestorationLoader.tsx
|
|
1927
1936
|
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1928
1937
|
var SessionRestorationLoader = ({
|
|
1929
1938
|
message = "Restoring session..."
|
|
@@ -1965,6 +1974,7 @@ init_UnifiedAuthProvider();
|
|
|
1965
1974
|
init_useSessionRestoration();
|
|
1966
1975
|
import { useMemo as useMemo6 } from "react";
|
|
1967
1976
|
import { Navigate, Outlet as Outlet2 } from "react-router-dom";
|
|
1977
|
+
init_logger();
|
|
1968
1978
|
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1969
1979
|
function ProtectedRoute({
|
|
1970
1980
|
requireEvent = true,
|
|
@@ -1995,7 +2005,7 @@ function ProtectedRoute({
|
|
|
1995
2005
|
}
|
|
1996
2006
|
if (!isAuthenticated) {
|
|
1997
2007
|
if (sessionRestoration.hasTimedOut || sessionRestoration.restorationError) {
|
|
1998
|
-
|
|
2008
|
+
logger.warn("ProtectedRoute", "Session restoration failed, redirecting to login", {
|
|
1999
2009
|
timedOut: sessionRestoration.hasTimedOut,
|
|
2000
2010
|
error: sessionRestoration.restorationError?.message
|
|
2001
2011
|
});
|
|
@@ -2012,7 +2022,7 @@ function ProtectedRoute({
|
|
|
2012
2022
|
] }) });
|
|
2013
2023
|
}
|
|
2014
2024
|
if (!selectedEvent) {
|
|
2015
|
-
|
|
2025
|
+
logger.debug("ProtectedRoute", "Events available but none selected - allowing render so selector is visible");
|
|
2016
2026
|
return /* @__PURE__ */ jsx16(Outlet2, {});
|
|
2017
2027
|
}
|
|
2018
2028
|
return /* @__PURE__ */ jsx16(Outlet2, {});
|
|
@@ -2020,6 +2030,7 @@ function ProtectedRoute({
|
|
|
2020
2030
|
|
|
2021
2031
|
// src/components/ErrorBoundary/ErrorBoundary.tsx
|
|
2022
2032
|
import { Component } from "react";
|
|
2033
|
+
init_logger();
|
|
2023
2034
|
import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2024
2035
|
var ErrorBoundary = class extends Component {
|
|
2025
2036
|
constructor(props) {
|
|
@@ -2027,14 +2038,14 @@ var ErrorBoundary = class extends Component {
|
|
|
2027
2038
|
this.retryTimeoutId = null;
|
|
2028
2039
|
this.reportError = (errorId, componentName) => {
|
|
2029
2040
|
if (import.meta.env.MODE === "production") {
|
|
2030
|
-
|
|
2041
|
+
logger.warn("ErrorBoundary", "Error reporting would be triggered in production:", { errorId, componentName });
|
|
2031
2042
|
}
|
|
2032
2043
|
};
|
|
2033
2044
|
this.handleRetry = () => {
|
|
2034
2045
|
const { maxRetries = 3 } = this.props;
|
|
2035
2046
|
const { retryCount } = this.state;
|
|
2036
2047
|
if (retryCount < maxRetries) {
|
|
2037
|
-
|
|
2048
|
+
logger.debug("ErrorBoundary", `Retrying component render (attempt ${retryCount + 1}/${maxRetries})`);
|
|
2038
2049
|
this.setState((prevState) => ({
|
|
2039
2050
|
hasError: false,
|
|
2040
2051
|
error: void 0,
|
|
@@ -2061,7 +2072,7 @@ var ErrorBoundary = class extends Component {
|
|
|
2061
2072
|
const { componentName = "Unknown Component", onError, enableReporting = true } = this.props;
|
|
2062
2073
|
const errorId = this.state.errorId;
|
|
2063
2074
|
this.setState({ errorInfo });
|
|
2064
|
-
|
|
2075
|
+
logger.error("ErrorBoundary", `[${componentName}] Caught error ${errorId}:`, error, errorInfo);
|
|
2065
2076
|
performanceBudgetMonitor.measure("ERROR_BOUNDARY_TRIGGER", 1, {
|
|
2066
2077
|
componentName,
|
|
2067
2078
|
errorId,
|
|
@@ -2167,6 +2178,7 @@ var ErrorBoundary = class extends Component {
|
|
|
2167
2178
|
// src/components/OrganisationSelector/OrganisationSelector.tsx
|
|
2168
2179
|
import { useState as useState7, useCallback as useCallback4 } from "react";
|
|
2169
2180
|
init_OrganisationProvider();
|
|
2181
|
+
init_logger();
|
|
2170
2182
|
import { RefreshCw as RefreshCw2, AlertCircle as AlertCircle2, Building2, Shield } from "lucide-react";
|
|
2171
2183
|
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2172
2184
|
function OrganisationSelector({
|
|
@@ -2204,9 +2216,9 @@ function OrganisationSelector({
|
|
|
2204
2216
|
if (newOrganisation && onOrganisationChange) {
|
|
2205
2217
|
onOrganisationChange(newOrganisation);
|
|
2206
2218
|
}
|
|
2207
|
-
|
|
2219
|
+
logger.debug("OrganisationSelector", "Successfully switched to organisation:", orgId);
|
|
2208
2220
|
} catch (error) {
|
|
2209
|
-
|
|
2221
|
+
logger.error("OrganisationSelector", "Failed to switch organisation:", error);
|
|
2210
2222
|
setSwitchError(error instanceof Error ? error.message : "Failed to switch organisation");
|
|
2211
2223
|
} finally {
|
|
2212
2224
|
setIsLoading(false);
|
|
@@ -2225,7 +2237,7 @@ function OrganisationSelector({
|
|
|
2225
2237
|
try {
|
|
2226
2238
|
await refreshOrganisations();
|
|
2227
2239
|
} catch (error) {
|
|
2228
|
-
|
|
2240
|
+
logger.error("OrganisationSelector", "Failed to refresh organisations:", error);
|
|
2229
2241
|
setSwitchError("Failed to refresh organisations");
|
|
2230
2242
|
} finally {
|
|
2231
2243
|
setIsLoading(false);
|
|
@@ -2336,107 +2348,13 @@ function OrganisationSelector({
|
|
|
2336
2348
|
] });
|
|
2337
2349
|
}
|
|
2338
2350
|
|
|
2339
|
-
// src/components/PasswordReset/PasswordResetForm.tsx
|
|
2340
|
-
import { useState as useState8 } from "react";
|
|
2341
|
-
init_UnifiedAuthProvider2();
|
|
2342
|
-
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2343
|
-
function PasswordResetForm({
|
|
2344
|
-
onSuccess,
|
|
2345
|
-
onError,
|
|
2346
|
-
className
|
|
2347
|
-
}) {
|
|
2348
|
-
const { resetPassword } = useUnifiedAuth();
|
|
2349
|
-
const [email, setEmail] = useState8("");
|
|
2350
|
-
const [isLoading, setIsLoading] = useState8(false);
|
|
2351
|
-
const [isSuccess, setIsSuccess] = useState8(false);
|
|
2352
|
-
const [error, setError] = useState8(null);
|
|
2353
|
-
const handleSubmit = async (e) => {
|
|
2354
|
-
e.preventDefault();
|
|
2355
|
-
if (!email.trim()) {
|
|
2356
|
-
return;
|
|
2357
|
-
}
|
|
2358
|
-
setIsLoading(true);
|
|
2359
|
-
setError(null);
|
|
2360
|
-
try {
|
|
2361
|
-
const { error: resetError } = await resetPassword(email);
|
|
2362
|
-
if (resetError) {
|
|
2363
|
-
const errorObj = new Error(resetError.message || "Failed to send reset email");
|
|
2364
|
-
setError(errorObj.message);
|
|
2365
|
-
onError?.(errorObj);
|
|
2366
|
-
} else {
|
|
2367
|
-
setIsSuccess(true);
|
|
2368
|
-
onSuccess?.();
|
|
2369
|
-
}
|
|
2370
|
-
} catch (err) {
|
|
2371
|
-
const errorObj = err instanceof Error ? err : new Error("An unexpected error occurred");
|
|
2372
|
-
setError(errorObj.message);
|
|
2373
|
-
onError?.(errorObj);
|
|
2374
|
-
} finally {
|
|
2375
|
-
setIsLoading(false);
|
|
2376
|
-
}
|
|
2377
|
-
};
|
|
2378
|
-
const handleSendAnother = () => {
|
|
2379
|
-
setIsSuccess(false);
|
|
2380
|
-
setError(null);
|
|
2381
|
-
};
|
|
2382
|
-
if (isSuccess) {
|
|
2383
|
-
return /* @__PURE__ */ jsx19("div", { className: cn("", className), role: "form", children: /* @__PURE__ */ jsxs16("div", { className: "space-y-4 text-center", children: [
|
|
2384
|
-
/* @__PURE__ */ jsx19("h2", { children: "Check your email" }),
|
|
2385
|
-
/* @__PURE__ */ jsxs16("p", { className: "text-sec-600", children: [
|
|
2386
|
-
"We have sent a password reset link to ",
|
|
2387
|
-
email
|
|
2388
|
-
] }),
|
|
2389
|
-
/* @__PURE__ */ jsx19(
|
|
2390
|
-
Button,
|
|
2391
|
-
{
|
|
2392
|
-
variant: "outline",
|
|
2393
|
-
onClick: handleSendAnother,
|
|
2394
|
-
className: "w-full",
|
|
2395
|
-
children: "Send another email"
|
|
2396
|
-
}
|
|
2397
|
-
)
|
|
2398
|
-
] }) });
|
|
2399
|
-
}
|
|
2400
|
-
return /* @__PURE__ */ jsx19("div", { className: cn("", className), role: "form", children: /* @__PURE__ */ jsxs16("div", { className: "space-y-4", children: [
|
|
2401
|
-
/* @__PURE__ */ jsxs16("div", { className: "space-y-2", children: [
|
|
2402
|
-
/* @__PURE__ */ jsx19("h2", { children: "Reset Password" }),
|
|
2403
|
-
/* @__PURE__ */ jsx19("p", { className: "text-sec-600", children: "Enter your email address and we'll send you a reset link." })
|
|
2404
|
-
] }),
|
|
2405
|
-
/* @__PURE__ */ jsxs16("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
|
|
2406
|
-
/* @__PURE__ */ jsxs16("div", { className: "space-y-2", children: [
|
|
2407
|
-
/* @__PURE__ */ jsx19(Label, { htmlFor: "email", children: "Email Address" }),
|
|
2408
|
-
/* @__PURE__ */ jsx19(
|
|
2409
|
-
Input,
|
|
2410
|
-
{
|
|
2411
|
-
id: "email",
|
|
2412
|
-
type: "email",
|
|
2413
|
-
value: email,
|
|
2414
|
-
onChange: (e) => setEmail(e.target.value),
|
|
2415
|
-
placeholder: "Enter your email",
|
|
2416
|
-
required: true,
|
|
2417
|
-
disabled: isLoading
|
|
2418
|
-
}
|
|
2419
|
-
)
|
|
2420
|
-
] }),
|
|
2421
|
-
error && /* @__PURE__ */ jsx19("div", { className: "text-sm text-destructive", role: "alert", children: error }),
|
|
2422
|
-
/* @__PURE__ */ jsx19(
|
|
2423
|
-
Button,
|
|
2424
|
-
{
|
|
2425
|
-
type: "submit",
|
|
2426
|
-
className: "w-full",
|
|
2427
|
-
disabled: !email.trim() || isLoading,
|
|
2428
|
-
children: isLoading ? "Sending..." : "Send Reset Link"
|
|
2429
|
-
}
|
|
2430
|
-
)
|
|
2431
|
-
] })
|
|
2432
|
-
] }) });
|
|
2433
|
-
}
|
|
2434
|
-
|
|
2435
2351
|
// src/hooks/useFileReference.ts
|
|
2436
|
-
import { useState as
|
|
2352
|
+
import { useState as useState8, useCallback as useCallback5, useEffect as useEffect5, useRef as useRef2, useMemo as useMemo7 } from "react";
|
|
2353
|
+
init_logger();
|
|
2354
|
+
var log = createLogger("useFileReference");
|
|
2437
2355
|
function useFileReference(supabase) {
|
|
2438
|
-
const [isLoading, setIsLoading] =
|
|
2439
|
-
const [error, setError] =
|
|
2356
|
+
const [isLoading, setIsLoading] = useState8(false);
|
|
2357
|
+
const [error, setError] = useState8(null);
|
|
2440
2358
|
const service = useMemo7(() => createFileReferenceService(supabase), [supabase]);
|
|
2441
2359
|
const uploadFile = useCallback5(async (options, file) => {
|
|
2442
2360
|
setIsLoading(true);
|
|
@@ -2600,10 +2518,10 @@ function useFileReferenceForRecord(supabase, table_name, record_id, organisation
|
|
|
2600
2518
|
getFileCount,
|
|
2601
2519
|
clearError
|
|
2602
2520
|
} = useFileReference(supabase);
|
|
2603
|
-
const [fileUrl, setFileUrl] =
|
|
2604
|
-
const [fileReference, setFileReference] =
|
|
2605
|
-
const [fileReferences, setFileReferences] =
|
|
2606
|
-
const [fileCount, setFileCount] =
|
|
2521
|
+
const [fileUrl, setFileUrl] = useState8(null);
|
|
2522
|
+
const [fileReference, setFileReference] = useState8(null);
|
|
2523
|
+
const [fileReferences, setFileReferences] = useState8([]);
|
|
2524
|
+
const [fileCount, setFileCount] = useState8(0);
|
|
2607
2525
|
const urlRefreshIntervalRef = useRef2(null);
|
|
2608
2526
|
const loadFileReference = useCallback5(async () => {
|
|
2609
2527
|
const reference = await getFileReference(table_name, record_id, organisation_id);
|
|
@@ -2675,8 +2593,8 @@ function useFileReferenceById(supabase, fileReferenceId, organisationId) {
|
|
|
2675
2593
|
getFileReferenceById,
|
|
2676
2594
|
clearError
|
|
2677
2595
|
} = useFileReference(supabase);
|
|
2678
|
-
const [fileReference, setFileReference] =
|
|
2679
|
-
const [fileUrl, setFileUrl] =
|
|
2596
|
+
const [fileReference, setFileReference] = useState8(null);
|
|
2597
|
+
const [fileUrl, setFileUrl] = useState8(null);
|
|
2680
2598
|
const loadFileReference = useCallback5(async () => {
|
|
2681
2599
|
if (!fileReferenceId || !organisationId) {
|
|
2682
2600
|
setFileReference(null);
|
|
@@ -2722,8 +2640,8 @@ function useFilesByCategory(supabase, table_name, record_id, category, organisat
|
|
|
2722
2640
|
getFilesByCategory,
|
|
2723
2641
|
clearError
|
|
2724
2642
|
} = useFileReference(supabase);
|
|
2725
|
-
const [fileReferences, setFileReferences] =
|
|
2726
|
-
const [fileUrls, setFileUrls] =
|
|
2643
|
+
const [fileReferences, setFileReferences] = useState8([]);
|
|
2644
|
+
const [fileUrls, setFileUrls] = useState8(/* @__PURE__ */ new Map());
|
|
2727
2645
|
const loadFiles = useCallback5(async () => {
|
|
2728
2646
|
if (!category || !organisation_id) {
|
|
2729
2647
|
setFileReferences([]);
|
|
@@ -2750,7 +2668,7 @@ function useFilesByCategory(supabase, table_name, record_id, category, organisat
|
|
|
2750
2668
|
urlMap.set(fileRef.id, url);
|
|
2751
2669
|
}
|
|
2752
2670
|
} catch (err) {
|
|
2753
|
-
|
|
2671
|
+
log.error(`Failed to load URL for file ${fileRef.id}:`, err);
|
|
2754
2672
|
}
|
|
2755
2673
|
}
|
|
2756
2674
|
setFileUrls(urlMap);
|
|
@@ -2770,49 +2688,8 @@ function useFilesByCategory(supabase, table_name, record_id, category, organisat
|
|
|
2770
2688
|
}
|
|
2771
2689
|
|
|
2772
2690
|
// src/components/FileUpload/FileUpload.tsx
|
|
2773
|
-
import { useState as
|
|
2774
|
-
|
|
2775
|
-
// src/utils/appIdResolver.ts
|
|
2776
|
-
async function getAppId(supabase, appName) {
|
|
2777
|
-
try {
|
|
2778
|
-
const { data, error } = await supabase.from("rbac_apps").select("id").ilike("name", appName).eq("is_active", true).single();
|
|
2779
|
-
if (error) {
|
|
2780
|
-
console.error("Failed to resolve app ID for app name:", appName, error);
|
|
2781
|
-
return null;
|
|
2782
|
-
}
|
|
2783
|
-
return data?.id || null;
|
|
2784
|
-
} catch (error) {
|
|
2785
|
-
console.error("Error resolving app ID for app name:", appName, error);
|
|
2786
|
-
return null;
|
|
2787
|
-
}
|
|
2788
|
-
}
|
|
2789
|
-
var CachedAppIdResolver = class {
|
|
2790
|
-
constructor() {
|
|
2791
|
-
this.cache = /* @__PURE__ */ new Map();
|
|
2792
|
-
this.ttl = 5 * 60 * 1e3;
|
|
2793
|
-
}
|
|
2794
|
-
// 5 minutes
|
|
2795
|
-
async getAppId(supabase, appName) {
|
|
2796
|
-
const now = Date.now();
|
|
2797
|
-
const cached = this.cache.get(appName);
|
|
2798
|
-
if (cached && cached.expires > now) {
|
|
2799
|
-
return cached.id;
|
|
2800
|
-
}
|
|
2801
|
-
const id = await getAppId(supabase, appName);
|
|
2802
|
-
this.cache.set(appName, { id, expires: now + this.ttl });
|
|
2803
|
-
return id;
|
|
2804
|
-
}
|
|
2805
|
-
clearCache() {
|
|
2806
|
-
this.cache.clear();
|
|
2807
|
-
}
|
|
2808
|
-
clearCacheForApp(appName) {
|
|
2809
|
-
this.cache.delete(appName);
|
|
2810
|
-
}
|
|
2811
|
-
};
|
|
2812
|
-
var cachedAppIdResolver = new CachedAppIdResolver();
|
|
2813
|
-
|
|
2814
|
-
// src/components/FileUpload/FileUpload.tsx
|
|
2815
|
-
import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2691
|
+
import { useState as useState9, useCallback as useCallback6, useRef as useRef3, useEffect as useEffect6, useMemo as useMemo8 } from "react";
|
|
2692
|
+
import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2816
2693
|
function FileUpload({
|
|
2817
2694
|
supabase,
|
|
2818
2695
|
table_name,
|
|
@@ -2834,11 +2711,11 @@ function FileUpload({
|
|
|
2834
2711
|
onProgress,
|
|
2835
2712
|
children
|
|
2836
2713
|
}) {
|
|
2837
|
-
const [isDragging, setIsDragging] =
|
|
2838
|
-
const [uploadStates, setUploadStates] =
|
|
2839
|
-
const [resolvedAppId, setResolvedAppId] =
|
|
2840
|
-
const [isResolvingAppId, setIsResolvingAppId] =
|
|
2841
|
-
const [appIdError, setAppIdError] =
|
|
2714
|
+
const [isDragging, setIsDragging] = useState9(false);
|
|
2715
|
+
const [uploadStates, setUploadStates] = useState9(/* @__PURE__ */ new Map());
|
|
2716
|
+
const [resolvedAppId, setResolvedAppId] = useState9(app_id || null);
|
|
2717
|
+
const [isResolvingAppId, setIsResolvingAppId] = useState9(!app_id);
|
|
2718
|
+
const [appIdError, setAppIdError] = useState9(null);
|
|
2842
2719
|
const fileInputRef = useRef3(null);
|
|
2843
2720
|
const { uploadFile, isLoading, error } = useFileReference(supabase);
|
|
2844
2721
|
useEffect6(() => {
|
|
@@ -3134,8 +3011,8 @@ function FileUpload({
|
|
|
3134
3011
|
};
|
|
3135
3012
|
const dragClasses = isDragging ? "border-main-500 bg-main-50" : "border-sec-300 hover:border-sec-400";
|
|
3136
3013
|
const disabledClasses = isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer hover:bg-sec-50";
|
|
3137
|
-
return /* @__PURE__ */
|
|
3138
|
-
/* @__PURE__ */
|
|
3014
|
+
return /* @__PURE__ */ jsxs16("div", { className: `space-y-4 ${className}`, children: [
|
|
3015
|
+
/* @__PURE__ */ jsxs16(
|
|
3139
3016
|
"div",
|
|
3140
3017
|
{
|
|
3141
3018
|
className: `relative border-2 border-dashed rounded-lg p-6 text-center transition-colors ${dragClasses} ${disabledClasses}`,
|
|
@@ -3144,8 +3021,8 @@ function FileUpload({
|
|
|
3144
3021
|
onDrop: handleDrop,
|
|
3145
3022
|
onClick: !isDisabled ? handleClick : void 0,
|
|
3146
3023
|
children: [
|
|
3147
|
-
children || /* @__PURE__ */
|
|
3148
|
-
/* @__PURE__ */
|
|
3024
|
+
children || /* @__PURE__ */ jsxs16("div", { className: "space-y-2", children: [
|
|
3025
|
+
/* @__PURE__ */ jsx19(
|
|
3149
3026
|
"input",
|
|
3150
3027
|
{
|
|
3151
3028
|
ref: fileInputRef,
|
|
@@ -3158,55 +3035,55 @@ function FileUpload({
|
|
|
3158
3035
|
"data-testid": "file-input"
|
|
3159
3036
|
}
|
|
3160
3037
|
),
|
|
3161
|
-
/* @__PURE__ */
|
|
3162
|
-
/* @__PURE__ */
|
|
3038
|
+
/* @__PURE__ */ jsx19("div", { className: "text-sec-600", children: isResolvingAppId ? "Resolving app configuration..." : isDragging ? "Drop files here..." : /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
3039
|
+
/* @__PURE__ */ jsx19("span", { className: "font-medium", children: "Click to upload" }),
|
|
3163
3040
|
" ",
|
|
3164
3041
|
"or drag and drop"
|
|
3165
3042
|
] }) }),
|
|
3166
|
-
/* @__PURE__ */
|
|
3043
|
+
/* @__PURE__ */ jsxs16("div", { className: "text-sm text-sec-500", children: [
|
|
3167
3044
|
!isResolvingAppId && accept !== "*/*" && `Accepted formats: ${accept}`,
|
|
3168
3045
|
!isResolvingAppId && maxSize && ` \u2022 Max size: ${Math.round(maxSize / 1024 / 1024)}MB`,
|
|
3169
3046
|
!isResolvingAppId && multiple && " \u2022 Multiple files allowed"
|
|
3170
3047
|
] })
|
|
3171
3048
|
] }),
|
|
3172
|
-
isUploading && !showProgress && /* @__PURE__ */
|
|
3049
|
+
isUploading && !showProgress && /* @__PURE__ */ jsx19("div", { className: "absolute inset-0 bg-white bg-opacity-75 flex items-center justify-center", children: /* @__PURE__ */ jsx19("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-main-500" }) })
|
|
3173
3050
|
]
|
|
3174
3051
|
}
|
|
3175
3052
|
),
|
|
3176
|
-
showProgress && uploadStates.size > 0 && /* @__PURE__ */
|
|
3053
|
+
showProgress && uploadStates.size > 0 && /* @__PURE__ */ jsx19("div", { className: "space-y-2", children: Array.from(uploadStates.entries()).map(([fileId, uploadState]) => {
|
|
3177
3054
|
const { file, progress, preview, result } = uploadState;
|
|
3178
3055
|
const isError = progress.status === "error";
|
|
3179
3056
|
const isCompleted = progress.status === "completed";
|
|
3180
3057
|
const isUploading2 = progress.status === "uploading" || progress.status === "processing";
|
|
3181
|
-
return /* @__PURE__ */
|
|
3058
|
+
return /* @__PURE__ */ jsxs16(
|
|
3182
3059
|
"div",
|
|
3183
3060
|
{
|
|
3184
3061
|
className: `flex items-center space-x-3 p-3 rounded-lg border ${isError ? "bg-acc-50 border-acc-200" : isCompleted ? "bg-success-50 border-success-200" : "bg-sec-50 border-sec-200"}`,
|
|
3185
3062
|
children: [
|
|
3186
|
-
/* @__PURE__ */
|
|
3063
|
+
/* @__PURE__ */ jsx19("div", { className: "flex-shrink-0", children: preview ? /* @__PURE__ */ jsx19(
|
|
3187
3064
|
"img",
|
|
3188
3065
|
{
|
|
3189
3066
|
src: preview,
|
|
3190
3067
|
alt: file.name,
|
|
3191
3068
|
className: "w-12 h-12 object-cover rounded"
|
|
3192
3069
|
}
|
|
3193
|
-
) : /* @__PURE__ */
|
|
3194
|
-
/* @__PURE__ */
|
|
3195
|
-
/* @__PURE__ */
|
|
3196
|
-
/* @__PURE__ */
|
|
3070
|
+
) : /* @__PURE__ */ jsx19("div", { className: "w-12 h-12 flex items-center justify-center bg-sec-200 rounded", children: /* @__PURE__ */ jsx19("span", { className: "text-2xl", children: "\u{1F4C4}" }) }) }),
|
|
3071
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 min-w-0", children: [
|
|
3072
|
+
/* @__PURE__ */ jsx19("div", { className: "font-medium text-sec-900 truncate", children: file.name }),
|
|
3073
|
+
/* @__PURE__ */ jsxs16("div", { className: "text-sm text-sec-500", children: [
|
|
3197
3074
|
formatFileSize(file.size),
|
|
3198
3075
|
isCompleted && result && " \u2022 Uploaded",
|
|
3199
3076
|
isError && progress.error && ` \u2022 ${progress.error}`
|
|
3200
3077
|
] }),
|
|
3201
|
-
showProgress && (isUploading2 || isError) && /* @__PURE__ */
|
|
3202
|
-
/* @__PURE__ */
|
|
3078
|
+
showProgress && (isUploading2 || isError) && /* @__PURE__ */ jsxs16("div", { className: "mt-2", children: [
|
|
3079
|
+
/* @__PURE__ */ jsx19("div", { className: "w-full bg-sec-200 rounded-full h-2", children: /* @__PURE__ */ jsx19(
|
|
3203
3080
|
"div",
|
|
3204
3081
|
{
|
|
3205
3082
|
className: `h-2 rounded-full transition-all duration-300 ${isError ? "bg-acc-500" : "bg-main-500"}`,
|
|
3206
3083
|
style: { width: `${progress.percentage}%` }
|
|
3207
3084
|
}
|
|
3208
3085
|
) }),
|
|
3209
|
-
isUploading2 && /* @__PURE__ */
|
|
3086
|
+
isUploading2 && /* @__PURE__ */ jsxs16("div", { className: "text-xs text-sec-500 mt-1", children: [
|
|
3210
3087
|
progress.percentage,
|
|
3211
3088
|
"% \u2022 ",
|
|
3212
3089
|
formatFileSize(progress.loaded),
|
|
@@ -3215,31 +3092,33 @@ function FileUpload({
|
|
|
3215
3092
|
] })
|
|
3216
3093
|
] })
|
|
3217
3094
|
] }),
|
|
3218
|
-
/* @__PURE__ */
|
|
3219
|
-
isCompleted && /* @__PURE__ */
|
|
3220
|
-
isError && /* @__PURE__ */
|
|
3221
|
-
isUploading2 && /* @__PURE__ */
|
|
3095
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-shrink-0", children: [
|
|
3096
|
+
isCompleted && /* @__PURE__ */ jsx19("span", { className: "text-success-500 text-xl", children: "\u2713" }),
|
|
3097
|
+
isError && /* @__PURE__ */ jsx19("span", { className: "text-acc-500 text-xl", children: "\u2715" }),
|
|
3098
|
+
isUploading2 && /* @__PURE__ */ jsx19("div", { className: "animate-spin rounded-full h-5 w-5 border-b-2 border-main-500" })
|
|
3222
3099
|
] })
|
|
3223
3100
|
]
|
|
3224
3101
|
},
|
|
3225
3102
|
fileId
|
|
3226
3103
|
);
|
|
3227
3104
|
}) }),
|
|
3228
|
-
appIdError && /* @__PURE__ */
|
|
3229
|
-
error && /* @__PURE__ */
|
|
3105
|
+
appIdError && /* @__PURE__ */ jsx19("div", { className: "p-3 bg-acc-50 border border-acc-200 rounded-lg text-sm text-acc-600", children: appIdError }),
|
|
3106
|
+
error && /* @__PURE__ */ jsx19("div", { className: "p-3 bg-acc-50 border border-acc-200 rounded-lg text-sm text-acc-600", children: error })
|
|
3230
3107
|
] });
|
|
3231
3108
|
}
|
|
3232
3109
|
|
|
3233
3110
|
// src/components/FileDisplay/FileDisplay.tsx
|
|
3234
|
-
import { useState as
|
|
3111
|
+
import { useState as useState11, useEffect as useEffect8, useRef as useRef5, useContext as useContext2, useMemo as useMemo9 } from "react";
|
|
3235
3112
|
|
|
3236
3113
|
// src/hooks/useFileUrl.ts
|
|
3237
|
-
import { useState as
|
|
3114
|
+
import { useState as useState10, useEffect as useEffect7, useCallback as useCallback7, useRef as useRef4 } from "react";
|
|
3115
|
+
init_logger();
|
|
3116
|
+
var log2 = createLogger("useFileUrl");
|
|
3238
3117
|
function useFileUrl(fileReference, options) {
|
|
3239
3118
|
const { organisation_id, supabase, autoLoad = true } = options;
|
|
3240
|
-
const [url, setUrl] =
|
|
3241
|
-
const [isLoading, setIsLoading] =
|
|
3242
|
-
const [error, setError] =
|
|
3119
|
+
const [url, setUrl] = useState10(null);
|
|
3120
|
+
const [isLoading, setIsLoading] = useState10(false);
|
|
3121
|
+
const [error, setError] = useState10(null);
|
|
3243
3122
|
const fileReferenceIdRef = useRef4(null);
|
|
3244
3123
|
const loadUrl = useCallback7(async () => {
|
|
3245
3124
|
if (!fileReference) {
|
|
@@ -3272,7 +3151,7 @@ function useFileUrl(fileReference, options) {
|
|
|
3272
3151
|
const error2 = err instanceof Error ? err : new Error("Failed to generate file URL");
|
|
3273
3152
|
setError(error2);
|
|
3274
3153
|
setUrl(null);
|
|
3275
|
-
|
|
3154
|
+
log2.error("Error generating URL:", error2);
|
|
3276
3155
|
} finally {
|
|
3277
3156
|
setIsLoading(false);
|
|
3278
3157
|
}
|
|
@@ -3305,7 +3184,8 @@ function useFileUrl(fileReference, options) {
|
|
|
3305
3184
|
|
|
3306
3185
|
// src/components/FileDisplay/FileDisplay.tsx
|
|
3307
3186
|
init_UnifiedAuthProvider();
|
|
3308
|
-
|
|
3187
|
+
init_logger();
|
|
3188
|
+
import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3309
3189
|
var fallbackSizeClasses = {
|
|
3310
3190
|
xs: "h-4 w-4 text-xs",
|
|
3311
3191
|
sm: "h-6 w-6 text-sm",
|
|
@@ -3344,9 +3224,9 @@ function FileDisplayContent({
|
|
|
3344
3224
|
fallbackText,
|
|
3345
3225
|
fallbackSize = "md"
|
|
3346
3226
|
}) {
|
|
3347
|
-
const [imageError, setImageError] =
|
|
3348
|
-
const [internalFileUrls, setInternalFileUrls] =
|
|
3349
|
-
const [deleteDialogOpen, setDeleteDialogOpen] =
|
|
3227
|
+
const [imageError, setImageError] = useState11(false);
|
|
3228
|
+
const [internalFileUrls, setInternalFileUrls] = useState11(new Map(fileUrls));
|
|
3229
|
+
const [deleteDialogOpen, setDeleteDialogOpen] = useState11(false);
|
|
3350
3230
|
const fileReferencesRef = useRef5([]);
|
|
3351
3231
|
const computedFallbackText = useMemo9(() => {
|
|
3352
3232
|
if (fallbackText) return fallbackText;
|
|
@@ -3412,17 +3292,17 @@ function FileDisplayContent({
|
|
|
3412
3292
|
};
|
|
3413
3293
|
if (error) {
|
|
3414
3294
|
if (ErrorComponent) {
|
|
3415
|
-
return /* @__PURE__ */
|
|
3295
|
+
return /* @__PURE__ */ jsx20(ErrorComponent, { error, retry: clearError });
|
|
3416
3296
|
}
|
|
3417
3297
|
if (showFallback) {
|
|
3418
|
-
return /* @__PURE__ */
|
|
3298
|
+
return /* @__PURE__ */ jsx20("div", { className: fallbackClasses, title: "File unavailable", children: computedFallbackText });
|
|
3419
3299
|
}
|
|
3420
|
-
return /* @__PURE__ */
|
|
3421
|
-
/* @__PURE__ */
|
|
3300
|
+
return /* @__PURE__ */ jsxs17("div", { className: `p-4 bg-acc-50 border border-acc-200 rounded-lg ${className}`, children: [
|
|
3301
|
+
/* @__PURE__ */ jsxs17("div", { className: "text-acc-600", children: [
|
|
3422
3302
|
"Error loading file: ",
|
|
3423
3303
|
error instanceof Error ? error.message : String(error)
|
|
3424
3304
|
] }),
|
|
3425
|
-
clearError && /* @__PURE__ */
|
|
3305
|
+
clearError && /* @__PURE__ */ jsx20(
|
|
3426
3306
|
"button",
|
|
3427
3307
|
{
|
|
3428
3308
|
onClick: clearError,
|
|
@@ -3434,38 +3314,38 @@ function FileDisplayContent({
|
|
|
3434
3314
|
}
|
|
3435
3315
|
if (fileCount === 0 && !isLoading) {
|
|
3436
3316
|
if (showFallback) {
|
|
3437
|
-
return /* @__PURE__ */
|
|
3317
|
+
return /* @__PURE__ */ jsxs17("div", { className: fallbackClasses, title: "No file", children: [
|
|
3438
3318
|
computedFallbackText,
|
|
3439
3319
|
children
|
|
3440
3320
|
] });
|
|
3441
3321
|
}
|
|
3442
|
-
return /* @__PURE__ */
|
|
3322
|
+
return /* @__PURE__ */ jsxs17("div", { className: `text-sec-500 text-center p-4 ${className}`, children: [
|
|
3443
3323
|
"No files found",
|
|
3444
3324
|
children
|
|
3445
3325
|
] });
|
|
3446
3326
|
}
|
|
3447
3327
|
if (isLoading && showFallback && fileCount === 0) {
|
|
3448
|
-
return /* @__PURE__ */
|
|
3328
|
+
return /* @__PURE__ */ jsxs17("div", { className: fallbackClasses, title: "Loading...", children: [
|
|
3449
3329
|
computedFallbackText,
|
|
3450
3330
|
children
|
|
3451
3331
|
] });
|
|
3452
3332
|
}
|
|
3453
3333
|
if (isLoading) {
|
|
3454
3334
|
if (LoadingComponent) {
|
|
3455
|
-
return /* @__PURE__ */
|
|
3335
|
+
return /* @__PURE__ */ jsx20(LoadingComponent, {});
|
|
3456
3336
|
}
|
|
3457
|
-
return /* @__PURE__ */
|
|
3337
|
+
return /* @__PURE__ */ jsx20("div", { className: `flex items-center justify-center p-4 ${className}`, children: /* @__PURE__ */ jsx20("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-main-500" }) });
|
|
3458
3338
|
}
|
|
3459
3339
|
if ((category || displayOnly) && fileReference) {
|
|
3460
3340
|
const isImage = fileReference.file_metadata.fileType?.startsWith("image/");
|
|
3461
3341
|
if (displayOnly && isImage && !showDelete) {
|
|
3462
3342
|
if (imageError && showFallback) {
|
|
3463
|
-
return /* @__PURE__ */
|
|
3343
|
+
return /* @__PURE__ */ jsx20("div", { className: fallbackClasses, title: fileReference.file_metadata.fileName || "File", children: computedFallbackText });
|
|
3464
3344
|
}
|
|
3465
3345
|
if (!fileUrl) {
|
|
3466
|
-
return /* @__PURE__ */
|
|
3346
|
+
return /* @__PURE__ */ jsx20("div", { className: `bg-sec-100 rounded animate-pulse ${className || "max-w-full h-48"}`, children: /* @__PURE__ */ jsx20("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx20("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-main-500" }) }) });
|
|
3467
3347
|
}
|
|
3468
|
-
return /* @__PURE__ */
|
|
3348
|
+
return /* @__PURE__ */ jsx20(
|
|
3469
3349
|
"img",
|
|
3470
3350
|
{
|
|
3471
3351
|
src: fileUrl,
|
|
@@ -3476,11 +3356,11 @@ function FileDisplayContent({
|
|
|
3476
3356
|
);
|
|
3477
3357
|
}
|
|
3478
3358
|
if (displayOnly && showFallback && (!fileUrl || imageError || !isImage)) {
|
|
3479
|
-
return /* @__PURE__ */
|
|
3359
|
+
return /* @__PURE__ */ jsx20("div", { className: fallbackClasses, title: fileReference.file_metadata.fileName || "File", children: computedFallbackText });
|
|
3480
3360
|
}
|
|
3481
|
-
return /* @__PURE__ */
|
|
3482
|
-
isImage && fileUrl && !imageError ? /* @__PURE__ */
|
|
3483
|
-
/* @__PURE__ */
|
|
3361
|
+
return /* @__PURE__ */ jsxs17("div", { className: `space-y-2 ${className}`, children: [
|
|
3362
|
+
isImage && fileUrl && !imageError ? /* @__PURE__ */ jsxs17("div", { className: "relative", children: [
|
|
3363
|
+
/* @__PURE__ */ jsx20(
|
|
3484
3364
|
"img",
|
|
3485
3365
|
{
|
|
3486
3366
|
src: fileUrl,
|
|
@@ -3489,8 +3369,8 @@ function FileDisplayContent({
|
|
|
3489
3369
|
onError: handleImageError
|
|
3490
3370
|
}
|
|
3491
3371
|
),
|
|
3492
|
-
showDelete && /* @__PURE__ */
|
|
3493
|
-
/* @__PURE__ */
|
|
3372
|
+
showDelete && /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
3373
|
+
/* @__PURE__ */ jsx20(
|
|
3494
3374
|
"button",
|
|
3495
3375
|
{
|
|
3496
3376
|
onClick: handleDeleteClick,
|
|
@@ -3500,29 +3380,29 @@ function FileDisplayContent({
|
|
|
3500
3380
|
children: "\xD7"
|
|
3501
3381
|
}
|
|
3502
3382
|
),
|
|
3503
|
-
/* @__PURE__ */
|
|
3504
|
-
/* @__PURE__ */
|
|
3505
|
-
/* @__PURE__ */
|
|
3506
|
-
/* @__PURE__ */
|
|
3507
|
-
/* @__PURE__ */
|
|
3508
|
-
/* @__PURE__ */
|
|
3383
|
+
/* @__PURE__ */ jsx20(Dialog, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */ jsxs17(DialogContent, { size: "sm", children: [
|
|
3384
|
+
/* @__PURE__ */ jsx20(DialogHeader, { children: /* @__PURE__ */ jsx20(DialogTitle, { children: "Confirm Delete" }) }),
|
|
3385
|
+
/* @__PURE__ */ jsx20(DialogBody, { children: /* @__PURE__ */ jsx20("p", { children: "Are you sure you want to delete this file? This action cannot be undone." }) }),
|
|
3386
|
+
/* @__PURE__ */ jsxs17(DialogFooter, { children: [
|
|
3387
|
+
/* @__PURE__ */ jsx20(Button, { variant: "outline", onClick: () => setDeleteDialogOpen(false), children: "Cancel" }),
|
|
3388
|
+
/* @__PURE__ */ jsx20(Button, { variant: "destructive", onClick: handleDeleteConfirm, children: "Delete" })
|
|
3509
3389
|
] })
|
|
3510
3390
|
] }) })
|
|
3511
3391
|
] })
|
|
3512
3392
|
] }) : isImage && imageError && showFallback ? (
|
|
3513
3393
|
// Show fallback when image fails to load and fallback is enabled
|
|
3514
|
-
/* @__PURE__ */
|
|
3515
|
-
) : /* @__PURE__ */
|
|
3516
|
-
/* @__PURE__ */
|
|
3517
|
-
/* @__PURE__ */
|
|
3518
|
-
/* @__PURE__ */
|
|
3519
|
-
/* @__PURE__ */
|
|
3394
|
+
/* @__PURE__ */ jsx20("div", { className: fallbackClasses, title: fileReference.file_metadata.fileName || "File", children: computedFallbackText })
|
|
3395
|
+
) : /* @__PURE__ */ jsxs17("div", { className: "flex items-center space-x-3 p-3 bg-sec-50 rounded-lg border border-sec-200", children: [
|
|
3396
|
+
/* @__PURE__ */ jsx20("span", { className: "text-2xl", children: getFileIcon(fileReference.file_metadata.fileType || "") }),
|
|
3397
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1 min-w-0", children: [
|
|
3398
|
+
/* @__PURE__ */ jsx20("div", { className: "font-medium text-sec-900 truncate", children: fileReference.file_metadata.fileName || "Unknown file" }),
|
|
3399
|
+
/* @__PURE__ */ jsxs17("div", { className: "text-sm text-sec-500", children: [
|
|
3520
3400
|
fileReference.file_metadata.fileSize && formatFileSize(fileReference.file_metadata.fileSize),
|
|
3521
3401
|
fileReference.file_metadata.fileType && ` \u2022 ${fileReference.file_metadata.fileType}`
|
|
3522
3402
|
] })
|
|
3523
3403
|
] }),
|
|
3524
|
-
showDelete && /* @__PURE__ */
|
|
3525
|
-
/* @__PURE__ */
|
|
3404
|
+
showDelete && /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
3405
|
+
/* @__PURE__ */ jsx20(
|
|
3526
3406
|
"button",
|
|
3527
3407
|
{
|
|
3528
3408
|
onClick: handleDeleteClick,
|
|
@@ -3532,12 +3412,12 @@ function FileDisplayContent({
|
|
|
3532
3412
|
children: "\xD7"
|
|
3533
3413
|
}
|
|
3534
3414
|
),
|
|
3535
|
-
/* @__PURE__ */
|
|
3536
|
-
/* @__PURE__ */
|
|
3537
|
-
/* @__PURE__ */
|
|
3538
|
-
/* @__PURE__ */
|
|
3539
|
-
/* @__PURE__ */
|
|
3540
|
-
/* @__PURE__ */
|
|
3415
|
+
/* @__PURE__ */ jsx20(Dialog, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */ jsxs17(DialogContent, { size: "sm", children: [
|
|
3416
|
+
/* @__PURE__ */ jsx20(DialogHeader, { children: /* @__PURE__ */ jsx20(DialogTitle, { children: "Confirm Delete" }) }),
|
|
3417
|
+
/* @__PURE__ */ jsx20(DialogBody, { children: /* @__PURE__ */ jsx20("p", { children: "Are you sure you want to delete this file? This action cannot be undone." }) }),
|
|
3418
|
+
/* @__PURE__ */ jsxs17(DialogFooter, { children: [
|
|
3419
|
+
/* @__PURE__ */ jsx20(Button, { variant: "outline", onClick: () => setDeleteDialogOpen(false), children: "Cancel" }),
|
|
3420
|
+
/* @__PURE__ */ jsx20(Button, { variant: "destructive", onClick: handleDeleteConfirm, children: "Delete" })
|
|
3541
3421
|
] })
|
|
3542
3422
|
] }) })
|
|
3543
3423
|
] })
|
|
@@ -3545,13 +3425,13 @@ function FileDisplayContent({
|
|
|
3545
3425
|
children
|
|
3546
3426
|
] });
|
|
3547
3427
|
}
|
|
3548
|
-
return /* @__PURE__ */
|
|
3428
|
+
return /* @__PURE__ */ jsxs17("div", { className: `space-y-2 ${className}`, children: [
|
|
3549
3429
|
fileReferences.map((fileRef) => {
|
|
3550
3430
|
const isImage = fileRef.file_metadata.fileType?.startsWith("image/");
|
|
3551
3431
|
const fileUrl2 = internalFileUrls.get(fileRef.id) || null;
|
|
3552
3432
|
const canDownload = !isImage && fileUrl2;
|
|
3553
|
-
return /* @__PURE__ */
|
|
3554
|
-
isImage && fileUrl2 ? /* @__PURE__ */
|
|
3433
|
+
return /* @__PURE__ */ jsxs17("div", { className: "flex items-center space-x-3 p-3 bg-sec-50 rounded-lg border border-sec-200", children: [
|
|
3434
|
+
isImage && fileUrl2 ? /* @__PURE__ */ jsx20(
|
|
3555
3435
|
"img",
|
|
3556
3436
|
{
|
|
3557
3437
|
src: fileUrl2,
|
|
@@ -3559,17 +3439,17 @@ function FileDisplayContent({
|
|
|
3559
3439
|
className: "w-12 h-12 object-cover rounded",
|
|
3560
3440
|
onError: handleImageError
|
|
3561
3441
|
}
|
|
3562
|
-
) : /* @__PURE__ */
|
|
3563
|
-
/* @__PURE__ */
|
|
3564
|
-
/* @__PURE__ */
|
|
3565
|
-
/* @__PURE__ */
|
|
3442
|
+
) : /* @__PURE__ */ jsx20("span", { className: "text-2xl", children: getFileIcon(fileRef.file_metadata.fileType || "") }),
|
|
3443
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1 min-w-0", children: [
|
|
3444
|
+
/* @__PURE__ */ jsx20("div", { className: "font-medium text-sec-900 truncate", children: fileRef.file_metadata.fileName || "Unknown file" }),
|
|
3445
|
+
/* @__PURE__ */ jsxs17("div", { className: "text-sm text-sec-500", children: [
|
|
3566
3446
|
fileRef.file_metadata.fileSize && formatFileSize(fileRef.file_metadata.fileSize),
|
|
3567
3447
|
fileRef.file_metadata.fileType && ` \u2022 ${fileRef.file_metadata.fileType}`,
|
|
3568
3448
|
fileRef.file_metadata.category && ` \u2022 ${fileRef.file_metadata.category}`
|
|
3569
3449
|
] })
|
|
3570
3450
|
] }),
|
|
3571
|
-
/* @__PURE__ */
|
|
3572
|
-
canDownload && /* @__PURE__ */
|
|
3451
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center space-x-2", children: [
|
|
3452
|
+
canDownload && /* @__PURE__ */ jsx20(
|
|
3573
3453
|
"a",
|
|
3574
3454
|
{
|
|
3575
3455
|
href: fileRef.file_path,
|
|
@@ -3579,7 +3459,7 @@ function FileDisplayContent({
|
|
|
3579
3459
|
children: "\u2193"
|
|
3580
3460
|
}
|
|
3581
3461
|
),
|
|
3582
|
-
showDelete && onDelete && /* @__PURE__ */
|
|
3462
|
+
showDelete && onDelete && /* @__PURE__ */ jsx20(
|
|
3583
3463
|
"button",
|
|
3584
3464
|
{
|
|
3585
3465
|
onClick: handleDeleteClick,
|
|
@@ -3613,22 +3493,9 @@ function FileDisplayPublic({
|
|
|
3613
3493
|
}) {
|
|
3614
3494
|
const publicPageContext = useContext2(PublicPageContext);
|
|
3615
3495
|
const supabase = publicPageContext?.supabase ?? null;
|
|
3616
|
-
console.log("[FileDisplayPublic] Supabase Client Context:", {
|
|
3617
|
-
hasPublicPageContext: !!publicPageContext,
|
|
3618
|
-
hasSupabaseClient: !!supabase,
|
|
3619
|
-
supabaseUrl: publicPageContext?.environment?.supabaseUrl || "not available",
|
|
3620
|
-
hasAnonKey: !!publicPageContext?.environment?.supabaseKey,
|
|
3621
|
-
hasAuth: !!supabase?.auth,
|
|
3622
|
-
organisation_id,
|
|
3623
|
-
table_name,
|
|
3624
|
-
record_id,
|
|
3625
|
-
category,
|
|
3626
|
-
context: "public_page_anonymous_user",
|
|
3627
|
-
note: "Public pages use anonymous Supabase client (no user session)"
|
|
3628
|
-
});
|
|
3629
3496
|
if (!supabase) {
|
|
3630
3497
|
if (showFallback) {
|
|
3631
|
-
return /* @__PURE__ */
|
|
3498
|
+
return /* @__PURE__ */ jsx20(
|
|
3632
3499
|
FileDisplayContent,
|
|
3633
3500
|
{
|
|
3634
3501
|
isLoading: false,
|
|
@@ -3654,7 +3521,7 @@ function FileDisplayPublic({
|
|
|
3654
3521
|
}
|
|
3655
3522
|
);
|
|
3656
3523
|
}
|
|
3657
|
-
return /* @__PURE__ */
|
|
3524
|
+
return /* @__PURE__ */ jsx20("div", { className: `text-sec-500 text-center p-4 ${className}`, children: "Supabase client not available in public context" });
|
|
3658
3525
|
}
|
|
3659
3526
|
const {
|
|
3660
3527
|
fileUrl,
|
|
@@ -3673,7 +3540,7 @@ function FileDisplayPublic({
|
|
|
3673
3540
|
{ supabase }
|
|
3674
3541
|
);
|
|
3675
3542
|
if (error) {
|
|
3676
|
-
|
|
3543
|
+
logger.error("FileDisplayPublic", "Error fetching file", {
|
|
3677
3544
|
table_name,
|
|
3678
3545
|
record_id,
|
|
3679
3546
|
organisation_id,
|
|
@@ -3682,23 +3549,6 @@ function FileDisplayPublic({
|
|
|
3682
3549
|
errorStack: error.stack
|
|
3683
3550
|
});
|
|
3684
3551
|
}
|
|
3685
|
-
if (fileUrl && !isLoading && !error) {
|
|
3686
|
-
console.log("[FileDisplayPublic] File loaded successfully:", {
|
|
3687
|
-
table_name,
|
|
3688
|
-
record_id,
|
|
3689
|
-
category,
|
|
3690
|
-
fileUrl: fileUrl.substring(0, 50) + "..."
|
|
3691
|
-
// Truncate URL for logging
|
|
3692
|
-
});
|
|
3693
|
-
}
|
|
3694
|
-
if (!isLoading && !error && !fileUrl && !fileReference) {
|
|
3695
|
-
console.log("[FileDisplayPublic] No file found (will show fallback if enabled):", {
|
|
3696
|
-
table_name,
|
|
3697
|
-
record_id,
|
|
3698
|
-
category,
|
|
3699
|
-
showFallback
|
|
3700
|
-
});
|
|
3701
|
-
}
|
|
3702
3552
|
const handleDelete = async () => {
|
|
3703
3553
|
};
|
|
3704
3554
|
let finalFileReference = fileReference;
|
|
@@ -3715,7 +3565,7 @@ function FileDisplayPublic({
|
|
|
3715
3565
|
finalFileCount = 1;
|
|
3716
3566
|
finalFileUrl = fileUrls.get(targetFile.id) || null;
|
|
3717
3567
|
}
|
|
3718
|
-
return /* @__PURE__ */
|
|
3568
|
+
return /* @__PURE__ */ jsx20(
|
|
3719
3569
|
FileDisplayContent,
|
|
3720
3570
|
{
|
|
3721
3571
|
isLoading,
|
|
@@ -3759,7 +3609,7 @@ function FileDisplayAuthenticated({
|
|
|
3759
3609
|
}) {
|
|
3760
3610
|
const { supabase } = useUnifiedAuth();
|
|
3761
3611
|
if (!supabase) {
|
|
3762
|
-
return /* @__PURE__ */
|
|
3612
|
+
return /* @__PURE__ */ jsx20("div", { className: `text-sec-500 text-center p-4 ${className}`, children: "Supabase client not available in authenticated context" });
|
|
3763
3613
|
}
|
|
3764
3614
|
const {
|
|
3765
3615
|
fileUrl,
|
|
@@ -3777,7 +3627,7 @@ function FileDisplayAuthenticated({
|
|
|
3777
3627
|
category,
|
|
3778
3628
|
{ supabase }
|
|
3779
3629
|
);
|
|
3780
|
-
const [displayOnlyFileReference, setDisplayOnlyFileReference] =
|
|
3630
|
+
const [displayOnlyFileReference, setDisplayOnlyFileReference] = useState11(null);
|
|
3781
3631
|
const displayOnlyFileUrlFromMap = displayOnlyFileReference ? fileUrls.get(displayOnlyFileReference.id) : null;
|
|
3782
3632
|
const displayOnlyFileUrlHook = useFileUrl(
|
|
3783
3633
|
displayOnlyFileReference && !displayOnlyFileUrlFromMap ? displayOnlyFileReference : null,
|
|
@@ -3817,7 +3667,7 @@ function FileDisplayAuthenticated({
|
|
|
3817
3667
|
finalError = error || displayOnlyFileUrlHook.error;
|
|
3818
3668
|
}
|
|
3819
3669
|
}
|
|
3820
|
-
return /* @__PURE__ */
|
|
3670
|
+
return /* @__PURE__ */ jsx20(
|
|
3821
3671
|
FileDisplayContent,
|
|
3822
3672
|
{
|
|
3823
3673
|
isLoading: finalIsLoading,
|
|
@@ -3862,7 +3712,7 @@ function FileDisplay({
|
|
|
3862
3712
|
}) {
|
|
3863
3713
|
const isPublicPage = useIsPublicPage();
|
|
3864
3714
|
if (isPublicPage) {
|
|
3865
|
-
return /* @__PURE__ */
|
|
3715
|
+
return /* @__PURE__ */ jsx20(
|
|
3866
3716
|
FileDisplayPublic,
|
|
3867
3717
|
{
|
|
3868
3718
|
table_name,
|
|
@@ -3882,7 +3732,7 @@ function FileDisplay({
|
|
|
3882
3732
|
}
|
|
3883
3733
|
);
|
|
3884
3734
|
}
|
|
3885
|
-
return /* @__PURE__ */
|
|
3735
|
+
return /* @__PURE__ */ jsx20(
|
|
3886
3736
|
FileDisplayAuthenticated,
|
|
3887
3737
|
{
|
|
3888
3738
|
table_name,
|
|
@@ -3904,9 +3754,9 @@ function FileDisplay({
|
|
|
3904
3754
|
}
|
|
3905
3755
|
|
|
3906
3756
|
// src/components/Table/Table.tsx
|
|
3907
|
-
import * as
|
|
3908
|
-
import { jsx as
|
|
3909
|
-
var Table =
|
|
3757
|
+
import * as React17 from "react";
|
|
3758
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3759
|
+
var Table = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
3910
3760
|
"table",
|
|
3911
3761
|
{
|
|
3912
3762
|
ref,
|
|
@@ -3915,9 +3765,9 @@ var Table = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
3915
3765
|
}
|
|
3916
3766
|
));
|
|
3917
3767
|
Table.displayName = "Table";
|
|
3918
|
-
var TableHeader =
|
|
3768
|
+
var TableHeader = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
3919
3769
|
TableHeader.displayName = "TableHeader";
|
|
3920
|
-
var TableBody =
|
|
3770
|
+
var TableBody = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
3921
3771
|
"tbody",
|
|
3922
3772
|
{
|
|
3923
3773
|
ref,
|
|
@@ -3926,7 +3776,7 @@ var TableBody = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
3926
3776
|
}
|
|
3927
3777
|
));
|
|
3928
3778
|
TableBody.displayName = "TableBody";
|
|
3929
|
-
var TableFooter =
|
|
3779
|
+
var TableFooter = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
3930
3780
|
"tfoot",
|
|
3931
3781
|
{
|
|
3932
3782
|
ref,
|
|
@@ -3938,7 +3788,7 @@ var TableFooter = React18.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
3938
3788
|
}
|
|
3939
3789
|
));
|
|
3940
3790
|
TableFooter.displayName = "TableFooter";
|
|
3941
|
-
var TableRow =
|
|
3791
|
+
var TableRow = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
3942
3792
|
"tr",
|
|
3943
3793
|
{
|
|
3944
3794
|
ref,
|
|
@@ -3950,7 +3800,7 @@ var TableRow = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
3950
3800
|
}
|
|
3951
3801
|
));
|
|
3952
3802
|
TableRow.displayName = "TableRow";
|
|
3953
|
-
var TableHead =
|
|
3803
|
+
var TableHead = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
3954
3804
|
"th",
|
|
3955
3805
|
{
|
|
3956
3806
|
ref,
|
|
@@ -3962,7 +3812,7 @@ var TableHead = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
3962
3812
|
}
|
|
3963
3813
|
));
|
|
3964
3814
|
TableHead.displayName = "TableHead";
|
|
3965
|
-
var TableCell =
|
|
3815
|
+
var TableCell = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
3966
3816
|
"td",
|
|
3967
3817
|
{
|
|
3968
3818
|
ref,
|
|
@@ -3971,7 +3821,7 @@ var TableCell = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
3971
3821
|
}
|
|
3972
3822
|
));
|
|
3973
3823
|
TableCell.displayName = "TableCell";
|
|
3974
|
-
var TableCaption =
|
|
3824
|
+
var TableCaption = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
3975
3825
|
"caption",
|
|
3976
3826
|
{
|
|
3977
3827
|
ref,
|
|
@@ -3982,7 +3832,7 @@ var TableCaption = React18.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
3982
3832
|
TableCaption.displayName = "TableCaption";
|
|
3983
3833
|
|
|
3984
3834
|
// src/components/PublicLayout/PublicPageHeader.tsx
|
|
3985
|
-
import { Fragment as Fragment7, jsx as
|
|
3835
|
+
import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3986
3836
|
function PublicPageHeader({
|
|
3987
3837
|
event,
|
|
3988
3838
|
eventCode,
|
|
@@ -3995,11 +3845,11 @@ function PublicPageHeader({
|
|
|
3995
3845
|
customEventLogo
|
|
3996
3846
|
}) {
|
|
3997
3847
|
const { appName } = useAppConfig();
|
|
3998
|
-
return /* @__PURE__ */
|
|
3848
|
+
return /* @__PURE__ */ jsxs18("header", { className: cn(
|
|
3999
3849
|
"w-full px-[max(0rem,calc((100vw-var(--app-width))/2-0.5rem))] grid grid-cols-[auto_1fr_auto] place-items-center gap-2",
|
|
4000
3850
|
className
|
|
4001
3851
|
), children: [
|
|
4002
|
-
showAppLogo && appName && /* @__PURE__ */
|
|
3852
|
+
showAppLogo && appName && /* @__PURE__ */ jsx22(
|
|
4003
3853
|
"img",
|
|
4004
3854
|
{
|
|
4005
3855
|
className: "ml-4 max-w-36 object-contain row-span-2",
|
|
@@ -4007,52 +3857,37 @@ function PublicPageHeader({
|
|
|
4007
3857
|
alt: appName
|
|
4008
3858
|
}
|
|
4009
3859
|
),
|
|
4010
|
-
event && /* @__PURE__ */
|
|
4011
|
-
/* @__PURE__ */
|
|
4012
|
-
showEventLogo && event && /* @__PURE__ */
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
/* @__PURE__ */ jsx23(
|
|
4027
|
-
FileDisplay,
|
|
4028
|
-
{
|
|
4029
|
-
table_name: "event",
|
|
4030
|
-
record_id: event.event_id,
|
|
4031
|
-
organisation_id: event.organisation_id,
|
|
4032
|
-
category: "event_logos" /* EVENT_LOGOS */,
|
|
4033
|
-
displayOnly: true,
|
|
4034
|
-
showFallback: true,
|
|
4035
|
-
fallbackSize: "md",
|
|
4036
|
-
className: "mr-4 max-w-36 row-span-2",
|
|
4037
|
-
generateFallbackText: (fileName) => {
|
|
4038
|
-
if (!event.event_name) return "EV";
|
|
4039
|
-
return event.event_name.split(/[\s\-_]+/).map((word) => word.charAt(0).toUpperCase()).join("").substring(0, 3);
|
|
4040
|
-
}
|
|
3860
|
+
event && /* @__PURE__ */ jsxs18(Fragment7, { children: [
|
|
3861
|
+
/* @__PURE__ */ jsx22("h1", { children: event.event_name }),
|
|
3862
|
+
showEventLogo && event && /* @__PURE__ */ jsx22(Fragment7, { children: customEventLogo || /* @__PURE__ */ jsx22(Fragment7, { children: /* @__PURE__ */ jsx22(
|
|
3863
|
+
FileDisplay,
|
|
3864
|
+
{
|
|
3865
|
+
table_name: "event",
|
|
3866
|
+
record_id: event.event_id,
|
|
3867
|
+
organisation_id: event.organisation_id,
|
|
3868
|
+
category: "event_logos" /* EVENT_LOGOS */,
|
|
3869
|
+
displayOnly: true,
|
|
3870
|
+
showFallback: true,
|
|
3871
|
+
fallbackSize: "md",
|
|
3872
|
+
className: "mr-4 max-w-36 row-span-2",
|
|
3873
|
+
generateFallbackText: (fileName) => {
|
|
3874
|
+
if (!event.event_name) return "EV";
|
|
3875
|
+
return event.event_name.split(/[\s\-_]+/).map((word) => word.charAt(0).toUpperCase()).join("").substring(0, 3);
|
|
4041
3876
|
}
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
event.event_venue && /* @__PURE__ */
|
|
3877
|
+
}
|
|
3878
|
+
) }) }),
|
|
3879
|
+
event.event_venue && /* @__PURE__ */ jsx22("h4", { children: event.event_venue })
|
|
4045
3880
|
] }),
|
|
4046
|
-
title && /* @__PURE__ */
|
|
4047
|
-
/* @__PURE__ */
|
|
4048
|
-
description && /* @__PURE__ */
|
|
3881
|
+
title && /* @__PURE__ */ jsxs18(Fragment7, { children: [
|
|
3882
|
+
/* @__PURE__ */ jsx22("h1", { children: title }),
|
|
3883
|
+
description && /* @__PURE__ */ jsx22("p", { className: "text-lg text-sec-600 max-w-3xl mx-auto", children: description })
|
|
4049
3884
|
] }),
|
|
4050
|
-
children && /* @__PURE__ */
|
|
3885
|
+
children && /* @__PURE__ */ jsx22(Fragment7, { children })
|
|
4051
3886
|
] });
|
|
4052
3887
|
}
|
|
4053
3888
|
|
|
4054
3889
|
// src/components/PublicLayout/PublicPageFooter.tsx
|
|
4055
|
-
import { Fragment as Fragment8, jsx as
|
|
3890
|
+
import { Fragment as Fragment8, jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4056
3891
|
function PublicPageFooter({
|
|
4057
3892
|
event,
|
|
4058
3893
|
companyName = "Solvera Solutions Pty Ltd",
|
|
@@ -4064,16 +3899,16 @@ function PublicPageFooter({
|
|
|
4064
3899
|
children
|
|
4065
3900
|
}) {
|
|
4066
3901
|
const copyrightText = copyright || `\xA9 Copyright 2022\u2013${year} all rights reserved, ${companyName}.`;
|
|
4067
|
-
return /* @__PURE__ */
|
|
4068
|
-
logo && /* @__PURE__ */
|
|
4069
|
-
children && /* @__PURE__ */
|
|
4070
|
-
/* @__PURE__ */
|
|
4071
|
-
links && links.length > 0 && /* @__PURE__ */
|
|
3902
|
+
return /* @__PURE__ */ jsx23("footer", { className: cn("mt-8 py-6 flex justify-center", className), children: /* @__PURE__ */ jsxs19("section", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto text-center", children: [
|
|
3903
|
+
logo && /* @__PURE__ */ jsx23("img", { src: logo, alt: "Logo", className: "h-8 w-auto" }),
|
|
3904
|
+
children && /* @__PURE__ */ jsx23(Fragment8, { children }),
|
|
3905
|
+
/* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: copyrightText }),
|
|
3906
|
+
links && links.length > 0 && /* @__PURE__ */ jsx23("ul", { className: "flex gap-4 mt-2 md:mt-0", children: links.map((link, index) => /* @__PURE__ */ jsx23("li", { children: /* @__PURE__ */ jsx23("a", { href: link.href, className: "text-muted-foreground hover:text-foreground", children: link.label }) }, index)) })
|
|
4072
3907
|
] }) });
|
|
4073
3908
|
}
|
|
4074
3909
|
|
|
4075
3910
|
// src/components/PublicLayout/PublicLoadingSpinner.tsx
|
|
4076
|
-
import { jsx as
|
|
3911
|
+
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4077
3912
|
var sizeClasses = {
|
|
4078
3913
|
sm: "h-4 w-4",
|
|
4079
3914
|
md: "h-8 w-8",
|
|
@@ -4090,8 +3925,8 @@ function PublicLoadingSpinner({
|
|
|
4090
3925
|
}) {
|
|
4091
3926
|
const sizeClass = sizeClasses[size];
|
|
4092
3927
|
const displayMessage = customMessage || message;
|
|
4093
|
-
const content = /* @__PURE__ */
|
|
4094
|
-
showLogo && /* @__PURE__ */
|
|
3928
|
+
const content = /* @__PURE__ */ jsxs20("div", { className: cn("flex flex-col items-center", className), children: [
|
|
3929
|
+
showLogo && /* @__PURE__ */ jsx24("div", { className: "mb-4", children: /* @__PURE__ */ jsx24(
|
|
4095
3930
|
"img",
|
|
4096
3931
|
{
|
|
4097
3932
|
className: "h-8 w-auto",
|
|
@@ -4099,8 +3934,8 @@ function PublicLoadingSpinner({
|
|
|
4099
3934
|
alt: "PACE Core"
|
|
4100
3935
|
}
|
|
4101
3936
|
) }),
|
|
4102
|
-
/* @__PURE__ */
|
|
4103
|
-
/* @__PURE__ */
|
|
3937
|
+
/* @__PURE__ */ jsxs20("div", { className: "relative", children: [
|
|
3938
|
+
/* @__PURE__ */ jsx24(
|
|
4104
3939
|
"div",
|
|
4105
3940
|
{
|
|
4106
3941
|
className: cn(
|
|
@@ -4111,12 +3946,12 @@ function PublicLoadingSpinner({
|
|
|
4111
3946
|
"aria-label": "Loading"
|
|
4112
3947
|
}
|
|
4113
3948
|
),
|
|
4114
|
-
/* @__PURE__ */
|
|
3949
|
+
/* @__PURE__ */ jsx24("span", { className: "sr-only", children: displayMessage })
|
|
4115
3950
|
] }),
|
|
4116
|
-
displayMessage && /* @__PURE__ */
|
|
3951
|
+
displayMessage && /* @__PURE__ */ jsx24("p", { className: "mt-4 text-sm text-sec-600 text-center", children: displayMessage })
|
|
4117
3952
|
] });
|
|
4118
3953
|
if (centered) {
|
|
4119
|
-
return /* @__PURE__ */
|
|
3954
|
+
return /* @__PURE__ */ jsx24("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ jsx24("div", { className: "max-w-md mx-auto px-4", children: content }) });
|
|
4120
3955
|
}
|
|
4121
3956
|
return content;
|
|
4122
3957
|
}
|
|
@@ -4125,11 +3960,11 @@ function PublicLoadingSpinnerFullPage({
|
|
|
4125
3960
|
eventName,
|
|
4126
3961
|
className = ""
|
|
4127
3962
|
}) {
|
|
4128
|
-
return /* @__PURE__ */
|
|
3963
|
+
return /* @__PURE__ */ jsx24("div", { className: cn(
|
|
4129
3964
|
"min-h-screen bg-background flex items-center justify-center",
|
|
4130
3965
|
className
|
|
4131
|
-
), children: /* @__PURE__ */
|
|
4132
|
-
/* @__PURE__ */
|
|
3966
|
+
), children: /* @__PURE__ */ jsxs20("div", { className: "max-w-md mx-auto text-center px-4", children: [
|
|
3967
|
+
/* @__PURE__ */ jsx24("div", { className: "mb-8", children: /* @__PURE__ */ jsx24(
|
|
4133
3968
|
"img",
|
|
4134
3969
|
{
|
|
4135
3970
|
className: "h-12 w-auto mx-auto",
|
|
@@ -4137,8 +3972,8 @@ function PublicLoadingSpinnerFullPage({
|
|
|
4137
3972
|
alt: "PACE Core"
|
|
4138
3973
|
}
|
|
4139
3974
|
) }),
|
|
4140
|
-
eventName && /* @__PURE__ */
|
|
4141
|
-
/* @__PURE__ */
|
|
3975
|
+
eventName && /* @__PURE__ */ jsx24("h1", { className: "text-2xl font-bold text-sec-900 mb-4", children: eventName }),
|
|
3976
|
+
/* @__PURE__ */ jsx24("div", { className: "relative mb-6", children: /* @__PURE__ */ jsx24(
|
|
4142
3977
|
"div",
|
|
4143
3978
|
{
|
|
4144
3979
|
className: "h-12 w-12 border-4 border-sec-200 border-t-main-600 rounded-full animate-spin mx-auto",
|
|
@@ -4146,11 +3981,11 @@ function PublicLoadingSpinnerFullPage({
|
|
|
4146
3981
|
"aria-label": "Loading"
|
|
4147
3982
|
}
|
|
4148
3983
|
) }),
|
|
4149
|
-
/* @__PURE__ */
|
|
4150
|
-
/* @__PURE__ */
|
|
4151
|
-
/* @__PURE__ */
|
|
4152
|
-
/* @__PURE__ */
|
|
4153
|
-
/* @__PURE__ */
|
|
3984
|
+
/* @__PURE__ */ jsx24("p", { className: "text-lg text-sec-600", children: message }),
|
|
3985
|
+
/* @__PURE__ */ jsxs20("div", { className: "mt-4 flex justify-center space-x-1", children: [
|
|
3986
|
+
/* @__PURE__ */ jsx24("div", { className: "h-2 w-2 bg-main-600 rounded-full animate-bounce", style: { animationDelay: "0ms" } }),
|
|
3987
|
+
/* @__PURE__ */ jsx24("div", { className: "h-2 w-2 bg-main-600 rounded-full animate-bounce", style: { animationDelay: "150ms" } }),
|
|
3988
|
+
/* @__PURE__ */ jsx24("div", { className: "h-2 w-2 bg-main-600 rounded-full animate-bounce", style: { animationDelay: "300ms" } })
|
|
4154
3989
|
] })
|
|
4155
3990
|
] }) });
|
|
4156
3991
|
}
|
|
@@ -4158,7 +3993,7 @@ function PublicLoadingSkeleton({
|
|
|
4158
3993
|
lines = 3,
|
|
4159
3994
|
className = ""
|
|
4160
3995
|
}) {
|
|
4161
|
-
return /* @__PURE__ */
|
|
3996
|
+
return /* @__PURE__ */ jsx24("div", { className: cn("animate-pulse", className), children: Array.from({ length: lines }).map((_, index) => /* @__PURE__ */ jsx24(
|
|
4162
3997
|
"div",
|
|
4163
3998
|
{
|
|
4164
3999
|
className: cn(
|
|
@@ -4171,7 +4006,7 @@ function PublicLoadingSkeleton({
|
|
|
4171
4006
|
}
|
|
4172
4007
|
|
|
4173
4008
|
// src/components/PublicLayout/PublicPageLayout.tsx
|
|
4174
|
-
import { Fragment as Fragment9, jsx as
|
|
4009
|
+
import { Fragment as Fragment9, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4175
4010
|
function PublicPageLayout({
|
|
4176
4011
|
eventCode,
|
|
4177
4012
|
children,
|
|
@@ -4193,7 +4028,7 @@ function PublicPageLayout({
|
|
|
4193
4028
|
});
|
|
4194
4029
|
if (isLoading) {
|
|
4195
4030
|
if (LoadingFallback === PublicLoadingSpinner) {
|
|
4196
|
-
return /* @__PURE__ */
|
|
4031
|
+
return /* @__PURE__ */ jsx25(
|
|
4197
4032
|
PublicLoadingSpinner,
|
|
4198
4033
|
{
|
|
4199
4034
|
className: "items-center justify-center",
|
|
@@ -4201,39 +4036,39 @@ function PublicPageLayout({
|
|
|
4201
4036
|
}
|
|
4202
4037
|
);
|
|
4203
4038
|
}
|
|
4204
|
-
return /* @__PURE__ */
|
|
4039
|
+
return /* @__PURE__ */ jsx25(LoadingFallback, {});
|
|
4205
4040
|
}
|
|
4206
4041
|
if (error && showValidationErrors) {
|
|
4207
4042
|
if (ErrorFallback) {
|
|
4208
|
-
return /* @__PURE__ */
|
|
4043
|
+
return /* @__PURE__ */ jsx25(ErrorFallback, { error, retry: handleRefetch });
|
|
4209
4044
|
}
|
|
4210
|
-
return /* @__PURE__ */
|
|
4211
|
-
/* @__PURE__ */
|
|
4212
|
-
/* @__PURE__ */
|
|
4045
|
+
return /* @__PURE__ */ jsxs21("main", { className: "flex flex-col items-center justify-center px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children: [
|
|
4046
|
+
/* @__PURE__ */ jsx25("h1", { children: "Event Not Found" }),
|
|
4047
|
+
/* @__PURE__ */ jsxs21("p", { children: [
|
|
4213
4048
|
'The event code "',
|
|
4214
4049
|
eventCode,
|
|
4215
4050
|
'" is invalid or the event is not available for public viewing.'
|
|
4216
4051
|
] }),
|
|
4217
|
-
/* @__PURE__ */
|
|
4052
|
+
/* @__PURE__ */ jsx25(Button, { onClick: handleRefetch, children: "Try Again" })
|
|
4218
4053
|
] });
|
|
4219
4054
|
}
|
|
4220
4055
|
if (!event && showValidationErrors) {
|
|
4221
|
-
return /* @__PURE__ */
|
|
4222
|
-
/* @__PURE__ */
|
|
4223
|
-
/* @__PURE__ */
|
|
4224
|
-
handleRefetch && /* @__PURE__ */
|
|
4056
|
+
return /* @__PURE__ */ jsxs21("main", { className: "flex flex-col items-center justify-center px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children: [
|
|
4057
|
+
/* @__PURE__ */ jsx25("h1", { children: "Event Not Available" }),
|
|
4058
|
+
/* @__PURE__ */ jsx25("p", { children: "This event is not available for public viewing." }),
|
|
4059
|
+
handleRefetch && /* @__PURE__ */ jsx25(Button, { onClick: handleRefetch, children: "Try Again" })
|
|
4225
4060
|
] });
|
|
4226
4061
|
}
|
|
4227
|
-
return /* @__PURE__ */
|
|
4228
|
-
customHeader || /* @__PURE__ */
|
|
4062
|
+
return /* @__PURE__ */ jsx25(PublicErrorBoundary, { children: /* @__PURE__ */ jsxs21(Fragment9, { children: [
|
|
4063
|
+
customHeader || /* @__PURE__ */ jsx25(
|
|
4229
4064
|
PublicPageHeader,
|
|
4230
4065
|
{
|
|
4231
4066
|
event: event || void 0,
|
|
4232
4067
|
eventCode
|
|
4233
4068
|
}
|
|
4234
4069
|
),
|
|
4235
|
-
/* @__PURE__ */
|
|
4236
|
-
showFooter && event && (customFooter || /* @__PURE__ */
|
|
4070
|
+
/* @__PURE__ */ jsx25("main", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children }),
|
|
4071
|
+
showFooter && event && (customFooter || /* @__PURE__ */ jsx25(PublicPageFooter, { event }))
|
|
4237
4072
|
] }) });
|
|
4238
4073
|
}
|
|
4239
4074
|
function usePublicPageContext2() {
|
|
@@ -4249,259 +4084,64 @@ function usePublicPageContext2() {
|
|
|
4249
4084
|
};
|
|
4250
4085
|
}
|
|
4251
4086
|
|
|
4252
|
-
// src/components/PublicLayout/PublicPageDebugger.tsx
|
|
4253
|
-
import { useEffect as useEffect9 } from "react";
|
|
4254
|
-
import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4255
|
-
function PublicPageDebugger({ enabled = true, label = "PublicPage" }) {
|
|
4256
|
-
useEffect9(() => {
|
|
4257
|
-
if (!enabled) return;
|
|
4258
|
-
console.log(`[${label}] Component mounted`);
|
|
4259
|
-
try {
|
|
4260
|
-
const { isPublicPage } = usePublicPageContext();
|
|
4261
|
-
console.log(`[${label}] Public page context detected:`, isPublicPage);
|
|
4262
|
-
} catch (error) {
|
|
4263
|
-
console.warn(`[${label}] Not in PublicPageProvider context:`, error instanceof Error ? error.message : String(error));
|
|
4264
|
-
}
|
|
4265
|
-
try {
|
|
4266
|
-
const { isAuthenticated } = (init_UnifiedAuthProvider2(), __toCommonJS(UnifiedAuthProvider_exports)).useUnifiedAuth();
|
|
4267
|
-
console.warn(`[${label}] AUTHENTICATION CONTEXT DETECTED! This should not happen in public pages.`);
|
|
4268
|
-
console.warn(`[${label}] isAuthenticated:`, isAuthenticated);
|
|
4269
|
-
} catch (error) {
|
|
4270
|
-
console.log(`[${label}] No authentication context detected (good for public pages)`);
|
|
4271
|
-
}
|
|
4272
|
-
try {
|
|
4273
|
-
const { selectedOrganisation } = (init_OrganisationProvider(), __toCommonJS(OrganisationProvider_exports)).useOrganisations();
|
|
4274
|
-
console.warn(`[${label}] ORGANISATION CONTEXT DETECTED! This should not happen in public pages.`);
|
|
4275
|
-
console.warn(`[${label}] selectedOrganisation:`, selectedOrganisation);
|
|
4276
|
-
} catch (error) {
|
|
4277
|
-
console.log(`[${label}] No organisation context detected (good for public pages)`);
|
|
4278
|
-
}
|
|
4279
|
-
try {
|
|
4280
|
-
const { events } = (init_EventProvider(), __toCommonJS(EventProvider_exports)).useEvents();
|
|
4281
|
-
console.warn(`[${label}] EVENT CONTEXT DETECTED! This should not happen in public pages.`);
|
|
4282
|
-
console.warn(`[${label}] events:`, events);
|
|
4283
|
-
} catch (error) {
|
|
4284
|
-
console.log(`[${label}] No event context detected (good for public pages)`);
|
|
4285
|
-
}
|
|
4286
|
-
const supabaseUrl = import.meta.env?.VITE_SUPABASE_URL;
|
|
4287
|
-
const supabaseKey = import.meta.env?.VITE_SUPABASE_ANON_KEY;
|
|
4288
|
-
console.log(`[${label}] Environment variables:`, {
|
|
4289
|
-
supabaseUrl: supabaseUrl ? "Present" : "Missing",
|
|
4290
|
-
supabaseKey: supabaseKey ? "Present" : "Missing"
|
|
4291
|
-
});
|
|
4292
|
-
return () => {
|
|
4293
|
-
console.log(`[${label}] Component unmounted`);
|
|
4294
|
-
};
|
|
4295
|
-
}, [enabled, label]);
|
|
4296
|
-
if (!enabled) return null;
|
|
4297
|
-
return /* @__PURE__ */ jsxs23("div", { style: {
|
|
4298
|
-
position: "fixed",
|
|
4299
|
-
top: 0,
|
|
4300
|
-
right: 0,
|
|
4301
|
-
background: "rgba(0,0,0,0.8)",
|
|
4302
|
-
color: "white",
|
|
4303
|
-
padding: "8px",
|
|
4304
|
-
fontSize: "12px",
|
|
4305
|
-
zIndex: 9999,
|
|
4306
|
-
fontFamily: "monospace"
|
|
4307
|
-
}, children: [
|
|
4308
|
-
/* @__PURE__ */ jsx27("div", { children: "Public Page Debugger" }),
|
|
4309
|
-
/* @__PURE__ */ jsx27("div", { children: "Check console for context analysis" })
|
|
4310
|
-
] });
|
|
4311
|
-
}
|
|
4312
|
-
|
|
4313
|
-
// src/components/PublicLayout/PublicPageDiagnostic.tsx
|
|
4314
|
-
import { useEffect as useEffect10, useState as useState13 } from "react";
|
|
4315
|
-
import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4316
|
-
function PublicPageDiagnostic({ enabled = true, label = "PublicPage" }) {
|
|
4317
|
-
const [diagnostics, setDiagnostics] = useState13({
|
|
4318
|
-
hasPublicPageContext: false,
|
|
4319
|
-
hasAuthContext: false,
|
|
4320
|
-
hasOrgContext: false,
|
|
4321
|
-
hasEventContext: false,
|
|
4322
|
-
hasEnvironmentVars: false,
|
|
4323
|
-
routeParams: null
|
|
4324
|
-
});
|
|
4325
|
-
useEffect10(() => {
|
|
4326
|
-
if (!enabled) return;
|
|
4327
|
-
const runDiagnostics = () => {
|
|
4328
|
-
const newDiagnostics = {
|
|
4329
|
-
hasPublicPageContext: false,
|
|
4330
|
-
hasAuthContext: false,
|
|
4331
|
-
hasOrgContext: false,
|
|
4332
|
-
hasEventContext: false,
|
|
4333
|
-
hasEnvironmentVars: false,
|
|
4334
|
-
routeParams: null
|
|
4335
|
-
};
|
|
4336
|
-
try {
|
|
4337
|
-
const { isPublicPage } = usePublicPageContext();
|
|
4338
|
-
newDiagnostics.hasPublicPageContext = isPublicPage === true;
|
|
4339
|
-
} catch (error) {
|
|
4340
|
-
newDiagnostics.hasPublicPageContext = false;
|
|
4341
|
-
}
|
|
4342
|
-
try {
|
|
4343
|
-
const { isAuthenticated } = (init_UnifiedAuthProvider2(), __toCommonJS(UnifiedAuthProvider_exports)).useUnifiedAuth();
|
|
4344
|
-
newDiagnostics.hasAuthContext = true;
|
|
4345
|
-
} catch (error) {
|
|
4346
|
-
newDiagnostics.hasAuthContext = false;
|
|
4347
|
-
}
|
|
4348
|
-
try {
|
|
4349
|
-
const { selectedOrganisation } = (init_OrganisationProvider(), __toCommonJS(OrganisationProvider_exports)).useOrganisations();
|
|
4350
|
-
newDiagnostics.hasOrgContext = true;
|
|
4351
|
-
} catch (error) {
|
|
4352
|
-
newDiagnostics.hasOrgContext = false;
|
|
4353
|
-
}
|
|
4354
|
-
try {
|
|
4355
|
-
const { events } = (init_EventProvider(), __toCommonJS(EventProvider_exports)).useEvents();
|
|
4356
|
-
newDiagnostics.hasEventContext = true;
|
|
4357
|
-
} catch (error) {
|
|
4358
|
-
newDiagnostics.hasEventContext = false;
|
|
4359
|
-
}
|
|
4360
|
-
const supabaseUrl = import.meta.env?.VITE_SUPABASE_URL;
|
|
4361
|
-
const supabaseKey = import.meta.env?.VITE_SUPABASE_ANON_KEY;
|
|
4362
|
-
newDiagnostics.hasEnvironmentVars = !!(supabaseUrl && supabaseKey);
|
|
4363
|
-
try {
|
|
4364
|
-
const { useParams } = __require("react-router-dom");
|
|
4365
|
-
const params = useParams();
|
|
4366
|
-
newDiagnostics.routeParams = params;
|
|
4367
|
-
} catch (error) {
|
|
4368
|
-
newDiagnostics.routeParams = null;
|
|
4369
|
-
}
|
|
4370
|
-
setDiagnostics(newDiagnostics);
|
|
4371
|
-
console.group(`\u{1F50D} [${label}] Public Page Diagnostics`);
|
|
4372
|
-
console.log("\u2705 Public Page Context:", newDiagnostics.hasPublicPageContext ? "PRESENT" : "MISSING");
|
|
4373
|
-
console.log("\u274C Auth Context:", newDiagnostics.hasAuthContext ? "PRESENT (BAD!)" : "ABSENT (GOOD!)");
|
|
4374
|
-
console.log("\u274C Org Context:", newDiagnostics.hasOrgContext ? "PRESENT (BAD!)" : "ABSENT (GOOD!)");
|
|
4375
|
-
console.log("\u274C Event Context:", newDiagnostics.hasEventContext ? "PRESENT (BAD!)" : "ABSENT (GOOD!)");
|
|
4376
|
-
console.log("\u2705 Environment Vars:", newDiagnostics.hasEnvironmentVars ? "PRESENT" : "MISSING");
|
|
4377
|
-
console.log("\u2705 Route Params:", newDiagnostics.routeParams);
|
|
4378
|
-
console.groupEnd();
|
|
4379
|
-
if (newDiagnostics.hasAuthContext || newDiagnostics.hasOrgContext || newDiagnostics.hasEventContext) {
|
|
4380
|
-
console.error(`\u{1F6A8} [${label}] PROBLEM DETECTED: Public page is inside authentication context!`);
|
|
4381
|
-
console.error("\u{1F527} SOLUTION: Move public routes outside of UnifiedAuthProvider, OrganisationProvider, and EventProvider");
|
|
4382
|
-
console.error("\u{1F4D6} See: packages/core/docs/emergency-public-pages-fix.md");
|
|
4383
|
-
} else if (!newDiagnostics.hasPublicPageContext) {
|
|
4384
|
-
console.warn(`\u26A0\uFE0F [${label}] WARNING: Not in PublicPageProvider context`);
|
|
4385
|
-
console.warn("\u{1F527} SOLUTION: Wrap your public page component in <PublicPageProvider>");
|
|
4386
|
-
} else if (!newDiagnostics.hasEnvironmentVars) {
|
|
4387
|
-
console.warn(`\u26A0\uFE0F [${label}] WARNING: Missing environment variables`);
|
|
4388
|
-
console.warn("\u{1F527} SOLUTION: Set VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY in your environment");
|
|
4389
|
-
} else {
|
|
4390
|
-
console.log(`\u2705 [${label}] All diagnostics passed! Public page should work correctly.`);
|
|
4391
|
-
}
|
|
4392
|
-
};
|
|
4393
|
-
runDiagnostics();
|
|
4394
|
-
}, [enabled, label]);
|
|
4395
|
-
if (!enabled) return null;
|
|
4396
|
-
return /* @__PURE__ */ jsxs24("div", { style: {
|
|
4397
|
-
position: "fixed",
|
|
4398
|
-
top: 0,
|
|
4399
|
-
left: 0,
|
|
4400
|
-
background: "rgba(0,0,0,0.9)",
|
|
4401
|
-
color: "white",
|
|
4402
|
-
padding: "12px",
|
|
4403
|
-
fontSize: "11px",
|
|
4404
|
-
zIndex: 9999,
|
|
4405
|
-
fontFamily: "monospace",
|
|
4406
|
-
maxWidth: "300px",
|
|
4407
|
-
borderRadius: "0 0 8px 0"
|
|
4408
|
-
}, children: [
|
|
4409
|
-
/* @__PURE__ */ jsx28("div", { style: { fontWeight: "bold", marginBottom: "8px" }, children: "\u{1F50D} Public Page Diagnostics" }),
|
|
4410
|
-
/* @__PURE__ */ jsxs24("div", { children: [
|
|
4411
|
-
"Public Context: ",
|
|
4412
|
-
diagnostics.hasPublicPageContext ? "\u2705" : "\u274C"
|
|
4413
|
-
] }),
|
|
4414
|
-
/* @__PURE__ */ jsxs24("div", { children: [
|
|
4415
|
-
"Auth Context: ",
|
|
4416
|
-
diagnostics.hasAuthContext ? "\u274C BAD" : "\u2705 GOOD"
|
|
4417
|
-
] }),
|
|
4418
|
-
/* @__PURE__ */ jsxs24("div", { children: [
|
|
4419
|
-
"Org Context: ",
|
|
4420
|
-
diagnostics.hasOrgContext ? "\u274C BAD" : "\u2705 GOOD"
|
|
4421
|
-
] }),
|
|
4422
|
-
/* @__PURE__ */ jsxs24("div", { children: [
|
|
4423
|
-
"Event Context: ",
|
|
4424
|
-
diagnostics.hasEventContext ? "\u274C BAD" : "\u2705 GOOD"
|
|
4425
|
-
] }),
|
|
4426
|
-
/* @__PURE__ */ jsxs24("div", { children: [
|
|
4427
|
-
"Env Vars: ",
|
|
4428
|
-
diagnostics.hasEnvironmentVars ? "\u2705" : "\u274C"
|
|
4429
|
-
] }),
|
|
4430
|
-
/* @__PURE__ */ jsxs24("div", { children: [
|
|
4431
|
-
"Route Params: ",
|
|
4432
|
-
diagnostics.routeParams ? "\u2705" : "\u274C"
|
|
4433
|
-
] }),
|
|
4434
|
-
/* @__PURE__ */ jsx28("div", { style: { marginTop: "8px", fontSize: "10px", opacity: 0.8 }, children: "Check console for detailed analysis" })
|
|
4435
|
-
] });
|
|
4436
|
-
}
|
|
4437
|
-
|
|
4438
4087
|
// src/components/PublicLayout/PublicPageContextChecker.tsx
|
|
4439
|
-
import { useEffect as
|
|
4440
|
-
|
|
4088
|
+
import { useEffect as useEffect9 } from "react";
|
|
4089
|
+
init_logger();
|
|
4090
|
+
import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4441
4091
|
function PublicPageContextChecker({ enabled = true, label = "PublicPage" }) {
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4092
|
+
const isDebugEnabled = import.meta.env.MODE === "development" && import.meta.env.VITE_ENABLE_DEBUG_LOGS === "true" || import.meta.env.MODE === "test" || import.meta.env.VITEST === true || typeof process !== "undefined" && false;
|
|
4093
|
+
if (!isDebugEnabled || !enabled) {
|
|
4094
|
+
return null;
|
|
4095
|
+
}
|
|
4096
|
+
useEffect9(() => {
|
|
4097
|
+
logger.debug("PublicPageContextChecker", `\u{1F6A8} [${label}] PUBLIC PAGE CONTEXT CHECK`);
|
|
4445
4098
|
try {
|
|
4446
4099
|
const { isAuthenticated } = (init_UnifiedAuthProvider2(), __toCommonJS(UnifiedAuthProvider_exports)).useUnifiedAuth();
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4100
|
+
logger.error("PublicPageContextChecker", `\u274C [${label}] AUTHENTICATION CONTEXT DETECTED!`);
|
|
4101
|
+
logger.error("PublicPageContextChecker", `\u274C [${label}] isAuthenticated:`, isAuthenticated);
|
|
4102
|
+
logger.error("PublicPageContextChecker", `\u274C [${label}] This public page is inside UnifiedAuthProvider - THIS IS WRONG!`);
|
|
4103
|
+
logger.error("PublicPageContextChecker", `\u274C [${label}] SOLUTION: Move public routes outside of authentication providers`);
|
|
4451
4104
|
} catch (error) {
|
|
4452
|
-
|
|
4105
|
+
logger.debug("PublicPageContextChecker", `\u2705 [${label}] No authentication context detected (GOOD!)`);
|
|
4453
4106
|
}
|
|
4454
4107
|
try {
|
|
4455
4108
|
const { selectedOrganisation } = (init_OrganisationProvider(), __toCommonJS(OrganisationProvider_exports)).useOrganisations();
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4109
|
+
logger.error("PublicPageContextChecker", `\u274C [${label}] ORGANISATION CONTEXT DETECTED!`);
|
|
4110
|
+
logger.error("PublicPageContextChecker", `\u274C [${label}] selectedOrganisation:`, selectedOrganisation);
|
|
4111
|
+
logger.error("PublicPageContextChecker", `\u274C [${label}] This public page is inside OrganisationProvider - THIS IS WRONG!`);
|
|
4112
|
+
logger.error("PublicPageContextChecker", `\u274C [${label}] SOLUTION: Move public routes outside of authentication providers`);
|
|
4460
4113
|
} catch (error) {
|
|
4461
|
-
|
|
4114
|
+
logger.debug("PublicPageContextChecker", `\u2705 [${label}] No organisation context detected (GOOD!)`);
|
|
4462
4115
|
}
|
|
4463
4116
|
try {
|
|
4464
4117
|
const { events } = (init_EventProvider(), __toCommonJS(EventProvider_exports)).useEvents();
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4118
|
+
logger.error("PublicPageContextChecker", `\u274C [${label}] EVENT CONTEXT DETECTED!`);
|
|
4119
|
+
logger.error("PublicPageContextChecker", `\u274C [${label}] events:`, events);
|
|
4120
|
+
logger.error("PublicPageContextChecker", `\u274C [${label}] This public page is inside EventProvider - THIS IS WRONG!`);
|
|
4121
|
+
logger.error("PublicPageContextChecker", `\u274C [${label}] SOLUTION: Move public routes outside of authentication providers`);
|
|
4469
4122
|
} catch (error) {
|
|
4470
|
-
|
|
4123
|
+
logger.debug("PublicPageContextChecker", `\u2705 [${label}] No event context detected (GOOD!)`);
|
|
4471
4124
|
}
|
|
4472
4125
|
try {
|
|
4473
4126
|
const { isPublicPage } = usePublicPageContext();
|
|
4474
4127
|
if (isPublicPage) {
|
|
4475
|
-
|
|
4128
|
+
logger.debug("PublicPageContextChecker", `\u2705 [${label}] Public page context detected (GOOD!)`);
|
|
4476
4129
|
} else {
|
|
4477
|
-
|
|
4478
|
-
|
|
4130
|
+
logger.warn("PublicPageContextChecker", `\u26A0\uFE0F [${label}] Not in PublicPageProvider context`);
|
|
4131
|
+
logger.warn("PublicPageContextChecker", `\u26A0\uFE0F [${label}] SOLUTION: Wrap your public page in <PublicPageProvider>`);
|
|
4479
4132
|
}
|
|
4480
4133
|
} catch (error) {
|
|
4481
|
-
|
|
4482
|
-
|
|
4134
|
+
logger.warn("PublicPageContextChecker", `\u26A0\uFE0F [${label}] Not in PublicPageProvider context`);
|
|
4135
|
+
logger.warn("PublicPageContextChecker", `\u26A0\uFE0F [${label}] SOLUTION: Wrap your public page in <PublicPageProvider>`);
|
|
4483
4136
|
}
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
console.log(`1. Check your main App.tsx file`);
|
|
4491
|
-
console.log(`2. Make sure public routes are completely separate from authentication providers`);
|
|
4492
|
-
console.log(`3. Follow the architecture in: packages/core/docs/public-pages-guide.md`);
|
|
4493
|
-
console.log(``);
|
|
4494
|
-
console.log(`\u2705 CORRECT ARCHITECTURE:`);
|
|
4495
|
-
console.log(`<BrowserRouter>`);
|
|
4496
|
-
console.log(` <Routes>`);
|
|
4497
|
-
console.log(` <Route path="/events/*" element={<PublicPageApp />} />`);
|
|
4498
|
-
console.log(` <Route path="/*" element={<AuthenticatedApp />} />`);
|
|
4499
|
-
console.log(` </Routes>`);
|
|
4500
|
-
console.log(`</BrowserRouter>`);
|
|
4501
|
-
console.groupEnd();
|
|
4137
|
+
logger.debug("PublicPageContextChecker", `\u{1F4D6} [${label}] IMMEDIATE ACTION REQUIRED`);
|
|
4138
|
+
logger.debug("PublicPageContextChecker", `If you see any \u274C errors above, your public page is inside authentication context.`);
|
|
4139
|
+
logger.debug("PublicPageContextChecker", `This will cause infinite loading loops and authentication errors.`);
|
|
4140
|
+
logger.debug("PublicPageContextChecker", `\u{1F527} SOLUTION: Check your main App.tsx file`);
|
|
4141
|
+
logger.debug("PublicPageContextChecker", `Make sure public routes are completely separate from authentication providers`);
|
|
4142
|
+
logger.debug("PublicPageContextChecker", `Follow the architecture in: packages/core/docs/public-pages-guide.md`);
|
|
4502
4143
|
}, [enabled, label]);
|
|
4503
|
-
|
|
4504
|
-
return /* @__PURE__ */ jsxs25("div", { style: {
|
|
4144
|
+
return /* @__PURE__ */ jsxs22("div", { style: {
|
|
4505
4145
|
position: "fixed",
|
|
4506
4146
|
top: 0,
|
|
4507
4147
|
left: 0,
|
|
@@ -4515,12 +4155,83 @@ function PublicPageContextChecker({ enabled = true, label = "PublicPage" }) {
|
|
|
4515
4155
|
borderRadius: "0 0 8px 0",
|
|
4516
4156
|
border: "2px solid #dc2626"
|
|
4517
4157
|
}, children: [
|
|
4518
|
-
/* @__PURE__ */
|
|
4519
|
-
/* @__PURE__ */
|
|
4520
|
-
/* @__PURE__ */
|
|
4158
|
+
/* @__PURE__ */ jsx26("div", { style: { fontWeight: "bold", marginBottom: "8px" }, children: "\u{1F6A8} PUBLIC PAGE CONTEXT CHECK" }),
|
|
4159
|
+
/* @__PURE__ */ jsx26("div", { children: "Check console for authentication context analysis" }),
|
|
4160
|
+
/* @__PURE__ */ jsx26("div", { style: { marginTop: "8px", fontSize: "10px", opacity: 0.9 }, children: "If you see \u274C errors in console, your public page is inside auth context!" })
|
|
4521
4161
|
] });
|
|
4522
4162
|
}
|
|
4523
4163
|
|
|
4164
|
+
// src/components/PublicLayout/EventLogo.tsx
|
|
4165
|
+
import React19 from "react";
|
|
4166
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
4167
|
+
function defaultGenerateFallbackText2(eventName) {
|
|
4168
|
+
if (!eventName) return "EV";
|
|
4169
|
+
return eventName.split(" ").map((word) => word.charAt(0).toUpperCase()).join("").substring(0, 3);
|
|
4170
|
+
}
|
|
4171
|
+
function EventLogo({
|
|
4172
|
+
eventId,
|
|
4173
|
+
eventName,
|
|
4174
|
+
organisationId,
|
|
4175
|
+
size = "md",
|
|
4176
|
+
className = "",
|
|
4177
|
+
showFallback = true,
|
|
4178
|
+
generateFallbackText = defaultGenerateFallbackText2,
|
|
4179
|
+
validateImage = true,
|
|
4180
|
+
// Deprecated but kept for backward compatibility
|
|
4181
|
+
loadingComponent: LoadingComponent,
|
|
4182
|
+
errorComponent: ErrorComponent
|
|
4183
|
+
}) {
|
|
4184
|
+
const adaptedGenerateFallbackText = React19.useCallback(
|
|
4185
|
+
(fileName) => {
|
|
4186
|
+
return generateFallbackText(eventName || fileName || "");
|
|
4187
|
+
},
|
|
4188
|
+
[eventName, generateFallbackText]
|
|
4189
|
+
);
|
|
4190
|
+
const adaptedErrorComponent = ErrorComponent ? React19.useCallback(
|
|
4191
|
+
({ error }) => {
|
|
4192
|
+
const errorObj = error instanceof Error ? error : new Error(String(error || "Unknown error"));
|
|
4193
|
+
return /* @__PURE__ */ jsx27(ErrorComponent, { error: errorObj });
|
|
4194
|
+
},
|
|
4195
|
+
[ErrorComponent]
|
|
4196
|
+
) : void 0;
|
|
4197
|
+
return /* @__PURE__ */ jsx27(
|
|
4198
|
+
FileDisplay,
|
|
4199
|
+
{
|
|
4200
|
+
table_name: "event",
|
|
4201
|
+
record_id: eventId,
|
|
4202
|
+
organisation_id: organisationId,
|
|
4203
|
+
category: "event_logos" /* EVENT_LOGOS */,
|
|
4204
|
+
displayOnly: true,
|
|
4205
|
+
showFallback,
|
|
4206
|
+
fallbackSize: size,
|
|
4207
|
+
className,
|
|
4208
|
+
generateFallbackText: adaptedGenerateFallbackText,
|
|
4209
|
+
loadingComponent: LoadingComponent,
|
|
4210
|
+
errorComponent: adaptedErrorComponent
|
|
4211
|
+
}
|
|
4212
|
+
);
|
|
4213
|
+
}
|
|
4214
|
+
function EventLogoCompact(props) {
|
|
4215
|
+
return /* @__PURE__ */ jsx27(
|
|
4216
|
+
EventLogo,
|
|
4217
|
+
{
|
|
4218
|
+
...props,
|
|
4219
|
+
size: "sm",
|
|
4220
|
+
className: `${props.className || ""} rounded-sm`
|
|
4221
|
+
}
|
|
4222
|
+
);
|
|
4223
|
+
}
|
|
4224
|
+
function EventLogoLarge(props) {
|
|
4225
|
+
return /* @__PURE__ */ jsx27(
|
|
4226
|
+
EventLogo,
|
|
4227
|
+
{
|
|
4228
|
+
...props,
|
|
4229
|
+
size: "xl",
|
|
4230
|
+
className: `${props.className || ""} rounded-lg`
|
|
4231
|
+
}
|
|
4232
|
+
);
|
|
4233
|
+
}
|
|
4234
|
+
|
|
4524
4235
|
export {
|
|
4525
4236
|
init_EventProvider,
|
|
4526
4237
|
Label,
|
|
@@ -4550,7 +4261,6 @@ export {
|
|
|
4550
4261
|
ProtectedRoute,
|
|
4551
4262
|
ErrorBoundary,
|
|
4552
4263
|
OrganisationSelector,
|
|
4553
|
-
PasswordResetForm,
|
|
4554
4264
|
useFileReference,
|
|
4555
4265
|
useFileReferenceForRecord,
|
|
4556
4266
|
useFileReferenceById,
|
|
@@ -4572,8 +4282,9 @@ export {
|
|
|
4572
4282
|
PublicLoadingSkeleton,
|
|
4573
4283
|
PublicPageLayout,
|
|
4574
4284
|
usePublicPageContext2 as usePublicPageContext,
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4285
|
+
PublicPageContextChecker,
|
|
4286
|
+
EventLogo,
|
|
4287
|
+
EventLogoCompact,
|
|
4288
|
+
EventLogoLarge
|
|
4578
4289
|
};
|
|
4579
|
-
//# sourceMappingURL=chunk-
|
|
4290
|
+
//# sourceMappingURL=chunk-NOHEVYVX.js.map
|