@jmruthers/pace-core 0.5.191 → 0.5.193
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AuthService-CbP_utw2.d.ts → AuthService-DjnJHDtC.d.ts} +1 -0
- package/dist/{DataTable-WKRZD47S.js → DataTable-5FU7IESH.js} +7 -6
- package/dist/{PublicPageProvider-ULXC_u6U.d.ts → PublicPageProvider-C0Sm_e5k.d.ts} +3 -1
- package/dist/{UnifiedAuthProvider-BYA9qB-o.d.ts → UnifiedAuthProvider-185Ih4dj.d.ts} +2 -0
- package/dist/{UnifiedAuthProvider-FTSG5XH7.js → UnifiedAuthProvider-RGJTDE2C.js} +3 -3
- package/dist/{api-IHKALJZD.js → api-N774RPUA.js} +2 -2
- package/dist/chunk-6C4YBBJM 5.js +628 -0
- package/dist/chunk-7D4SUZUM.js 2.map +1 -0
- package/dist/{chunk-LOMZXPSN.js → chunk-7EQTDTTJ.js} +47 -74
- package/dist/chunk-7EQTDTTJ.js 2.map +1 -0
- package/dist/chunk-7EQTDTTJ.js.map +1 -0
- package/dist/{chunk-6LTQQAT6.js → chunk-7FLMSG37.js} +336 -137
- package/dist/chunk-7FLMSG37.js 2.map +1 -0
- package/dist/chunk-7FLMSG37.js.map +1 -0
- package/dist/{chunk-XNYQOL3Z.js → chunk-BC4IJKSL.js} +9 -18
- package/dist/chunk-BC4IJKSL.js.map +1 -0
- package/dist/{chunk-ULHIJK66.js → chunk-E3SPN4VZ 5.js } +146 -36
- package/dist/chunk-E3SPN4VZ.js +12917 -0
- package/dist/{chunk-ULHIJK66.js.map → chunk-E3SPN4VZ.js.map} +1 -1
- package/dist/chunk-E66EQZE6 5.js +37 -0
- package/dist/chunk-E66EQZE6.js 2.map +1 -0
- package/dist/{chunk-6TQDD426.js → chunk-HWIIPPNI.js} +40 -221
- package/dist/chunk-HWIIPPNI.js.map +1 -0
- package/dist/chunk-I7PSE6JW 5.js +191 -0
- package/dist/chunk-I7PSE6JW.js 2.map +1 -0
- package/dist/{chunk-OETXORNB.js → chunk-IIELH4DL.js} +211 -136
- package/dist/chunk-IIELH4DL.js.map +1 -0
- package/dist/{chunk-ROXMHMY2.js → chunk-KNC55RTG.js} +13 -3
- package/dist/{chunk-ROXMHMY2.js.map → chunk-KNC55RTG.js 5.map } +1 -1
- package/dist/chunk-KNC55RTG.js.map +1 -0
- package/dist/chunk-KQCRWDSA.js 5.map +1 -0
- package/dist/{chunk-XYXSXPUK.js → chunk-LFNCN2SP.js} +7 -6
- package/dist/chunk-LFNCN2SP.js 2.map +1 -0
- package/dist/chunk-LFNCN2SP.js.map +1 -0
- package/dist/chunk-LMC26NLJ 2.js +84 -0
- package/dist/{chunk-VKB2CO4Z.js → chunk-NOAYCWCX 5.js } +84 -87
- package/dist/chunk-NOAYCWCX.js +4993 -0
- package/dist/chunk-NOAYCWCX.js.map +1 -0
- package/dist/chunk-QWWZ5CAQ.js 3.map +1 -0
- package/dist/chunk-QXHPKYJV 3.js +113 -0
- package/dist/chunk-R77UEZ4E 3.js +68 -0
- package/dist/chunk-VBXEHIUJ.js 6.map +1 -0
- package/dist/{chunk-VRGWKHDB.js → chunk-XNXXZ43G.js} +77 -33
- package/dist/chunk-XNXXZ43G.js.map +1 -0
- package/dist/chunk-ZSAAAMVR 6.js +25 -0
- package/dist/components.d.ts +2 -2
- package/dist/components.js +7 -7
- package/dist/components.js 5.map +1 -0
- package/dist/hooks.js +8 -8
- package/dist/index.d.ts +5 -5
- package/dist/index.js +12 -14
- package/dist/index.js.map +1 -1
- package/dist/providers.d.ts +3 -3
- package/dist/providers.js +2 -2
- package/dist/rbac/index.d.ts +1 -19
- package/dist/rbac/index.js +7 -9
- package/dist/styles/index 2.js +12 -0
- package/dist/styles/index.js 5.map +1 -0
- package/dist/theming/runtime 5.js +19 -0
- package/dist/theming/runtime.js 5.map +1 -0
- package/dist/utils.js +1 -1
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/Logger.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +2 -2
- package/docs/api/classes/RBACAuditManager.md +2 -2
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +2 -2
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +10 -10
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/enums/LogLevel.md +1 -1
- package/docs/api/enums/RBACErrorCode.md +1 -1
- package/docs/api/enums/RPCFunction.md +1 -1
- package/docs/api/interfaces/AddressFieldProps.md +1 -1
- package/docs/api/interfaces/AddressFieldRef.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/AutocompleteOptions.md +1 -1
- package/docs/api/interfaces/AvatarProps.md +1 -1
- package/docs/api/interfaces/BadgeProps.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CalendarProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/ComplianceResult.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/DatabaseComplianceResult.md +1 -1
- package/docs/api/interfaces/DatabaseIssue.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventAppRoleData.md +1 -1
- package/docs/api/interfaces/ExportColumn.md +1 -1
- package/docs/api/interfaces/ExportOptions.md +1 -1
- package/docs/api/interfaces/FileDisplayProps.md +24 -11
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/FormFieldProps.md +1 -1
- package/docs/api/interfaces/FormProps.md +1 -1
- package/docs/api/interfaces/GrantEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoggerConfig.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +2 -2
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +2 -2
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/ParsedAddress.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +4 -4
- package/docs/api/interfaces/ProgressProps.md +1 -1
- package/docs/api/interfaces/ProtectedRouteProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/QuickFix.md +1 -1
- package/docs/api/interfaces/RBACAccessValidateParams.md +1 -1
- package/docs/api/interfaces/RBACAccessValidateResult.md +1 -1
- package/docs/api/interfaces/RBACAuditLogParams.md +1 -1
- package/docs/api/interfaces/RBACAuditLogResult.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +2 -2
- package/docs/api/interfaces/RBACContext.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RBACPageAccessCheckParams.md +1 -1
- package/docs/api/interfaces/RBACPerformanceMetrics.md +1 -1
- package/docs/api/interfaces/RBACPermissionCheckParams.md +1 -1
- package/docs/api/interfaces/RBACPermissionCheckResult.md +2 -2
- package/docs/api/interfaces/RBACPermissionsGetParams.md +1 -1
- package/docs/api/interfaces/RBACPermissionsGetResult.md +1 -1
- package/docs/api/interfaces/RBACResult.md +1 -1
- package/docs/api/interfaces/RBACRoleGrantParams.md +2 -2
- package/docs/api/interfaces/RBACRoleGrantResult.md +1 -1
- package/docs/api/interfaces/RBACRoleRevokeParams.md +2 -2
- package/docs/api/interfaces/RBACRoleRevokeResult.md +1 -1
- package/docs/api/interfaces/RBACRoleValidateParams.md +2 -2
- package/docs/api/interfaces/RBACRoleValidateResult.md +1 -1
- package/docs/api/interfaces/RBACRolesListParams.md +1 -1
- package/docs/api/interfaces/RBACRolesListResult.md +2 -2
- package/docs/api/interfaces/RBACSessionTrackParams.md +1 -1
- package/docs/api/interfaces/RBACSessionTrackResult.md +1 -1
- package/docs/api/interfaces/ResourcePermissions.md +1 -1
- package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RoleManagementResult.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +2 -2
- package/docs/api/interfaces/RouteConfig.md +2 -2
- package/docs/api/interfaces/RuntimeComplianceResult.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/SessionRestorationLoaderProps.md +1 -1
- package/docs/api/interfaces/SetupIssue.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/SwitchProps.md +1 -1
- package/docs/api/interfaces/TabsContentProps.md +1 -1
- package/docs/api/interfaces/TabsListProps.md +1 -1
- package/docs/api/interfaces/TabsProps.md +1 -1
- package/docs/api/interfaces/TabsTriggerProps.md +1 -1
- package/docs/api/interfaces/TextareaProps.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +60 -38
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +13 -13
- package/docs/api/interfaces/UseFormDialogOptions.md +1 -1
- package/docs/api/interfaces/UseFormDialogReturn.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +2 -2
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +2 -2
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +2 -2
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UseResourcePermissionsOptions.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +194 -209
- package/docs/migration/database-changes-december-2025.md +2 -1
- package/docs/rbac/event-based-apps.md +124 -6
- package/package.json +1 -1
- package/scripts/check-pace-core-compliance.cjs +292 -57
- package/src/__tests__/rls-policies.test.ts +3 -1
- package/src/components/DataTable/__tests__/DataTable.default-state.test.tsx +172 -45
- package/src/components/DataTable/__tests__/DataTable.grouping-aggregation.test.tsx +121 -28
- package/src/components/DataTable/__tests__/DataTableCore.test-setup.ts +9 -8
- package/src/components/DataTable/__tests__/DataTableCore.test.tsx +20 -52
- package/src/components/DataTable/__tests__/a11y.basic.test.tsx +170 -34
- package/src/components/DataTable/__tests__/keyboard.test.tsx +75 -12
- package/src/components/DataTable/__tests__/pagination.modes.test.tsx +75 -11
- package/src/components/DataTable/components/UnifiedTableBody.tsx +85 -14
- package/src/components/DataTable/hooks/useDataTablePermissions.ts +75 -10
- package/src/components/FileDisplay/FileDisplay.test.tsx +2 -1
- package/src/components/FileDisplay/FileDisplay.tsx +16 -4
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +6 -4
- package/src/components/NavigationMenu/NavigationMenu.tsx +1 -10
- package/src/components/OrganisationSelector/OrganisationSelector.tsx +0 -1
- package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +25 -2
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +97 -68
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +0 -7
- package/src/components/ProtectedRoute/ProtectedRoute.test.tsx +5 -9
- package/src/components/ProtectedRoute/ProtectedRoute.tsx +0 -1
- package/src/components/PublicLayout/PublicPageProvider.tsx +0 -1
- package/src/hooks/__tests__/useSecureDataAccess.unit.test.tsx +14 -7
- package/src/hooks/services/useAuthService.ts +21 -3
- package/src/hooks/services/useEventService.ts +21 -3
- package/src/hooks/services/useInactivityService.ts +21 -3
- package/src/hooks/services/useOrganisationService.ts +21 -3
- package/src/hooks/useFileDisplay.ts +10 -17
- package/src/hooks/useSecureDataAccess.test.ts +16 -9
- package/src/hooks/useSecureDataAccess.ts +3 -2
- package/src/providers/services/EventServiceProvider.tsx +0 -8
- package/src/providers/services/UnifiedAuthProvider.tsx +174 -24
- package/src/rbac/__tests__/adapters.comprehensive.test.tsx +10 -16
- package/src/rbac/__tests__/isSuperAdmin.real.test.ts +82 -0
- package/src/rbac/adapters.tsx +3 -22
- package/src/rbac/api.test.ts +2 -2
- package/src/rbac/api.ts +7 -1
- package/src/rbac/components/EnhancedNavigationMenu.tsx +2 -15
- package/src/rbac/components/NavigationGuard.tsx +1 -10
- package/src/rbac/components/NavigationProvider.tsx +0 -1
- package/src/rbac/components/PermissionEnforcer.tsx +45 -12
- package/src/rbac/components/SecureDataProvider.tsx +0 -1
- package/src/rbac/components/__tests__/EnhancedNavigationMenu.test.tsx +7 -43
- package/src/rbac/components/__tests__/NavigationGuard.test.tsx +4 -11
- package/src/rbac/components/__tests__/NavigationProvider.test.tsx +3 -3
- package/src/rbac/components/__tests__/SecureDataProvider.fixed.test.tsx +1 -1
- package/src/rbac/components/__tests__/SecureDataProvider.test.tsx +1 -1
- package/src/rbac/engine.ts +14 -2
- package/src/rbac/hooks/index.ts +0 -3
- package/src/rbac/hooks/usePermissions.ts +51 -11
- package/src/rbac/hooks/useRBAC.ts +3 -13
- package/src/rbac/hooks/useResolvedScope.test.ts +75 -54
- package/src/rbac/hooks/useResolvedScope.ts +58 -33
- package/src/rbac/hooks/useSecureSupabase.ts +4 -9
- package/src/rbac/secureClient.ts +31 -0
- package/src/services/EventService.ts +4 -57
- package/src/services/InactivityService.ts +127 -34
- package/src/services/OrganisationService.ts +68 -10
- package/dist/chunk-6LTQQAT6.js.map +0 -1
- package/dist/chunk-6TQDD426.js.map +0 -1
- package/dist/chunk-LOMZXPSN.js.map +0 -1
- package/dist/chunk-OETXORNB.js.map +0 -1
- package/dist/chunk-VKB2CO4Z.js.map +0 -1
- package/dist/chunk-VRGWKHDB.js.map +0 -1
- package/dist/chunk-XNYQOL3Z.js.map +0 -1
- package/dist/chunk-XYXSXPUK.js.map +0 -1
- package/scripts/check-pace-core-compliance.js +0 -512
- package/src/rbac/hooks/useSuperAdminBypass.ts +0 -126
- package/src/utils/context/superAdminOverride.ts +0 -58
- /package/dist/{DataTable-WKRZD47S.js.map → DataTable-5FU7IESH.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-FTSG5XH7.js.map → UnifiedAuthProvider-RGJTDE2C.js.map} +0 -0
- /package/dist/{api-IHKALJZD.js.map → api-N774RPUA.js.map} +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// src/utils/validation/schema.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
function pickSchema(schema, keys) {
|
|
4
|
+
const shape = Object.entries(schema.shape).filter(([key]) => keys.includes(key)).reduce((acc, [key, value]) => {
|
|
5
|
+
acc[key] = value;
|
|
6
|
+
return acc;
|
|
7
|
+
}, {});
|
|
8
|
+
return z.object(shape);
|
|
9
|
+
}
|
|
10
|
+
function combineSchemas(schemas) {
|
|
11
|
+
return schemas.reduce(
|
|
12
|
+
(merged, schema) => merged.merge(schema),
|
|
13
|
+
z.object({})
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// src/types/validation.ts
|
|
18
|
+
import { z as z2 } from "zod";
|
|
19
|
+
var emailSchema = z2.string().email("Please enter a valid email address");
|
|
20
|
+
var nameSchema = z2.string().min(1, "Name is required").max(100, "Name must be less than 100 characters");
|
|
21
|
+
var phoneSchema = z2.string().regex(/^\+?[\d\s\-\(\)]+$/, "Please enter a valid phone number");
|
|
22
|
+
var urlSchema = z2.string().url("Please enter a valid URL");
|
|
23
|
+
var dateSchema = z2.string().refine((date) => !isNaN(Date.parse(date)), "Please enter a valid date");
|
|
24
|
+
var passwordSchema = z2.string().min(8, "Password must be at least 8 characters").regex(/[A-Z]/, "Password must contain at least one uppercase letter").regex(/[a-z]/, "Password must contain at least one lowercase letter").regex(/[0-9]/, "Password must contain at least one number");
|
|
25
|
+
var securePasswordSchema = passwordSchema.regex(/[!@#$%^&*(),.?":{}|<>]/, "Password must contain at least one special character");
|
|
26
|
+
var loginSchema = z2.object({
|
|
27
|
+
email: emailSchema,
|
|
28
|
+
password: z2.string().min(1, "Password is required")
|
|
29
|
+
});
|
|
30
|
+
var registrationSchema = z2.object({
|
|
31
|
+
email: emailSchema,
|
|
32
|
+
password: passwordSchema,
|
|
33
|
+
confirmPassword: z2.string()
|
|
34
|
+
}).refine((data) => data.password === data.confirmPassword, {
|
|
35
|
+
message: "Passwords don't match",
|
|
36
|
+
path: ["confirmPassword"]
|
|
37
|
+
});
|
|
38
|
+
var secureLoginSchema = z2.object({
|
|
39
|
+
email: emailSchema,
|
|
40
|
+
password: securePasswordSchema
|
|
41
|
+
});
|
|
42
|
+
var passwordResetSchema = z2.object({
|
|
43
|
+
email: emailSchema
|
|
44
|
+
});
|
|
45
|
+
var changePasswordSchema = z2.object({
|
|
46
|
+
currentPassword: z2.string().min(1, "Current password is required"),
|
|
47
|
+
newPassword: securePasswordSchema,
|
|
48
|
+
confirmPassword: z2.string()
|
|
49
|
+
}).refine((data) => data.newPassword === data.confirmPassword, {
|
|
50
|
+
message: "Passwords don't match",
|
|
51
|
+
path: ["confirmPassword"]
|
|
52
|
+
});
|
|
53
|
+
var userProfileSchema = z2.object({
|
|
54
|
+
name: nameSchema,
|
|
55
|
+
email: emailSchema,
|
|
56
|
+
phone: phoneSchema.optional(),
|
|
57
|
+
website: urlSchema.optional(),
|
|
58
|
+
bio: z2.string().max(500).optional()
|
|
59
|
+
});
|
|
60
|
+
var contactFormSchema = z2.object({
|
|
61
|
+
name: nameSchema,
|
|
62
|
+
email: emailSchema,
|
|
63
|
+
message: z2.string().min(1, "Message is required").max(1e3, "Message must be less than 1000 characters")
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
pickSchema,
|
|
68
|
+
combineSchemas,
|
|
69
|
+
emailSchema,
|
|
70
|
+
nameSchema,
|
|
71
|
+
phoneSchema,
|
|
72
|
+
urlSchema,
|
|
73
|
+
dateSchema,
|
|
74
|
+
passwordSchema,
|
|
75
|
+
securePasswordSchema,
|
|
76
|
+
loginSchema,
|
|
77
|
+
registrationSchema,
|
|
78
|
+
secureLoginSchema,
|
|
79
|
+
passwordResetSchema,
|
|
80
|
+
changePasswordSchema,
|
|
81
|
+
userProfileSchema,
|
|
82
|
+
contactFormSchema
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=chunk-LMC26NLJ.js.map
|
|
@@ -25,12 +25,12 @@ import {
|
|
|
25
25
|
SelectSeparator,
|
|
26
26
|
SelectTrigger,
|
|
27
27
|
SelectValue
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-E3SPN4VZ.js";
|
|
29
29
|
import {
|
|
30
30
|
useCan,
|
|
31
31
|
usePermissions,
|
|
32
32
|
useRBAC
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-XNXXZ43G.js";
|
|
34
34
|
import {
|
|
35
35
|
createFileReferenceService,
|
|
36
36
|
generateFileUrlsBatch,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
useFileDisplay,
|
|
43
43
|
usePreventTabReload,
|
|
44
44
|
usePublicFileDisplay
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-BC4IJKSL.js";
|
|
46
46
|
import {
|
|
47
47
|
useToast
|
|
48
48
|
} from "./chunk-6C4YBBJM.js";
|
|
@@ -53,16 +53,16 @@ import {
|
|
|
53
53
|
useEvents,
|
|
54
54
|
useIsPublicPage,
|
|
55
55
|
useResolvedScope
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-IIELH4DL.js";
|
|
57
57
|
import {
|
|
58
58
|
EventServiceContext,
|
|
59
59
|
useOrganisations,
|
|
60
60
|
useSessionRestoration,
|
|
61
61
|
useUnifiedAuth
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-7FLMSG37.js";
|
|
63
63
|
import {
|
|
64
64
|
isSuperAdmin
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-KNC55RTG.js";
|
|
66
66
|
import {
|
|
67
67
|
assertAppId
|
|
68
68
|
} from "./chunk-QXHPKYJV.js";
|
|
@@ -515,6 +515,7 @@ function FileDisplayContent({
|
|
|
515
515
|
displayOnly,
|
|
516
516
|
showDelete,
|
|
517
517
|
className,
|
|
518
|
+
imgClassName,
|
|
518
519
|
children,
|
|
519
520
|
onDelete,
|
|
520
521
|
clearError,
|
|
@@ -637,12 +638,12 @@ function FileDisplayContent({
|
|
|
637
638
|
if (!fileUrl) {
|
|
638
639
|
return /* @__PURE__ */ jsx4("figure", { className: className || "max-w-full h-48", title: "Loading", children: /* @__PURE__ */ jsx4("p", { className: fallbackClasses, children: /* @__PURE__ */ jsx4(LoadingSpinner, {}) }) });
|
|
639
640
|
}
|
|
640
|
-
return /* @__PURE__ */ jsx4("figure", { className: className || "
|
|
641
|
+
return /* @__PURE__ */ jsx4("figure", { className: className || "", children: /* @__PURE__ */ jsx4(
|
|
641
642
|
"img",
|
|
642
643
|
{
|
|
643
644
|
src: fileUrl,
|
|
644
645
|
alt: fileReference.file_metadata.fileName || "File",
|
|
645
|
-
className: "
|
|
646
|
+
className: imgClassName || "object-cover size-full",
|
|
646
647
|
onError: handleImageError
|
|
647
648
|
}
|
|
648
649
|
) });
|
|
@@ -685,7 +686,7 @@ function FileDisplayContent({
|
|
|
685
686
|
{
|
|
686
687
|
src: fileUrl,
|
|
687
688
|
alt: fileReference.file_metadata.fileName || "File",
|
|
688
|
-
className: "
|
|
689
|
+
className: imgClassName || "object-cover size-full",
|
|
689
690
|
onError: handleImageError
|
|
690
691
|
}
|
|
691
692
|
),
|
|
@@ -782,7 +783,7 @@ function FileDisplayContent({
|
|
|
782
783
|
{
|
|
783
784
|
src: fileUrl2,
|
|
784
785
|
alt: fileRef.file_metadata.fileName || "File",
|
|
785
|
-
className:
|
|
786
|
+
className: imgClassName || "object-cover size-full",
|
|
786
787
|
onError: handleImageError
|
|
787
788
|
}
|
|
788
789
|
) : /* @__PURE__ */ jsx4("span", { className: "text-2xl", children: getFileIcon(fileRef.file_metadata.fileType || "") }),
|
|
@@ -832,6 +833,7 @@ function FileDisplayPublic({
|
|
|
832
833
|
displayOnly = false,
|
|
833
834
|
showDelete = false,
|
|
834
835
|
className = "",
|
|
836
|
+
imgClassName,
|
|
835
837
|
children,
|
|
836
838
|
loadingComponent,
|
|
837
839
|
errorComponent,
|
|
@@ -861,6 +863,7 @@ function FileDisplayPublic({
|
|
|
861
863
|
displayOnly,
|
|
862
864
|
showDelete: false,
|
|
863
865
|
className,
|
|
866
|
+
imgClassName,
|
|
864
867
|
children,
|
|
865
868
|
onDelete: void 0,
|
|
866
869
|
organisation_id,
|
|
@@ -934,6 +937,7 @@ function FileDisplayPublic({
|
|
|
934
937
|
displayOnly,
|
|
935
938
|
showDelete: false,
|
|
936
939
|
className,
|
|
940
|
+
imgClassName,
|
|
937
941
|
children,
|
|
938
942
|
onDelete: showDelete ? handleDelete : void 0,
|
|
939
943
|
organisation_id,
|
|
@@ -957,6 +961,7 @@ function FileDisplayAuthenticated({
|
|
|
957
961
|
displayOnly = false,
|
|
958
962
|
showDelete = false,
|
|
959
963
|
className = "",
|
|
964
|
+
imgClassName,
|
|
960
965
|
children,
|
|
961
966
|
loadingComponent,
|
|
962
967
|
errorComponent,
|
|
@@ -1042,6 +1047,7 @@ function FileDisplayAuthenticated({
|
|
|
1042
1047
|
displayOnly,
|
|
1043
1048
|
showDelete,
|
|
1044
1049
|
className,
|
|
1050
|
+
imgClassName,
|
|
1045
1051
|
children,
|
|
1046
1052
|
onDelete: showDelete ? handleDelete : void 0,
|
|
1047
1053
|
clearError: refetch,
|
|
@@ -1066,6 +1072,7 @@ function FileDisplay({
|
|
|
1066
1072
|
displayOnly = false,
|
|
1067
1073
|
showDelete = false,
|
|
1068
1074
|
className = "",
|
|
1075
|
+
imgClassName,
|
|
1069
1076
|
children,
|
|
1070
1077
|
loadingComponent,
|
|
1071
1078
|
errorComponent,
|
|
@@ -1089,6 +1096,7 @@ function FileDisplay({
|
|
|
1089
1096
|
displayOnly,
|
|
1090
1097
|
showDelete,
|
|
1091
1098
|
className,
|
|
1099
|
+
imgClassName,
|
|
1092
1100
|
children,
|
|
1093
1101
|
loadingComponent,
|
|
1094
1102
|
errorComponent,
|
|
@@ -1112,6 +1120,7 @@ function FileDisplay({
|
|
|
1112
1120
|
displayOnly,
|
|
1113
1121
|
showDelete,
|
|
1114
1122
|
className,
|
|
1123
|
+
imgClassName,
|
|
1115
1124
|
children,
|
|
1116
1125
|
loadingComponent,
|
|
1117
1126
|
errorComponent,
|
|
@@ -2598,7 +2607,6 @@ function OrganisationSelector({
|
|
|
2598
2607
|
if (newOrganisation && onOrganisationChange) {
|
|
2599
2608
|
onOrganisationChange(newOrganisation);
|
|
2600
2609
|
}
|
|
2601
|
-
logger.debug("OrganisationSelector", "Successfully switched to organisation:", orgId);
|
|
2602
2610
|
} catch (error) {
|
|
2603
2611
|
logger.error("OrganisationSelector", "Failed to switch organisation:", error);
|
|
2604
2612
|
setSwitchError(error instanceof Error ? error.message : "Failed to switch organisation");
|
|
@@ -2970,7 +2978,7 @@ var NavigationMenu = React15.forwardRef(({
|
|
|
2970
2978
|
}
|
|
2971
2979
|
const userId2 = authContext.user.id;
|
|
2972
2980
|
const appName = authContext.appName;
|
|
2973
|
-
import("./api-
|
|
2981
|
+
import("./api-N774RPUA.js").then(({ resolveAppContext }) => {
|
|
2974
2982
|
resolveAppContext({
|
|
2975
2983
|
userId: userId2,
|
|
2976
2984
|
appName
|
|
@@ -2979,7 +2987,6 @@ var NavigationMenu = React15.forwardRef(({
|
|
|
2979
2987
|
setResolvedAppId(result.appId);
|
|
2980
2988
|
}
|
|
2981
2989
|
}).catch((error) => {
|
|
2982
|
-
logger.debug("NavigationMenu", "Failed to resolve appId", error);
|
|
2983
2990
|
});
|
|
2984
2991
|
});
|
|
2985
2992
|
}
|
|
@@ -3220,15 +3227,6 @@ var NavigationMenu = React15.forwardRef(({
|
|
|
3220
3227
|
};
|
|
3221
3228
|
const handleItemClick = (item) => {
|
|
3222
3229
|
if (auditLog) {
|
|
3223
|
-
logger.debug("NavigationMenu", "Navigation access attempt:", {
|
|
3224
|
-
itemId: item.id,
|
|
3225
|
-
label: item.label,
|
|
3226
|
-
href: item.href,
|
|
3227
|
-
permissions: item.permissions,
|
|
3228
|
-
roles: item.roles,
|
|
3229
|
-
accessLevel: item.accessLevel,
|
|
3230
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
3231
|
-
});
|
|
3232
3230
|
}
|
|
3233
3231
|
if (!authContext) {
|
|
3234
3232
|
if (onNavigate) {
|
|
@@ -3574,7 +3572,7 @@ function PaceAppLayout({
|
|
|
3574
3572
|
onRouteAccessDenied,
|
|
3575
3573
|
onRouteStrictModeViolation
|
|
3576
3574
|
}) {
|
|
3577
|
-
const { user, signOut, updatePassword, supabase, appId: contextAppId } = useUnifiedAuth();
|
|
3575
|
+
const { user, signOut, updatePassword, supabase, appId: contextAppId, selectedOrganisationId } = useUnifiedAuth();
|
|
3578
3576
|
const {
|
|
3579
3577
|
selectedOrganisation,
|
|
3580
3578
|
isContextReady,
|
|
@@ -3582,6 +3580,34 @@ function PaceAppLayout({
|
|
|
3582
3580
|
ensureOrganisationContext,
|
|
3583
3581
|
isLoading: organisationLoading
|
|
3584
3582
|
} = useOrganisations();
|
|
3583
|
+
const { isSuperAdmin: isSuperAdminFromRBAC, isLoading: rbacLoading } = useRBAC();
|
|
3584
|
+
const [isSuperAdminDirect, setIsSuperAdminDirect] = useState12(false);
|
|
3585
|
+
const [isCheckingSuperAdminDirect, setIsCheckingSuperAdminDirect] = useState12(false);
|
|
3586
|
+
useEffect8(() => {
|
|
3587
|
+
const checkSuperAdminDirect = async () => {
|
|
3588
|
+
if (!user?.id) {
|
|
3589
|
+
setIsSuperAdminDirect(false);
|
|
3590
|
+
setIsCheckingSuperAdminDirect(false);
|
|
3591
|
+
return;
|
|
3592
|
+
}
|
|
3593
|
+
if (isSuperAdminFromRBAC) {
|
|
3594
|
+
setIsCheckingSuperAdminDirect(false);
|
|
3595
|
+
return;
|
|
3596
|
+
}
|
|
3597
|
+
setIsCheckingSuperAdminDirect(true);
|
|
3598
|
+
try {
|
|
3599
|
+
const superAdminStatus = await isSuperAdmin(user.id);
|
|
3600
|
+
setIsSuperAdminDirect(superAdminStatus);
|
|
3601
|
+
} catch (error) {
|
|
3602
|
+
logger.error("PaceAppLayout", "Error checking super admin status directly", { userId: user?.id, error });
|
|
3603
|
+
setIsSuperAdminDirect(false);
|
|
3604
|
+
} finally {
|
|
3605
|
+
setIsCheckingSuperAdminDirect(false);
|
|
3606
|
+
}
|
|
3607
|
+
};
|
|
3608
|
+
checkSuperAdminDirect();
|
|
3609
|
+
}, [user?.id, isSuperAdminFromRBAC]);
|
|
3610
|
+
const isSuperAdmin2 = isSuperAdminFromRBAC || isSuperAdminDirect;
|
|
3585
3611
|
const navigate = useNavigate();
|
|
3586
3612
|
const location = useLocation();
|
|
3587
3613
|
useEventTheme();
|
|
@@ -3597,23 +3623,22 @@ function PaceAppLayout({
|
|
|
3597
3623
|
selectedEventId: selectedEvent?.event_id || null
|
|
3598
3624
|
});
|
|
3599
3625
|
const resolvedAppId = contextAppId || resolvedScope?.appId;
|
|
3626
|
+
const scopeOrgId = resolvedScope?.organisationId || selectedOrganisation?.id || "";
|
|
3627
|
+
const scopeEventId = resolvedScope?.eventId || selectedEvent?.event_id || void 0;
|
|
3628
|
+
const scopeAppId = resolvedScope?.appId || resolvedAppId || void 0;
|
|
3600
3629
|
const scope = useMemo9(() => {
|
|
3601
|
-
|
|
3602
|
-
|
|
3630
|
+
const newScope = {};
|
|
3631
|
+
if (scopeOrgId) {
|
|
3632
|
+
newScope.organisationId = scopeOrgId;
|
|
3603
3633
|
}
|
|
3604
|
-
if (
|
|
3605
|
-
|
|
3606
|
-
organisationId: selectedOrganisation.id,
|
|
3607
|
-
eventId: selectedEvent?.event_id || void 0,
|
|
3608
|
-
appId: resolvedAppId || resolvedScope?.appId || void 0
|
|
3609
|
-
};
|
|
3634
|
+
if (scopeEventId) {
|
|
3635
|
+
newScope.eventId = scopeEventId;
|
|
3610
3636
|
}
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
}, [resolvedScope, selectedOrganisation?.id, selectedEvent?.event_id, resolvedAppId]);
|
|
3637
|
+
if (scopeAppId) {
|
|
3638
|
+
newScope.appId = scopeAppId;
|
|
3639
|
+
}
|
|
3640
|
+
return newScope;
|
|
3641
|
+
}, [scopeOrgId, scopeEventId, scopeAppId]);
|
|
3617
3642
|
const defaultNavItems = useMemo9(() => [
|
|
3618
3643
|
{ id: "home", label: "Home", href: "/", icon: "Home" },
|
|
3619
3644
|
{ id: "dashboard", label: "Dashboard", href: "/dashboard", icon: "LayoutDashboard" },
|
|
@@ -3632,72 +3657,51 @@ function PaceAppLayout({
|
|
|
3632
3657
|
return pageIdMapping[currentPath];
|
|
3633
3658
|
}
|
|
3634
3659
|
const pathSegments = currentPath.slice(1).split("/").filter(Boolean);
|
|
3635
|
-
return pathSegments[0] || "
|
|
3660
|
+
return pathSegments[0] || "";
|
|
3636
3661
|
}, [location.pathname, pageIdMapping]);
|
|
3637
3662
|
const currentPermission = useMemo9(() => {
|
|
3638
|
-
if (!enforcePermissions) {
|
|
3639
|
-
return "
|
|
3663
|
+
if (!enforcePermissions || !currentPageId) {
|
|
3664
|
+
return "";
|
|
3640
3665
|
}
|
|
3641
3666
|
const permissionString = `${currentRoutePermission}:page.${currentPageId}`;
|
|
3642
3667
|
return permissionString;
|
|
3643
3668
|
}, [enforcePermissions, currentRoutePermission, currentPageId]);
|
|
3644
|
-
const
|
|
3645
|
-
const [isCheckingSuperAdmin, setIsCheckingSuperAdmin] = useState12(false);
|
|
3646
|
-
useEffect8(() => {
|
|
3647
|
-
const checkSuperAdminStatus = async () => {
|
|
3648
|
-
if (!user?.id) {
|
|
3649
|
-
setIsSuperAdminUser(false);
|
|
3650
|
-
setIsCheckingSuperAdmin(false);
|
|
3651
|
-
return;
|
|
3652
|
-
}
|
|
3653
|
-
setIsCheckingSuperAdmin(true);
|
|
3654
|
-
try {
|
|
3655
|
-
const superAdminStatus = await isSuperAdmin(user.id);
|
|
3656
|
-
setIsSuperAdminUser(superAdminStatus);
|
|
3657
|
-
} catch (error) {
|
|
3658
|
-
logger.error("PaceAppLayout", "Error checking super admin status", { userId: user?.id, error });
|
|
3659
|
-
setIsSuperAdminUser(false);
|
|
3660
|
-
} finally {
|
|
3661
|
-
setIsCheckingSuperAdmin(false);
|
|
3662
|
-
}
|
|
3663
|
-
};
|
|
3664
|
-
checkSuperAdminStatus();
|
|
3665
|
-
}, [user?.id]);
|
|
3669
|
+
const shouldCheckPermission = enforcePermissions && !!currentPermission && !!currentPageId;
|
|
3666
3670
|
const { can: canFromHook, isLoading: isCheckingPermission, error: permissionError } = useCan(
|
|
3667
3671
|
user?.id || "",
|
|
3668
3672
|
scope,
|
|
3669
|
-
currentPermission,
|
|
3670
|
-
currentPageId,
|
|
3673
|
+
shouldCheckPermission ? currentPermission : "",
|
|
3674
|
+
shouldCheckPermission ? currentPageId : "",
|
|
3671
3675
|
true,
|
|
3672
3676
|
// useCache
|
|
3673
3677
|
appName
|
|
3674
3678
|
// Pass appName for PORTAL/ADMIN special case
|
|
3675
3679
|
);
|
|
3676
|
-
const can =
|
|
3680
|
+
const can = isSuperAdmin2 ? true : canFromHook;
|
|
3677
3681
|
const hasPermission = enforcePermissions ? can : true;
|
|
3678
3682
|
useEffect8(() => {
|
|
3679
3683
|
if (!enforcePermissions) {
|
|
3680
3684
|
return;
|
|
3681
3685
|
}
|
|
3682
|
-
if (
|
|
3686
|
+
if (isCheckingPermission) {
|
|
3683
3687
|
return;
|
|
3684
3688
|
}
|
|
3685
|
-
if (strictMode && !
|
|
3689
|
+
if (strictMode && !isSuperAdmin2 && !can) {
|
|
3686
3690
|
logger.error("PaceAppLayout", "STRICT MODE VIOLATION: User attempted to access protected page without permission", {
|
|
3687
3691
|
pageName: currentPageId,
|
|
3688
3692
|
operation: currentRoutePermission,
|
|
3689
3693
|
userId: user?.id,
|
|
3690
|
-
isSuperAdmin:
|
|
3694
|
+
isSuperAdmin: isSuperAdmin2,
|
|
3691
3695
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
3692
3696
|
});
|
|
3693
3697
|
if (onStrictModeViolation) {
|
|
3694
3698
|
onStrictModeViolation(currentPageId, currentRoutePermission);
|
|
3695
3699
|
}
|
|
3696
3700
|
}
|
|
3697
|
-
if (!
|
|
3701
|
+
if (!isSuperAdmin2 && !can && onPageAccessDenied) {
|
|
3698
3702
|
onPageAccessDenied(currentPageId, currentRoutePermission);
|
|
3699
3703
|
}
|
|
3700
|
-
}, [enforcePermissions, can, isCheckingPermission,
|
|
3704
|
+
}, [enforcePermissions, can, isCheckingPermission, isSuperAdmin2, currentPageId, currentRoutePermission, user?.id, strictMode, auditLog, onPageAccessDenied, onStrictModeViolation]);
|
|
3701
3705
|
const [filteredMenuItems, setFilteredMenuItems] = useState12(baseMenuItems);
|
|
3702
3706
|
useEffect8(() => {
|
|
3703
3707
|
let isMounted = true;
|
|
@@ -3725,8 +3729,8 @@ function PaceAppLayout({
|
|
|
3725
3729
|
return;
|
|
3726
3730
|
}
|
|
3727
3731
|
try {
|
|
3728
|
-
const { isSuperAdmin:
|
|
3729
|
-
const isSuper = await
|
|
3732
|
+
const { isSuperAdmin: checkSuperAdminDynamic } = await import("./api-N774RPUA.js");
|
|
3733
|
+
const isSuper = await checkSuperAdminDynamic(user.id);
|
|
3730
3734
|
if (isSuper) {
|
|
3731
3735
|
if (isMounted) {
|
|
3732
3736
|
setFilteredMenuItems(baseMenuItems);
|
|
@@ -3740,7 +3744,7 @@ function PaceAppLayout({
|
|
|
3740
3744
|
}
|
|
3741
3745
|
}
|
|
3742
3746
|
try {
|
|
3743
|
-
const { getPermissionMap } = await import("./api-
|
|
3747
|
+
const { getPermissionMap } = await import("./api-N774RPUA.js");
|
|
3744
3748
|
const permissionScope = {
|
|
3745
3749
|
organisationId: currentScope.organisationId,
|
|
3746
3750
|
eventId: currentScope.eventId,
|
|
@@ -3796,7 +3800,7 @@ function PaceAppLayout({
|
|
|
3796
3800
|
let hasAccess = true;
|
|
3797
3801
|
if (currentRoute.pageId && currentRoute.permissions && currentRoute.permissions.length > 0) {
|
|
3798
3802
|
try {
|
|
3799
|
-
const { isPermittedCached } = await import("./api-
|
|
3803
|
+
const { isPermittedCached } = await import("./api-N774RPUA.js");
|
|
3800
3804
|
const hasPagePermission = await isPermittedCached({
|
|
3801
3805
|
userId: user?.id || "",
|
|
3802
3806
|
scope,
|
|
@@ -3812,7 +3816,7 @@ function PaceAppLayout({
|
|
|
3812
3816
|
}
|
|
3813
3817
|
}
|
|
3814
3818
|
if (hasAccess && currentRoute.roles && currentRoute.roles.length > 0 && user?.id) {
|
|
3815
|
-
const { useUnifiedAuth: useUnifiedAuth2 } = await import("./UnifiedAuthProvider-
|
|
3819
|
+
const { useUnifiedAuth: useUnifiedAuth2 } = await import("./UnifiedAuthProvider-RGJTDE2C.js");
|
|
3816
3820
|
hasAccess = true;
|
|
3817
3821
|
}
|
|
3818
3822
|
if (!isMounted) return;
|
|
@@ -3858,26 +3862,26 @@ function PaceAppLayout({
|
|
|
3858
3862
|
}
|
|
3859
3863
|
return {};
|
|
3860
3864
|
};
|
|
3861
|
-
if (user?.id && organisationLoading) {
|
|
3865
|
+
if (user?.id && organisationLoading && !isSuperAdmin2 && !isCheckingSuperAdminDirect && !rbacLoading && !selectedOrganisationId) {
|
|
3862
3866
|
return /* @__PURE__ */ jsx20("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs15("div", { className: "text-center", children: [
|
|
3863
3867
|
/* @__PURE__ */ jsx20("div", { className: "animate-spin rounded-full size-8 border-b-2 border-sec-900 mx-auto mb-4" }),
|
|
3864
3868
|
/* @__PURE__ */ jsx20("p", { className: "text-sec-600", children: "Loading organisation context..." })
|
|
3865
3869
|
] }) });
|
|
3866
3870
|
}
|
|
3867
|
-
if (enforcePermissions &&
|
|
3871
|
+
if (enforcePermissions && isCheckingPermission) {
|
|
3868
3872
|
return /* @__PURE__ */ jsx20("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs15("div", { className: "text-center", children: [
|
|
3869
3873
|
/* @__PURE__ */ jsx20("div", { className: "animate-spin rounded-full size-8 border-b-2 border-sec-900 mx-auto mb-4" }),
|
|
3870
3874
|
/* @__PURE__ */ jsx20("p", { className: "text-sec-600", children: "Checking permissions..." })
|
|
3871
3875
|
] }) });
|
|
3872
3876
|
}
|
|
3873
|
-
if (enforcePermissions && permissionError && !
|
|
3877
|
+
if (enforcePermissions && permissionError && !isSuperAdmin2) {
|
|
3874
3878
|
return /* @__PURE__ */ jsx20("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs15("div", { className: "text-center", children: [
|
|
3875
3879
|
/* @__PURE__ */ jsx20("h2", { className: "text-xl font-semibold text-acc-600 mb-2", children: "Permission Error" }),
|
|
3876
3880
|
/* @__PURE__ */ jsx20("p", { className: "text-sec-600 mb-4", children: permissionError.message }),
|
|
3877
3881
|
/* @__PURE__ */ jsx20(Button, { onClick: () => navigate("/"), children: "Go Home" })
|
|
3878
3882
|
] }) });
|
|
3879
3883
|
}
|
|
3880
|
-
if (enforcePermissions && hasPermission === false && !
|
|
3884
|
+
if (enforcePermissions && hasPermission === false && !isCheckingSuperAdminDirect && !isSuperAdmin2) {
|
|
3881
3885
|
if (enforcePagePermissions && pagePermissionFallback) {
|
|
3882
3886
|
return /* @__PURE__ */ jsx20(Fragment7, { children: pagePermissionFallback });
|
|
3883
3887
|
}
|
|
@@ -3968,7 +3972,6 @@ var PaceLoginPage = ({
|
|
|
3968
3972
|
await eventService.restorePersistedEvent();
|
|
3969
3973
|
}
|
|
3970
3974
|
} catch (error) {
|
|
3971
|
-
logger.debug("PaceLoginPage", "Could not restore persisted event (service may not be ready):", error);
|
|
3972
3975
|
}
|
|
3973
3976
|
};
|
|
3974
3977
|
const timeoutId = setTimeout(() => {
|
|
@@ -4002,7 +4005,6 @@ var PaceLoginPage = ({
|
|
|
4002
4005
|
}
|
|
4003
4006
|
const { data: pagesData, error: pagesError } = await supabase.from("rbac_app_pages").select("id, page_name").eq("app_id", appData.id);
|
|
4004
4007
|
if (pagesError || !pagesData || pagesData.length === 0) {
|
|
4005
|
-
logger.debug("PaceLoginPage", "No pages configured for app:", appName);
|
|
4006
4008
|
setAccessError(`You do not have permission to access ${appName}. This application is currently unavailable. Please contact your administrator if you believe you should have access.`);
|
|
4007
4009
|
setIsCheckingAccess(false);
|
|
4008
4010
|
return;
|
|
@@ -4010,7 +4012,6 @@ var PaceLoginPage = ({
|
|
|
4010
4012
|
const { data: orgRow } = await supabase.from("rbac_organisation_roles").select("organisation_id").eq("user_id", userId).eq("status", "active").is("revoked_at", null).limit(1).maybeSingle();
|
|
4011
4013
|
const organisationId = orgRow?.organisation_id;
|
|
4012
4014
|
if (!organisationId) {
|
|
4013
|
-
logger.debug("PaceLoginPage", "User has no organisation access");
|
|
4014
4015
|
setAccessError(`You do not have permission to access ${appName}. You are not assigned to any organisation. Please contact your administrator.`);
|
|
4015
4016
|
setIsCheckingAccess(false);
|
|
4016
4017
|
return;
|
|
@@ -4027,19 +4028,16 @@ var PaceLoginPage = ({
|
|
|
4027
4028
|
p_page_id: page.page_name
|
|
4028
4029
|
// Page name to resolve to UUID
|
|
4029
4030
|
});
|
|
4030
|
-
logger.debug("PaceLoginPage", "Permission check for page:", { pageName: page.page_name, hasPermission, error: permError });
|
|
4031
4031
|
if (!permError && hasPermission === true) {
|
|
4032
4032
|
hasAnyAccess = true;
|
|
4033
4033
|
break;
|
|
4034
4034
|
}
|
|
4035
4035
|
}
|
|
4036
4036
|
if (hasAnyAccess) {
|
|
4037
|
-
logger.debug("PaceLoginPage", "User has access to app");
|
|
4038
4037
|
setIsCheckingAccess(false);
|
|
4039
4038
|
navigate(onSuccessRedirectPath, { replace: true });
|
|
4040
4039
|
return;
|
|
4041
4040
|
}
|
|
4042
|
-
logger.debug("PaceLoginPage", "Access denied - no permissions");
|
|
4043
4041
|
setAccessError(`You do not have permission to access ${appName}. This application is restricted to authorized users only. Please contact your administrator if you believe you should have access.`);
|
|
4044
4042
|
setIsCheckingAccess(false);
|
|
4045
4043
|
} catch (error) {
|
|
@@ -4251,7 +4249,6 @@ function ProtectedRoute({
|
|
|
4251
4249
|
] }) });
|
|
4252
4250
|
}
|
|
4253
4251
|
if (!selectedEvent) {
|
|
4254
|
-
logger.debug("ProtectedRoute", "Events available but none selected - allowing render so selector is visible");
|
|
4255
4252
|
return /* @__PURE__ */ jsx23(Outlet2, {});
|
|
4256
4253
|
}
|
|
4257
4254
|
return /* @__PURE__ */ jsx23(Outlet2, {});
|
|
@@ -4993,4 +4990,4 @@ export {
|
|
|
4993
4990
|
PublicPageFooter,
|
|
4994
4991
|
PublicPageLayout
|
|
4995
4992
|
};
|
|
4996
|
-
//# sourceMappingURL=chunk-
|
|
4993
|
+
//# sourceMappingURL=chunk-NOAYCWCX.js.map
|